Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 % ======================================================================
3 % defoldfonts.dtx
4 % Copyright © 2008–2025 Markus Kohm
5 %
6 % Development of this work is taking place at
7 % <https://github.com/komascript/defoldfont>. New issues should be
8 % reported there as well as known issues can be found.
9 %
10 % This work may be distributed and/or modified under the conditions of
11 % the LaTeX Project Public License, version 1.3c of the license.
12 % The latest version of this license is in
13 % http://www.latex-project.org/lppl.txt
14 % and version 1.<3c or later is part of all distributions of LaTeX
15 % version 2005/12/01 or later and of this work.
16 %
17 % The Current Maintainer and author of this work is Markus Kohm.
18 %
19 % This work consists of the file `defoldfonts.dtx' and `README.md'.
20 %
21 % The recommended way to install `defoldfonts' is to use
22 % the package manager of your TeX distribution.
23 % ======================================================================
24 %
25 %<*dtx>
26 \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
27 \ProvidesFile{defoldfonts.dtx}
28 %</dtx>
29 %<*dtx|package>
30 %<package>\ProvidesPackage{defoldfonts}
31 [2025-09-29 v1.1
32 %<dtx> sources and unpack driver of
33 re-implementation of deprecated KOMA-Script code]
34 %</dtx|package>
35 %<*dtx>
36 \ifx\documentclass\undefined
37 \input docstrip.tex
38 \generate{%
39 \file{defoldfonts.sty}{%
40 \from{defoldfonts.dtx}{package}%
41 }%
42 }%
43 \else
44 \let\endbatchfile\relax
45 \fi
46 \endbatchfile
47 \documentclass[ngerman,USenglish]{koma-script-source-doc}
48 \setcounter{IndexColumns}{2}
49 \usepackage{babel}
50 \usepackage{csquotes}
51 \usepackage[style=alphabetic]{biblatex}
52 \begin{filecontents}[force]{\jobname.bib}
53 @online{pkg:koma-script,
54 author={Markus Kohm},
55 version={3.48},
56 date={2025-09-09},
57 title={{\KOMAScript} --- A bundle of versatile classes and packages},
58 url={https://ctan.org/pkg/koma-script},
59 urldate={2025-09-29},
60 note={The \KOMAScript{} bundle provides replacements for the \pkg*{article},
61 \pkg*{report}, and \pkg*{book} classes with emphasis on typography and
62 versatility. There is also a letter class.},
63 }
64 @manual{pkg:koma-script:manual:de,
65 author={Markus Kohm},
66 date={2025-09-09},
67 title={{\KOMAScript}},
68 subtitle={Die Anleitung},
69 url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-de.pdf},
70 urldate={2025-09-29},
71 }
72 @manual{pkg:koma-script:manual:en,
73 author={Markus Kohm},
74 date={2025-09-09},
75 title={{\KOMAScript}},
76 subtitle={The Guide},
77 url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-en.pdf},
78 urldate={2025-09-29},
79 }
80 \end{filecontents}
81 \addbibresource{\jobname.bib}
82 \setcounter{StandardModuleDepth}{2}
83 \begin{document}
84 \nocite{pkg:koma-script,pkg:koma-script:manual:en,pkg:koma-script:manual:de}
85 \DocInput{defoldfonts.dtx}
86 \end{document}
87 %</dtx>
88 %\fi
89 %
90 % \changes{v0.1}{2023/06/01}{start of \KOMAScript{} spin-off}
91 % \changes{v1.0}{2023-07-28}{first release}
92 % \changes{v1.1}{2025-09-29}{typofix in \cs{ProvidesPackage}}
93 %
94 % \GetFileInfo{defoldfonts.dtx}
95 % \title{Defining Old Font Commands}
96 % \author{\href{mailto:[email protected]}{Markus Kohm}}
97 % \date{Version \filedate{} \fileversion}
98 % \maketitle
99 % \begin{abstract}
100 % The package defines the old font commands \cs{rm}, \cs{sf}, \cs{tt},
101 % \cs{bf}, \cs{it}, and \cs{sc} that became obsolete with \LaTeXe{} and has
102 % been removed from the \LaTeX{} kernel. It also defines the old
103 % \href{https://komascript.de/}{\KOMAScript} font command \cs{sfb}. It can
104 % be useful if you use a class like the
105 % \href{https://komascript.de/}{\KOMAScript} classes, which do not define
106 % the old commands by default, and also an old \BibTeX{} style or package,
107 % that depends on these commands. However, it should be seen as an emergency
108 % workaround rather than a solution.
109 % \end{abstract}
110 %
111 % \tableofcontents
112 %
113 %\iffalse
114 %<*doc>
115 %\fi
116 \section{What are the possible reasons for using package
117 \texorpdfstring{\pkg*{defoldfonts}}{defoldfonts} and how to do it?}
118 \label{sec:reasons}
119
120 \DescribeCommand{\rm}%
121 \DescribeCommand{\sf}%
122 \DescribeCommand{\tt}%
123 \DescribeCommand{\bf}%
124 \DescribeCommand{\it}%
125 \DescribeCommand{\sl}%
126 \DescribeCommand{\sc}%
127 \DescribeCommand{\sfb}%
128 With \LaTeXe{} in 1994 the font commands of \LaTeX~2.09 became obsolete. These
129 are not longer defined in the \LaTeX{} kernel. Instead of them, you should use
130 \cs{rmfamily} resp. \cs{textrm}, \cs{sffamily} resp. \cs{textsf},
131 \cs{ttfamily} resp. \cs{texttt}, \cs{bfseries} resp. \cs{textbf}, \cs{itshape}
132 resp. \cs{textit}, \cs{slshape} resp. \cs{textsl}, and \cs{scshape}
133 resp. \cs{testsc}. The old \href{https://komascript.de/}{\KOMAScript} command
134 \cs{sfb} should be replaced by a combination of \cs{sf} and \cs{bf}
135 resp. \cs{textsf} and \cs{textbf}. But unfortunately not only some old
136 \BibTeX{} styles but even some packages still use these obsolete commands. The
137 standard classes therefore still define them. The
138 \href{https://komascript.de/}{\KOMAScript} classes also define them, but only
139 to show an error message like:
140 \begin{verbatim}
141 Class scrartcl Error: undefined old font command `\bf'.
142
143 See the scrartcl class documentation for explanation.
144 Type H <return> for immediate help.
145 ...
146
147 l.3 \bf
148 \end{verbatim}
149 Within an interactive \LaTeX{} run you can get some more information typing
150 \texttt{H} and pressing the \texttt{return} key:
151 \begin{verbatim}
152 You should note that since 1994 LaTeX2e provides a new font selection scheme
153 called NFSS2 with several new, combinable font commands. KOMA-Script
154 classes had defined the old font commands like `\bf' only for compatibility
155 with old LaTeX 2.09 document styles of Script 2.0. Nevertheless, these
156 commands are deprecated and undocumented at least since 2003. Since 2013
157 KOMA-Script classes warned about soon removement of these deprecated commands.
158 Now, after two decades of LaTeX2e and NFSS2, these commands will not work any
159 more. If loading a package results in this error message, you should contact
160 the author of that package and ask him to replace the deprecated font command
161 `\bf', e.g., by `\normalfont \bfseries `. Otherwise you should reconfigure
162 or replace the package. If you have used the old font command `\bf' yourself,
163 you should replace it, e.g., by `\normalfont \bfseries '.
164 To make it work for now, you can use the already also deprecated class option
165 `enabledeprecatedfontcommands'.
166 \end{verbatim}
167 So to fix the issue, you could load the class with option
168 \opt{enabledeprecatedfontcommands}. But because this option is also
169 deprecated, this would result in warning messages like:
170 \begin{verbatim}
171 Class scrartcl Warning: deprecated option `enabledeprecatedfontcommands'.
172 (scrartcl) Note, that this option was already depreacted when
173 (scrartcl) it has been defined. Support for old font commands
174 (scrartcl) has been removed from KOMA-Script more than one
175 (scrartcl) decade ago. It is not recommended to use them any
176 (scrartcl) longer. Therefore usage of this class option also
177 (scrartcl) is not recommended.
178 \end{verbatim}
179 and:
180 \begin{verbatim}
181 Class scrartcl Warning: deprecated old font command `\bf' used.
182 (scrartcl) You should note, that since 1994 LaTeX2e provides a
183 (scrartcl) new font selection scheme called NFSS2 with several
184 (scrartcl) new, combinable font commands. New KOMA-Script classes
185 (scrartcl) defined the old font commands like `\bf' only for
186 (scrartcl) compatibility with LaTeX 2.09 document styles of
187 (scrartcl) Script 2.0. These commands are deprecated and
188 (scrartcl) undocumented at least since 2003. Since 2013,
189 (scrartcl) KOMA-Script classes warned about soon removement of
190 (scrartcl) these deprecated commands. Now, after two decades of
191 (scrartcl) LaTeX2e, NFSS2, and KOMA-Script these commands will
192 (scrartcl) not work any longer. If loading a package results in
193 (scrartcl) this message you should contact the author of that
194 (scrartcl) package and ask him to replace the depracted font
195 (scrartcl) command `\bf', e.g., by `\normalfont \bfseries '.
196 (scrartcl) Otherwise you should reconfigure or replace the
197 (scrartcl) package. If you have used the old font command
198 (scrartcl) `\bf' yourself you should replace it, e.g., by
199 (scrartcl) `\normalfont \bfseries ' on input line ….
200 \end{verbatim}
201 As an alternative you can load package \pkg*{defoldfonts}.
202
203 The package should be loaded in the preamble using:
204 \begin{verbatim}
205 \usepackage{defoldfonts}
206 \end{verbatim}
207 Usually the order of \pkg*{defoldfonts} and other packages is irrelevant.
208
209 % \iffalse
210 %</doc>
211 % \fi
212 %
213 % \MaybeStop{\printbibliography[heading=bibintoc]\PrintIndex}
214 %
215 % \iffalse
216 %<*package>
217 % \fi
218 % \section{Implementation}
219 % \label{sec:implementation}
220 %
221 % \begin{macrocode}
222 \ProcessOptions\relax
223 % \end{macrocode}
224 %
225 % \begin{command}{\rm,\sf,\tt,\bf,\it,\sl,\sc,\sfb}
226 % We define these commands without compromise:
227 % \begin{macrocode}
228 \DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
229 \DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
230 \DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
231 \DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
232 \DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
233 \DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
234 \DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
235 \DeclareOldFontCommand{\sfb}{\normalfont\sffamily\bfseries}{\@nomath\sfb}
236 % \end{macrocode}
237 % \end{command}
238 %
239 % \iffalse
240 %</package>
241 % \fi
242 %
243 % \Finale
244 % \PrintChanges
245 %
246 % \endinput
247 % Local Variables:
248 % mode: doctex
249 % ispell-local-dictionary: "en_US"
250 % eval: (flyspell-mode 1)
251 % TeX-master: t
252 % End: