PDF 图像上出现 \scalebox 错误?

PDF 图像上出现 \scalebox 错误?

我不确定我是否理解发生了什么,但似乎如果某个\scaleboxPDF(example-image-a通过\includegraphics)的放大倍数是一定量(x10),则结果的内容是有错误的。

在 MWE 中,我采用example-image-aPDF、png 和 jpg 格式。我总共修剪了 80% 的宽度和高度,每种情况下都相同。然后我将结果缩放 10 倍(或在某些情况下缩放 9 倍)。右侧显示了参考图,以供比较。

首先,图像的高度不同。我认为这不是问题……这只是意味着原始 PDF 版本比相应的 png 和 jpg 版本尺寸小。但是,请关注左侧的两幅图像,它们分别是按 9 倍和 10 倍缩放的 PDF 版本。9 倍的缩放比例给出了正确的结果,它与第 3 幅 (png) 和第 4 幅 (jpg) 图像的内容(如果不是比例)相匹配。但是,第二幅图像的缩放比例为 10 倍,丢失了字母的黑色部分A

如果我取消注释\renewcommand,以使最后的无效\scalebox,则第二张图像的黑色部分将返回,这意味着它在最后的之前就在那里\scalebox

这是因为我使用了临时框 6 和 8 吗?这与 PDF 图像层有关吗?是我遗漏了一些简单的东西吗?还是这里存在更普遍的问题?

\documentclass[margin=0.1cm] {standalone}
\usepackage{graphicx}
\usepackage{trimclip}
%\renewcommand\scalebox[2]{#2}% TO CANCEL THE SCALING
\begin{document}
\sbox8{\includegraphics{example-image-a.pdf}}
\sbox6{\clipbox{.5\wd8{} .25\ht8{} .3\wd8{} .55\ht8}{\copy8}}
\scalebox{9}{\copy6}
%vs 
\sbox8{\includegraphics{example-image-a.pdf}}
\sbox6{\clipbox{.5\wd8{} .25\ht8{} .3\wd8{} .55\ht8}{\copy8}}
\scalebox{10}{\copy6}
%vs.
\sbox8{\includegraphics{example-image-a.png}}
\sbox6{\clipbox{.5\wd8{} .25\ht8{} .3\wd8{} .55\ht8}{\copy8}}
\scalebox{10}{\copy6}
%vs.
\sbox8{\includegraphics{example-image-a.jpg}}
\sbox6{\clipbox{.5\wd8{} .25\ht8{} .3\wd8{} .55\ht8}{\copy8}}
\scalebox{10}{\copy6}
%vs.
\scalebox{2}{\copy8}
\end{document}

在此处输入图片描述

再次,通过以下方式取消缩放\renewcommand

在此处输入图片描述

更新:

在 Ulrike 表示无法重现这种情况后,我检查了日志文件并发现了这个警告。我不知道它有多大相关性:

pdfTeX warning: miktex-pdftex.exe (file C:/Users/steven.segletes/AppData/Roamin
g/MiKTeX/2.9/tex/latex/mwe/example-image-a.pdf): PDF inclusion: found PDF versi
on <1.5>, but at most version <1.4> allowed

我将 MikTeX 安装更新至最新版本:

pdfTeX, Version 3.141592653-2.6-1.40.22 (MiKTeX 21.3) (preloaded format=pdflatex 2021.5.19)

我还example-image-a.pdfhttps://ctan.org/tex-archive/macros/latex/contrib/mwe并且这两次更新都没有产生任何差异,无论是警告还是输出的外观。

更新2

我发现 PDF 在 Adob​​e Reader 中可以正确呈现,但在 TeXworks 中却不能正确呈现。

正如 Ulrike 所问,这是日志文件:

This is pdfTeX, Version 3.141592653-2.6-1.40.22 (MiKTeX 21.3) (preloaded format=pdflatex 2021.4.14)  20 MAY 2021 16:33
entering extended mode
**./junk.tex
(junk.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18>
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/standalone\standal
one.cls
Document Class: standalone 2018/03/26 v1.3a Class to compile TeX sub-files stan
dalone

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/latex-tools\shelle
sc.sty
Package: shellesc 2019/11/08 v1.0c unified shell escape interface for LaTeX
Package shellesc Info: Restricted shell escape enabled on input line 77.
)
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/generic/iftex\ifluatex.s
ty
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/generic/iftex\iftex.sty
Package: iftex 2020/03/06 v1.0d TeX engine tests
))
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/xkeyval\xkeyval.st
y
Package: xkeyval 2020/11/20 v2.8 package option processing (HA)

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/generic/xkeyval\xkeyval.
tex
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/generic/xkeyval\xkvutils
.tex
\XKV@toks=\toks15
\XKV@tempa@toks=\toks16

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/generic/xkeyval\keyval.t
ex))
\XKV@depth=\count179
File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
))
\sa@internal=\count180
\c@sapage=\count181

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/standalone\standal
one.cfg
File: standalone.cfg 2018/03/26 v1.3a Default configuration file for 'standalon
e' class
)
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\size10.clo
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
)
\c@part=\count182
\c@section=\count183
\c@subsection=\count184
\c@subsubsection=\count185
\c@paragraph=\count186
\c@subparagraph=\count187
\c@figure=\count188
\c@table=\count189
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)
\sa@box=\box47
)
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\graphicx.
sty
Package: graphicx 2020/09/09 v1.2b Enhanced LaTeX Graphics (DPC,SPQR)

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\graphics.
sty
Package: graphics 2020/08/30 v1.4c Standard LaTeX Graphics (DPC,SPQR)

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\trig.sty
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-cfg\graph
ics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 105.

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-def\pdfte
x.def
File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex
))
\Gin@req@height=\dimen139
\Gin@req@width=\dimen140
)
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/adjustbox\trimclip
.sty
Package: trimclip 2020/08/19 v1.2 Trim and clip general TeX material

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/collectbox\collect
box.sty
Package: collectbox 2012/05/17 v0.4b Collect macro arguments as boxes
\collectedbox=\box48
)
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/adjustbox\adjcalc.
sty
Package: adjcalc 2012/05/16 v1.1 Provides advanced setlength with multiple back
-ends (calc, etex, pgfmath)
)
\tc@llx=\dimen141
\tc@lly=\dimen142
\tc@urx=\dimen143
\tc@ury=\dimen144
Package trimclip Info: Using driver 'tc-pdftex.def'.

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/adjustbox\tc-pdfte
x.def
File: tc-pdftex.def 2019/01/04 v2.2 Clipping driver for pdftex
))
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3backend\l3backen
d-pdftex.def
File: l3backend-pdftex.def 2021-03-18 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count190
\l__pdf_internal_box=\box49
) (junk.aux)
\openout1 = `junk.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/context/base/mkii\supp-p
df.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count191
\scratchdimen=\dimen145
\scratchbox=\box50
\nofMPsegments=\count192
\nofMParguments=\count193
\everyMPshowfont=\toks17
\MPscratchCnt=\count194
\MPscratchDim=\dimen146
\MPnumerator=\count195
\makeMPintoPDFobject=\count196
\everyMPtoPDFconversion=\toks18
)
(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/epstopdf-pkg\epsto
pdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
85.

(C:\Users\Steven\AppData\Local\Programs\MiKTeX 2.9\tex/latex/00miktex\epstopdf-
sys.cfg
File: epstopdf-sys.cfg 2021/03/18 v2.0 Configuration of epstopdf for MiKTeX
))

pdfTeX warning: miktex-pdftex.exe (file C:/Users/Steven/AppData/Local/Programs/
MiKTeX 2.9/tex/latex/mwe/example-image-a.pdf): PDF inclusion: found PDF version
 <1.5>, but at most version <1.4> allowed
<example-image-a.pdf, id=1, 321.2pt x 240.9pt>
File: example-image-a.pdf Graphic file (type pdf)
<use example-image-a.pdf>
Package pdftex.def Info: example-image-a.pdf  used on input line 6.
(pdftex.def)             Requested size: 321.19922pt x 240.8994pt.
File: example-image-a.pdf Graphic file (type pdf)
<use example-image-a.pdf>
Package pdftex.def Info: example-image-a.pdf  used on input line 10.
(pdftex.def)             Requested size: 321.19922pt x 240.8994pt.
<example-image-a.png, id=2, 401.5pt x 301.125pt>
File: example-image-a.png Graphic file (type png)
<use example-image-a.png>
Package pdftex.def Info: example-image-a.png  used on input line 14.
(pdftex.def)             Requested size: 401.49901pt x 301.12425pt.
<example-image-a.jpg, id=3, 401.5pt x 301.125pt>
File: example-image-a.jpg Graphic file (type jpg)
<use example-image-a.jpg>
Package pdftex.def Info: example-image-a.jpg  used on input line 18.
(pdftex.def)             Requested size: 401.49901pt x 301.12425pt.
[1

 <C:/Users/Steven/AppData/Local/Programs/MiKTeX 2.9/tex/latex/mwe/example-image
-a.pdf{C:/Users/Steven/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}> <C:/
Users/Steven/AppData/Local/Programs/MiKTeX 2.9/tex/latex/mwe/example-image-a.pn
g> <C:/Users/Steven/AppData/Local/Programs/MiKTeX 2.9/tex/latex/mwe/example-ima
ge-a.jpg>] (junk.aux) ) 
Here is how much of TeX's memory you used:
 1891 strings out of 479321
 31689 string characters out of 2854162
 316567 words of memory out of 3000000
 19358 multiletter control sequences out of 15000+600000
 403430 words of font info for 27 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 68i,5n,74p,207b,170s stack positions out of 5000i,500n,10000p,200000b,80000s
<C:/Users/Steven/AppData/Local/Programs/MiKTeX 2.9/fonts
/type1/public/lm/lmss17.pfb>
Output written on junk.pdf (1 page, 30241 bytes).
PDF statistics:
 16 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 16 words of extra memory for PDF output out of 10000 (max. 10000000)

相关内容