Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (c) 2007 by Andreas Bühmann
4 % Copyright (c) 2025 by Michael Ummels <[email protected]>
5 %
6 % This work may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3c
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in
10 % http://www.latex-project.org/lppl.txt
11 % and version 1.3 or later is part of all distributions of LaTeX
12 % version 2005/12/01 or later.
13 %
14 % This work has the LPPL maintenance status `maintained'.
15 %
16 % The Current Maintainer of this work is Michael Ummels.
17 %
18 % This work consists of the files fontaxes.dtx, fontaxes.ins and
19 % the derived file fontaxes.sty.
20 %
21 %<*driver>
22 \documentclass[a4paper]{ltxdoc}
23
24 \usepackage[T1]{fontenc}
25 \usepackage{fontaxes}
26 \usepackage{hypdoc}
27 \usepackage[toc,enum,bib,lineno]{tabfigures}
28 \usepackage[scale=0.95]{cantarell}
29 \usepackage[narrow]{inconsolata}
30 \usepackage{microtype}
31
32 \hypersetup{
33 bookmarksnumbered,
34 colorlinks=false,
35 pdfborder={0 0 0},
36 }
37
38 % Hack in order to get quotes in verbatim mode right
39 \DeclareEncodingSubset{TS1}{zi4}{1}
40
41 \renewcommand\sfdefault{cantarell-OsF}
42 \renewcommand\familydefault{\sfdefault}
43 \renewcommand\baselinestretch{1.1}
44
45 \newcommand*\pkg[1]{\mbox{#1}}
46 \newcommand*\axis[1]{\textit{#1}}
47
48 \OnlyDescription
49
50 \begin{document}
51 \DocInput{fontaxes.dtx}
52 \end{document}
53 %</driver>
54 %\fi
55 %
56 % \GetFileInfo{fontaxes.sty}
57 %
58 % \title{The fontaxes package (deprecated)}
59 % \author{Michael Ummels}
60 % \date{\fileversion\quad\filedate}
61 % \maketitle
62 %
63 % \begin{abstract}
64 % \textbf{Deprecated:} The \pkg{fontaxes} package simulates multiple independent
65 % font selection axes on top of certain single NFSS axes: \axis{base family},
66 % \axis{figure style}, and \axis{figure alignment} on top of \axis{family};
67 % \axis{primary shape} and \axis{secondary shape} on top of \axis{shape};
68 % and \axis{math weight} and \axis{math figure alignment} on top of
69 % \axis{math version}.
70 % \end{abstract}
71 %
72 % \section{Introduction}
73 %
74 % When this package was conceived, \LaTeX\ support for fonts with italic
75 % small-caps or \emph{swash capitals} was limited and choosing such a font
76 % shape was only possible using the low-level command \cs{fontshape}. This
77 % package simplified access to such shapes by introducing new commands like
78 % \cs{swshape} and making combinations like \cs{itshape}\cs{scshape} work.
79 % With \LaTeX\ release 2020-02-02, that functionality was integrated
80 % into the kernel \cite{ltnews31}, so this package has lost its
81 % main \emph{raison d'être}.
82 % However, switching between different \emph{figure versions} is still
83 % a hassle with \LaTeX's font selection scheme \cite{nfss}, so all commands
84 % defined by \pkg{fontaxes} that deal with figure versions (e.g.\ \cs{lnfigures}
85 % and \cs{tbfigures}) have been incorporated into a new package called
86 % \pkg{figureversions}\footnote{\url{https://ctan.org/pkg/figureversions}},
87 % released in April 2025.
88 %
89 % For backwards compatibility and for ensuring a smooth transition, the
90 % \pkg{fontaxes} package has also been rewritten and is now a thin wrapper
91 % around the \pkg{figureversions} package, providing additional commands like
92 % \cs{fontprimaryshape}, which have been used in documents and (font) packages
93 % in the wild.
94 %
95 % \section{Migration to \pkg{figureversions}}
96 %
97 % As a document author, if you have explicitly loaded \pkg{fontaxes}, you can
98 % almost surely just replace |\usepackage{fontaxes}| by
99 % |\usepackage{figureversions}|. Only if you have used \cs{fontprimaryshape}
100 % or \cs{fontsecondaryshape} in your document, you need to replace that by the
101 % standard \LaTeX\ command \cs{fontshape}.
102 %
103 % As a font package author, you might have used the command
104 % \cs{fa@naming@exception} to define a new figure version like so:
105 % \begin{quote}
106 % |\fa@naming@exception{figures}{|\marg{figurestyle}|{proportional}}|\marg{suffix1} \\
107 % |\fa@naming@exception{figures}{|\marg{figurestyle}|{tabular}}|\marg{suffix2}
108 % \end{quote}
109 % With the \pkg{figureversions} package, you can replace both commands with a
110 % a single call to |\figureversions_new_figurestyle:nnn|. Since this is a
111 % \LaTeX3 command, you need to enter \LaTeX3 mode though:
112 % \begin{quote}
113 % |\ExplSyntaxOn| \\
114 % |\figureversions_new_figurestyle:nnn|\ \marg{figurestyle}\ \marg{suffix1}
115 % \ \marg{suffix2} \\
116 % |\ExplSyntaxOff|
117 % \end{quote}
118 % Note that there is no equivalent for other calls to |\fa@naming@exceptions|,
119 % which have no effect in this version of \pkg{fontaxes} anyway.
120 %
121 % \StopEventually{
122 % \begin{thebibliography}{9}
123 %
124 % \bibitem{ltnews31}
125 % \LaTeX\ News. Issue 31, February 2020.
126 % \url{https://www.latex-project.org/news/latex2e-news/ltnews31.pdf}
127 %
128 % \bibitem{nfss}
129 % \LaTeX\ Project Team:
130 % \LaTeXe\ font selection.
131 % \url{https://www.latex-project.org/help/documentation/fntguide.pdf}
132 %
133 % \end{thebibliography}
134 % }
135 %
136 % \section{Implementation}
137 % \AddToHook{sffamily}{\fontfigurealignment{tabular}}
138 %
139 % \begin{macrocode}
140 %<*package>
141 \NeedsTeXFormat{LaTeX2e}[2018-04-01]
142 \DeclareRelease{v1}{2011-09-20}{fontaxes-v1.sty}
143 \DeclareCurrentRelease{v2}{2025-04-21}
144 \ProvidesPackage{fontaxes}[2026-01-02 v2.0.2 Font selection axes (deprecated)]
145 % \end{macrocode}
146 % First, we check whether the \pkg{figureversions} package exists. We cannot use
147 % \cs{IfFileExists} here since we need to execute code with \cs{ExplSyntaxOn}
148 % in the positive case, but this does not work inside arguments of
149 % \cs{IfFileExists}. Hence, we simply switch \cs{ExplSyntaxOn} immediately, and
150 % use the corresponding \LaTeX3 conditional.
151 % \begin{macrocode}
152 \ExplSyntaxOn
153 \file_if_exist:nTF { figureversions.sty }
154 {
155 % \end{macrocode}
156 % For the \pkg{figureversions} package to work, we need \LaTeX\ format
157 % 2024-11-01; we can use the |\IncludeInRelease| macro to execute code
158 % conditionally on the format version.
159 % \begin{macrocode}
160 \IncludeInRelease { 2024-11-01 } { fontaxes }
161 { Use~figureversions~if~present }
162 \RequirePackage { figureversions }
163 \msg_new:nnn { fontaxes } { unsupported-axis }
164 { Axis~`#1`~not~supported~for~command~\fa@naming@exception~\msg_line_context: }
165 \msg_new:nnn { fontaxes } { unsupported-alignment }
166 { Value~`#1'~not~supported~as~figure~alignment~\msg_line_context: }
167 \cs_generate_variant:Nn
168 \__figureversions_new_figurestyle_proportional:nn { V }
169 \cs_generate_variant:Nn
170 \__figureversions_new_figurestyle_tabular:nn { V }
171 \cs_new_eq:NN \fontprimaryshape \fontshape
172 \cs_new_eq:NN \fontsecondaryshape \fontshape
173 \cs_new_protected:Npn \fa@naming@exception #1#2#3
174 {
175 \str_if_eq:nnTF {#1} {figures}
176 {
177 \str_set:Ne \l_tmpa_str { \tl_head:n { #2 } }
178 \str_set:Ne \l_tmpb_str { \tl_item:nn { #2 } { 2 } }
179 \str_if_eq:VnTF \l_tmpb_str { proportional }
180 {
181 \__figureversions_new_figurestyle_proportional:Vn
182 \l_tmpa_str { #3 }
183 }
184 {
185 \str_if_eq:VnTF \l_tmpb_str { tabular }
186 {
187 \__figureversions_new_figurestyle_tabular:Vn
188 \l_tmpa_str { #3 }
189 }
190 {
191 \msg_warning:nnV { fontaxes } { unsupported-alignment }
192 \l_tmpb_str
193 }
194 }
195 }
196 { \msg_warning:nnn { fontaxes } { unsupported-axis } { #1 } }
197 }
198 \EndIncludeInRelease
199 }
200 {}
201 \ExplSyntaxOff
202 % \end{macrocode}
203 % For older releases of \LaTeX or if \pkg{figureversions} does not exist, we
204 % simply fall back to version~1.
205 % \begin{macrocode}
206 \IncludeInRelease{0000-00-00}{fontaxes}{Fall back to v1}
207 \InputIfFileExists{fontaxes-v1.sty}{}{%
208 \PackageError{fontaxes}{Failed~to~find~file~`fontaxes-v1.sty'}%
209 {Your~installation~seems~broken.~Try~reinstalling~the~package.}%
210 }
211 \EndIncludeInRelease
212 %</package>
213 % \end{macrocode}
214 % \RemoveFromHook{sffamily}
215 % \Finale