LaTeX是一种用于编写文档的精彩语言.使用hyperref
软件包pdflatex
,您可以轻松生成包含元数据的文档,这是一个很好的功能,可以在Web上引用您的文档.
我经常使用以下模板:
\documentclass[11pt]{article}
\usepackage[pdftex, pdfusetitle,colorlinks=false,pdfborder={0 0 0}]{hyperref}%
\hypersetup{%
pdftitle={My title},%
pdfauthor={My name},%
pdfkeywords={my first keyword, my second keyword, more keywords.},%
}%
\begin{document}
\title{My title}
\author{My name}
\date{}
\maketitle
{\bf Keywords:} my first keyword, my second keyword, more keywords.%
My text is here...
\end{document}
Run Code Online (Sandbox Code Playgroud)
到目前为止,它很好.我的问题从示例中弹出:有没有办法在标题中定义字符串变量,以便它们可以作为参数传递给hyperref
然后传递给frontmatter或文本.就像是:
\documentclass[11pt]{article}
%-------definitions-----
\def\Author{My name}
\def\Title{My title}
\def\Keywords{my first keyword, my second keyword, more keywords.}
%--------------------------
\usepackage[pdftex, pdfusetitle,colorlinks=false,pdfborder={0 0 0}]{hyperref}%
\hypersetup{%
pdftitle={\Title},%
pdfauthor={\Author},%
pdfkeywords={\Keywords},%
}%
\begin{document}
\title{\Title}
\author{\Author}
\date{}
\maketitle
{\bf …
Run Code Online (Sandbox Code Playgroud) 我在为Sweave编程R时遇到了一些问题,#rstats twitter组经常指向这里,所以我想我会把这个问题提到SO人群中.我是一名分析师 - 而不是程序员 - 所以在我的第一篇文章中轻松一点.
问题在于:我正在起草一份带有R的Sweave调查报告,并希望报告边际收益\Sexpr{}
.例如,而不是说:
只有14%的受访者表示'X'.
我想写这样的报告:
只有\ Sexpr {p.mean(variable)} $ \%$的受访者表示'X'.
的问题是,Sweave表达式的结果转换中\Sexpr{}
为字符串,这意味着从在R和表达出现我的文档中的输出的输出是不同的.例如,上面我使用函数'p.mean':
Run Code Online (Sandbox Code Playgroud)p.mean<- function (x) {options(digits=1) mmm<-weighted.mean(x, weight=weight, na.rm=T) print(100*mmm) }
在R中,输出如下所示:
Run Code Online (Sandbox Code Playgroud)p.mean(variable) >14
但是当我使用时\Sexpr{p.mean(variable)}
,我的文档中会得到一个未连接的字符串(在本例中为13.5857142857143).我试图将函数的输出限制digits=1
在全局环境,函数本身和各种命令中.它似乎只包含R打印,而不是表达式结果的字符转换,最终打印在LaTeX文件中.
Run Code Online (Sandbox Code Playgroud)as.character(p.mean(variable)) >[1] 14 >[1] "13.5857142857143"
有谁知道我可以,或者通过重新编程R函数或与Sweave或设置做以限制LaTeX的文件打印的数字\Sexpr{}
?
我有一个PDF文件,我想在Linux上进行后期处理.特别是我想:
使用Windows,可以使用Adobe Distiller执行这两个步骤(打开文档文件并将其打印到具有相应设置的新PDF文档中).
在Linux上我可以使用Ghostscript [1]来配置字体,但它似乎不能用Type 1字体替换(所有?)Type 3字体或者组合相同字体的多个子集.
关于如何使用免费工具实现这两项任务的任何提示?
(我知道如何将Type 3字体转换为PDF格式的Type 1字体.但是,我真的不在乎理论上是否丢失了有关字体的信息,因为此对话在Distiller中似乎工作正常).
[1]参数:
gs -dPDFA -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH \
-sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 \
-dMaxSubsetPct=100 -dSubsetFonts=true \
-dEmbedAllFonts=true -sOutputFile=/tmp/tmp.pdf -f "$1"
Run Code Online (Sandbox Code Playgroud) 我正在使用breakurl包和带有pdfLatex和BibTeX的hyperref包来引用一个url.网址正在破坏,但不是根据我的边缘.我有什么方法可以让网址识别我的边距或强制换行?提前致谢.
码:
__CODE__
可能是一种排列__CODE__
;-)
任何帮助表示赞赏,不,这不是作业 - 个人兴趣:-)
如何使用Sphinx生成一个pdflatex
文档,其中在目录之前有一些文本?生成的LaTeX文件似乎总是\tableofcontents
在任何文档正文之前.
我一直无法找到关于此的任何信息/文档,如果有人有任何提示我会很感激.我对需要直接修改tex文件的'手动'解决方案不感兴趣 - 我正在寻找可以直接在rst文件中指定的指令/选项.
我在代码块中有一个线性模型,我希望在LaTeX中很好地显示.模型调用采用标准形式,使用波浪号〜在LaTeX中可以进行排版.
\documentclass{article}
\begin{document}
<<>>=
lm(Sepal.Width ~ Sepal.Length, data = iris)
@
\end{document}
Run Code Online (Sandbox Code Playgroud)
代码编织knitr::knit(mwe.Rnw)
,然后通过PDFLaTeX运行.
在LaTeX中制作漂亮的波浪线非常烦人,并且让它们变得简单易行.对由此产生的.tex文件的检查knit
表明,代码被放入三个环境中,其中\begin{alltt} ... \end{alltt}
有一个是有趣的环境.但该软件包alltt
不提供任何特殊排版特殊字符的快速修复.
我是knitr的新手,过去我有一些非常基本的乳胶知识,所以我搜索已经希望找到一个已经发布到某处的解决方案.但是,我无法解决我的问题.我希望有人能够提供帮助.
我有一个14列和多行的数据框,比方说60.使用数据我需要以横向布局生成PDF报告,并将此数据框作为表格呈现在那里.
我找到的最接近的解决方案是 tex.stackexchange.com:LaTex Longtable跨越多个页面
我在那里使用了一些提示.但是,表格放置不正确.最右边的列在页面的右边缘被截断.该表在页面末尾没有"续"字.我在这里发布我的代码和图片.
我正在寻找一个解决方案,将长桌正确放在页面上,如果我遗漏任何明显的请不要拍:)我真的很新.
\documentclass[a4paper, landscape]{article}
\usepackage[a4paper, margin=1in, hmarginratio=1:1, landscape]{geometry}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{xcolor}
\definecolor{myblue}{RGB}{24,57,121}
\usepackage{lipsum}
\usepackage{booktabs}
\usepackage{colortbl}
\usepackage{array}
\usepackage{rotating}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0.5pt}
\setlength\headheight{40mm}
\begin{document}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
\renewcommand*{\arraystretch}{1.0}
%
\section{My Long Table}
%\begin{center}
%\begin{small}
%\setlongtables
%\begin{longtable}
<<echo=FALSE, eval=TRUE, results='asis'>>=
library(knitr)
library(xtable)
df <- data.frame(replicate(13, sample(1000000:9000000, 60,replace=TRUE)))
df$Sum <- rowSums(df)
totals <- colSums(df)
df <- rbind(df, totals)
names(df) <- c("Jan 2014", "Feb 2014", "Mar 2014", "Apr 2014", "May 2014", "Jun 2014", "Jul 2014",
"Aug 2014", "Sep …
Run Code Online (Sandbox Code Playgroud) 当使用 pdflatex 时,-output-directory
我在外部化 tikz 数字时遇到了问题。虽然 .md5 文件是在我期望的地方创建的,但创建外部化图片文件(.pdf、.log、.dpth)的命令失败。我的假设是发生这种情况是因为pdflatex
创建这些文件不继承-output-directory
选项,因此无法在正确的位置创建文件。
这是显示行为的最小示例。
main.tex:
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]
\begin{document}
Test externalize in combination with -output-directory
\tikzsetnextfilename{testpicture}
\begin{tikzpicture}
\node {Node};
\end{tikzpicture}
\end{document}
Run Code Online (Sandbox Code Playgroud)
重击:
mkdir -p build/tikz
pdflatex -output-directory build -shell-escape main.tex
Run Code Online (Sandbox Code Playgroud)
错误:
===== 'mode=convert with system call': Invoking 'pdflatex
-shell-escape -halt-on-error -interaction=batchmode -jobname
"tikz/testpicture" "\def\tikzexternalrealjob{main}\input{main}"'
======== This is pdfTeX, Version 3.14159265-2.6-1.40.16
(TeX Live 2015/Debian) (preloaded format=pdflatex)
\write18 enabled.
entering extended mode
! I can't write on file `tikz/testpicture.log'.
Run Code Online (Sandbox Code Playgroud)
结果目录结构(输出tree …
给定一个包含多个 jpg 文件(照片)的目录,我想创建一个 pdf 文件,每页一张照片。但是,我希望照片原封不动地存储在 pdf 文件中;即,我想避免解码和重新编码。因此,理想情况下,我希望能够使用 linux 命令行等从 pdf 文件中提取原始 jpg 文件(可能减去元数据)pdfimages
。
到目前为止我的想法:
imagemagick convert
。但是,我对压缩选项感到困惑:如果我选择 100% quality
,是否意味着 jpg 会在内部解码,然后进行无损编码?(这显然不是我想要的?)pdflatex
。有些人声称图形包包含无损图像,而其他人则对此提出异议。无论如何,pdflatex会稍微麻烦一些(我首先必须找出照片的尺寸,然后相应地设置页面大小,确保没有边距、标题等)。我最近在参考书目中发现了一个问题,但不知何故无法解决。当标题太长时它就会出现,但只要标题足够短,它就会正常使用 URL,正如您在第二个示例中看到的那样。
似乎像“[]”这样的符号是由某些东西生成的,并且日志在段落中给了我 2x Overfull \hbox (X pt 太宽)。
设置:document.tex
和bib/literature.bib
设置:pdfLatex(使用 biber 和 texindy)
最小的例子:
\documentclass[
11pt,
a4paper
]{scrreprt}
% add bibliography
\usepackage[style=alphabetic, sorting=anyt]{biblatex}
\addbibresource{bib/literature.bib}
\usepackage[colorlinks, urlcolor=blue]{hyperref}
\begin{document}
\cite{Gaedke}
\cite{IOT}
\printbibliography
\end{document}
Run Code Online (Sandbox Code Playgroud)
文学参考书目
@online{Gaedke,
author = {Gaedke, Martin and Heil, Andreas},
title = {{GET /dgs HTTP/1.1 Host: www.WebComposition.net.}},
url = {http://www.mendeley.com/research/dgs-http11-host-wwwwebcompositionnet/},
urldate={2018-08-19}
}
@online{IOT,
author = {Litzel, Nico },
title = {Was ist das Internet of Things?},
url = {https://www.bigdata-insider.de/was-ist-das-internet-of-things-a-590806/},
urldate={2018-08-19}
}
Run Code Online (Sandbox Code Playgroud)