texlive[73714] Master/texmf-dist: fontscale (3feb25)
commits+karl at tug.org
commits+karl at tug.org
Mon Feb 3 21:54:59 CET 2025
Revision: 73714
https://tug.org/svn/texlive?view=revision&revision=73714
Author: karl
Date: 2025-02-03 21:54:59 +0100 (Mon, 03 Feb 2025)
Log Message:
-----------
fontscale (3feb25)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md
trunk/Master/texmf-dist/doc/latex/fontscale/beery.cls
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-classic.tex
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-font-steps.tex
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-musical.tex
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.pdf
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.tex
trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.pdf
trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.tex
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md 2025-02-03 20:54:45 UTC (rev 73713)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/CHANGELOG.md 2025-02-03 20:54:59 UTC (rev 73714)
@@ -7,6 +7,12 @@
## [Unreleased]
+## [v3.1.0] - 2025-02-03
+
+### Added
+- `fontscale-code.tex`
+- `fontscale-code.pdf`
+
## [v3.0.6] - 2025-01-17
### Changed
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/beery.cls
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/beery.cls 2025-02-03 20:54:45 UTC (rev 73713)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/beery.cls 2025-02-03 20:54:59 UTC (rev 73714)
@@ -1,15 +1,43 @@
% Note: This class is designed ONLY for 'fontscale.tex'. Compiled with LuaTeX.
+% LOADING THE CLASS
+
% LaTeX2e version 2023-11-01 added \IfExplAtLeastTF.
\NeedsTeXFormat{LaTeX2e}[2023-11-01]
\ProvidesExplClass
{beery}
- {2025-01-17}
+ {2025-02-03}
+ {0.0.0}
{}
- {}
+\prop_gput:Nnn \g_msg_module_type_prop { beery } { Class }
+
+% l3kernel version 2023-10-10 added many 'e'-variants.
+\IfExplAtLeastTF { 2023-10-10 } { }
+ {
+ \msg_new:nnn { beery } { expl3-out-of-date }
+ {
+ The~ beery~ class~ could~ not~ load.~
+ This~ class~ requires~
+ L3~ programming~ layer~ version~ 2023-10-10~ or~ newer.
+ }
+ \msg_critical:nn { beery } { expl3-out-of-date }
+ }
+
+\sys_if_engine_luatex:F
+ {
+ \msg_new:nnn { beery } { luatex-required }
+ { The~ beery~ class~ could~ not~ load.~ This~ class~ requires~ LuaTeX. }
+ \msg_critical:nn { beery } { luatex-required }
+ }
+
\LoadClass { article }
+% MESSAGES
+
+\msg_new:nnn { beery } { math-mode-error }
+ { '#1'~ cannot~ be~ used~ in~ math~ mode~ \msg_line_context:. }
+
\RequirePackage { fontscale }
\fontscalesetup { musical }
\RequirePackage { siunitx }
@@ -32,70 +60,172 @@
, breakable
}
+% SOME VARIABLES
+
+\fp_const:Nn \c_beery_golden_ratio_fp { 1.6180 3398 8749 8948 }
+\tl_const:Nn \c_beery_alphabet_tl { abcdefghijklmnopqrstuvwxyz }
+\tl_const:Nn \c_beery_digits_tl { 0123456789 }
+
+\regex_const:Nn \c__beery_ends_in_letter_regex { ^.*[A-Za-z]$ }
+
+% Scratch variables
+\box_new:N \l__beery_tmp_box
+
% CUSTOM MACROS
-\tl_const:Nn \c_beery_alphabet_tl { abcdefghijklmnopqrstuvwxyz }
\NewExpandableDocumentCommand \alphabet { } { \c_beery_alphabet_tl }
+\NewExpandableDocumentCommand \digits { } { \c_beery_digits_tl }
+\NewExpandableDocumentCommand \pangram { }
+ { The~ quick~ brown~ fox~ jumps~ over~ the~ lazy~ dog. }
+
\NewDocumentCommand \Key
{ >{ \TrimSpaces } m >{ \TrimSpaces } o >{ \TrimSpaces } o }
{
\mode_leave_vertical:
+ \IfNoValueTF {#2}
+ { \__beery_print_key:n {#1} }
+ {
+ \IfNoValueTF {#3}
+ { \__beery_print_key:nn {#1} {#2} }
+ { \__beery_print_key:nnn {#1} {#2} {#3} }
+ }
+ }
+\cs_new_protected:Npn \__beery_print_key:n #1 { \texttt {#1} }
+\cs_new_protected:Npn \__beery_print_key:nn #1#2
+ { \texttt { #1 \ensuremath { \,=\, } \allowbreak #2 } }
+\cs_new_protected:Npn \__beery_print_key:nnn #1#2#3
+ {
\group_begin:
\ttfamily
- \IfNoValueTF {#3}
- {
- \IfNoValueTF {#2}
- {#1}
- { #1 $\,=\,$ \allowbreak #2 }
- }
- { #1 $\,=\,$ #2 \hspace* { \fill } \hbox:n { initial $\,=\,$ #3 } }
+ #1 \ensuremath { \,=\, } #2 \hspace* { \fill }
+ \hbox:n { initial \ensuremath { \,=\, } #3 }
\group_end:
}
-\NewDocumentCommand \Value { >{ \TrimSpaces } m } { \texttt {#1} \@ }
-\NewDocumentCommand \cmd { >{ \TrimSpaces } m }
- { \texttt { \token_to_str:N #1 } \@ }
+\NewDocumentCommand \Value { >{ \TrimSpaces } m }
+ {
+ \mode_if_math:TF
+ {
+ \msg_error:nne { beery } { math-mode-error }
+ { \token_to_str:N \Value }
+ }
+ { \__beery_print_value:n {#1} }
+ }
+\cs_new_protected:Npn \__beery_print_value:n #1 { \texttt {#1} \@ }
\NewDocumentCommand \cs { >{ \TrimSpaces } m }
+ {
+ \mode_if_math:TF
+ { \msg_error:nne { beery } { math-mode-error } { \token_to_str:N \cs } }
+ { \__beery_print_cs:n {#1} }
+ }
+\cs_new_protected:Npn \__beery_print_cs:n #1
{ \texttt { \token_to_str:c {#1} } \@ }
\NewDocumentCommand \marg { >{ \TrimSpaces } m }
+ { \__beery_print_m_arg:n {#1} }
+\cs_new_protected:Npn \__beery_print_m_arg:n #1
{
\allowbreak
\texttt { \c_left_brace_str }
- $\langle$
+ \ensuremath \langle
\group_begin:
\normalfont \itshape #1
\group_end:
- $\rangle$
+ \ensuremath \rangle
\texttt { \c_right_brace_str }
}
\NewDocumentCommand \oarg { >{ \TrimSpaces } m }
+ { \__beery_print_o_arg:n {#1} }
+\cs_new_protected:Npn \__beery_print_o_arg:n #1
{
\allowbreak
\texttt { [ }
- $\langle$
+ \ensuremath \langle
\group_begin:
\normalfont \itshape #1
\group_end:
- $\rangle$
+ \ensuremath \rangle
\texttt { ] }
}
-\NewDocumentCommand \sarg { } { $\langle$ \texttt {*} $\rangle$ }
-\NewDocumentCommand \meta { >{ \TrimSpaces } m }
+\NewDocumentCommand \sarg { } { \__beery_print_s_arg: }
+\cs_new_protected:Npn \__beery_print_s_arg:
+ { \ensuremath \langle \texttt {*} \ensuremath \rangle }
+\NewDocumentCommand \meta { >{ \TrimSpaces } m } { \__beery_print_meta:n {#1} }
+\cs_new_protected:Npn \__beery_print_meta:n #1
{
- $\langle$
+ \ensuremath \langle
\group_begin:
\normalfont \itshape #1
\group_end:
- $\rangle$
+ \ensuremath \rangle
}
-\NewDocumentCommand \cls { >{ \TrimSpaces } m } { \textsf {#1} \@ }
-\NewDocumentCommand \env { >{ \TrimSpaces } m } { \texttt {#1} \@ }
-\NewDocumentCommand \pkg { >{ \TrimSpaces } m } { \textsf {#1} \@ }
-\NewDocumentCommand \latin { >{ \TrimSpaces } m } { \textit {#1} }
+\NewDocumentCommand \cls { >{ \TrimSpaces } m }
+ {
+ \mode_if_math:TF
+ { \msg_error:nne { beery } { math-mode-error } { \token_to_str:N \cls } }
+ { \__beery_print_cls:n {#1} }
+ }
+\cs_new_protected:Npn \__beery_print_cls:n #1 { \textsf {#1} \@ }
+\NewDocumentCommand \env { >{ \TrimSpaces } m }
+ {
+ \mode_if_math:TF
+ { \msg_error:nne { beery } { math-mode-error } { \token_to_str:N \env } }
+ { \__beery_print_env:n {#1} }
+ }
+\cs_new_protected:Npn \__beery_print_env:n #1 { \texttt {#1} \@ }
+\NewDocumentCommand \pkg { >{ \TrimSpaces } m }
+ {
+ \mode_if_math:TF
+ { \msg_error:nne { beery } { math-mode-error } { \token_to_str:N \pkg } }
+ { \__beery_print_pkg:n {#1} }
+ }
+\cs_new_protected:Npn \__beery_print_pkg:n #1 { \textsf {#1} \@ }
+\NewDocumentCommand \latin { >{ \TrimSpaces } m }
+ {
+ \mode_if_math:TF
+ {
+ \msg_error:nne { beery } { math-mode-error }
+ { \token_to_to_str:N \latin }
+ }
+ { \__beery_print_latin:n {#1} }
+ }
+\cs_new_protected:Npn \__beery_print_latin:n #1 { \textit {#1} }
+\NewDocumentCommand \AllCaps { O { 50 } >{ \TrimSpaces } m }
+ {
+ \mode_if_math:TF
+ {
+ \msg_error:nne { beery } { math-mode-error }
+ { \token_to_str:N \AllCaps }
+ }
+ { \__beery_text_all_caps:nn {#1} {#2} }
+ }
+\cs_new_protected:Npn \__beery_text_all_caps:nn #1#2
+ {
+ \textls [ \int_eval:n {#1} ] { \text_uppercase:n {#2} }
+ \regex_match:NnT \c__beery_ends_in_letter_regex {#2} { \@ }
+ }
+\NewDocumentCommand \AllSmallCaps
+ { >{ \ReverseBoolean } s O { 50 } >{ \TrimSpaces } m }
+ {
+ \mode_if_math:TF
+ {
+ \msg_error:nne { beery } { math-mode-error }
+ { \token_to_str:N \AllSmallCaps }
+ }
+ {
+ \IfBooleanTF #1
+ { \__beery_text_small_caps:nn {#2} {#3} }
+ { \__beery_text_lowercase_small_caps:nn {#2} {#3} }
+ }
+ }
+\cs_new_protected:Npn \__beery_text_small_caps:nn #1#2
+ { \textls [ \int_eval:n {#1} ] { \scshape #2 } }
+\cs_new_protected:Npn \__beery_text_lowercase_small_caps:nn #1#2
+ { \textls [ \int_eval:n {#1} ] { \scshape \text_lowercase:n {#2} } }
+
% PAGE STYLE
-\hbox_set:Nn \l_tmpa_box { \c_beery_alphabet_tl }
-\dim_const:Nn \c_beery_alphabet_dim { \box_wd:N \l_tmpa_box }
+\hbox_set:Nn \l__beery_tmp_box { \c_beery_alphabet_tl }
+\dim_const:Nn \c_beery_alphabet_dim { \box_wd:N \l__beery_tmp_box }
\dim_log:N \c_beery_alphabet_dim
\dim_const:Nn \c_beery_big_dim { \l_fontscale_normalsize_baselineskip_skip }
@@ -122,16 +252,21 @@
\skip_log:N \c_beery_medium_skip
\skip_log:N \c_beery_small_skip
+% \flushbottom
\raggedbottom
\int_set:Nn \vbadness { 100 }
\skip_set:Nn \topskip { \l_fontscale_normalsize_size_dim }
\skip_set_eq:NN \splittopskip \topskip
+
\RequirePackage { geometry }
\dim_const:Nn \c_beery_textwidth_dim
{ \fp_to_dim:n { \c_e_fp * \dim_to_fp:n { \c_beery_alphabet_dim } } }
\dim_const:Nn \c_beery_textheight_dim
- { \fp_to_dim:n { 1.6180 * \dim_to_fp:n { \c_beery_textwidth_dim } } }
+ {
+ \fp_to_dim:n
+ { \c_beery_golden_ratio_fp * \dim_to_fp:n { \c_beery_textwidth_dim } }
+ }
\dim_const:Nn \c_beery_footskip_dim
{ \c_beery_big_dim + \l_fontscale_footnotesize_baselineskip_skip }
\geometry
@@ -149,7 +284,7 @@
\RequirePackage { fancyhdr }
\pagestyle { fancy }
\fancyhf { }
-\renewcommand \headrulewidth { 0pt }
+\cs_set:Npn \headrulewidth { 0pt }
\fancyfoot [ C ]
{ \footnotesize \thepage \c_space_tl of~ \pageref { LastPage } }
@@ -164,6 +299,8 @@
\dim_set_eq:NN \JustifyingParindent \RaggedRightParindent
\RaggedRight
% \justifying
+\RequirePackage { microtype }
+\microtypesetup { protrusion = false , expansion = false }
\int_set:Nn \pretolerance { -1 }
\int_set:Nn \tolerance { 200 }
\dim_zero:N \emergencystretch
@@ -237,18 +374,36 @@
% list headings
% https://tex.stackexchange.com/questions/2644/how-to-prevent-a-page-break-before-an-itemize-list
-\NewDocumentCommand \KeepNextPar { s }
+\NewDocumentCommand \KeepNextPar { > { \ReverseBoolean } s }
{
- \par
- \IfBooleanTF #1
+ \mode_if_math:TF
{
- \int_compare:nNnT \prevgraf = 1
- { \nobreak \@afterheading }
+ \msg_error:nne { beery } { math-mode-error }
+ { \token_to_str:N \KeepNextPar }
}
+ {
+ \IfBooleanTF #1
+ { \__beery_keep_next_par: }
+ { \__beery_keep_next_par_if_single_line: }
+ }
+ }
+\cs_new_protected:Npn \__beery_keep_next_par: { \nobreak \@afterheading }
+\cs_new_protected:Npn \__beery_keep_next_par_if_single_line:
+ {
+ \int_compare:nNnT \prevgraf = 1
{ \nobreak \@afterheading }
}
\NewDocumentCommand \listheading { m }
{
+ \mode_if_math:TF
+ {
+ \msg_error:nne { beery } { math-mode-error }
+ { \token_to_str:N \listheading }
+ }
+ { \__beery_typeset_list_heading:n {#1} }
+ }
+\cs_new_protected:Npn \__beery_typeset_list_heading:n #1
+ {
\par
#1
\par
@@ -265,7 +420,7 @@
% FOOTNOTES
\RequirePackage [ bottom ] { footmisc }
-\renewcommand \footnoterule { }
+\cs_set_protected:Npn \footnoterule { }
% \setlength { \skip \footins } { \c_beery_big_skip }
\dim_set:Nn \footnotesep { \f at linespread \footnotesep }
\coffin_new:N \l__beery_footnote_coffin
@@ -275,11 +430,11 @@
{
\fp_to_dim:n
{
- ( 1.2 * \f at linespread - 1 )
- * \dim_to_fp:n { \l_fontscale_footnotesize_size_dim }
+ ( 1.2 * \f at linespread - 1 ) *
+ \dim_to_fp:n { \l_fontscale_footnotesize_size_dim }
}
}
-\RenewDocumentCommand \@makefntext { +m }
+\cs_set_protected:Npn \@makefntext #1
{
\vcoffin_set:Nnn \l__beery_footnote_coffin { \textwidth }
{
@@ -289,8 +444,8 @@
{
\fp_to_dim:n
{
- ( 1 - \l_fontscale_footnotesize_scale_fp ) / 2
- * \dim_to_fp:n { \textwidth }
+ ( 1 - \l_fontscale_footnotesize_scale_fp ) / 2 *
+ \dim_to_fp:n { \textwidth }
}
}
\dim_set_eq:NN \rightmargin \leftmargin
Added: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.pdf 2025-02-03 20:54:45 UTC (rev 73713)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.pdf 2025-02-03 20:54:59 UTC (rev 73714)
Property changes on: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.tex 2025-02-03 20:54:59 UTC (rev 73714)
@@ -0,0 +1,28 @@
+\documentclass{article}
+
+\usepackage{parskip}
+\usepackage{geometry}
+\geometry{a4paper,heightrounded,centering}
+\raggedbottom\raggedright
+
+\usepackage{codehigh}
+
+\usepackage{hyperref}
+\hypersetup{bookmarksnumbered}
+
+
+\begin{document}
+
+
+\section*{\Large The \textsf{fontscale} package}
+
+A flexible interface for setting font sizes
+
+Oliver Beery
+
+Version 3.1.0\quad{}3 February 2025
+
+\dochighinput[language=latex/latex3]{fontscale.sty}
+
+
+\end{document}
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-code.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-classic.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-classic.tex 2025-02-03 20:54:45 UTC (rev 73713)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-classic.tex 2025-02-03 20:54:59 UTC (rev 73714)
@@ -1,4 +1,4 @@
-\ProvidesFile{fontscale-table-classic.tex}[2025-01-17]
+\ProvidesFile{fontscale-table-classic.tex}[2025-02-03]
\begin{table}
\centering
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-font-steps.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-font-steps.tex 2025-02-03 20:54:45 UTC (rev 73713)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-font-steps.tex 2025-02-03 20:54:59 UTC (rev 73714)
@@ -1,4 +1,4 @@
-\ProvidesFile{fontscale-table-font-steps.tex}[2025-01-17]
+\ProvidesFile{fontscale-table-font-steps.tex}[2025-02-03]
\begin{table}
\centering
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-musical.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-musical.tex 2025-02-03 20:54:45 UTC (rev 73713)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale-table-musical.tex 2025-02-03 20:54:59 UTC (rev 73714)
@@ -1,4 +1,4 @@
-\ProvidesFile{fontscale-table-musical.tex}[2025-01-17]
+\ProvidesFile{fontscale-table-musical.tex}[2025-02-03]
\begin{table}
\centering
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.tex 2025-02-03 20:54:45 UTC (rev 73713)
+++ trunk/Master/texmf-dist/doc/latex/fontscale/fontscale.tex 2025-02-03 20:54:59 UTC (rev 73714)
@@ -14,7 +14,7 @@
Oliver Beery
-Version 3.0.6\quad{}17 January 2025
+Version 3.1.0\quad{}3 February 2025
\section{Introduction}
@@ -77,7 +77,7 @@
\end{itemize}
Unlike the standard \LaTeX{} document classes, the font size commands from \cs{tiny} to \cs{Huge} defined 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 use hooks, which are documented in the \LaTeXe{} kernel.
+If the user would like to add this functionality or perhaps other features to the font size commands, they can use hooks, which are documented in \pkg{lthooks} and \pkg{ltcmdhooks}.
\subsection{The font size parameters}
\label{subsec:fontsizeparameters}
@@ -84,11 +84,11 @@
When using the \pkg{fontscale} package, each font size, including the standard \LaTeX{} font size commands from \cs{tiny} to \cs{Huge}, has a font step, font scale, font size, and font baselineskip.
The latter two parameters are the familiar first and second arguments to \cs{fontsize}\marg{dimen}\marg{skip}.
-(The font baselineskip, stored in the kernel command \cs{f at baselineskip}, should not be confused with the paragraph baselineskip \cs{baselineskip}.)
+(The font baselineskip should not be confused with the paragraph baselineskip \cs{baselineskip}.)
The font scale and font step are different ways of describing the font size.
The font scale is the relative font size; the ratio of the font size to \cs{normalsize}, which has a font scale of \num{1}.
The font step is the number of font size gradations from \cs{normalsize}, which has a font step of \num{0}.
-Table~\ref{table:fontsteps} displays the font step of each font size command.
+Table \ref{table:fontsteps} displays the font step of each font size command.
\input{./fontscale-table-font-steps.tex}
@@ -96,8 +96,7 @@
\label{subsec:syntax}
This package defines some keys and commands that take as a value or argument a \meta{floating point expression}, \meta{integer expression}, \meta{dimen expression}, or \meta{skip expression}.
-This syntax has the same representation as the arguments to \cs{fpeval}, \cs{inteval}, \cs{dimeval}, and \cs{skipeval}, documented in \pkg{usrguide}.%
-\footnote{\url{https://ctan.org/pkg/usrguide}}
+This syntax has the same representation as the arguments to \cs{fpeval}, \cs{inteval}, \cs{dimeval}, and \cs{skipeval}, documented in \pkg{usrguide}.
\section{Keys}
@@ -111,7 +110,7 @@
{%
The key
\texorpdfstring
- {\texttt{typographic-scale}}
+ {\Key{typographic-scale}}
{typographic-scale}%
}
\label{subsec:typographicscale}
@@ -150,7 +149,7 @@
Setting the value of the key \Key{typographic-scale} to \Key{classic-10pt}, \Key{classic-11pt}, or \Key{classic-12pt} sets the font size of each font size command from \cs{tiny} to \cs{Huge} to values based on their position in the classic typographic scale.
The named point size\---\qtylist[list-final-separator={, or }]{10;11;12}{pt}\---is the font size of \cs{normalsize}.
The font sizes of the other font size commands are the adjacent font sizes in the classic typographic scale.
-Table~\ref{table:classic} displays the font size of each font size command when using a classic typographic scale.
+Table \ref{table:classic} displays the font size of each font size command when using a classic typographic scale.
\input{./fontscale-table-classic.tex}
@@ -173,7 +172,7 @@
\begin{equation}\label{eq:musical}
f_i = f_0 \times r ^ { i / n }
\end{equation}
-$f_i$ is the font size with font step~$i$.
+$f_i$ is the font size with font step $i$.
$f_0$ is the base font size.
$n$ is the number of musical notes\---the number of font size gradations or steps above $f_0$.
$r$ is the musical ratio, the ratio of the highest to the lowest note $ f_n / f_0 $.
@@ -185,7 +184,7 @@
The initial value is \num{2}.
The key \Key{musical\slash{}notes} sets the number of musical notes to the value of \meta{integer expression}.
The initial value is \num{5}.
-Table~\ref{table:musical} displays the font size of each font size command when using a musical typographic scale with the initial values.
+Table \ref{table:musical} displays the font size of each font size command when using a musical typographic scale with the initial values.
\input{./fontscale-table-musical.tex}
@@ -193,7 +192,7 @@
{%
The key
\texorpdfstring
- {\texttt{baselineskip-size-ratio}}
+ {\Key{baselineskip-size-ratio}}
{baselineskip-size-ratio}%
}
\label{subsec:baselineskipsizeratio}
@@ -278,7 +277,7 @@
Adding the optional star \sarg{} first resets all the \pkg{fontscale} package keys to their initial values.
The order of the keys in \meta{key$\,=\,$value list} does not affect how the keys are processed (unless a key is set more than once).
Can be used mid\-/document.
-The effect is local to the current group.
+The scope of the effect is local to the current group.
Does nothing, except issue a warning, if used in math mode.
\cs{fontscalesetup} should typically be used only once in the preamble or omitted if the user is satisfied with the initial font sizes and font baselineskips.
@@ -299,8 +298,8 @@
They can be used for printing or within calculations.
For clarity, \cs{CurrentFontStep} will be explained in detail.
-If the current font size equals the font size of any font size command from \cs{tiny} to \cs{Huge}, then \cs{CurrentFontStep} expands to the font step of that font size command (Table~\ref{table:fontsteps}).
-If not and if the value of the key \Key{typographic-scale} is \Value{musical}, \cs{CurrentFontStep} expands to the font step calculated from the musical typographic scale (Equation~\ref{eq:musical}).
+If the current font size equals the font size of any font size command from \cs{tiny} to \cs{Huge}, then \cs{CurrentFontStep} expands to the font step of that font size command (Table \ref{table:fontsteps}).
+If not and if the value of the key \Key{typographic-scale} is \Value{musical}, \cs{CurrentFontStep} expands to the font step calculated from the musical typographic scale (Equation \ref{eq:musical}).
Otherwise, the current font step is undefined and \cs{CurrentFontStep} expands to nothing.
\subsection{More font size commands}
@@ -320,7 +319,7 @@
\listheading{Three exceptions:}
\begin{itemize}
\item
- If the font step equals the font step of any font size command from \cs{tiny} to \cs{Huge} (Table~\ref{table:fontsteps}), then that font size command will be used directly.%
+ If the font step equals the font step of any font size command from \cs{tiny} to \cs{Huge} (Table \ref{table:fontsteps}), then that font size command will be used directly.%
\footnote
{%
\label{fn:setfontstep}%
@@ -329,7 +328,7 @@
\item
\cs{SetFontStep} will issue an error if the font step is undefined (as explained for \cs{CurrentFontStep} in \S\ref{subsec:expandable}).
The font step must equal the font step of any font size command from \cs{tiny} to \cs{Huge} unless the value of the key \Key{typographic-scale} is \Value{musical}.%
- \footnote{See Footnote~\ref{fn:setfontstep}.}
+ \footnote{See Footnote \ref{fn:setfontstep}.}
\cs{SetFontStep*} will always issue an error if the current font step is undefined.
\item
Does nothing, except issue a warning, if used in math mode.
@@ -423,7 +422,7 @@
\end{mydisplaycode}
Tests if the current font size equals the font size of any font size command from \cs{tiny} to \cs{Huge}.
-If so, prints the name of that font size command, including the backslash character.
+If so, prints the name of that font size command.
If not, prints \enquote{\string\undefined}.
Cannot be used in math mode.
Modified: trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty 2025-02-03 20:54:45 UTC (rev 73713)
+++ trunk/Master/texmf-dist/tex/latex/fontscale/fontscale.sty 2025-02-03 20:54:59 UTC (rev 73714)
@@ -1,15 +1,17 @@
-% Package : fontscale -- A flexible interface for setting font sizes
-% Copyright : 2024-2025 (c) Oliver Beery <beeryoliver at gmail.com>
-% CTAN : https://ctan.org/pkg/fontscale
-% Repository: https://github.com/beeryoliver/fontscale
-% License : The LaTeX Project Public License 1.3c
+%%% Package : fontscale -- A flexible interface for setting font sizes
+%%% Copyright : 2024-2025 (c) Oliver Beery <beeryoliver at gmail.com>
+%%% CTAN : https://ctan.org/pkg/fontscale
+%%% Repository: https://github.com/beeryoliver/fontscale
+%%% License : The LaTeX Project Public License 1.3c
+%%> \section{Loading the package}
+
% LaTeX2e version 2023-11-01 added \IfExplAtLeastTF.
\NeedsTeXFormat{LaTeX2e}[2023-11-01]
\ProvidesExplPackage
{fontscale}
- {2025-01-17}
- {3.0.6}
+ {2025-02-03}
+ {3.1.0}
{A flexible interface for setting font sizes}
% l3kernel version 2023-10-10 added many 'e'-variants.
@@ -26,7 +28,7 @@
% This package does not require any other packages!
-% MESSAGES
+%%> \section{Messages}
\msg_new:nnn { fontscale } { key-musical-base-out-of-bounds }
{
@@ -97,7 +99,7 @@
because~ the~ current~ font~ step~ is~ undefined~ \msg_line_context:.
}
-% SOME VARIABLES
+%%> \section{Some variables}
% Declares and initializes the font step, font scale, font size, and font
% baselineskip of each font size command from \tiny to \Huge.
@@ -186,15 +188,15 @@
\dim_new:N \l_fontscale_size_dim
\skip_new:N \l_fontscale_baselineskip_skip
-% For speed, \__fontscale_hook_selectfont: tries to avoid computing a floating
-% point expression by using \fp_set_eq:NN when the font size equals the font
-% size of any font size command from \tiny to \Huge. The case when the font
-% size equals that of \normalsize is optimized further because it is by far
-% the most common case. \f at size and \f at baselineskip are not used elsewhere in
-% the code.
+% For speed, \__fontscale_hook_code_selectfont: tries to avoid computing a
+% floating point expression by using \fp_set_eq:NN when the font size equals
+% the font size of any font size command from \tiny to \Huge. The case when
+% the font size equals that of \normalsize is optimized further because it is
+% by far the most common case. \f at size and \f at baselineskip are not used
+% elsewhere in the code.
\hook_gput_code:nnn { selectfont } { fontscale }
- { \__fontscale_hook_selectfont: }
-\cs_new_protected:Npn \__fontscale_hook_selectfont:
+ { \__fontscale_hook_code_selectfont: }
+\cs_new_protected:Npn \__fontscale_hook_code_selectfont:
{
\dim_set:Nn \l_fontscale_size_dim { \f at size pt }
\skip_set:Nn \l_fontscale_baselineskip_skip { \f at baselineskip }
@@ -203,9 +205,9 @@
\fp_set_eq:NN \l_fontscale_step_fp \c_fontscale_normalsize_step_fp
\fp_set_eq:NN \l_fontscale_scale_fp \c_fontscale_normalsize_scale_fp
}
- { \__fontscale_hook_selectfont_auxi: }
+ { \__fontscale_hook_code_selectfont_auxi: }
}
-\cs_new_protected:Npn \__fontscale_hook_selectfont_auxi:
+\cs_new_protected:Npn \__fontscale_hook_code_selectfont_auxi:
{
\dim_case:nnF { \l_fontscale_size_dim }
{
@@ -256,28 +258,28 @@
\fp_set_eq:NN \l_fontscale_scale_fp \l_fontscale_Huge_scale_fp
}
}
- { \__fontscale_hook_selectfont_auxii: }
+ { \__fontscale_hook_code_selectfont_auxii: }
}
-\cs_new_protected:Npn \__fontscale_hook_selectfont_auxii:
+\cs_new_protected:Npn \__fontscale_hook_code_selectfont_auxii:
{
\fp_set:Nn \l_fontscale_scale_fp
{
- \dim_to_fp:n { \l_fontscale_size_dim }
- / \l__fontscale_normalsize_size_fp
+ \dim_to_fp:n { \l_fontscale_size_dim } /
+ \l__fontscale_normalsize_size_fp
}
\str_if_eq:VnTF \l__fontscale_typographic_scale_str { musical }
{
\fp_set:Nn \l_fontscale_step_fp
{
- \l__fontscale_musical_selectfont_fp
- * ln
+ \l__fontscale_musical_selectfont_fp *
+ ln
(
\dim_compare:nNnTF \l__fontscale_musical_base_dim =
\l_fontscale_normalsize_size_dim
{ \l_fontscale_scale_fp }
{
- \dim_to_fp:n { \l_fontscale_size_dim }
- / \l__fontscale_musical_base_fp
+ \dim_to_fp:n { \l_fontscale_size_dim } /
+ \l__fontscale_musical_base_fp
}
)
}
@@ -294,16 +296,18 @@
\fp_const:Nn \c__fontscale_five_fp { 5 }
-% Scratch variable
-\fp_new:N \l__fontscale_tmp_fp
+% Scratch variables
+\dim_new:N \l__fontscale_tmp_dim
+\skip_new:N \l__fontscale_tmp_skip
+\fp_new:N \l__fontscale_tmp_fp
-% SOME FUNCTIONS
+%%> \section{Some functions}
% Variants of l3kernel functions
\cs_generate_variant:Nn \msg_error:nnnn { nnv , nne }
% Used to process user input. Sets an integer/dimen/skip variable from an
-% integer/dimen/skip expression and removes extra tokens. A default unit of
-% 'pt' is appended in the dimen/skip expressions.
+% integer/dimen/skip expression and removes extra trailing tokens, if any. A
+% default unit of 'pt' is appended in the dimen and skip expressions.
\cs_new_protected:Npn \__fontscale_int_set_from_user:Nn #1#2
{
\afterassignment \use_none_delimit_by_q_stop:w
@@ -313,7 +317,7 @@
\cs_new_protected:Npn \__fontscale_dim_set_from_user:Nn #1#2
{
\afterassignment \use_none_delimit_by_q_stop:w
- #1 = \dimexpr #2 pt \relax \relax
+ #1 = \dimexpr #2 pt \relax
\q_stop
}
\cs_generate_variant:Nn \__fontscale_dim_set_from_user:Nn { c }
@@ -327,17 +331,13 @@
% Argument processors
\cs_new_protected:Npn \__fontscale_arg_process_dim:n #1
{
- \group_begin:
- \__fontscale_dim_set_from_user:Nn \l_tmpa_dim {#1}
- \exp_args:NNNV \group_end:
- \tl_set:Nn \ProcessedArgument \l_tmpa_dim
+ \__fontscale_dim_set_from_user:Nn \l__fontscale_tmp_dim {#1}
+ \tl_set:NV \ProcessedArgument \l__fontscale_tmp_dim
}
\cs_new_protected:Npn \__fontscale_arg_process_skip:n #1
{
- \group_begin:
- \__fontscale_skip_set_from_user:Nn \l_tmpa_skip {#1}
- \exp_args:NNNV \group_end:
- \tl_set:Nn \ProcessedArgument \l_tmpa_skip
+ \__fontscale_skip_set_from_user:Nn \l__fontscale_tmp_skip {#1}
+ \tl_set:NV \ProcessedArgument \l__fontscale_tmp_skip
}
% Used to define \tiny to \Huge. Sets \@currsize only for compatibility. Need
% \dim_use:N only for compatibility with versions of the microtype package
@@ -387,12 +387,14 @@
\cs_new:Npn \__fontscale_fp_eval_round:n #1
{ \fp_eval:n { round ( #1 , \c__fontscale_five_fp ) } }
-% DEFINE KEYS
+%%> \section{Define keys}
+% Variables not defined with \keys_define:nn.
\str_new:N \l__fontscale_typographic_scale_str
\dim_new:N \l__fontscale_musical_base_dim
\int_new:N \l__fontscale_musical_notes_int
+% Used to define .code:n keys.
\cs_new_protected:Npn \__fontscale_keys_code_musical_base:
{
\__fontscale_dim_set_from_user:Nn \l__fontscale_musical_base_dim
@@ -592,6 +594,8 @@
, Huge .value_required:n = true
}
+%%> \section{Initialize and pre-compile keys}
+
% Pre-compiles the keys with their initial values and then sets the keys to
% their initial values. This is significantly faster than using .initial:n and
% \keys_precompile:nnN. The special value of \q_no_value is used to test if the
@@ -642,7 +646,7 @@
}
\__fontscale_keys_set_initial:
-% SET AND PROCESS KEYS
+%%> \section{Set and process keys}
\NewDocumentCommand \fontscalesetup { s m }
{
@@ -730,8 +734,8 @@
{
\fp_to_dim:n
{
- \l__fontscale_normalsize_size_fp
- * \l__fontscale_baselineskip_size_ratio_fp
+ \l__fontscale_normalsize_size_fp *
+ \l__fontscale_baselineskip_size_ratio_fp
}
}
}
@@ -792,9 +796,8 @@
{
\fp_to_dim:n
{
- \l__fontscale_musical_base_fp * \l__fontscale_musical_ratio_fp
- ^ ( \use:c { c_fontscale_#1_step_fp }
- / \l__fontscale_musical_notes_fp )
+ \l__fontscale_musical_base_fp * \l__fontscale_musical_ratio_fp ^
+ ( \use:c { c_fontscale_#1_step_fp } / \l__fontscale_musical_notes_fp )
}
}
% Sets the font size, font scale, and font baselineskip of the other font size
@@ -828,8 +831,8 @@
{ \int_use:N \l__fontscale_musical_notes_int }
\fp_set:Nn \l__fontscale_musical_selectfont_fp
{
- \int_use:N \l__fontscale_musical_notes_int
- / ln ( \l__fontscale_musical_ratio_fp )
+ \int_use:N \l__fontscale_musical_notes_int /
+ ln ( \l__fontscale_musical_ratio_fp )
}
}
}
@@ -848,8 +851,8 @@
{
\fp_to_dim:n
{
- \l__fontscale_normalsize_size_fp
- * ( \use:c { l__fontscale_#1_scale_tl } )
+ \l__fontscale_normalsize_size_fp *
+ ( \use:c { l__fontscale_#1_scale_tl } )
}
}
\dim_compare:nNnF { \use:c { l_fontscale_#1_size_dim } } > \c_zero_dim
@@ -888,8 +891,8 @@
\prg_break_point:
\fp_set:cn { l_fontscale_#1_scale_fp }
{
- \dim_to_fp:n { \use:c { l_fontscale_#1_size_dim } }
- / \l__fontscale_normalsize_size_fp
+ \dim_to_fp:n { \use:c { l_fontscale_#1_size_dim } } /
+ \l__fontscale_normalsize_size_fp
}
\quark_if_no_value:cTF { l__fontscale_#1_baselineskip_tl }
{
@@ -897,8 +900,8 @@
{
\fp_to_dim:n
{
- \dim_to_fp:n { \use:c { l_fontscale_#1_size_dim } }
- * \l__fontscale_baselineskip_size_ratio_fp
+ \dim_to_fp:n { \use:c { l_fontscale_#1_size_dim } } *
+ \l__fontscale_baselineskip_size_ratio_fp
}
}
}
@@ -926,7 +929,7 @@
{ \msg_warning:nn { fontscale } { font-sizes-out-of-order } }
}
-% DOCUMENT COMMANDS
+%%> \section{Document commands}
% Defines the standard LaTeX font size commands from \tiny to \Huge and
% initializes to \normalsize. Their internal functions are not used elsewhere
@@ -1131,9 +1134,9 @@
{
\fp_to_dim:n
{
- \l__fontscale_musical_base_fp
- * \l__fontscale_musical_ratio_fp
- ^ ( \l__fontscale_tmp_fp / \l__fontscale_musical_notes_fp )
+ \l__fontscale_musical_base_fp *
+ \l__fontscale_musical_ratio_fp ^
+ ( \l__fontscale_tmp_fp / \l__fontscale_musical_notes_fp )
}
}
}
@@ -1201,8 +1204,8 @@
{
\fp_to_dim:n
{
- \l__fontscale_tmp_fp
- * \dim_to_fp:n { \l_fontscale_baselineskip_skip }
+ \l__fontscale_tmp_fp *
+ \dim_to_fp:n { \l_fontscale_baselineskip_skip }
}
}
}
@@ -1247,8 +1250,10 @@
{ \__fontscale_print_font_size_parameters: }
\cs_new_protected:Npn \__fontscale_print_font_size_parameters:
{
- step~ =~ \fp_if_nan:nF { \l_fontscale_step_fp }
- { \__fontscale_fp_eval_round:n { \l_fontscale_step_fp } } ,~
+ step~ =~
+ \fp_if_nan:nF { \l_fontscale_step_fp }
+ { \__fontscale_fp_eval_round:n { \l_fontscale_step_fp } }
+ ,~
scale~ =~ \__fontscale_fp_eval_round:n { \l_fontscale_scale_fp } ,~
size~ =~ \dim_use:N \l_fontscale_size_dim ,~
baselineskip~ =~ \skip_use:N \l_fontscale_baselineskip_skip
@@ -1273,12 +1278,14 @@
{
\token_to_str:c {##1} \@ \c_colon_str \c_space_tl
step~ =~ \fp_use:c { c_fontscale_##1_step_fp } ,~
- scale~ =~ \str_if_eq:nnTF {##1} { normalsize } { 1 }
+ scale~ =~
+ \str_if_eq:nnTF {##1} { normalsize }
+ { 1 }
{
\__fontscale_fp_eval_round:n
{ \use:c { l_fontscale_##1_scale_fp } }
}
- ,~
+ ,~
size~ =~ \dim_use:c { l_fontscale_##1_size_dim } ,~
baselineskip~ =~ \skip_use:c { l_fontscale_##1_baselineskip_skip }
\str_if_eq:nnF {##1} { Huge } { \newline }
@@ -1352,7 +1359,7 @@
\@
}
-% TEXT PURIFY
+%%> \section{Purifying text}
\NewExpandableDocumentCommand \__fontscale_use_none_sm:w { s m } { }
\tl_map_inline:nn
More information about the tex-live-commits
mailing list.