Debian Codegraph @

texmf-dist/source/generic/luatex85/luatex85.dtx

raw
1 % \iffalse
2 %% Source File: luatex85.dtx
3 %% Copyright 2015-2016 LaTeX3 project
4 %%
5 %% This file may be distributed under the terms of the LPPL.
6 %% See README for details.
7 %
8 %<*dtx>
9 \ProvidesFile{luatex85.dtx}
10 %</dtx>
11 %<package>\ifx\ProvidesPackage\undefined
12 %<package>\def\next#1#2[#3]{\wlog{#2 #3}\expandafter\gdef
13 %<package>\csname [email protected]\endcsname{#3}}
14 %<package>\expandafter\next\fi
15 %<package>\ProvidesPackage{luatex85}
16 %<driver> \ProvidesFile{luatex85.drv}
17 % \fi
18 % \ProvidesFile{luatex85.dtx}
19 [2016/06/15 v1.4 pdftex aliases for luatex]
20 %
21 % \iffalse
22 %<*driver>
23 \documentclass{ltxdoc}
24 \begin{document}
25 \DocInput{luatex85.dtx}
26 \end{document}
27 %</driver>
28 % \fi
29 %
30 % \hfuzz0.6pt
31 %
32 % \GetFileInfo{luatex85.dtx}
33 %
34 % \title{The \textsf{luatex85} Package\thanks{This file
35 % has version number \fileversion, last
36 % revised \filedate.
37 % Please report any issues at https://github.com/josephwright/luatex85/issues}}
38 % \author{LaTeX3 project}
39 % \date{\filedate}
40 % \maketitle
41 %
42 % \section{Introduction}
43 %
44 % Lua\TeX\ 0.85 and 0.87 contain many changes from Lua\TeX~0.80 as contained in \TeX{}Live 2014.
45 % Most notably almost all the pdf\TeX\ extended primitves with names
46 % \verb|\pdf...| have been renamed or removed. Lua\TeX\ is aiming for
47 % a cleaner separation of the ``back end'' PDF generation (that
48 % corresponds to the work of a dvi driver with classical \TeX).
49 %
50 % There are many other changes and bug fixes in the Lua\TeX\ sources,
51 % however this package is just concerned with compatibility for
52 % documents or packages using the pdf\TeX\ primitives.
53 %
54 % The changes are of several types:
55 %
56 % A few commands have been removed,
57 % as the facilities are achievable in Lua (mostly these had already
58 % been removed in earlier release).
59 %
60 % Some commands have been ``adopted'' as Lua\TeX\ primitives and so
61 % lose their \verb|\pdf| prefix (and in some cases are renamed)
62 % so \verb|\pdfsavepos| becomes \verb|\savepos|, but \verb|\pdfoutput|
63 % becomes \verb|\outputmode|.
64 %
65 % The majority of the ``back end'' commands have been removed and
66 % replaced by calls to one of three new primitives,
67 % \verb|\pdffeedback|, \verb|\pdfextension| and \verb|\pdfvariable|
68 % These take keywords so for example \verb|\pdfliteral| becomes
69 % \verb|\pdfextension literal|.
70 %
71 % The Lua\TeX\ manual lists suitable compatibility definitions
72 % that may be made so that documents can continue to use the old
73 % names. Mostly this package just consists of those definitions, with
74 % minor changes in some cases. (Mostly different choices over the use
75 % of \verb|\protected| or \verb|\edef|.)
76 %
77 % In general it is recommended that packages are updated to use the
78 % new primitive Lua\TeX\ syntax when used with Lua\TeX, but until
79 % packages are updated authors may find that adding\\%
80 % \verb|\RequirePackage{luatex85}|\\
81 % as the first line of their
82 % document helps with the use of older packages with the new Lua\TeX.
83 %
84 % As noted above, there are other changes in Lua\TeX, notably the
85 % removal of the |\verb\write18| syntax for accessing system commands.
86 % The \LaTeX\ \textsf{tools} bundle includes
87 % the \textsf{shellesc} package which emulates
88 % \verb|\write18| as well as providing an alternative
89 % \verb|\Shellescape| syntax that may be used with all engines.
90 %
91 % Note that if packages are found that require \textsf{luatex85}
92 % you may want to contact the authors asking that the packages
93 % be updated to current Lua\TeX\ syntax. The \textsf{luatex85} package
94 % should be seen as a temporary aid to improve compatibility during
95 % the transition towards Lua\TeX~1.0 it is not intended that future
96 % documents should always have to load this compatibility emulation.
97 %
98 % The package is designed to also be usable with plain Lua\TeX.
99 %
100 %
101 % \section{Implementation}
102 %
103 % \begin{macrocode}
104 %<*package>
105 % \end{macrocode}
106 %
107 % \subsection{Checking the engine}
108 % \begin{macrocode}
109 \ifx\pdfvariable\undefined
110 \expandafter\endinput
111 \fi
112 % \end{macrocode}
113
114 % \subsection{Commands promoted to Lua\TeX\ primitives.}
115 %
116 %
117 % \begin{macrocode}
118 \let\pdfpagewidth \pagewidth
119 \let\pdfpageheight \pageheight
120 \let\pdfadjustspacing \adjustspacing
121 \let\pdfprotrudechars \protrudechars
122 \let\pdfnoligatures \ignoreligaturesinfont
123 \let\pdffontexpand \expandglyphsinfont
124 \let\pdfcopyfont \copyfont
125 \let\pdfxform \saveboxresource
126 \let\pdflastxform \lastsavedboxresourceindex
127 \let\pdfrefxform \useboxresource
128 \let\pdfximage \saveimageresource
129 \let\pdflastximage \lastsavedimageresourceindex
130 \let\pdflastximagepages \lastsavedimageresourcepages
131 \let\pdfrefximage \useimageresource
132 \let\pdfsavepos \savepos
133 \let\pdflastxpos \lastxpos
134 \let\pdflastypos \lastypos
135 \let\pdfoutput \outputmode
136 \let\pdfdraftmode \draftmode
137 \let\pdfpxdimen \pxdimen
138 \let\pdfinsertht \insertht
139 \let\pdfnormaldeviate \normaldeviate
140 \let\pdfuniformdeviate \uniformdeviate
141 \let\pdfsetrandomseed \setrandomseed
142 \let\pdfrandomseed \randomseed
143 \let\pdfprimitive \primitive
144 \let\ifpdfprimitive \ifprimitive
145 \let\ifpdfabsnum \ifabsnum
146 \let\ifpdfabsdim \ifabsdim
147 % \end{macrocode}
148 % Use |\enableprimitives| here in case of conflict with tracefnt.
149 % \begin{macrocode}
150 \directlua{tex.enableprimitives('pdf',{'tracingfonts'})}
151 % \end{macrocode}
152 %
153 % \subsection{Commands converted to constants}
154 % The |\pdffeedback| version is not defined in dvi mode and (currently) is
155 % curiously defined to be 40 in pdf mode, so define these as constant values.
156 % \begin{macrocode}
157 \protected\def\pdftexversion {\numexpr 140\relax}
158 \def\pdftexrevision {7}
159 %\protected\def\pdftexversion {\numexpr\pdffeedback version\relax}
160 % \def\pdftexrevision {\pdffeedback revision}
161 % \end{macrocode}
162 %
163 % \subsection{Commands converted to \cs{pdffeedback}}
164 % Expandable commands use a simple |\def|. Internal registers that
165 % were accessed via |\the| in PDF\TeX\ use a |\protected| definition
166 % using |\numexpr| terminated by an explicit |\relax|.
167 % \begin{macrocode}
168 \protected\def\pdflastlink {\numexpr\pdffeedback lastlink\relax}
169 \protected\def\pdfretval {\numexpr\pdffeedback retval\relax}
170 \protected\def\pdflastobj {\numexpr\pdffeedback lastobj\relax}
171 \protected\def\pdflastannot {\numexpr\pdffeedback lastannot\relax}
172 \def\pdfxformname {\pdffeedback xformname}
173 {\outputmode=1
174 \xdef\pdfcreationdate {\pdffeedback creationdate}
175 }
176 \def\pdffontname {\pdffeedback fontname}
177 \def\pdffontobjnum {\pdffeedback fontobjnum}
178 \def\pdffontsize {\pdffeedback fontsize}
179 \def\pdfpageref {\pdffeedback pageref}
180 \def\pdfcolorstackinit {\pdffeedback colorstackinit}
181 % \end{macrocode}
182 %
183 % \subsection{Commands converted to calls to \cs{pdfextension}}
184 % These use a |\protected| definition. Commands that take no following
185 % argument are currently terminated by |\relax| as suggested in the
186 % Lua\TeX\ manual, although it would be appear to be sufficient to
187 % consistently terminate these commands with a space.
188 % \begin{macrocode}
189 \protected\def\pdfliteral {\pdfextension literal}
190 \protected\def\pdfcolorstack {\pdfextension colorstack}
191 \protected\def\pdfsetmatrix {\pdfextension setmatrix}
192 \protected\def\pdfsave {\pdfextension save\relax}
193 \protected\def\pdfrestore {\pdfextension restore\relax}
194 \protected\def\pdfobj {\pdfextension obj }
195 \protected\def\pdfrefobj {\pdfextension refobj }
196 \protected\def\pdfannot {\pdfextension annot }
197 \protected\def\pdfstartlink {\pdfextension startlink }
198 \protected\def\pdfendlink {\pdfextension endlink\relax}
199 \protected\def\pdfoutline {\pdfextension outline }
200 \protected\def\pdfdest {\pdfextension dest }
201 \protected\def\pdfthread {\pdfextension thread }
202 \protected\def\pdfstartthread {\pdfextension startthread }
203 \protected\def\pdfendthread {\pdfextension endthread\relax}
204 \protected\def\pdfinfo {\pdfextension info }
205 \protected\def\pdfcatalog {\pdfextension catalog }
206 \protected\def\pdfnames {\pdfextension names }
207 \protected\def\pdfincludechars {\pdfextension includechars }
208 \protected\def\pdffontattr {\pdfextension fontattr }
209 \protected\def\pdfmapfile {\pdfextension mapfile }
210 \protected\def\pdfmapline {\pdfextension mapline }
211 \protected\def\pdftrailer {\pdfextension trailer }
212 \protected\def\pdfglyphtounicode {\pdfextension glyphtounicode }
213 % \end{macrocode}
214 %
215 % \subsection{Commands converted to calls to \cs{pdfvariable}}
216 % Currently as suggested in the manual the call to |\pdfvariable| has
217 % no explict termination, and relies on the fact that no variable name
218 % is a prefix of another. |\edef| is used to save one expansion step
219 % when these comands are used the definition directly access the
220 % internal command token.
221 % \begin{macrocode}
222 \protected\edef\pdfcompresslevel {\pdfvariable compresslevel}
223 \protected\edef\pdfobjcompresslevel {\pdfvariable objcompresslevel}
224 \protected\edef\pdfdecimaldigits {\pdfvariable decimaldigits}
225 \protected\edef\pdfgamma {\pdfvariable gamma}
226 \protected\edef\pdfimageresolution {\pdfvariable imageresolution}
227 \protected\edef\pdfimageapplygamma {\pdfvariable imageapplygamma}
228 \protected\edef\pdfimagegamma {\pdfvariable imagegamma}
229 \protected\edef\pdfimagehicolor {\pdfvariable imagehicolor}
230 % \end{macrocode}
231 % Note that |\pdfimageaddfilename| was never actually in PDF\TeX,
232 % But is included here so that all the |\pdfvariable| cases are covered.
233 % \begin{macrocode}
234 \protected\edef\pdfimageaddfilename {\pdfvariable imageaddfilename}
235 % \end{macrocode}
236 % \begin{macrocode}
237 \protected\edef\pdfpkresolution {\pdfvariable pkresolution}
238 \protected\edef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts}
239 \protected\edef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel}
240 % \end{macrocode}
241 % Note that |\pdfreplacefont| was never in public releases of
242 % PDF\TeX, It was in Lua\TeX0.85, but discussion on luatex list
243 % lead to it being removed in 0.87
244 % \begin{macrocode}
245 %\protected\edef\pdfreplacefont {\pdfvariable replacefont}
246 % \end{macrocode}
247 % \begin{macrocode}
248 \protected\edef\pdfgentounicode {\pdfvariable gentounicode}
249 \protected\edef\pdfpagebox {\pdfvariable pagebox}
250 \protected\edef\pdfminorversion {\pdfvariable minorversion}
251 \protected\edef\pdfuniqueresname {\pdfvariable uniqueresname}
252 \protected\edef\pdfhorigin {\pdfvariable horigin}
253 \protected\edef\pdfvorigin {\pdfvariable vorigin}
254 \protected\edef\pdflinkmargin {\pdfvariable linkmargin}
255 \protected\edef\pdfdestmargin {\pdfvariable destmargin}
256 \protected\edef\pdfthreadmargin {\pdfvariable threadmargin}
257 \protected\edef\pdfpagesattr {\pdfvariable pagesattr}
258 \protected\edef\pdfpageattr {\pdfvariable pageattr}
259 \protected\edef\pdfpageresources {\pdfvariable pageresources}
260 % \end{macrocode}
261 % Note that |\pdfxformattr| and |\pdfxformresources| were never
262 % in PDF\TeX, But are included here so that all the
263 % |\pdfvariable| cases are covered.
264 % \begin{macrocode}
265 \protected\edef\pdfxformattr {\pdfvariable xformattr}
266 \protected\edef\pdfxformresources {\pdfvariable xformresources}
267 % \end{macrocode}
268 % \begin{macrocode}
269 \protected\edef\pdfpkmode {\pdfvariable pkmode}
270 % \end{macrocode}
271 %
272 % \begin{macrocode}
273 %</package>
274 % \end{macrocode}
275 %
276 % \Finale
277 %