给定一个使用 hyperref 包的 latex 文件,我希望通过以下方式将其转换为 pdf:
latex "foo.tex"
dvips "foo.dvi" -z -P Pdf
ps2pdf "foo.ps"
然而,这样所有的超链接都会丢失!
这是一个最小的工作示例:
\documentclass{article}
\usepackage{color}
\usepackage{amsthm}
\usepackage[dvips,colorlinks=true,citecolor=blue,linkcolor=blue]{hyperref}
\newtheorem{theorem}{Theorem}[section]
\title{Template}
\author{Johnny Cash}
\begin{document}
\maketitle
\begin{theorem}\label{def:1}
Text
\end{theorem}
We use Definition \ref{def:1}.
\cite{Ric55}
BODY OF TEXT
\newpage
\begin{thebibliography}{xxx}
\bibitem[Ric55]{Ric55}
Little Richards.
\newblock Tutti Frutti,
\newblock {\em Annals of Mathematics}, 1955.
\end{thebibliography}
\end{document}
编辑:
问题现在解决了。问题出在调用 Ghostscript 9.14;更新到 Ghostscript 9.16 后一切又恢复正常。
文件:
DVI:
日志档案:
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9 64-bit) (preloaded format=latex 2015.8.19) 20 AUG 2015 14:48
entering extended mode
**simple-template2.tex
("C:\tex\Template Tex file\simple-template2.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\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files\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\MiKTeX 2.9\tex\latex\graphics\color.sty"
Package: color 2005/11/14 v1.0j Standard LaTeX Color (DPC)
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\color.cfg"
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
)
Package color Info: Driver file: dvips.def on input line 130.
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\dvips.def"
File: dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\dvipsnam.def"
File: dvipsnam.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
))
("C:\Program Files\MiKTeX 2.9\tex\latex\amscls\amsthm.sty"
Package: amsthm 2004/08/06 v2.20
\thm@style=\toks14
\thm@bodyfont=\toks15
\thm@headfont=\toks16
\thm@notefont=\toks17
\thm@headpunct=\toks18
\thm@preskip=\skip43
\thm@postskip=\skip44
\thm@headsep=\skip45
\dth@everypar=\toks19
)
("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\hyperref.sty"
Package: hyperref 2012/11/06 v6.83m Hypertext links for LaTeX
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\hobsub-hyperref.sty"
Package: hobsub-hyperref 2012/04/25 v1.12 Bundle oberdiek, subset hyperref (HO)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\hobsub-generic.sty"
Package: hobsub-generic 2012/04/25 v1.12 Bundle oberdiek, subset generic (HO)
Package: hobsub 2012/04/25 v1.12 Construct package bundles (HO)
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
Package: ifvtex 2010/03/01 v1.5 Detect VTeX and its facilities (HO)
Package ifvtex Info: VTeX not detected.
Package: intcalc 2007/09/27 v1.1 Expandable calculations with integers (HO)
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in PDF mode is not detected.
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds) That can mean that you are not using pdfTeX 1.50 or
(etexcmds) that some package has redefined \expanded.
(etexcmds) In the latter case, load this package earlier.
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO)
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO)
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode is ignored in DVI mode.
Package: pdfescape 2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
Package: bigintcalc 2012/04/08 v1.3 Expandable calculations on big integers (HO
)
Package: bitset 2011/01/30 v1.1 Handle bit-vector datatype (HO)
Package: uniquecounter 2011/01/30 v1.2 Provide unlimited unique counter (HO)
)
Package hobsub Info: Skipping package `hobsub' (already loaded).
Package: letltxmacro 2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
Package: hopatch 2011/06/24 v1.1 Wrapper for package hooks (HO)
Package: xcolor-patch 2011/01/30 xcolor patch
Package: atveryend 2011/06/30 v1.8 Hooks at the very end of document (HO)
Package atveryend Info: \enddocument detected (standard20110627).
Package: atbegshi 2011/10/05 v1.16 At begin shipout hook (HO)
Package: refcount 2011/10/16 v3.4 Data extraction from label references (HO)
Package: hycolor 2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks20
)
("C:\Program Files\MiKTeX 2.9\tex\generic\ifxetex\ifxetex.sty"
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
)
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\auxhook.sty"
Package: auxhook 2011/03/04 v1.3 Hooks for auxiliary files (HO)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty"
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO)
)
\@linkdim=\dimen103
\Hy@linkcounter=\count87
\Hy@pagecounter=\count88
("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\pd1enc.def"
File: pd1enc.def 2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
)
\Hy@SavedSpaceFactor=\count89
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\hyperref.cfg"
File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
)
Package hyperref Info: Option `colorlinks' set `true' on input line 4319.
Package hyperref Info: Hyper figures OFF on input line 4443.
Package hyperref Info: Link nesting OFF on input line 4448.
Package hyperref Info: Hyper index ON on input line 4451.
Package hyperref Info: Plain pages OFF on input line 4458.
Package hyperref Info: Backreferencing OFF on input line 4463.
Package hyperref Info: Implicit mode ON; LaTeX internals redefined.
Package hyperref Info: Bookmarks ON on input line 4688.
\c@Hy@tempcnt=\count90
("C:\Program Files\MiKTeX 2.9\tex\latex\url\url.sty"
\Urlmuskip=\muskip10
Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc.
)
LaTeX Info: Redefining \url on input line 5041.
\XeTeXLinkMargin=\dimen104
\Fld@menulength=\count91
\Field@Width=\dimen105
\Fld@charsize=\dimen106
Package hyperref Info: Hyper figures OFF on input line 6295.
Package hyperref Info: Link nesting OFF on input line 6300.
Package hyperref Info: Hyper index ON on input line 6303.
Package hyperref Info: backreferencing OFF on input line 6310.
Package hyperref Info: Link coloring ON on input line 6313.
Package hyperref Info: Link coloring with OCG OFF on input line 6320.
Package hyperref Info: PDF/A mode OFF on input line 6325.
LaTeX Info: Redefining \ref on input line 6365.
LaTeX Info: Redefining \pageref on input line 6369.
\Hy@abspage=\count92
\c@Item=\count93
\c@Hfootnote=\count94
)
Package hyperref Message: Driver: hdvips.
("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\hdvips.def"
File: hdvips.def 2012/11/06 v6.83m Hyperref driver for dvips
("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\pdfmark.def"
File: pdfmark.def 2012/11/06 v6.83m Hyperref definitions for pdfmark specials
\pdf@docset=\toks21
\pdf@box=\box26
\pdf@toks=\toks22
\pdf@defaulttoks=\toks23
\HyField@AnnotCount=\count95
\Fld@listcount=\count96
\c@bookmark@seq@number=\count97
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\rerunfilecheck.sty"
Package: rerunfilecheck 2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2
82.
)
\Hy@SectionHShift=\skip46
))
\c@theorem=\count98
("C:\tex\Template Tex file\simple-template2.aux")
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 14.
LaTeX Font Info: ... okay on input line 14.
\AtBeginShipoutBox=\box27
Package hyperref Info: Link coloring ON on input line 14.
("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\nameref.sty"
Package: nameref 2012/10/27 v2.43 Cross-referencing by name of section
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\gettitlestring.sty"
Package: gettitlestring 2010/12/03 v1.4 Cleanup title references (HO)
)
\c@section@level=\count99
)
LaTeX Info: Redefining \ref on input line 14.
LaTeX Info: Redefining \pageref on input line 14.
LaTeX Info: Redefining \nameref on input line 14.
("C:\tex\Template Tex file\simple-template2.out")
("C:\tex\Template Tex file\simple-template2.out")
\@outlinefile=\write3
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <12> on input line 17.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 17.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 17.
[1
]
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 44.
[2]
Package atveryend Info: Empty hook `AfterLastShipout' on input line 44.
("C:\tex\Template Tex file\simple-template2.aux")
Package atveryend Info: Empty hook `AtVeryEndDocument' on input line 44.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 44.
Package rerunfilecheck Info: File `simple-template2.out' has not changed.
(rerunfilecheck) Checksum: D41D8CD98F00B204E9800998ECF8427E;0.
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 44.
)
Here is how much of TeX's memory you used:
4635 strings out of 493922
69554 string characters out of 3147293
146765 words of memory out of 3000000
7933 multiletter control sequences out of 15000+200000
7934 words of font info for 28 fonts, out of 3000000 for 9000
841 hyphenation exceptions out of 8191
29i,6n,27p,189b,318s stack positions out of 5000i,500n,10000p,200000b,50000s
Output written on simple-template2.dvi (2 pages, 4340 bytes).
答案1
选项-z
适用dvips
于hypertex
基于 DVI hyperTeX 特制的驱动程序:
\usepackage[hypertex]{hyperref}
dvips
当使用选项时:
\usepackage[dvips]{hyperref}
然后使用基于 pdfmarks 的驱动程序。然后-z
不应使用选项。via 方式pdfmark
更强大,因为支持更多功能并且可以配置链接(边框颜色,...)。