diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md | 62 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fontscale/beery.cls | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-classic.tex | 20 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-font-steps.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-modular-musical.tex | 18 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf | bin | 129725 -> 131367 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex | 105 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fontscale/fontscale.sty | 73 |
8 files changed, 173 insertions, 117 deletions
diff --git a/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md b/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md new file mode 100644 index 00000000000..802fb374ef1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md @@ -0,0 +1,62 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a +Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to +[Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [v1.2.0] - 2024-04-15 + +### Added +- It is now documented that the keys and commands provided by this package take + as a value or argument a dimen, skip, floating point, or integer expression + instead of simply a size, skip, number, or integer. +- This package now includes a CHANGELOG file. + +### Changed +- Documentation improvements. + +### Fixed +- The key `reset=preamble` and `\SetFontStep` no longer rely on undocumented + `expl3` features. +- Corrected typo in the documentation. + +## [v1.1.1] - 2024-04-07 + +### Changed +- Improved performance, especially when using a musical typographic scale. +- Small documentation improvements. + +## [v1.1.0] - 2024-03-31 + +### Added + - `\SetFontStep`, `\SetFontScale`, `\SetFontSize`, `\ScaleFont`, and + `\SetFontSizeBaselineskip` are now set up to work with `\text_purify:n`. + +## [v1.0.3] - 2024-03-26 + +### Changed +- Code improvements, particularly to document commands defined with optional + arguments. + +## [v1.0.2] - 2024-03-22 + +### Changed +- Performance and code improvements. + +### Fixed +- Fixed issue where the key `reset=preamble` relied on an unsupported `V`-type + `bool` argument. + +## [v1.0.1] - 2024-03-08 + +### Added +- Added the `.tex` sources for the documentation. +- Added the CTAN link to the `.sty` and README files. + +## [v1.0.0] - 2024-03-06 + +### Added +- First official release to CTAN.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/fontscale/beery.cls b/Master/texmf-dist/doc/latex/fontscale/beery.cls index d1d480ba138..bfc38f9a59f 100644 --- a/Master/texmf-dist/doc/latex/fontscale/beery.cls +++ b/Master/texmf-dist/doc/latex/fontscale/beery.cls @@ -4,7 +4,7 @@ \NeedsTeXFormat{LaTeX2e}[2023-06-01] \ProvidesExplClass {beery} - {2024-03-08} + {2024-04-15} {} {} @@ -49,8 +49,8 @@ \NewDocumentCommand \cmd { m } { \texttt { \token_to_str:N #1 } \@ } \NewDocumentCommand \cs { m } { \texttt { \token_to_str:c {#1} } \@ } \NewDocumentCommand \marg { m } - { \texttt { \c_left_brace_str #1 \c_right_brace_str } } -\NewDocumentCommand \oarg { m } { \texttt { [ #1 ] } } + { \allowbreak \texttt { \c_left_brace_str #1 \c_right_brace_str } } +\NewDocumentCommand \oarg { m } { \allowbreak \texttt { [ #1 ] } } \NewDocumentCommand \meta { m } { \texttt { \textlangle #1 \textrangle } } \NewDocumentCommand \cls { m } { \textsf {#1} } \NewDocumentCommand \env { m } { \texttt {#1} } @@ -210,7 +210,7 @@ \RequirePackage [ bottom ] { footmisc } \renewcommand \footnoterule { } \setlength { \skip \footins } { \c_beery_big_skip } - +\dim_set:Nn \footnotesep { \f@linespread \footnotesep } \coffin_new:N \l__beery_footnote_coffin % 1.2 = baselineskip-size-ratio \dim_const:Nn \c_beery_footnote_baselineheight_dim diff --git a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-classic.tex b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-classic.tex index 56015bba68f..029d304d82c 100644 --- a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-classic.tex +++ b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-classic.tex @@ -1,4 +1,6 @@ -\ProvidesFile{fontscale-manual-table-classic.tex}[2024-03-08] +\ProvidesFile + {fontscale-manual-table-classic.tex} + [2024-04-15] \begin{table} \centering @@ -10,14 +12,14 @@ \bigskip \begin{tblr} { - colspec= - { - l - Q[si={table-format=3.2},c] - Q[si={table-format=3.2},c] - Q[si={table-format=3.2},c] - } - ,cell{1}{2-Z}={guard} + colspec= + { + l + Q[si={table-format=3.2},c] + Q[si={table-format=3.2},c] + Q[si={table-format=3.2},c] + } + , cell{1}{2-Z}={guard} } \toprule Command & \Key{classic-10pt} & \Key{classic-11pt} & \Key{classic-12pt} \\ diff --git a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-font-steps.tex b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-font-steps.tex index 8392f99dbbf..8c5cc8c1416 100644 --- a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-font-steps.tex +++ b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-font-steps.tex @@ -1,4 +1,6 @@ -\ProvidesFile{fontscale-manual-table-font-steps.tex}[2024-03-08] +\ProvidesFile + {fontscale-manual-table-font-steps.tex} + [2024-04-15] \begin{table} \centering diff --git a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-modular-musical.tex b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-modular-musical.tex index 6fd10d99916..306578ec354 100644 --- a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-modular-musical.tex +++ b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual-table-modular-musical.tex @@ -1,4 +1,6 @@ -\ProvidesFile{fontscale-manual-table-modular-musical.tex}[2024-03-08] +\ProvidesFile + {fontscale-manual-table-modular-musical.tex} + [2024-04-15] \begin{table} \centering @@ -10,13 +12,13 @@ \bigskip \begin{tblr} { - colspec= - { - l - Q[si={table-format=3.2},c] - Q[si={table-format=3.2},c] - } - ,cell{1}{2-3}={guard} + colspec= + { + l + Q[si={table-format=3.2},c] + Q[si={table-format=3.2},c] + } + , cell{1}{2-3}={guard} } \toprule Command & \Key{modular} & \Key{musical} \\ diff --git a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf Binary files differindex d45ffefea94..a1c5644e607 100644 --- a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf +++ b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.pdf diff --git a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex index 0260881adee..ca5b3224fd0 100644 --- a/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex +++ b/Master/texmf-dist/doc/latex/fontscale/fontscale-manual.tex @@ -13,7 +13,7 @@ A user interface for setting document font sizes Oliver Beery -Version 1.1.1\quad{}7 April 2024 +Version 1.2.0\quad{}15 April 2024 \section{Introduction} @@ -42,7 +42,6 @@ Version 1.1.1\quad{}7 April 2024 For advanced users, store the step, scale, size, and baselineskip of each font size command in \pkg{expl3} variables. \end{itemize} - \subsection{Loading the package} \label{subsec:loading} @@ -55,12 +54,12 @@ If you get a warning that Computer Modern is not available in the requested size \cs{usepackage}\marg{fontscale} \nopagebreak\newline -\cs{fontscalesetup}\marg{\meta{keys}} +\cs{fontscalesetup}\marg{\meta{keyval list}} Load the \pkg{fontscale} package via the usual command in the document preamble. This package has no package options. -Instead, the package keys are set up via the command \cs{fontscalesetup}\marg{\meta{keys}}. -\meta{keys} must receive a comma\-/separated list of keys and their associated values. +Instead, the package keys are set up via the command \cs{fontscalesetup}\marg{\meta{keyval list}}. +\meta{keyval list} must receive a comma\-/separated list of keys and their associated values. The package keys are documented in \S\ref{sec:choosing} and \S\ref{sec:overwriting}. Many \LaTeX{} document classes have a font size option (\Key{10pt}, \Key{11pt}, \Key{12pt}, etc.\@) which not only changes the set of document font sizes, but also modifies additional settings such as the page layout and vertical spacing which were specifically designed to work with those font sizes. @@ -70,18 +69,22 @@ Internally, this package sets up each font size command from \cs{tiny} to \cs{Hu Unlike the standard document classes, the font size commands set up by this package do not change the vertical spacing for displayed math and list structures. If the user would like to add this functionality or perhaps other features to the font size commands, they can do so via hooks, which are documented in the \LaTeX{} kernel. - \subsection{Terminology} \label{subsec:terminology} When using the \pkg{fontscale} package, each font size, including the standard font size commands from \cs{tiny} to \cs{Huge}, has a step, scale, size, and baselineskip. -The latter two parameters are the familiar first and second arguments to the low\-/level font command \cs{fontsize}\marg{\meta{size}}\marg{\meta{skip}}. +The latter two parameters are the familiar first and second arguments to the low\-/level font command \cs{fontsize}\marg{\meta{dimen}}\marg{\meta{skip}}. The font scale is the relative font size; the ratio of the font size to \cs{normalsize}. The font step is the number of font size gradations from \cs{normalsize}, which has a step of \num{0}. Table~\ref{table:fontsteps} lists the font step of each font size command. \input{./fontscale-manual-table-font-steps.tex} +This package defines many keys and commands that take as a value or argument a \meta{dim expr}, \meta{skip expr}, \meta{fp expr}, or \meta{int expr}. +This syntax is short for a dimen, skip, floating point, or integer expression, respectively. +See \pkg{usrguide} \S5 for more information.% +\footnote{\url{https://ctan.org/pkg/usrguide}} + \section{Choosing the typographic scale} \label{sec:choosing} @@ -90,11 +93,11 @@ Table~\ref{table:fontsteps} lists the font step of each font size command. [classic-10pt, classic-11pt, classic-12pt, modular, musical] [classic-10pt] \newline -\Key{modular/ratio}[\meta{number}][1.125] +\Key{modular/ratio}[\meta{fp expr}][1.125] \newline -\Key{musical/ratio}[\meta{number}][2]% +\Key{musical/ratio}[\meta{fp expr}][2]% \nopagebreak\newline -\Key{musical/notes}[\meta{integer}][5] +\Key{musical/notes}[\meta{int expr}][5] The key \Key{typographic\-/scale} sets the font sizes using a classic, modular, or musical typographic scale. These are common methods of choosing a set of document font sizes. @@ -116,7 +119,7 @@ Table~\ref{table:classicscales} lists the size of each font size command when us The key \Key{modular} sets the font sizes from \cs{tiny} to \cs{Huge} using a modular typographic scale. In a modular scale, each font size is a fixed ratio from the adjacent font sizes.% \footnote{\url{https://alistapart.com/article/more-meaningful-typography/}} -Here, the base font size is the size of \cs{normalsize}, which can be set via the key \Key{normalsize/size}[\meta{size}], more documented in \S\ref{sec:overwriting}. +Here, the base font size is the size of \cs{normalsize}, which can be set via the key \Key{normalsize/size}[\meta{dim expr}], more documented in \S\ref{sec:overwriting}. If not set, \cs{normalsize} initializes to \qty{10}{pt}. The modular ratio can be set via the key \Key{modular\slash{}ratio}. The initial modular ratio is \num{1.125}. @@ -142,16 +145,16 @@ The musical ratio~$r$ and the number of notes~$n$ can be set via the keys \Key{m The initial musical ratio\---\num{2}\---and the initial number of notes\---\num{5}\---are the same as that of the classic typographic scale.% \footnote{Ibid.} Conveniently, \cs{Huge} is \num{5} steps above \cs{normalsize}. -The font size of \cs{normalsize}~$f_0$ can be set using the key \Key{normalsize/size}[\meta{size}], more documented in \S\ref{sec:overwriting}. +The font size of \cs{normalsize}~$f_0$ can be set using the key \Key{normalsize/size}[\meta{dim expr}], more documented in \S\ref{sec:overwriting}. When using a musical typographic scale, \cs{normalsize} initializes to \qty{10}{pt}.% \footnote {I have set the initial value to \qty{10}{pt} instead of the \qty{12}{pt} recommended by the Spencer Mortensen article because this matches the default settings of the standard \LaTeXe{} document classes.} -\Key{baselineskip-size-ratio}[\meta{number}][1.2] +\Key{baselineskip-size-ratio}[\meta{fp expr}][1.2] \KeepNextPar* The key \Key{baselineskip\-/size\-/ratio} sets the ratio of the font baselineskip to the font size. -By default, the font baselineskip of each font size command equals its font size times \Key{baselineskip\-/size\-/ratio}. -Users should not adjust this value unless they really know what they are doing. +By default, the font baselineskip of each font size command equals its font size times \meta{fp expr}. +Users should not set this key unless they really know what they are doing. When using increased line spacing, users should prefer the low\-/level font command \cs{linespread} or the \pkg{setspace} package. @@ -161,29 +164,29 @@ When using increased line spacing, users should prefer the low\-/level font comm In some situations, users may need to explicitly set the scale, size, or baselineskip of a font size command, overwriting the value set by the keys in \S\ref{sec:choosing}. Note that the font steps and the scale of \cs{normalsize} are constants and cannot be changed. -\Key{\meta{font size command}/scale}[\meta{number}] +\Key{\meta{font size command}/scale}[\meta{fp expr}] \KeepNextPar* -The keys \Key{\meta{font size command}\slash{}scale} set the scale of \meta{font size command} to \meta{number}, ignoring the value set by the key \Key{typographic-scale}. +The keys \Key{\meta{font size command}\slash{}scale} set the scale of \meta{font size command} to \meta{fp expr}, ignoring the value set by the key \Key{typographic-scale}. The key \Key{normalsize\slash{}scale} is not defined. -\Key{\meta{font size command}/size}[\meta{size}] +\Key{\meta{font size command}/size}[\meta{dim expr}] \KeepNextPar* -The keys \Key{\meta{font size command}\slash{}size} set the size of \meta{font size command} to \meta{size}, ignoring the values set by the keys \Key{typographic-scale} and \Key{\meta{font size command}\slash{}scale}. -\meta{size} supplies a default unit of \unit{pt}. +The keys \Key{\meta{font size command}\slash{}size} set the size of \meta{font size command} to \meta{dim expr}, ignoring the values set by the keys \Key{typographic-scale} and \Key{\meta{font size command}\slash{}scale}. +\meta{dim expr} supplies a default unit of \unit{pt}. The package will issue a warning if the user sets the keys \Key{\meta{font size command}\slash{}size} and \Key{\meta{font size command}\slash{}scale} for the same \meta{font size command} since the latter key will be ignored. -\Key{\meta{font size command}/baselineskip}[\meta{skip}] +\Key{\meta{font size command}/baselineskip}[\meta{skip expr}] \KeepNextPar* -The keys \Key{\meta{font size command}\slash{}baselineskip} set the font baselineskip of \meta{font size command} to \meta{skip} instead of calculating it from the size of \meta{font size command} and \Key{baselineskip\-/size\-/ratio}. -\meta{skip} supplies a default unit of \unit{pt}. +The keys \Key{\meta{font size command}\slash{}baselineskip} set the font baselineskip of \meta{font size command} to \meta{skip expr} instead of calculating it from the size of \meta{font size command} and \Key{baselineskip\-/size\-/ratio}. +\meta{skip expr} supplies a default unit of \unit{pt}. -\Key{\meta{font size command}}[\meta{size}] +\Key{\meta{font size command}}[\meta{dim expr}] \nopagebreak\newline -\Key{\meta{font size command}}[\meta{size}/\meta{skip}] +\Key{\meta{font size command}}[\meta{dim expr}/\meta{skip expr}] The keys \Key{\meta{font size command}} set the keys \Key{\meta{font size command}\slash{}size} or \Key{\meta{font size command}\slash{}baselineskip} in a condensed format. The latter format resembles traditional typographic notation where the size and leading of a text can be expressed as, for example, $10/12$ or $11/13$. @@ -220,7 +223,7 @@ Caution: \cs{CurrentFontStep} will expand to nothing if the current step is unde Internally, \cs{CurrentFontStep}, \cs{CurrentFontScale}, and \cs{CurrentFontSize} use the kernel command \cs{f@size}. \cs{CurrentFontSize} expands to \texttt{f@size pt}. \cs{CurrentFontBaselineskip} expands to the kernel command \cs{f@baselineskip}. -Note that the low\-/level font command \cs{fontsize}\marg{\meta{size}}\allowbreak\marg{\meta{skip}} sets \cs{f@size} before expanding its second argument. +Note that the low\-/level font command \cs{fontsize}\marg{\meta{dimen}}\marg{\meta{skip}} sets \cs{f@size} before expanding its second argument. This means that \cs{CurrentFontStep}, \cs{CurrentFontScale}, and \cs{CurrentFontSize} may need to be first expanded if used in \meta{skip}. This package provides the command \cs{SetFontSizeBaselineskip} as an alternative to \cs{fontsize} + \cs{selectfont} that avoids this issue (\S\ref{subsec:fontsize}). @@ -229,18 +232,19 @@ This package provides the command \cs{SetFontSizeBaselineskip} as an alternative The \pkg{fontscale} package provides the commands \cs{SetFontStep}, \cs{SetFontScale}, \cs{SetFontSize}, \cs{ScaleFont}, and \cs{SetFontSizeBaselineskip} which set the font size in different ways. The first three commands have a starred version which sets the font size relative to the current font size. -Internally, these commands all use the low\-/level font commands \cs{fontsize}\marg{\meta{size}}\allowbreak\marg{\meta{skip}} and \cs{selectfont}. +Internally, these commands all use the low\-/level font commands \cs{fontsize} and \cs{selectfont}. These commands should be used only in special cases. Generally, users should prefer the font size commands from \cs{tiny} to \cs{Huge} for typographic and syntactic consistency, although \cs{SetFontStep*}\marg{\meta{integer}} can use a font size command directly. -\cs{SetFontStep}\marg{\meta{number}} +\cs{SetFontStep}\marg{\meta{fp expr}} \nopagebreak\newline -\cs{SetFontStep*}\marg{\meta{number}} +\cs{SetFontStep*}\marg{\meta{fp expr}} -\cs{SetFontStep} sets the font size by setting the font step to \meta{number}. -The starred version \cs{SetFontStep*} adds \meta{number} to the current font step. -If the choice of typographic scale is not modular or musical, then the only valid values for \meta{number} are the integers from \num{-4} to \num{5}, corresponding to the font size commands from \cs{tiny} to \cs{Huge}. +\cs{SetFontStep} sets the font size by setting the font step to \meta{fp expr}. +The starred version \cs{SetFontStep*} adds \meta{fp expr} to the current font step. +If the choice of typographic scale is not modular or musical, then the only valid values for \meta{fp expr} are the integers from \num{-4} to \num{5}, corresponding to the font size commands from \cs{tiny} to \cs{Huge}. \cs{SetFontStep} will issue an error if the step is invalid. +The starred version \cs{SetFontStep*} will also issue an error if the current step is invalid. \cs{SetFontStep} sets the font baselineskip to the calculated font size \texttimes{} \Key{baselineskip\-/size\-/ratio}. If the step matches the step of any font size command, then that font size command will be used directly. @@ -257,40 +261,39 @@ If the step matches the step of any font size command, then that font size comma Otherwise, it produces an error. \end{itemize} -\cs{SetFontScale}\marg{\meta{number}} +\cs{SetFontScale}\marg{\meta{fp expr}} \nopagebreak\newline -\cs{SetFontScale*}\marg{\meta{number}} +\cs{SetFontScale*}\marg{\meta{fp expr}} -\cs{SetFontScale} sets the font size by setting the font scale to \meta{number}. +\cs{SetFontScale} sets the font size by setting the font scale to \meta{fp expr}. The font baselineskip is set to the calculated font size \texttimes{} \Key{baselineskip\-/size\-/ratio}. -The starred version \cs{SetFontScale*} adds \meta{number} to the current font scale. +The starred version \cs{SetFontScale*} adds \meta{fp expr} to the current font scale. For example, \cs{SetFontScale}\marg{1.25} makes the font size 25\% larger than \cs{normalsize}. -If the current font size is \cs{normalsize}, \cs{SetFontScale*}\marg{0.25} is equivalent to \cs{SetFontScale}\marg{1.25}. +If the current font size is \cs{normalsize}, \cs{SetFontScale*}\marg{0.2} is equivalent to \cs{SetFontScale}\marg{1.2}. -\cs{SetFontSize}\marg{\meta{size}} +\cs{SetFontSize}\marg{\meta{dim expr}} \nopagebreak\newline -\cs{SetFontSize*}\marg{\meta{size}} +\cs{SetFontSize*}\marg{\meta{dim expr}} -\cs{SetFontSize} sets the font size to \meta{size}. -\meta{size} supplies a default unit of \unit{pt}. +\cs{SetFontSize} sets the font size to \meta{dim expr}. +\meta{dim expr} supplies a default unit of \unit{pt}. The font baselineskip is set to the font size \texttimes{} \Key{baselineskip\-/size\-/ratio}. -The starred version \cs{SetFontSize*} adds \meta{size} to the current size. +The starred version \cs{SetFontSize*} adds \meta{dim expr} to the current size. For example, \cs{SetFontSize*}\marg{1} and \cs{SetFontSize*}\marg{-1pt} increase and decrease the current font size by a \unit{pt}. -\cs{ScaleFont}\marg{\meta{number}} +\cs{ScaleFont}\marg{\meta{fp expr}} \KeepNextPar* -Scales the current font size and the current font baselineskip by a factor of \meta{number}. +Scales the current font size and the current font baselineskip by a factor of \meta{fp expr}. \cs{ScaleFont} resembles the \cs{scalefont} command provided by the \pkg{scalefnt} package, except that it uses floating point calculations and clears the stretch and shrink components of the font baselineskip. For example, if the current font size and font baselineskip are \qty{10}{pt} and \qty{12}{pt}, using \cs{ScaleFont}\marg{0.8} will reduce them proportionally to \qty{8}{pt} and \qty{9.6}{pt}. -\cs{SetFontSizeBaselineskip}\marg{\meta{size}}\marg{\meta{skip}} +\cs{SetFontSizeBaselineskip}\marg{\meta{dim expr}}\marg{\meta{skip expr}} \KeepNextPar* -Sets the font size and font baselineskip to \meta{size} and \meta{skip}. -Both \meta{size} and \meta{skip} supply a default unit of \unit{pt}. -\cs{SetFontSizeBaselineskip} can be used as an alternative to \cs{fontsize} + \cs{selectfont} as it avoids the issue with \cs{f@size} discussed in \S\ref{subsec:fontparameters} -\vfill\pagebreak%manual +Sets the font size and font baselineskip to \meta{dim expr} and \meta{skip expr}. +Both arguments supply a default unit of \unit{pt}. +\cs{SetFontSizeBaselineskip} can be used as an alternative to \cs{fontsize} + \cs{selectfont} as it avoids the issue with \cs{f@size} discussed in \S\ref{subsec:fontparameters}. \subsection{Testing and debugging} \label{subsec:debug} @@ -322,7 +325,7 @@ The default \meta{text} is \enquote{The \texttt{fontscale} package: A user inter If so, it prints the name of that font size command. If not, it instead prints \enquote{UNDEFINED\@}. One useful way of printing example text is by using -\cs{PrintSampleText}\allowbreak\oarg{\cs{PrintFontSizeCommand}:\textvisiblespace{}\cs{PrintFontParameters}}. +\cs{PrintSampleText}\oarg{\cs{PrintFontSizeCommand}:\textvisiblespace{}\cs{PrintFontParameters}}. \subsection {% @@ -332,7 +335,7 @@ One useful way of printing example text is by using } \label{subsec:fontscalesetup} -\cs{fontscalesetup}\marg{\meta{keys}} +\cs{fontscalesetup}\marg{\meta{keyval list}} \KeepNextPar* Sets and processes the \pkg{fontscale} package keys and uses \cs{normalsize}. diff --git a/Master/texmf-dist/tex/latex/fontscale/fontscale.sty b/Master/texmf-dist/tex/latex/fontscale/fontscale.sty index 3fd18ccd917..514350189c7 100644 --- a/Master/texmf-dist/tex/latex/fontscale/fontscale.sty +++ b/Master/texmf-dist/tex/latex/fontscale/fontscale.sty @@ -8,8 +8,8 @@ \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesExplPackage {fontscale} - {2024-04-07} - {1.1.1} + {2024-04-15} + {1.2.0} {A user interface for setting document font sizes} % The 2023-10-10 l3kernel update added many 'e'-variants. @@ -108,14 +108,12 @@ \skip_new:N \l_fontscale_Huge_baselineskip_skip \str_new:N \l__fontscale_typographic_scale_str -\tl_new:N \l__fontscale_keys_precompile_preamble_tl % Used in floating point expressions for speed. \fp_new:N \l__fontscale_normalsize_size_fp \fp_new:N \l__fontscale_musical_notes_fp % Temporary variables -\fp_new:N \l__fontscale_step_fp \tl_new:N \l__fontscale_step_tl \tl_new:N \l__fontscale_scale_tl \dim_new:N \l__fontscale_size_dim @@ -246,13 +244,7 @@ \keys_define:nn { fontscale } { reset .choices:nn = { initial , preamble } - { - \int_case:nn { \l_keys_choice_int } - { - { 1 } { \c__fontscale_keys_precompile_initial_tl } - { 2 } { \l__fontscale_keys_precompile_preamble_tl } - } - } + { \use:c { __fontscale_keys_precompile_#1: } } , reset .default:n = initial , ignore-order .bool_set:N = \l__fontscale_ignore_order_bool @@ -448,7 +440,7 @@ % Pre-compiles the keys with their initial values. The keys are pre-compiled % by hand for speed. -\tl_const:Nn \c__fontscale_keys_precompile_initial_tl +\cs_new_protected:Npn \__fontscale_keys_precompile_initial: { \bool_set_false:N \l__fontscale_ignore_order_bool \fp_set:Nn \l__fontscale_baselineskip_size_ratio_fp { 1.2 } @@ -489,28 +481,29 @@ \tl_set:Nn \l__fontscale_huge_baselineskip_tl { \q_no_value } \tl_set:Nn \l__fontscale_Huge_baselineskip_tl { \q_no_value } } -\c__fontscale_keys_precompile_initial_tl +\__fontscale_keys_precompile_initial: % Pre-compiles the keys with their values at the end of the preamble. The keys % are pre-compiled by hand for speed. +\cs_new_eq:NN \__fontscale_keys_precompile_preamble: \prg_do_nothing \AddToHook { begindocument / before } - { \__fontscale_keys_precompile_preamble: } -\cs_new_protected:Npn \__fontscale_keys_precompile_preamble: + { \__fontscale_keys_precompile_preamble_set: } +\cs_new_protected:Npn \__fontscale_keys_precompile_preamble_set: { - \tl_set:Ne \l__fontscale_keys_precompile_preamble_tl + \cs_set_protected:Npe \__fontscale_keys_precompile_preamble: { \bool_if:NTF \l__fontscale_ignore_order_bool { \bool_set_true:N } { \bool_set_false:N } - \l__fontscale_ignore_order_bool + \exp_not:N \l__fontscale_ignore_order_bool \fp_set:Nn \exp_not:N \l__fontscale_baselineskip_size_ratio_fp - { \l__fontscale_baselineskip_size_ratio_fp } + { \exp_not:V \l__fontscale_baselineskip_size_ratio_fp } \str_set:Nn \exp_not:N \l__fontscale_typographic_scale_str { \l__fontscale_typographic_scale_str } \fp_set:Nn \exp_not:N \l__fontscale_modular_ratio_fp - { \l__fontscale_modular_ratio_fp } + { \exp_not:V \l__fontscale_modular_ratio_fp } \fp_set:Nn \exp_not:N \l__fontscale_musical_ratio_fp - { \l__fontscale_musical_ratio_fp } - \int_set:Nn \l__fontscale_musical_notes_int + { \exp_not:V \l__fontscale_musical_ratio_fp } + \int_set:Nn \exp_not:N \l__fontscale_musical_notes_int { \int_use:N \l__fontscale_musical_notes_int } \tl_set:Nn \exp_not:N \l__fontscale_tiny_scale_tl @@ -1025,23 +1018,18 @@ } \cs_new_protected:Npn \__fontscale_set_font_step:n #1 { - \fp_set:Nn \l__fontscale_step_fp {#1} - \__fontscale_set_font_step_aux:N \l__fontscale_step_fp - } -\cs_new_protected:Npn \__fontscale_set_font_step_aux:N #1 - { - \token_case_meaning:NnF #1 + \str_case:enF { \fp_eval:n {#1} } { - \c_fontscale_tiny_step_fp { \tiny } - \c_fontscale_scriptsize_step_fp { \scriptsize } - \c_fontscale_footnotesize_step_fp { \footnotesize } - \c_fontscale_small_step_fp { \small } - \c_fontscale_normalsize_step_fp { \normalsize } - \c_fontscale_large_step_fp { \large } - \c_fontscale_Large_step_fp { \Large } - \c_fontscale_LARGE_step_fp { \LARGE } - \c_fontscale_huge_step_fp { \huge } - \c_fontscale_Huge_step_fp { \Huge } + { -4 } { \tiny } + { -3 } { \scriptsize } + { -2 } { \footnotesize } + { -1 } { \small } + { 0 } { \normalsize } + { 1 } { \large } + { 2 } { \Large } + { 3 } { \LARGE } + { 4 } { \huge } + { 5 } { \Huge } } { \str_case:onF \l__fontscale_typographic_scale_str @@ -1053,7 +1041,7 @@ \fp_to_dim:n { \l__fontscale_normalsize_size_fp - * \l__fontscale_modular_ratio_fp ^ #1 + * \l__fontscale_modular_ratio_fp ^ (#1) } } { @@ -1070,7 +1058,7 @@ { \l__fontscale_normalsize_size_fp * \l__fontscale_musical_ratio_fp - ^ ( #1 / \l__fontscale_musical_notes_fp ) + ^ ( (#1) / \l__fontscale_musical_notes_fp ) } } { @@ -1088,12 +1076,9 @@ \tl_set:Ne \l__fontscale_step_tl { \__fontscale_current_font_step: } \tl_if_empty:NTF \l__fontscale_step_tl { \msg_error:nn { fontscale } { font-step-out-of-bounds } } - { - \fp_set:Nn \l__fontscale_step_fp { (#1) + \l__fontscale_step_tl } - \__fontscale_add_font_step_aux:N \l__fontscale_step_fp - } + { \__fontscale_add_font_step_aux:n { (#1) + \l__fontscale_step_tl } } } -\cs_new_eq:NN \__fontscale_add_font_step_aux:N \__fontscale_set_font_step_aux:N +\cs_new_eq:NN \__fontscale_add_font_step_aux:n \__fontscale_set_font_step:n \NewDocumentCommand \SetFontScale { s m } { |