Debian Codegraph @

texmf-dist/source/latex/accsupp/accsupp.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: accsupp.dtx
4 % Version: 2019/12/05 v0.6
5 % Info: Accessibility support by marked content
6 %
7 % Copyright (C)
8 % 2007, 2010 Heiko Oberdiek
9 % 2016-2019 Oberdiek Package Support Group
10 % https://github.com/ho-tex/accsupp/issues
11 %
12 % This work may be distributed and/or modified under the
13 % conditions of the LaTeX Project Public License, either
14 % version 1.3c of this license or (at your option) any later
15 % version. This version of this license is in
16 % https://www.latex-project.org/lppl/lppl-1-3c.txt
17 % and the latest version of this license is in
18 % https://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of
20 % LaTeX version 2005/12/01 or later.
21 %
22 % This work has the LPPL maintenance status "maintained".
23 %
24 % The Current Maintainers of this work are
25 % Heiko Oberdiek and the Oberdiek Package Support Group
26 % https://github.com/ho-tex/accsupp/issues
27 %
28 % This work consists of the main source file accsupp.dtx
29 % and the derived files
30 % accsupp.sty, accsupp.pdf, accsupp.ins, accsupp.drv,
31 % accsupp-pdftex.def, \ccsupp-luatex.def, accsupp-dvipdfm.def,
32 % accsupp-dvips.def,
33 % accsupp-example1.tex, accsupp-example2.tex,
34 % accsupp-test1.tex.
35 %
36 % Distribution:
37 % CTAN:macros/latex/contrib/accsupp/accsupp.dtx
38 % CTAN:macros/latex/contrib/accsupp/accsupp.pdf
39 %
40 % Unpacking:
41 % (a) If accsupp.ins is present:
42 % tex accsupp.ins
43 % (b) Without accsupp.ins:
44 % tex accsupp.dtx
45 % (c) If you insist on using LaTeX
46 % latex \let\install=y\input{accsupp.dtx}
47 % (quote the arguments according to the demands of your shell)
48 %
49 % Documentation:
50 % (a) If accsupp.drv is present:
51 % latex accsupp.drv
52 % (b) Without accsupp.drv:
53 % latex accsupp.dtx; ...
54 % The class ltxdoc loads the configuration file ltxdoc.cfg
55 % if available. Here you can specify further options, e.g.
56 % use A4 as paper format:
57 % \PassOptionsToClass{a4paper}{article}
58 %
59 % Programm calls to get the documentation (example):
60 % pdflatex accsupp.dtx
61 % makeindex -s gind.ist accsupp.idx
62 % pdflatex accsupp.dtx
63 % makeindex -s gind.ist accsupp.idx
64 % pdflatex accsupp.dtx
65 %
66 % Installation:
67 % TDS:tex/latex/accsupp/accsupp.sty
68 % TDS:tex/latex/accsupp/accsupp-pdftex.def
69 % TDS:tex/latex/accsupp/accsupp-luatex.def
70 % TDS:tex/latex/accsupp/accsupp-dvipdfm.def
71 % TDS:tex/latex/accsupp/accsupp-dvips.def
72 % TDS:doc/latex/accsupp/accsupp.pdf
73 % TDS:doc/latex/accsupp/accsupp-example1.tex
74 % TDS:doc/latex/accsupp/accsupp-example2.tex
75 % TDS:source/latex/accsupp/accsupp.dtx
76 %
77 %<*ignore>
78 \begingroup
79 \catcode123=1 %
80 \catcode125=2 %
81 \def\x{LaTeX2e}%
82 \expandafter\endgroup
83 \ifcase 0\ifx\install y1\fi\expandafter
84 \ifx\csname processbatchFile\endcsname\relax\else1\fi
85 \ifx\fmtname\x\else 1\fi\relax
86 \else\csname fi\endcsname
87 %</ignore>
88 %<*install>
89 \input docstrip.tex
90 \Msg{************************************************************************}
91 \Msg{* Installation}
92 \Msg{* Package: accsupp 2019/12/05 v0.6 Accessibility support by marked content (HO)}
93 \Msg{************************************************************************}
94
95 \keepsilent
96 \askforoverwritefalse
97
98 \let\MetaPrefix\relax
99 \preamble
100
101 This is a generated file.
102
103 Project: accsupp
104 Version: 2019/12/05 v0.6
105
106 Copyright (C)
107 2007, 2010 Heiko Oberdiek
108 2016-2019 Oberdiek Package Support Group
109
110 This work may be distributed and/or modified under the
111 conditions of the LaTeX Project Public License, either
112 version 1.3c of this license or (at your option) any later
113 version. This version of this license is in
114 https://www.latex-project.org/lppl/lppl-1-3c.txt
115 and the latest version of this license is in
116 https://www.latex-project.org/lppl.txt
117 and version 1.3 or later is part of all distributions of
118 LaTeX version 2005/12/01 or later.
119
120 This work has the LPPL maintenance status "maintained".
121
122 The Current Maintainers of this work are
123 Heiko Oberdiek and the Oberdiek Package Support Group
124 https://github.com/ho-tex/accsupp/issues
125
126
127 This work consists of the main source file accsupp.dtx
128 and the derived files
129 accsupp.sty, accsupp.pdf, accsupp.ins, accsupp.drv,
130 accsupp-pdftex.def, accsupp-luatex.def, accsupp-dvipdfm.def,
131 accsupp-dvips.def,
132 accsupp-example1.tex, accsupp-example2.tex,
133 accsupp-test1.tex.
134
135 \endpreamble
136 \let\MetaPrefix\DoubleperCent
137
138 \generate{%
139 \file{accsupp.ins}{\from{accsupp.dtx}{install}}%
140 \file{accsupp.drv}{\from{accsupp.dtx}{driver}}%
141 \usedir{tex/latex/accsupp}%
142 \file{accsupp.sty}{\from{accsupp.dtx}{package}}%
143 \file{accsupp-pdftex.def}{\from{accsupp.dtx}{pdftex}}%
144 \file{accsupp-luatex.def}{\from{accsupp.dtx}{luatex}}%
145 \file{accsupp-dvipdfm.def}{\from{accsupp.dtx}{dvipdfm}}%
146 \file{accsupp-dvips.def}{\from{accsupp.dtx}{dvips}}%
147 \usedir{doc/latex/accsupp}%
148 \file{accsupp-example1.tex}{\from{accsupp.dtx}{example1}}%
149 \file{accsupp-example2.tex}{\from{accsupp.dtx}{example2}}%
150 }
151
152 \catcode32=13\relax% active space
153 \let =\space%
154 \Msg{************************************************************************}
155 \Msg{*}
156 \Msg{* To finish the installation you have to move the following}
157 \Msg{* files into a directory searched by TeX:}
158 \Msg{*}
159 \Msg{* accsupp.sty, accsupp-pdftex.def, accsupp-dvipdfm.def,}
160 \Msg{* accsupp-dvips.def}
161 \Msg{*}
162 \Msg{* To produce the documentation run the file `accsupp.drv'}
163 \Msg{* through LaTeX.}
164 \Msg{*}
165 \Msg{* Happy TeXing!}
166 \Msg{*}
167 \Msg{************************************************************************}
168
169 \endbatchfile
170 %</install>
171 %<*ignore>
172 \fi
173 %</ignore>
174 %<*driver>
175 \NeedsTeXFormat{LaTeX2e}
176 \ProvidesFile{accsupp.drv}%
177 [2019/12/05 v0.6 Accessibility support by marked content (HO)]%
178 \documentclass{ltxdoc}
179 \usepackage{holtxdoc}[2011/11/22]
180 \begin{document}
181 \DocInput{accsupp.dtx}%
182 \end{document}
183 %</driver>
184 % \fi
185 %
186 %
187 %
188 % \GetFileInfo{accsupp.drv}
189 %
190 % \title{The \xpackage{accsupp} package}
191 % \date{2019/12/05 v0.6}
192 % \author{Heiko Oberdiek\thanks
193 % {Please report any issues at \url{https://github.com/ho-tex/accsupp/issues}}}
194 %
195 % \maketitle
196 %
197 % \begin{abstract}
198 % Since PDF 1.5 portions of a page can be marked for better
199 % accessibility support.
200 % For example, replacement texts or expansions of abbreviations can be
201 % provided. Package \xpackage{accsupp} starts with providing a minimal
202 % low-level interface for programmers. Status is experimental.
203 % \end{abstract}
204 %
205 % \tableofcontents
206 %
207 % \section{Documentation}
208 %
209 % \subsection{Macros}
210 %
211 % Section ``10.8 Accessibility Support'' of the PDF reference
212 % \cite{pdfspec} lists some features that can be added by
213 % operators for marked content.
214 %
215 % \begin{declcs}{BeginAccSupp} \M{options}
216 % \end{declcs}
217 % It puts the operator |BDC| in the page stream:
218 % \begin{quote}
219 % |/Span|\\
220 % |<<|\dots|>>| \qquad \textit{\% property dictionary}\\
221 % |BDC|
222 % \end{quote}
223 % The contents of the dictionary is controlled by \meta{options}.
224 % See sections \ref{sec:feature} and \ref{sec:method}.
225 %
226 % \begin{declcs}{EndAccSupp} \M{options}
227 % \end{declcs}
228 % It puts the operator |EMC| in the page stream.
229 % The only option is \xoption{pdfliteral}, see section \ref{sec:pdftex}.
230 %
231 % \bigskip
232 % \noindent\textbf{Note:}
233 % The caller is responsible for the placement of \cs{BeginAccSupp}
234 % and \cs{EndAccSupp} pairs. Especially page breaks are not allowed
235 % in between.
236 %
237 % \subsubsection{Feature options}\label{sec:feature}
238 %
239 % The PDF reference \cite{pdfspec} describes and explains the different
240 % features. The names of the feature options are the same as the
241 % key names for the property dictionary for operator |BDC|, see
242 % \cs{BeginAccSupp}.
243 %
244 % \begin{description}
245 % \item[\xoption{ActualText}:]
246 % Provides a replacement text, see examples in
247 % section \ref{sec:example}.
248 % \item[\xoption{Alt}:]
249 % Provides an alternate description.
250 % \item[\xoption{E}:]
251 % Provides the expansion of an abbreviation or an acronym.
252 % \item[\xoption{Lang}:]
253 % Specifies the language.
254 % \end{description}
255 %
256 % \subsubsection{Input methods}\label{sec:method}
257 %
258 % Except for \xoption{Lang} option \xoption{method} controls
259 % how the argument for \xoption{ActualText}, \xoption{Alt},
260 % and \xoption{E} are interpreted.
261 % \begin{description}
262 % \item[\xoption{method=plain}:]
263 % The string is only expanded and written without further
264 % treatment. Special characters are not protected, thus this method
265 % may result in an invalid PDF file.
266 % \item[\xoption{method=escape}:]
267 % The string is expanded and special characters are escaped.
268 % The result is a valid PDF string.
269 % \item[\xoption{method=hex}:]
270 % The string is given in hexadecimal notation.
271 % Section \ref{sec:example:notparallel} shows an example.
272 % \item[\xoption{method=pdfstringdef}:]
273 % If package \xpackage{hyperref} is loaded, then its \cs{pdfstringdef}
274 % is used. This method is slow, but useful if the string contains
275 % arbitrary \hologo{TeX} code.
276 % \item[\xoption{unicode}:]
277 % This option is needed, if the string is given as Unicode string
278 % (16 bit). Internally it adds the string prefix for Unicode.
279 % In case of \xoption{method=pdfstringdef} it passes the option
280 % to \cs{hypersetup}.
281 % \end{description}
282 %
283 % \subsection{Workaround, option \xoption{space}}
284 %
285 % PDF specification says in ``10.8.3 Replacement Text''
286 % \begin{quote}
287 % Just as alternative descriptions can be provided for images and other
288 % items that do not translate naturally into text (\dots), replacement
289 % text can be specified for content that does translate into text but
290 % that is represented in a nonstandard way. These nonstandard representations
291 % might include, for example, glyphs for ligatures or custom characters, or
292 % inline graphics corresponding to letters in an illuminated manustript or to
293 % dropped capitals.
294 % \end{quote}
295 % However, the ActualText is ignored in Acrobat Reader
296 % (until version 9 at least), if the content does not contain glyphs.
297 % Option \xoption{space} adds such an invisible glyph, a space
298 % character. The font name can be configured by option \xoption{spacefont},
299 % the default font is \texttt{phvr8r}. The character slot is given
300 % by option \xoption{spacechar}, default is \texttt{32}, the usual
301 % position of the space character.
302 %
303 % These options can also be given as package options or in
304 % macro \cs{AccSuppSetup} that takes a key value list as argument.
305 % Usually only option \xoption{space} is necessary, if the
306 % contents does not contain glyphs otherwise. Option \xoption{space}
307 % is enabled by |space| or |space=true| and disabled by |space=false|.
308 % It is disabled as default. The option is evaluated by \cs{BeginAccSupp}
309 % and ignored by \cs{EndAccSupp}.
310 %
311 % Note: Even with option \xoption{space} I get sometimes wrong texts
312 % when cut \& paste from AR7/Linux or AR8/Linux, e.g.
313 % \begin{quote}
314 % |Hello| $\rightarrow$ |Helo|, |Helol|, |Hell|, \dots\\
315 % |Hello World| $\rightarrow$ |Helo WorldW|, |Helo World|, \dots
316 % \end{quote}
317 % I do not know what Acrobat Reader is doing here, thus feedback and
318 % insights are welcome.
319 %
320 % \subsection{Driver options}
321 %
322 % Driver options are package options only.
323 % The special \hologo{TeX} compilers \hologo{pdfTeX}, \hologo{LuaTeX} and \hologo{XeTeX}
324 % are detected automatically. The default for unrecognized drivers can be
325 % set by defining \cs{ActualTextDriverDefault}. This can be done
326 % in the configuration file \xfile{accsupp.cfg}.
327 %
328 % \subsubsection{Option \xoption{pdftex}}\label{sec:pdftex}
329 % Package option \xoption{pdftex} is used for \hologo{pdfTeX} in PDF mode.
330 % Additionally \cs{BeginAccSupp} and \cs{EndAccSupp} understand
331 % option \xoption{pdfliteral}. It controls
332 % the modifier keyword for \cs{pdfliteral}:
333 % \begin{quote}
334 % |pdfliteral=direct| $\Rightarrow$ |\pdfliteral direct{...}|
335 % \end{quote}
336 %
337 % \subsubsection{Option \xoption{luatex}}\label{sec:luatex}
338 % Package option \xoption{luatex} is used for \hologo{LuaTeX} in PDF mode.
339 % Additionally \cs{BeginAccSupp} and \cs{EndAccSupp} understand
340 % option \xoption{pdfliteral}. It controls
341 % the modifier keyword for \cs{pdfextension} literal:
342 % \begin{quote}
343 % |pdfliteral=direct| $\Rightarrow$ |\pdfextension literal direct{...}|
344 % \end{quote}
345 %
346 % \subsubsection{Option \xoption{dvipdfm}}
347 %
348 % Package option \xoption{dvipdfm} and its aliases \xoption{dvipdfmx}
349 % \xoption{xetex} are used for drivers that support
350 % \textsf{dvipdfm} specials.
351 %
352 % \subsubsection{Option \xoption{dvips}}
353 %
354 % Package option \xoption{dvips} and its alias \xoption{dvipsone}
355 % write pdfmark specials in the output. Unhappily these pdfmark
356 % operators are ignored by \textsf{ghostscript} (latest tested
357 % version is 8.54). Perhaps they are recognized by commercial
358 % distiller applications.
359 %
360 % \subsubsection{Turning off page stream compression}
361 %
362 % For debugging it is useful to have uncompressed page stream objects.
363 % This can be done afterwards via \textsf{pdftk}:
364 % \begin{quote}
365 % |pdftk file.pdf output file-uncompressed.pdf uncompress|
366 % \end{quote}
367 % Or the PDF file is generated uncompressed:
368 % \begin{description}
369 % \item[\hologo{pdfTeX}:] |\pdfcompresslevel=0|
370 % \item[dvipdfm:] |dvipdfm -z0 ...|
371 % \item[dvipdfmx:] |dvipdfmx -z0 ...|
372 % \item[ghostscript/ps2pdf:]
373 % |ps2pdf -dCompressPages=false input.ps output.pdf|
374 % \end{description}
375 %
376 % \section{Example}
377 % \label{sec:example}
378 %
379 % \subsection{Example \cs{notparallel}}
380 % \label{sec:example:notparallel}
381 %
382 % \begin{macrocode}
383 %<*example1>
384 % \end{macrocode}
385 % \begin{macrocode}
386 %<<END
387 \documentclass{article}
388 \usepackage{accsupp}[2007/11/14]
389 \usepackage{centernot}
390 % U+2226 NOT PARALLEL
391 % \mathrel{...} prevents page break in between
392 \newcommand*{\notparallel}{%
393 \ensuremath{%
394 \mathrel{%
395 \BeginAccSupp{method=hex,unicode,ActualText=2226}%
396 \centernot{\parallel}%
397 \EndAccSupp{}%
398 }%
399 }%
400 }
401 \begin{document}
402 \begin{equation}
403 A\notparallel B
404 \end{equation}
405 \end{document}
406 %END
407 % \end{macrocode}
408 % \begin{macrocode}
409 %</example1>
410 % \end{macrocode}
411 %
412 % \subsection{Example with \xoption{pdfstringdef}}
413 %
414 % \begin{macrocode}
415 %<*example2>
416 % \end{macrocode}
417 % \begin{macrocode}
418 %<<END
419 \documentclass{article}
420 \usepackage[unicode]{hyperref}
421 \usepackage{accsupp}[2007/11/14]
422 \begin{document}
423 \begin{equation}
424 \BeginAccSupp{
425 method=pdfstringdef,
426 unicode,
427 ActualText={%
428 a\texttwosuperior +b\texttwosuperior
429 =c\texttwosuperior
430 }
431 }
432 a^2 + b^2 = c^2
433 \EndAccSupp{}
434 \end{equation}
435 \end{document}
436 %END
437 % \end{macrocode}
438 % \begin{macrocode}
439 %</example2>
440 % \end{macrocode}
441 %
442 % \StopEventually{
443 % }
444 %
445 % \section{Implementation}
446 %
447 % \subsection{Package}
448 %
449 % \begin{macrocode}
450 %<*package>
451 % \end{macrocode}
452 %
453 % \begin{macrocode}
454 \begingroup\catcode61\catcode48\catcode32=10\relax%
455 \catcode13=5 % ^^M
456 \endlinechar=13 %
457 \catcode123=1 % {
458 \catcode125=2 % }
459 \catcode64=11 % @
460 \def\x{\endgroup
461 \expandafter\edef\csname ACCSUPP@AtEnd\endcsname{%
462 \endlinechar=\the\endlinechar\relax
463 \catcode13=\the\catcode13\relax
464 \catcode32=\the\catcode32\relax
465 \catcode35=\the\catcode35\relax
466 \catcode61=\the\catcode61\relax
467 \catcode64=\the\catcode64\relax
468 \catcode123=\the\catcode123\relax
469 \catcode125=\the\catcode125\relax
470 }%
471 }%
472 \x\catcode61\catcode48\catcode32=10\relax%
473 \catcode13=5 % ^^M
474 \endlinechar=13 %
475 \catcode35=6 % #
476 \catcode64=11 % @
477 \catcode123=1 % {
478 \catcode125=2 % }
479 \def\TMP@EnsureCode#1#2{%
480 \edef\ACCSUPP@AtEnd{%
481 \ACCSUPP@AtEnd
482 \catcode#1=\the\catcode#1\relax
483 }%
484 \catcode#1=#2\relax
485 }
486 \TMP@EnsureCode{10}{12}% ^^J
487 \TMP@EnsureCode{33}{12}% !
488 \TMP@EnsureCode{39}{12}% '
489 \TMP@EnsureCode{40}{12}% (
490 \TMP@EnsureCode{41}{12}% )
491 \TMP@EnsureCode{42}{12}% *
492 \TMP@EnsureCode{44}{12}% ,
493 \TMP@EnsureCode{45}{12}% -
494 \TMP@EnsureCode{46}{12}% .
495 \TMP@EnsureCode{47}{12}% /
496 \TMP@EnsureCode{58}{12}% :
497 \TMP@EnsureCode{60}{12}% <
498 \TMP@EnsureCode{62}{12}% >
499 \TMP@EnsureCode{94}{7}% ^ (superscript)
500 \TMP@EnsureCode{96}{12}% `
501 \TMP@EnsureCode{254}{12}% ^^fe
502 \TMP@EnsureCode{255}{12}% ^^ff
503 \edef\ACCSUPP@AtEnd{\ACCSUPP@AtEnd\noexpand\endinput}
504 % \end{macrocode}
505 %
506 % Package identification.
507 % \begin{macrocode}
508 \NeedsTeXFormat{LaTeX2e}
509 \ProvidesPackage{accsupp}%
510 [2019/12/05 v0.6 Accessibility support by marked content (HO)]
511 % \end{macrocode}
512 %
513 % \begin{macrocode}
514 \RequirePackage{pdfescape}[2007/02/25]
515 \RequirePackage{iftex}
516 \RequirePackage{kvoptions}
517 % \end{macrocode}
518 % \begin{macrocode}
519 \SetupKeyvalOptions{%
520 family=ACCSUPP,%
521 prefix=ACCSUPP@%
522 }
523 % \end{macrocode}
524 %
525 % \subsection{Space setup}
526 %
527 % \begin{macrocode}
528 \DeclareBoolOption{space}
529 \DeclareStringOption[phvr8r]{spacefont}
530 \DeclareStringOption[32]{spacechar}
531 % \end{macrocode}
532 %
533 % \subsection{Driver detection and setup}
534 %
535 % \paragraph{Driver declarations.}
536 %
537 % \begin{macrocode}
538 \def\ACCSUPP@DefineDriverKey{%
539 \@dblarg\ACCSUPP@@DefineDriverKey
540 }
541 \def\ACCSUPP@@DefineDriverKey[#1]#2{%
542 \define@key{ACCSUPP}{#2}[]{%
543 \def\ACCSUPP@driver{#1}%
544 }%
545 \g@addto@macro\ACCSUPP@DisableOptions{%
546 \DisableKeyvalOption{ACCSUPP}{#2}%
547 }%
548 }
549 \let\ACCSUPP@DisableOptions\@empty
550 \ACCSUPP@DefineDriverKey{pdftex}
551 \ACCSUPP@DefineDriverKey{luatex}
552 \ACCSUPP@DefineDriverKey{dvips}
553 \ACCSUPP@DefineDriverKey[dvips]{dvipsone}
554 \ACCSUPP@DefineDriverKey{dvipdfm}
555 \ACCSUPP@DefineDriverKey[dvipdfm]{dvipdfmx}
556 \ACCSUPP@DefineDriverKey[dvipdfm]{xetex}
557 \let\ACCSUPP@driver\relax
558 \InputIfFileExists{accsupp.cfg}{}{}
559 \providecommand*{\ActualTextDriverDefault}{dvips}
560 \ifpdf
561 \ifx\pdfextension\@undefined
562 \def\ACCSUPP@driver{pdftex}%
563 \else
564 \def\ACCSUPP@driver{luatex}%
565 \fi
566 \else
567 \ifxetex
568 \def\ACCSUPP@driver{dvipdfm}%
569 \else
570 \ifx\ACCSUPP@driver\relax
571 \let\ACCSUPP@driver\ActualTextDriverDefault
572 \fi
573 \fi
574 \fi
575 % \end{macrocode}
576 %
577 % \paragraph{Process options.}
578 %
579 % \begin{macrocode}
580 \ProcessKeyvalOptions*
581 \ACCSUPP@DisableOptions
582 % \end{macrocode}
583 %
584 % \paragraph{Driver validation and loading.}
585 %
586 % \begin{macrocode}
587 \def\ACCSUPP@temp{pdftex}%
588 \ifpdf
589 \ifx\pdfextension\@undefined\else
590 \def\ACCSUPP@temp{luatex}%
591 \fi
592 \ifx\ACCSUPP@temp\ACCSUPP@driver
593 \else
594 \PackageWarningNoLine{accsupp}{%
595 Wrong driver `\ACCSUPP@driver', using `pdftex' instead%
596 }%
597 ed as
598 \let\ACCSUPP@driver\ACCSUPP@temp
599 \fi
600 \else
601 \ifx\ACCSUPP@temp\ACCSUPP@driver
602 \PackageError{accsupp}{%
603 Wrong driver, pdfTeX is not running in PDF mode.\MessageBreak
604 Package loading is aborted%
605 }\@ehc
606 \expandafter\expandafter\expandafter\ACCSUPP@AtEnd
607 \fi
608 \def\ACCSUPP@temp{dvipdfm}%
609 \ifxetex
610 \ifx\ACCSUPP@temp\ACCSUPP@driver
611 \else
612 \PackageWarningNoLine{accsupp}{%
613 Wrong driver `\ACCSUPP@driver',\MessageBreak
614 using `dvipdfm' for XeTeX instead%
615 }%
616 \let\ACCSUPP@driver\ACCSUPP@temp
617 \fi
618 \fi
619 \fi%
620 \ifx\ACCSUPP@driver\relax
621 \PackageError{accsupp}{%
622 Missing driver option.\MessageBreak
623 Package loading is aborted%
624 }\@ehc
625 \expandafter\ACCSUPP@AtEnd
626 \fi%
627 \InputIfFileExists{accsupp-\[email protected]}{}{%
628 \PackageError{accsupp}{%
629 Unsupported driver `\ACCSUPP@driver'.\MessageBreak
630 Package loading is aborted%
631 }\@ehc
632 \ACCSUPP@AtEnd
633 }%
634 % \end{macrocode}
635 %
636 % \subsection{Main macro}
637 %
638 % \begin{macrocode}
639 \DeclareBoolOption{unicode}
640 \DeclareStringOption[page]{pdfliteral}
641 \DeclareStringOption{Lang}
642 \def\ACCSUPP@method{escape}
643 \define@key{ACCSUPP}{method}{%
644 \@ifundefined{ACCSUPP@method@#1}{%
645 \PackageError{accsupp}{%
646 Ignoring unknown method `#1'%
647 }\@ehc
648 }{%
649 \edef\ACCSUPP@method{#1}%
650 }%
651 }
652 \let\ACCSUPP@Lang\relax
653 \def\ACCSUPP@temp#1{%
654 \expandafter\ACCSUPP@@temp\csname ACCSUPP@#1\endcsname{#1}%
655 }
656 \def\ACCSUPP@@temp#1#2{%
657 \let#1\relax
658 \define@key{ACCSUPP}{#2}{%
659 \def#1{##1}%
660 \ifx#1\@empty
661 \def#1{()}%
662 \else
663 \csname ACCSUPP@method@\ACCSUPP@method\endcsname#1%
664 \fi
665 }%
666 }
667 \ACCSUPP@temp{Alt}
668 \ACCSUPP@temp{ActualText}
669 \ACCSUPP@temp{E}
670 % \end{macrocode}
671 %
672 % \begin{macrocode}
673 \newcommand*{\BeginAccSupp}[1]{%
674 \begingroup
675 \setkeys{ACCSUPP}{#1}%
676 \edef\ACCSUPP@span{%
677 /Span<<%
678 \ifx\ACCSUPP@Lang\relax
679 \else
680 /Lang\ACCSUPP@Lang
681 \fi
682 \ifx\ACCSUPP@Alt\relax
683 \else
684 /Alt\ACCSUPP@Alt
685 \fi
686 \ifx\ACCSUPP@ActualText\relax
687 \else
688 /ActualText\ACCSUPP@ActualText
689 \fi
690 \ifx\ACCSUPP@E\relax
691 \else
692 /E\ACCSUPP@E
693 \fi
694 >>%
695 }%
696 \ACCSUPP@bdc
697 \ACCSUPP@space
698 \endgroup
699 }
700 \newcommand*{\EndAccSupp}[1]{%
701 \begingroup
702 \setkeys{ACCSUPP}{#1}%
703 \ACCSUPP@emc
704 \endgroup
705 }
706 \def\ACCSUPP@space{%
707 \ifACCSUPP@space
708 \begingroup
709 \@ifundefined{ACCSUPP@Font}{%
710 \global\font\ACCSUPP@Font=\ACCSUPP@spacefont\relax
711 }{}%
712 \leavevmode
713 \setbox\z@\hbox{\ACCSUPP@Font\char\ACCSUPP@spacechar}%
714 \wd\z@\z@
715 \ht\z@\z@
716 \dp\z@\z@
717 \copy\z@
718 \endgroup
719 \fi
720 }
721 \newcommand*{\AccSuppSetup}{%
722 \setkeys{ACCSUPP}%
723 }
724 % \end{macrocode}
725 %
726 % \subsubsection{Input methods}
727 %
728 % \begin{macrocode}
729 \def\ACCSUPP@method@plain#1{%
730 \csname @safe@activestrue\endcsname
731 \edef#1{%
732 (%
733 \ifACCSUPP@unicode
734 \string\376\string\377%
735 \fi
736 #1%
737 )%
738 }%
739 \@onelevel@sanitize#1%
740 }
741 % \end{macrocode}
742 % \begin{macrocode}
743 \def\ACCSUPP@method@escape#1{%
744 \EdefEscapeString#1{%
745 \ifACCSUPP@unicode
746 ^^fe^^ff%
747 \fi
748 #1%
749 }%
750 \edef#1{(#1)}%
751 }%
752 % \end{macrocode}
753 % \begin{macrocode}
754 \def\ACCSUPP@method@hex#1{%
755 \edef#1{%
756 <%
757 \ifACCSUPP@unicode
758 FEFF%
759 \fi
760 #1%
761 >%
762 }%
763 }
764 % \end{macrocode}
765 % \begin{macrocode}
766 \def\ACCSUPP@method@pdfstringdef#1{%
767 \ifACCSUPP@unicode
768 \@ifundefined{hypersetup}{}{%
769 \hypersetup{unicode}%
770 }%
771 \fi
772 \@ifundefined{pdfstringdef}{%
773 \PackageError{accsupp}{%
774 Method `pdfstringdef' requires package `hyperref'%
775 }\@ehc
776 \let\ACCSUPP@temp\@empty
777 }{%
778 \begingroup
779 \setbox0=\hbox{%
780 \pdfstringdef\ACCSUPP@temp#1%
781 \global\let\ACCSUPP@temp\ACCSUPP@temp
782 }%
783 \endgroup
784 }%
785 \edef#1{(\ACCSUPP@temp)}%
786 }
787 % \end{macrocode}
788 %
789 % \begin{macrocode}
790 \ACCSUPP@AtEnd%
791 %</package>
792 % \end{macrocode}
793 %
794 % \subsection{Drivers}
795 %
796 % \subsubsection{Driver \xoption{pdftex}}
797 %
798 % \begin{macrocode}
799 %<*pdftex>
800 \NeedsTeXFormat{LaTeX2e}
801 \ProvidesFile{accsupp-pdftex.def}%
802 [2019/12/05 v0.6 accsupp driver for pdfTeX (HO)]%
803 % \end{macrocode}
804 %
805 % \begin{macrocode}
806 \def\ACCSUPP@bdc{%
807 \pdfliteral\ACCSUPP@pdfliteral{\ACCSUPP@span BDC}%
808 }
809 \def\ACCSUPP@emc{%
810 \pdfliteral\ACCSUPP@pdfliteral{EMC}%
811 }
812 % \end{macrocode}
813 % \begin{macrocode}
814 %</pdftex>
815 % \end{macrocode}
816 %
817 % \subsubsection{Driver \xoption{luatex}}
818 %
819 % \begin{macrocode}
820 %<*luatex>
821 \NeedsTeXFormat{LaTeX2e}
822 \ProvidesFile{accsupp-luatex.def}%
823 [2019/12/05 v0.6 accsupp driver for pdfTeX (HO)]%
824 % \end{macrocode}
825 %
826 % \begin{macrocode}
827 \protected\def\ACCSUPP@pdf@literal{\pdfextension literal}
828 \def\ACCSUPP@bdc{%
829 \ACCSUPP@pdf@literal\ACCSUPP@pdfliteral{\ACCSUPP@span BDC}%
830 }
831 \def\ACCSUPP@emc{%
832 \ACCSUPP@pdf@literal\ACCSUPP@pdfliteral{EMC}%
833 }
834 % \end{macrocode}
835 % \begin{macrocode}
836 %</luatex>
837 % \end{macrocode}
838 %
839 % \subsubsection{Driver \xoption{dvipdfm}}
840 %
841 % \begin{macrocode}
842 %<*dvipdfm>
843 \NeedsTeXFormat{LaTeX2e}
844 \ProvidesFile{accsupp-dvipdfm.def}%
845 [2019/12/05 v0.6 accsupp driver for dvipdfm (HO)]%
846 % \end{macrocode}
847 %
848 % \begin{macrocode}
849 \def\ACCSUPP@bdc{%
850 \special{pdf:content \ACCSUPP@span BDC}%
851 }
852 \def\ACCSUPP@emc{%
853 \special{pdf:content EMC}%
854 }
855 % \end{macrocode}
856 % \begin{macrocode}
857 %</dvipdfm>
858 % \end{macrocode}
859 %
860 % \subsubsection{Driver \xoption{dvips}}
861 %
862 % \begin{macrocode}
863 %<*dvips>
864 \NeedsTeXFormat{LaTeX2e}
865 \ProvidesFile{accsupp-dvips.def}%
866 [2019/12/05 v0.6 accsupp driver for dvips (HO)]%
867 % \end{macrocode}
868 %
869 % \begin{macrocode}
870 \def\ACCSUPP@bdc{%
871 \special{ps:[\ACCSUPP@span/BDC pdfmark}%
872 }
873 \def\ACCSUPP@emc{%
874 \special{ps:[/EMC pdfmark}%
875 }
876 % \end{macrocode}
877 % \begin{macrocode}
878 %</dvips>
879 % \end{macrocode}
880 % \section{Installation}
881 %
882 % \subsection{Download}
883 %
884 % \paragraph{Package.} This package is available on
885 % CTAN\footnote{\CTANpkg{accsupp}}:
886 % \begin{description}
887 % \item[\CTAN{macros/latex/contrib/accsupp/accsupp.dtx}] The source file.
888 % \item[\CTAN{macros/latex/contrib/accsupp/accsupp.pdf}] Documentation.
889 % \end{description}
890 %
891 %
892 % \paragraph{Bundle.} All the packages of the bundle `accsupp'
893 % are also available in a TDS compliant ZIP archive. There
894 % the packages are already unpacked and the documentation files
895 % are generated. The files and directories obey the TDS standard.
896 % \begin{description}
897 % \item[\CTANinstall{install/macros/latex/contrib/accsupp.tds.zip}]
898 % \end{description}
899 % \emph{TDS} refers to the standard ``A Directory Structure
900 % for \TeX\ Files'' (\CTANpkg{tds}). Directories
901 % with \xfile{texmf} in their name are usually organized this way.
902 %
903 % \subsection{Bundle installation}
904 %
905 % \paragraph{Unpacking.} Unpack the \xfile{accsupp.tds.zip} in the
906 % TDS tree (also known as \xfile{texmf} tree) of your choice.
907 % Example (linux):
908 % \begin{quote}
909 % |unzip accsupp.tds.zip -d ~/texmf|
910 % \end{quote}
911 %
912 % \subsection{Package installation}
913 %
914 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
915 % \docstrip\ archive. The files are extracted by running the
916 % \xfile{.dtx} through \plainTeX:
917 % \begin{quote}
918 % \verb|tex accsupp.dtx|
919 % \end{quote}
920 %
921 % \paragraph{TDS.} Now the different files must be moved into
922 % the different directories in your installation TDS tree
923 % (also known as \xfile{texmf} tree):
924 % \begin{quote}
925 % \def\t{^^A
926 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
927 % accsupp.sty & tex/latex/accsupp/accsupp.sty\\
928 % accsupp-pdftex.def & tex/latex/accsupp/accsupp-pdftex.def\\
929 % accsupp-luatex.def & tex/latex/accsupp/accsupp-luatex.def\\
930 % accsupp-dvipdfm.def & tex/latex/accsupp/accsupp-dvipdfm.def\\
931 % accsupp-dvips.def & tex/latex/accsupp/accsupp-dvips.def\\
932 % accsupp.pdf & doc/latex/accsupp/accsupp.pdf\\
933 % accsupp-example1.tex & doc/latex/accsupp/accsupp-example1.tex\\
934 % accsupp-example2.tex & doc/latex/accsupp/accsupp-example2.tex\\
935 % accsupp.dtx & source/latex/accsupp/accsupp.dtx\\
936 % \end{tabular}^^A
937 % }^^A
938 % \sbox0{\t}^^A
939 % \ifdim\wd0>\linewidth
940 % \begingroup
941 % \advance\linewidth by\leftmargin
942 % \advance\linewidth by\rightmargin
943 % \edef\x{\endgroup
944 % \def\noexpand\lw{\the\linewidth}^^A
945 % }\x
946 % \def\lwbox{^^A
947 % \leavevmode
948 % \hbox to \linewidth{^^A
949 % \kern-\leftmargin\relax
950 % \hss
951 % \usebox0
952 % \hss
953 % \kern-\rightmargin\relax
954 % }^^A
955 % }^^A
956 % \ifdim\wd0>\lw
957 % \sbox0{\small\t}^^A
958 % \ifdim\wd0>\linewidth
959 % \ifdim\wd0>\lw
960 % \sbox0{\footnotesize\t}^^A
961 % \ifdim\wd0>\linewidth
962 % \ifdim\wd0>\lw
963 % \sbox0{\scriptsize\t}^^A
964 % \ifdim\wd0>\linewidth
965 % \ifdim\wd0>\lw
966 % \sbox0{\tiny\t}^^A
967 % \ifdim\wd0>\linewidth
968 % \lwbox
969 % \else
970 % \usebox0
971 % \fi
972 % \else
973 % \lwbox
974 % \fi
975 % \else
976 % \usebox0
977 % \fi
978 % \else
979 % \lwbox
980 % \fi
981 % \else
982 % \usebox0
983 % \fi
984 % \else
985 % \lwbox
986 % \fi
987 % \else
988 % \usebox0
989 % \fi
990 % \else
991 % \lwbox
992 % \fi
993 % \else
994 % \usebox0
995 % \fi
996 % \end{quote}
997 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
998 % TDS installing feature, then some files can already be in the right
999 % place, see the documentation of \docstrip.
1000 %
1001 % \subsection{Refresh file name databases}
1002 %
1003 % If your \TeX~distribution
1004 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
1005 % these. For example, \TeX\,Live\ users run \verb|texhash| or
1006 % \verb|mktexlsr|.
1007 %
1008 % \subsection{Some details for the interested}
1009 %
1010 % \paragraph{Unpacking with \LaTeX.}
1011 % The \xfile{.dtx} chooses its action depending on the format:
1012 % \begin{description}
1013 % \item[\plainTeX:] Run \docstrip\ and extract the files.
1014 % \item[\LaTeX:] Generate the documentation.
1015 % \end{description}
1016 % If you insist on using \LaTeX\ for \docstrip\ (really,
1017 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
1018 % about your intention:
1019 % \begin{quote}
1020 % \verb|latex \let\install=y\input{accsupp.dtx}|
1021 % \end{quote}
1022 % Do not forget to quote the argument according to the demands
1023 % of your shell.
1024 %
1025 % \paragraph{Generating the documentation.}
1026 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
1027 % the documentation. The process can be configured by the
1028 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
1029 % line into this file, if you want to have A4 as paper format:
1030 % \begin{quote}
1031 % \verb|\PassOptionsToClass{a4paper}{article}|
1032 % \end{quote}
1033 % An example follows how to generate the
1034 % documentation with pdf\LaTeX:
1035 % \begin{quote}
1036 %\begin{verbatim}
1037 %pdflatex accsupp.dtx
1038 %makeindex -s gind.ist accsupp.idx
1039 %pdflatex accsupp.dtx
1040 %makeindex -s gind.ist accsupp.idx
1041 %pdflatex accsupp.dtx
1042 %\end{verbatim}
1043 % \end{quote}
1044 %
1045 % \begin{thebibliography}{9}
1046 % \bibitem{pdfspec}
1047 % Adobe Systems Incorporated,
1048 % \textit{PDF Reference}, 6th edition, 2006.
1049 % \url{http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference.pdf}
1050 %
1051 % \end{thebibliography}
1052 %
1053 % \begin{History}
1054 % \begin{Version}{2007/03/21 v0.1}
1055 % \item
1056 % First version.
1057 % \end{Version}
1058 % \begin{Version}{2007/11/14 v0.2}
1059 % \item
1060 % Various bug fixes.
1061 % \item
1062 % Catcode section rewritten, test added.
1063 % \end{Version}
1064 % \begin{Version}{2010/01/16 v0.3}
1065 % \item
1066 % \cs{AccSuppSetup} added.
1067 % \item
1068 % Options \xoption{space}, \xoption{spacefont}, \xoption{spacechar} added.
1069 % \end{Version}
1070 % \begin{Version}{2016/05/16 v0.4}
1071 % \item
1072 % Documentation updates.
1073 % \end{Version}
1074 % \begin{Version}{2018/03/28 v0.5}
1075 % \item
1076 % LuaTeX support added.
1077 % \end{Version}
1078 % \begin{Version}{2019/12/05 v0.6}
1079 % \item
1080 % Documentation updates.
1081 % \end{Version}
1082 % \end{History}
1083 %
1084 % \PrintIndex
1085 %
1086 % \Finale
1087 \endinput