Debian Codegraph @

texmf-dist/doc/latex/nameauth/compat.tex

raw
1 %%
2 %% This is file `compat.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% nameauth.dtx (with options: `compat')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright (C) 2025 by Charles P. Schaum <charles[dot][email protected]>
12 %%
13 %% This file may be distributed and/or modified under the
14 %% conditions of the LaTeX Project Public License, either
15 %% version 1.3 of this license or (at your option) any
16 %% later version. The latest version of this license is in:
17 %%
18 %% https://www.latex-project.org/lppl.txt
19 %%
20 %% and version 1.3 or later is part of all distributions
21 %% of LaTeX version 2005/12/01 or later.
22 %%
23 %% This work includes all source and generated files
24 %% described as such in README.md, included herein.
25 %%
26 % This is not a standalone document.
27 % Use this file only in the document preamble.
28
29 % Ensure that we have the needed macros.
30 \usepackage{etoolbox}
31
32 % Allow special catcodes.
33 \makeatletter
34
35 % Do not include the rest of this file
36 % unless we are in a document preamble.
37 \ifx\@onlypreamble\@notprerr\else
38 % Include the rest of this if--else statement.
39
40 % Check against the latex version date. Create a macro
41 % if the date is at least 2018/10/05 because that is
42 % when Unicode processing changed for the better.
43 \@ifl@t@r\fmtversion{2018/10/05}{\newcommand*\nameauthltx{}}{}
44
45 % Here we check for 2018/04/30 because that is when xparse
46 % added the ! modifier.
47 \@ifl@t@r\fmtversion{2018/04/30}{\newcommand*\nameauthxp{}}{}
48
49 % Here we assist backward compatibility for older
50 % distributions of LaTeX and compatibility for multiple
51 % LaTeX engines.
52
53 % If we want to use TikZ, this flag will help us.
54 % We use this method to avoid crashing some dvi
55 % viewers. Define the macro \noTikZ to bypass this check.
56 \newif\ifDoTikZ
57
58 % If we couch this statement in a conditional, we avoid
59 % potential errors in older versions.
60 \IfFileExists{iftex.sty}{\usepackage{iftex}}{}
61
62 % The presence of \RequireTUTeX means that these older
63 % packages are not needed (thanks to iftex). Otherwise
64 % we are using an older version and need these packages.
65
66 \unless\ifdefined\RequireTUTeX
67 \usepackage{ifxetex}
68 \usepackage{ifluatex}
69 \usepackage{ifpdf}
70 \fi
71
72 % Instead of worrying about older or newer changes, we
73 % ensure consistency when the LaTeX engine changes.
74 % The goal is to get the same ``lmodern'' look.
75 % Users will need to change language and font options
76 % for their own needs.
77
78 % To remain compatible with our experience on older
79 % distributions, we load fontspec and prefer polyglossia
80 % with both XeLaTeX and LuaLaTeX. One cannot load both
81 % babel and polyglossia. See the relevant documentation.
82
83 % This flag causes polyglossia to be the default.
84 \newif\ifloadbabel
85
86 % Here we do the right thing for the right LaTeX version.
87 \ifxetex
88 % We always load fontspec in this case.
89 \usepackage{fontspec}
90 % Loading TikZ will work (pdf)
91 \DoTikZtrue
92 \else
93 \ifluatex
94 \ifpdf
95 % This is the usual pdf-version lualatex.
96 % We always load fontspec in this case.
97 \usepackage{fontspec}
98 % Loading TikZ will work (pdf)
99 \DoTikZtrue
100 \else
101 \loadbabeltrue
102 % This is dvilualatex (dvi mode).
103 \IfFileExists{utf8-2018.def}{}
104 {\usepackage[utf8]{inputenc}}
105 \usepackage[TS1,T1]{fontenc}
106 \usepackage{lmodern}
107 % No TikZ with dvi workflows for dvi viewers.
108 \fi
109 \else
110 \loadbabeltrue
111 % Here we load the same packages, whether dvi
112 % or pdf is being used. We address that below.
113 \IfFileExists{utf8-2018.def}{}
114 {\usepackage[utf8]{inputenc}}
115 \usepackage[TS1,T1]{fontenc}
116 \usepackage{lmodern}
117 % Now we check for pdflatex. If so, use TikZ.
118 \ifpdf \DoTikZtrue \fi
119 % Otherwise, no TikZ with dvi workflows.
120 \fi
121 \fi
122
123 % Defining the \nolangs macro inhibits defaults.
124 \unless\ifdefined{\nolangs}
125 \ifloadbabel
126 \usepackage[american]{babel}
127 \else
128 \usepackage{polyglossia}
129 \setdefaultlanguage{american}
130 \fi
131 \fi
132
133 % Defining the \noTikZ macro inhibits defaults.
134 \unless\ifdefined{\noTikZ}
135 \ifDoTikZ
136 \usepackage{tikz}
137 \else
138 % Do something with pstricks, pdftricks, ps4pdf.
139 \fi
140 \fi
141
142 % End of part needing to be in the preamble.
143 \fi
144
145 % Return to normal catcodes.
146 \makeatother
147
148 % End of included file.