我已经使用 Latex 很多年了,认为自己相当熟练,但这个错误让我很困惑。我在 Windows 7 中使用 Miktex 2.9,遇到了一个错误,而到目前为止,在其他系统上它一直运行良好。
我收到错误:
! pdfTeX error (\pdfsetmatrix): Unrecognized format..
<to be read again>
\endgroup \set@typeset@protect
l.9 \end{document}
当使用 pdflatex 进行编译时,我包含一个图像(png 或 pdf,还没有尝试其他格式)并尝试使用以下任一方法调整其大小:
\includegraphics[width=\textwidth]{CQL.pdf}
或者
\includegraphics[height=10cm]{CQL.pdf}
但是,如果我简单使用:
\includegraphics{CQL.pdf}
然后一切正常。我删除了所有其他包,并将文档类设置为 article 而不是自定义样式,但这并不能解决问题。以下是导致此问题的最小代码片段:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics[height=10cm]{CQL.pdf}
\end{figure}
\end{document}
如果可以选择,我可能会通过启动 Ubuntu 来避免这种麻烦,但我目前没有这个选项(在 VM 中也没有)。有人能帮帮我吗?
编辑:有问题的PDF文件:https://drive.google.com/file/d/0BwRwUW7S2s2HWXMxMEtCeXNOS3c/edit
日志输出,包括 \listfiles 输出:
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9) (preloaded
format=pdflatex 2014.2.11) 18 FEB 2014 17:17 entering extended mode
**figtest (C:\Users\andrew.k\Documents\ecai2014\figtest.tex LaTeX2e <2011/06/27> Babel <v3.8m> and hyphenation patterns for english,
afrikaans, ancientgreek, ar abic, armenian, assamese, basque, bengali,
bokmal, bulgarian, catalan, coptic, croatian, czech, danish, dutch,
esperanto, estonian, farsi, finnish, french, ga lician, german,
german-x-2013-05-26, greek, gujarati, hindi, hungarian, iceland ic,
indonesian, interlingua, irish, italian, kannada, kurmanji, latin,
latvian, lithuanian, malayalam, marathi, mongolian, mongolianlmc,
monogreek, ngerman, n german-x-2013-05-26, nynorsk, oriya, panjabi,
pinyin, polish, portuguese, roman ian, russian, sanskrit, serbian,
slovak, slovenian, spanish, swedish, swissgerm an, tamil, telugu,
turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl ishmax,
welsh, loaded. ("C:\Program Files (x86)\MiKTeX
2.9\tex\latex\base\article.cls" Document Class: article 2007/10/19 v1.4h Standard LaTeX document class ("C:\Program Files (x86)\MiKTeX
2.9\tex\latex\base\size10.clo" File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option) ) \c@part=\count79
\c@section=\count80 \c@subsection=\count81 \c@subsubsection=\count82
\c@paragraph=\count83 \c@subparagraph=\count84 \c@figure=\count85
\c@table=\count86 \abovecaptionskip=\skip41 \belowcaptionskip=\skip42
\bibindent=\dimen102 ) ("C:\Program Files (x86)\MiKTeX
2.9\tex\latex\graphics\graphicx.sty" Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14 ) ("C:\Program Files (x86)\MiKTeX
2.9\tex\latex\graphics\graphics.sty" Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 1999/03/16 v1.09 sin cos tan (DPC) ) ("C:\Program Files
(x86)\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg" File: graphics.cfg
2007/01/18 v1.5 graphics configuration of teTeX/TeXLive ) Package
graphics Info: Driver file: pdftex.def on input line 91.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
("C:\Program Files (x86)\MiKTeX
2.9\tex\generic\oberdiek\infwarerr.sty" Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) ) ("C:\Program Files
(x86)\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty" Package: ltxcmds
2011/11/09 v1.22 LaTeX kernel commands for general use (HO) )
\Gread@gobject=\count87 )) \Gin@req@height=\dimen103
\Gin@req@width=\dimen104 )
(C:\Users\andrew.k\Documents\ecai2014\figtest.aux) LaTeX Font Info:
Checking defaults for OML/cmm/m/it on input line 6. LaTeX Font Info:
... okay on input line 6. LaTeX Font Info: Checking defaults for
T1/cmr/m/n on input line 6. LaTeX Font Info: ... okay on input line
6. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 6. LaTeX Font Info: ... okay on input line 6. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 6. LaTeX Font Info:
... okay on input line 6. LaTeX Font Info: Checking defaults for
OMX/cmex/m/n on input line 6. LaTeX Font Info: ... okay on input
line 6. LaTeX Font Info: Checking defaults for U/cmr/m/n on input
line 6. LaTeX Font Info: ... okay on input line 6.
(C:\Users\andrew.k\AppData\Roaming\MiKTeX\2.9\tex\context\base\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count88 \scratchdimen=\dimen105 \scratchbox=\box26
\nofMPsegments=\count89 \nofMParguments=\count90
\everyMPshowfont=\toks15 \MPscratchCnt=\count91
\MPscratchDim=\dimen106 \MPnumerator=\count92
\makeMPintoPDFobject=\count93 \everyMPtoPDFconversion=\toks16 )
<CQL.pdf, id=1, 722.7pt x 542.025pt> File: CQL.pdf Graphic file (type
pdf) <use CQL.pdf> Package pdftex.def Info: CQL.pdf used on input
line 9. (pdftex.def) Requested size: 379.37907pt x
284.52756pt.
Overfull \hbox (34.37907pt too wide) in paragraph at lines 9--10 [][]
[]
[1 ! pdfTeX error (\pdfsetmatrix): Unrecognized format.. <to be read
again>
\endgroup \set@typeset@protect l.12 \end{document}
Here is how much of TeX's memory you used: 1100 strings out of
493921 14605 string characters out of 3144867 62924 words of memory
out of 3000000 4449 multiletter control sequences out of 15000+200000
3640 words of font info for 14 fonts, out of 3000000 for 9000 841
hyphenation exceptions out of 8191 27i,5n,19p,215b,213s stack
positions out of 5000i,500n,10000p,200000b,50000s ! ==> Fatal error
occurred, no output PDF file produced!
答案1
评论太长了。
您可以尝试以下示例吗?
\documentclass{article}
\begin{document}
Hello
\pdfsetmatrix{.52495 0 0 .52495}
World
\end{document}
如果它断了,如果将该\pdfsetmatrix
行替换为以下内容,会发生什么情况?
\pdfsetmatrix{2 0 0 2}
或者
\pdfsetmatrix{2.0 0.0 0.0 2.0}
到目前为止,我无法重现该问题,无论是使用 TL 还是 MiKTeX。
pdftex.def 2011/05/27 v0.06d, md5sum=3C8A0D99822330F2DFABC0DFB09CE897
graphics.sty 2009/02/05 v1.0o
graphicx.sty 1999/02/16 v1.0f
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9) (preloaded format=pdflatex 2014.2.18)
CQL.pdf: size=2312 md5sum=8D0D2F67766E6E135B1B70B09BCA5CCA
pdfTeX 可以计算 MD5 校验和:
\typeout{md5(CQL.pdf)=\pdfmdfivesum file{CQL.pdf}}
据我所知,版本是相同的。此外,您还输出了来自\pdfsetmatrix
(来自此回答):
\let\orgpdfsetmatrix\pdfsetmatrix
\renewcommand*{\pdfsetmatrix}[1]{%
\typeout{* setmatrix: [#1]}%
\orgpdfsetmatrix{#1}%
}
输出看起来正确:
* setmatrix: [.52495 0 0 .52495]
因此,我能找到的唯一区别是二进制。您使用的是 64 位版本吗?我已经使用 32 位版本的 MiKTeX 进行了测试。
因此我认为,这个问题值得研究,但很困难,因为它似乎无法轻易重现。
此外评论来自 Acrofales:
\pdfsetmatrix{2.0 0.0 0.0 2.0}
中断,没有点的变体\pdfsetmatrix{2 0 0 2}
起作用。
从源代码来看pdftexdir/utils.c
:
typedef struct {
double a;
double b;
double c;
double d;
double e;
double f;
} matrix_entry;
...
integer pdfsetmatrix(poolpointer in, scaled cur_h, scaled cur_v)
{
matrix_entry x, *y, *z;
char dummy;
if (page_mode) {
if (sscanf((const char *) &strpool[in], " %lf %lf %lf %lf %c",
&x.a, &x.b, &x.c, &x.d, &dummy) != 4) {
return 0; /* failure */
}
...
}
手册页说明了%lf
:
l
:表示...转换将是e
、f
或之一g
,并且下一个指针是指向double
(而不是float
)的指针。
这可能不适用于 MiKTeX 64 位版本使用的编译器 Microsoft Visual C++ 2008,根据构建说明对于 Windows。如果变量大小不匹配,sscanf
并且内存写入变量之外,这也可以解释安全违规。