当我从 Ubuntu 12.10 打印某个 PDF 时,我看到很多乱码。我尝试从 Mac OS X 打印相同的 PDF,成功了。有什么想法可以解决这个问题吗?
以下是 PDF 内容: https://www.yousendit.com/download/WFJWOGNYQzNmVFlYRHRVag(SHA-1 校验和为 955496e5d8aea341422a61e83bf2c8867d92cebf )。
它是从这个非常简单的 LaTeX 文件编译而来的:
\documentclass[12pt,english]{letter}
\usepackage[margin=.75in]{geometry}
\usepackage{babel}
\begin{document}
\address{sender \\ address line 1 \\ address line 2}
\letter{recipient \\ address line 1 \\ address line 2}
\signature{My Full Name}
\opening{Dear Recipient,}
Here's a letter for you.
\closing{Sincerely,}
\end{document}
使用此命令:
pdflatex test.tex
这是第 1 页:
这是第 2 页:
我通过两台不同的 Ubuntu 12.10 计算机打印到两台不同的打印机得到了相同的结果。
这里还有一些调试信息:
$ pdflatex --version
pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
kpathsea version 6.1.0
Copyright 2012 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.2.49; using libpng 1.2.49
Compiled with zlib 1.2.7; using zlib 1.2.7
Compiled with poppler version 0.20.4
这是 .log 文件:
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian) (format=pdflatex 2013.1.9) 3 JUN 2013 20:33
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**test.tex
(./test.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo
aded.
(/usr/share/texlive/texmf-dist/tex/latex/base/letter.cls
Document Class: letter 1999/04/29 v1.2z Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo
File: size12.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\longindentation=\dimen102
\indentedwidth=\dimen103
\labelcount=\count79
)
(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty
Package: geometry 2010/09/12 v5.6 Page Geometry
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in PDF mode is detected.
)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty
Package: ifvtex 2010/03/01 v1.5 Detect VTeX and its facilities (HO)
Package ifvtex Info: VTeX not detected.
)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
)
\Gm@cnth=\count80
\Gm@cntv=\count81
\c@Gm@tempcnt=\count82
\Gm@bindingoffset=\dimen104
\Gm@wd@mp=\dimen105
\Gm@odd@mp=\dimen106
\Gm@even@mp=\dimen107
\Gm@layoutwidth=\dimen108
\Gm@layoutheight=\dimen109
\Gm@layouthoffset=\dimen110
\Gm@layoutvoffset=\dimen111
\Gm@dimlist=\toks15
)
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
Package: babel 2008/07/08 v3.8m The Babel package
(/usr/share/texlive/texmf-dist/tex/generic/babel/english.ldf
Language: english 2005/03/30 v3.3o English support from the babel system
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.def
File: babel.def 2008/07/08 v3.8m Babel common definitions
\babel@savecnt=\count83
\U@D=\dimen112
)
\l@british = a dialect from \language\l@english
\l@UKenglish = a dialect from \language\l@english
\l@canadian = a dialect from \language\l@american
\l@australian = a dialect from \language\l@british
\l@newzealand = a dialect from \language\l@british
)) (./test.aux)
\openout1 = `test.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 T1/cmr/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 OMS/cmsy/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.
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
*geometry* verbose mode - [ preamble ] result:
* driver: pdftex
* paper: <default>
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes:
* h-part:(L,W,R)=(54.2025pt, 505.89pt, 54.2025pt)
* v-part:(T,H,B)=(54.2025pt, 686.56499pt, 54.2025pt)
* \paperwidth=614.295pt
* \paperheight=794.96999pt
* \textwidth=505.89pt
* \textheight=686.56499pt
* \oddsidemargin=-18.06749pt
* \evensidemargin=-18.06749pt
* \topmargin=-75.06749pt
* \headheight=12.0pt
* \headsep=45.0pt
* \topskip=12.0pt
* \footskip=25.0pt
* \marginparwidth=90.0pt
* \marginparsep=11.0pt
* \columnsep=10.0pt
* \skip\footins=10.0pt plus 2.0pt minus 4.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <12> on input line 9.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 9.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 9.
[1
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux) )
Here is how much of TeX's memory you used:
995 strings out of 495059
13062 string characters out of 3182031
68184 words of memory out of 3000000
4226 multiletter control sequences out of 15000+200000
6376 words of font info for 23 fonts, out of 3000000 for 9000
14 hyphenation exceptions out of 8191
25i,6n,32p,170b,104s stack positions out of 5000i,500n,10000p,200000b,50000s
</usr/share/
texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb>
Output written on test.pdf (1 page, 14134 bytes).
PDF statistics:
12 PDF objects out of 1000 (max. 8388607)
7 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
这是有关打印机 #1 的信息...
- 品牌和型号:Brother MFC-8840D BR-Script3
- 设备 URI:ipp://192.168.1.9:631/printers/Brother(它通过 USB 连接到 Ubuntu 12.04.2 机器,然后我通过网络打印到它)
打印机#2(几小时后会有更多信息)...
- 品牌和型号:待定
- 设备 URI:待定
答案1
通过添加修复\usepackage[T1]{fontenc}
。也许https://tex.stackexchange.com/questions/664/why-should-i-use-usepackaget1fontenc解释原因。与上面的原始 LaTeX 代码不同:
--- orig.tex 2013-06-06 10:50:08.669371329 -0700
+++ new.tex 2013-06-06 10:50:19.829371518 -0700
@@ -1,4 +1,5 @@
\documentclass[12pt,english]{letter}
+\usepackage[T1]{fontenc}
\usepackage[margin=.75in]{geometry}
\usepackage{babel}
这是整个 LaTeX 文件,可以使用 pdflatex 顺利编译,在 evince 中看起来不错,并且可以在 Ubuntu 和 OS X 上顺利打印:
\documentclass[12pt,english]{letter}
\usepackage[T1]{fontenc}
\usepackage[margin=.75in]{geometry}
\usepackage{babel}
\begin{document}
\address{sender \\ address line 1 \\ address line 2}
\letter{recipient \\ address line 1 \\ address line 2}
\signature{My Full Name}
\opening{Dear Recipient,}
Here's a letter for you.
\closing{Sincerely,}
\end{document}