Debian Codegraph @

texmf-dist/source/support/latex-make/pdfswitch.dtx

raw
1 % \iffalse meta-comment
2 %%
3 %% File: pdfswitch.dtx Copyright (C) 2002--2016 V. Danjean, A. Legrand
4 %% [email protected]
5 %% [email protected]
6 %%
7 %% This program is free software; you can redistribute it and/or
8 %% modify it under the terms of the GNU General Public License
9 %% as published by the Free Software Foundation; either version 2
10 %% of the License, or (at your option) any later version.
11 %%
12 %% This program is distributed in the hope that it will be useful,
13 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
14 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 %% GNU General Public License for more details.
16 %%
17 %% You should have received a copy of the GNU General Public License
18 %% along with this program; if not, write to the Free Software
19 %% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 %%
21 %
22 %<*dtx>
23 \ProvidesFile{pdfswitch.dtx}
24 %</dtx>
25 %<package>\NeedsTeXFormat{LaTeX2e}%
26 %<package>\ProvidesPackage{pdfswitch}%
27 % \fi
28 % \ProvidesFile{pdfswitch.dtx}
29 [2021/10/26 v2.4.3 No changes in pdfswitch.dtx]
30 %<*package>
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 % SWITCH FOR PDFLATEX or LATEX
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 %%%
35 \RequirePackage{ae,aeguill}
36 \RequirePackage{ifthen}
37 \RequirePackage{ifpdf}
38 \RequirePackage{etoolbox}
39
40 \newboolean{nocolor@pdfswitch}
41 \setboolean{nocolor@pdfswitch}{false}
42 \DeclareOption{nocolor}{\setboolean{nocolor@pdfswitch}{true}}
43 \newboolean{backref@pdfswitch}
44 \setboolean{backref@pdfswitch}{false}
45 \DeclareOption{backref}{\setboolean{backref@pdfswitch}{true}}
46 \newboolean{pagebackref@pdfswitch}
47 \setboolean{pagebackref@pdfswitch}{false}
48 \DeclareOption{pagebackref}{\setboolean{pagebackref@pdfswitch}{true}}
49 \newboolean{noborder@pdfswitch}
50 \setboolean{noborder@pdfswitch}{false}
51 \DeclareOption{noborder}{\setboolean{noborder@pdfswitch}{true}}
52 \newboolean{plainpages@pdfswitch}
53 \setboolean{plainpages@pdfswitch}{false}
54 \DeclareOption{plainpages}{\setboolean{plainpages@pdfswitch}{true}}
55
56 \ProcessOptions
57
58 %%%%%%%%%%%%%%%%%%%%%%%%% graphicx and thumbpdf %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 % differ the hyperref and (x)color package loading
60 \AtEndPreamble{%
61 \RequirePackage{hyperref}%
62 \@ifundefined{colorbox}{%
63 \IfFileExists{xcolor.sty}{\RequirePackage{xcolor}}%
64 {\RequirePackage{color}}%
65 }{}%
66 \definecolor{pdfurlcolor}{rgb}{0,0,0.6}%
67 \definecolor{pdfcitecolor}{rgb}{0,0.6,0}%
68 \definecolor{pdflinkcolor}{rgb}{0.6,0,0}%
69 %
70 \RequirePackage{graphicx}%
71 }%
72 \ifpdf
73 \PassOptionsToPackage{pdftex}{graphicx} %%% graphics for pdfLaTeX
74 \PassOptionsToPackage{pdftex}{color}
75 \PassOptionsToPackage{pdftex}{thumbpdf} %%% thumbnails for pdflatex
76 \AtEndPreamble{%
77 \DeclareGraphicsExtensions{.pdf} %%% standard extension for included graphics
78 \RequirePackage{thumbpdf}%
79 }%
80 \else
81 \PassOptionsToPackage{dvips}{graphicx} %%% graphics for dvips
82 \AtEndPreamble{%
83 \DeclareGraphicsExtensions{.eps} %%% standard extension for included graphics
84 }%
85 %\usepackage[ps2pdf]{thumbpdf} %%% thumbnails for ps2pdf
86 \fi
87
88 %%%%%%%%%%%%%%%%%%%%%%%%% Basic options for hyperref %%%%%%%%%%%%%%%%%%%%%%%%%
89 \ifpdf
90 \edef\keys@pdfswitch{%
91 pdftex, %%% hyper-references for pdflatex
92 bookmarks=true,% %%% generate bookmarks ...
93 bookmarksnumbered=true,% %%% ... with numbers
94 hypertexnames=false,% %%% needed for correct links to figures !!!
95 breaklinks=true% %%% break links if exceeding a single line
96 }
97 \else
98 \edef\keys@pdfswitch{%
99 ps2pdf, %%% hyper-references for ps2pdf
100 bookmarks=true,% %%% generate bookmarks ...
101 bookmarksnumbered=true,% %%% ... with numbers
102 hypertexnames=false,% %%% needed for correct links to figures !!!
103 breaklinks=true,% %%% breaks lines, but links are very small
104 pdfborder={0 0 11.0} %%% border-width of frames will
105 %%% be multiplied with 0.009 by ps2pdf
106 }
107 \fi
108
109 \ifthenelse{\boolean{nocolor@pdfswitch}}{%
110 \edef\keys@pdfswitch{\keys@pdfswitch,colorlinks=false}%
111 }{
112 \edef\keys@pdfswitch{\keys@pdfswitch,colorlinks=true,%
113 citecolor=pdfcitecolor,
114 urlcolor=pdfurlcolor,
115 linkcolor=pdflinkcolor,
116 linkbordercolor={1 1 1}}%
117 }
118
119 \ifthenelse{\boolean{plainpages@pdfswitch}}{%
120 }{
121 \edef\keys@pdfswitch{\keys@pdfswitch,plainpages=false}%
122 }
123
124 \ifthenelse{\boolean{noborder@pdfswitch}}{%
125 \edef\keys@pdfswitch{\keys@pdfswitch,pdfborder={0 0 0}}%
126 }{}
127
128 \ifthenelse{\boolean{backref@pdfswitch}}{%
129 \edef\keys@pdfswitch{\keys@pdfswitch,backref}%
130 }{}
131
132 \ifthenelse{\boolean{pagebackref@pdfswitch}}{%
133 \edef\keys@pdfswitch{\keys@pdfswitch,pagebackref}%
134 }{}
135
136 \PassOptionsToPackage{\keys@pdfswitch}{hyperref}%
137
138 %%%%%%%%%%%%%%%%%%%%%%%%% HyperSetup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139 \AtBeginDocument{
140 \ifpdf
141 \hypersetup{
142 pdfauthor = {\@author},
143 pdftitle = {\@title},
144 pdfsubject = {\@ifundefined{@subject}{}{\@subject}},
145 pdfkeywords = {\@ifundefined{@keywords}{}{\@keywords}},
146 }
147 %%% pdfcreator, pdfproducer, and Creation Date are automatically set by pdflatex !!!
148 \pdfadjustspacing=1 %%% force LaTeX-like character spacing
149 \else%
150 \fi%
151 }
152 %</package>