summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/fontscale/CHANGELOG.md8
-rw-r--r--macros/latex/contrib/fontscale/beery.cls28
-rw-r--r--macros/latex/contrib/fontscale/fontscale-table-classic.tex2
-rw-r--r--macros/latex/contrib/fontscale/fontscale-table-font-steps.tex2
-rw-r--r--macros/latex/contrib/fontscale/fontscale-table-musical.tex2
-rw-r--r--macros/latex/contrib/fontscale/fontscale.pdfbin104110 -> 104879 bytes
-rw-r--r--macros/latex/contrib/fontscale/fontscale.sty137
-rw-r--r--macros/latex/contrib/fontscale/fontscale.tex41
8 files changed, 123 insertions, 97 deletions
diff --git a/macros/latex/contrib/fontscale/CHANGELOG.md b/macros/latex/contrib/fontscale/CHANGELOG.md
index e330a07eb7..46a32e8fc9 100644
--- a/macros/latex/contrib/fontscale/CHANGELOG.md
+++ b/macros/latex/contrib/fontscale/CHANGELOG.md
@@ -7,6 +7,14 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
## [Unreleased]
+## [v2.1.0] - 2024-08-12
+
+### Changed
+- Documentation improvements.
+
+### Added
+- `\CurrentFontSizeCommand`
+
## [v2.0.0] - 2024-08-02
### Changed
diff --git a/macros/latex/contrib/fontscale/beery.cls b/macros/latex/contrib/fontscale/beery.cls
index 45a3b95982..f2fd7fd2c5 100644
--- a/macros/latex/contrib/fontscale/beery.cls
+++ b/macros/latex/contrib/fontscale/beery.cls
@@ -4,7 +4,7 @@
\NeedsTeXFormat{LaTeX2e}[2023-11-01]
\ProvidesExplClass
{beery}
- {2024-08-02}
+ {2024-08-12}
{}
{}
@@ -23,7 +23,8 @@
% CUSTOM MACROS
-\NewExpandableDocumentCommand \alphabet { } { abcdefghijklmnopqrstuvwxyz }
+\tl_const:Nn \c_beery_alphabet_tl { abcdefghijklmnopqrstuvwxyz }
+\NewExpandableDocumentCommand \alphabet { } { \c_beery_alphabet_tl }
\NewDocumentCommand \Key { m o o }
{
\mode_leave_vertical:
@@ -73,7 +74,7 @@
% PAGE STYLE
-\hbox_set:Nn \l__beery_tmp_box { abcdefghijklmnopqrstuvwxyz }
+\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
@@ -126,7 +127,8 @@
\nonfrenchspacing
\linespread { 1 }
-\RequirePackage [ skip = \c_beery_medium_skip ] { parskip }
+\skip_set_eq:NN \parskip \c_beery_medium_skip
+\dim_zero:N \parindent
\RequirePackage [ raggedrightboxes ] { ragged2e }
\skip_set:Nn \RaggedRightRightskip { 0pt plus 0.5 \linewidth }
\dim_zero:N \RaggedRightParindent
@@ -150,19 +152,21 @@
\titlespacing* \section % section
{ 0pt } % indent
{
- \c_beery_big_dim
+ - \parskip
+ + \c_beery_big_dim
plus \fp_eval:n { 1 / 2 * 4 } \c_beery_big_dim
minus \fp_eval:n { 1 / 3 / 4 } \c_beery_big_dim
} % before
- { \c_beery_medium_skip } % after
+ { - \parskip + \c_beery_medium_skip } % after
\titlespacing* \subsection
{ 0pt }
{
- \fp_eval:n { 4 / 3 } \c_beery_medium_dim
+ - \parskip
+ + \fp_eval:n { 4 / 3 } \c_beery_medium_dim
plus \fp_eval:n { 1 / 2 * 4 } \c_beery_medium_dim
minus \fp_eval:n { 1 / 3 / 4 } \c_beery_medium_dim
}
- { \c_beery_medium_skip }
+ { - \parskip + \c_beery_medium_skip }
\titleformat \section % section
[ block ] % shape
@@ -202,7 +206,10 @@
{
\par
\IfBooleanTF #1
- { \int_compare:nNnT { \prevgraf } = { 1 } { \nobreak \@afterheading } }
+ {
+ \int_compare:nNnT { \prevgraf } = { 1 }
+ { \nobreak \@afterheading }
+ }
{ \nobreak \@afterheading }
}
\NewDocumentCommand \listheading { m }
@@ -210,7 +217,8 @@
\par
#1
\par
- \int_compare:nNnT { \prevgraf } = { 1 } { \nobreak \@afterheading }
+ \int_compare:nNnT { \prevgraf } = { 1 }
+ { \nobreak \@afterheading }
\vspace { \skip_eval:n { \c_beery_small_skip - \parskip } }
}
diff --git a/macros/latex/contrib/fontscale/fontscale-table-classic.tex b/macros/latex/contrib/fontscale/fontscale-table-classic.tex
index b1d98834c6..50ff413e36 100644
--- a/macros/latex/contrib/fontscale/fontscale-table-classic.tex
+++ b/macros/latex/contrib/fontscale/fontscale-table-classic.tex
@@ -1,6 +1,6 @@
\ProvidesFile
{fontscale-table-classic.tex}
- [2024-08-02]
+ [2024-08-12]
\begin{table}
\centering
diff --git a/macros/latex/contrib/fontscale/fontscale-table-font-steps.tex b/macros/latex/contrib/fontscale/fontscale-table-font-steps.tex
index 7b0a7fca87..5b20f18681 100644
--- a/macros/latex/contrib/fontscale/fontscale-table-font-steps.tex
+++ b/macros/latex/contrib/fontscale/fontscale-table-font-steps.tex
@@ -1,6 +1,6 @@
\ProvidesFile
{fontscale-table-font-steps.tex}
- [2024-08-02]
+ [2024-08-12]
\begin{table}
\centering
diff --git a/macros/latex/contrib/fontscale/fontscale-table-musical.tex b/macros/latex/contrib/fontscale/fontscale-table-musical.tex
index aac7c60ebc..e6a6ca5ce0 100644
--- a/macros/latex/contrib/fontscale/fontscale-table-musical.tex
+++ b/macros/latex/contrib/fontscale/fontscale-table-musical.tex
@@ -1,6 +1,6 @@
\ProvidesFile
{fontscale-table-musical.tex}
- [2024-08-02]
+ [2024-08-12]
\begin{table}
\centering
diff --git a/macros/latex/contrib/fontscale/fontscale.pdf b/macros/latex/contrib/fontscale/fontscale.pdf
index 0ac3be30ee..adcd809134 100644
--- a/macros/latex/contrib/fontscale/fontscale.pdf
+++ b/macros/latex/contrib/fontscale/fontscale.pdf
Binary files differ
diff --git a/macros/latex/contrib/fontscale/fontscale.sty b/macros/latex/contrib/fontscale/fontscale.sty
index 314c337e3e..70bfae6026 100644
--- a/macros/latex/contrib/fontscale/fontscale.sty
+++ b/macros/latex/contrib/fontscale/fontscale.sty
@@ -8,8 +8,8 @@
\NeedsTeXFormat{LaTeX2e}[2023-11-01]
\ProvidesExplPackage
{fontscale}
- {2024-08-02}
- {2.0.0}
+ {2024-08-12}
+ {2.1.0}
{A flexible interface for setting font sizes}
% l3kernel version 2023-10-10 added many 'e'-variants.
@@ -117,6 +117,7 @@
% Scratch variables
\tl_new:N \l__fontscale_tmp_tl
+\str_new:N \l__fontscale_tmp_str
\dim_new:N \l__fontscale_tmp_dim
\fp_new:N \l__fontscale_tmp_fp
@@ -284,7 +285,8 @@
The~ font~ step~
\msg_line_context: \c_space_tl
must~ equal~ an~ integer~ from~ -4~ to~ 5,~
- unless~ the~ value~ of~ the~ key~ 'typographic-scale'~ is~ 'musical'.
+ unless~ the~ value~ of~ the~ key~ 'typographic-scale'~ is~ 'musical'.~
+ \msg_see_documentation_text:n { fontscale }
}
\msg_new:nnn { fontscale } { current-font-step-out-of-bounds }
{
@@ -940,6 +942,65 @@
{ \__fontscale_baselineskip: }
\cs_new:Npn \__fontscale_baselineskip: { \f@baselineskip }
+\NewExpandableDocumentCommand \CurrentFontSizeCommand { }
+ { \__fontscale_name: }
+\cs_new:Npn \__fontscale_name:
+ {
+ \dim_case:nn { \f@size pt }
+ {
+ { \l_fontscale_tiny_size_dim }
+ {
+ \skip_if_eq:nnT { \l_fontscale_tiny_baselineskip_skip }
+ { \f@baselineskip } { tiny }
+ }
+ { \l_fontscale_scriptsize_size_dim }
+ {
+ \skip_if_eq:nnT { \l_fontscale_scriptsize_baselineskip_skip }
+ { \f@baselineskip } { scriptsize }
+ }
+ { \l_fontscale_footnotesize_size_dim }
+ {
+ \skip_if_eq:nnT { \l_fontscale_footnotesize_baselineskip_skip }
+ { \f@baselineskip } { footnotesize }
+ }
+ { \l_fontscale_small_size_dim }
+ {
+ \skip_if_eq:nnT { \l_fontscale_small_baselineskip_skip }
+ { \f@baselineskip } { small }
+ }
+ { \l_fontscale_normalsize_size_dim }
+ {
+ \skip_if_eq:nnT { \l_fontscale_normalsize_baselineskip_skip }
+ { \f@baselineskip } { normalsize }
+ }
+ { \l_fontscale_large_size_dim }
+ {
+ \skip_if_eq:nnT { \l_fontscale_large_baselineskip_skip }
+ { \f@baselineskip } { large }
+ }
+ { \l_fontscale_Large_size_dim }
+ {
+ \skip_if_eq:nnT { \l_fontscale_Large_baselineskip_skip }
+ { \f@baselineskip } { Large }
+ }
+ { \l_fontscale_LARGE_size_dim }
+ {
+ \skip_if_eq:nnT { \l_fontscale_LARGE_baselineskip_skip }
+ { \f@baselineskip } { LARGE }
+ }
+ { \l_fontscale_huge_size_dim }
+ {
+ \skip_if_eq:nnT { \l_fontscale_huge_baselineskip_skip }
+ { \f@baselineskip } { huge }
+ }
+ { \l_fontscale_Huge_size_dim }
+ {
+ \skip_if_eq:nnT { \l_fontscale_Huge_baselineskip_skip }
+ { \f@baselineskip } { Huge }
+ }
+ }
+ }
+
\NewDocumentCommand \SetFontStep { s m }
{
\mode_if_math:TF
@@ -1204,72 +1265,10 @@
}
\cs_new_protected:Npn \__fontscale_print_name:
{
- \dim_case:nn { \f@size pt }
- {
- { \l_fontscale_tiny_size_dim }
- {
- \skip_if_eq:nnT { \f@baselineskip }
- { \l_fontscale_tiny_baselineskip_skip }
- { \token_to_str:N \tiny \prg_break: }
- }
- { \l_fontscale_scriptsize_size_dim }
- {
- \skip_if_eq:nnT { \f@baselineskip }
- { \l_fontscale_scriptsize_baselineskip_skip }
- { \token_to_str:N \scriptsize \prg_break: }
- }
- { \l_fontscale_footnotesize_size_dim }
- {
- \skip_if_eq:nnT { \f@baselineskip }
- { \l_fontscale_footnotesize_baselineskip_skip }
- { \token_to_str:N \footnotesize \prg_break: }
- }
- { \l_fontscale_small_size_dim }
- {
- \skip_if_eq:nnT { \f@baselineskip }
- { \l_fontscale_small_baselineskip_skip }
- { \token_to_str:N \small \prg_break: }
- }
- { \l_fontscale_normalsize_size_dim }
- {
- \skip_if_eq:nnT { \f@baselineskip }
- { \l_fontscale_normalsize_baselineskip_skip }
- { \token_to_str:N \normalsize \prg_break: }
- }
- { \l_fontscale_large_size_dim }
- {
- \skip_if_eq:nnT { \f@baselineskip }
- { \l_fontscale_large_baselineskip_skip }
- { \token_to_str:N \large \prg_break: }
- }
- { \l_fontscale_Large_size_dim }
- {
- \skip_if_eq:nnT { \f@baselineskip }
- { \l_fontscale_Large_baselineskip_skip }
- { \token_to_str:N \Large \prg_break: }
- }
- { \l_fontscale_LARGE_size_dim }
- {
- \skip_if_eq:nnT { \f@baselineskip }
- { \l_fontscale_LARGE_baselineskip_skip }
- { \token_to_str:N \LARGE \@ \prg_break: }
- }
- { \l_fontscale_huge_size_dim }
- {
- \skip_if_eq:nnT { \f@baselineskip }
- { \l_fontscale_huge_baselineskip_skip }
- { \token_to_str:N \huge \prg_break: }
- }
- { \l_fontscale_Huge_size_dim }
- {
- \skip_if_eq:nnT { \f@baselineskip }
- { \l_fontscale_Huge_baselineskip_skip }
- { \token_to_str:N \Huge \prg_break: }
- }
- }
- \token_to_str:N \undefined
- \prg_break:
- \prg_break_point:
+ \str_set:Ne \l__fontscale_tmp_str { \__fontscale_name: }
+ \str_if_empty:NTF \l__fontscale_tmp_str
+ { \token_to_str:N \undefined }
+ { \c_backslash_str \l__fontscale_tmp_str \@ }
}
% TEXT PURIFY
diff --git a/macros/latex/contrib/fontscale/fontscale.tex b/macros/latex/contrib/fontscale/fontscale.tex
index 9178542c3a..3737afe5b6 100644
--- a/macros/latex/contrib/fontscale/fontscale.tex
+++ b/macros/latex/contrib/fontscale/fontscale.tex
@@ -14,7 +14,7 @@ A flexible interface for setting font sizes
Oliver Beery
-Version 2.0.0\quad{}2 August 2024
+Version 2.1.0\quad{}12 August 2024
\section{Introduction}
@@ -32,9 +32,9 @@ Version 2.0.0\quad{}2 August 2024
\item
Set the font sizes and font baselineskips of the standard \LaTeX{} font size commands mid\-/document or within a local group (\S\ref{subsec:fontscalesetup}).
\item
- Provides expandable commands that expand to the current font step, font scale, font size, or font baselineskip (\S\ref{subsec:expandable}).
+ Provides expandable commands that expand to the current font step, font scale, font size, font baselineskip, or font size command (\S\ref{subsec:expandable}).
\item
- Provides additional font size commands, including setting the font size by setting the font step or font scale and setting the font size relative to the current font size using more powerful tools than the \pkg{relsize} package (\S\ref{subsec:fontsize}).
+ Provides additional font size commands, including setting the font size by setting the font step or font scale and setting the font size relative to the current font size using more powerful tools than the \pkg{scalefnt} and \pkg{relsize} packages (\S\ref{subsec:fontsize}).
\item
For \LaTeX3 programmers, this package defines public \pkg{expl3} variables that store the font step, font scale, font size, and font baselineskip of each font size command from \cs{tiny} to \cs{Huge} (\S\ref{sec:programming}).
\end{itemize}
@@ -42,7 +42,7 @@ Version 2.0.0\quad{}2 August 2024
\subsection{Loading the package}
\label{subsec:loading}
-\listheading{The \pkg{fontscale} package requires:}
+\listheading{Requirements:}
\begin{itemize}
\item \LaTeXe{} version 2023-11-01 or newer
\item \pkg{l3kernel} version 2023-10-10 or newer
@@ -58,6 +58,8 @@ Alternatively, you can use the Latin Modern font by loading the \pkg{lmodern} pa
The \pkg{fontscale} package has no package options.
Instead, this package provides the command \cs{fontscalesetup}\marg{key\-/value list} (\S\ref{subsec:fontscalesetup}) which sets the package keys (\S\ref{sec:keys}).
+When loaded, this package uses \cs{normalsize} after defining and initializing the font size commands from \cs{tiny} to \cs{Huge}.
+
Many \LaTeX{} document classes have a font size option (e.g.\@ \Key{10pt}, \Key{11pt}, \Key{12pt}) 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.
For this reason, you may want to set the document class font size option close to the font size of \cs{normalsize} set by this package.
@@ -73,8 +75,6 @@ For this reason, you may want to set the document class font size option close t
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.
-When loaded, this package uses \cs{normalsize} after initializing the font size commands from \cs{tiny} to \cs{Huge}.
-
\subsection{The font size parameters}
\label{subsec:fontsizeparameters}
@@ -180,9 +180,9 @@ The font baselineskips of the font size commands from \cs{tiny} to \cs{Huge} are
\Key{baselineskip-size-ratio}[\meta{floating point expression}][1.2]
\KeepNextPar*
-Sets the ratio of the font baselineskip to the font size to the result of computing the \meta{floating point expression}.
-The font baselineskip of each font size command equals its font size times this number.
-The value of this key must be at least \num{1}.
+Sets the font baselineskip of each font size command from \cs{tiny} to \cs{Huge} equal to its font size \texttimes{} the result of computing the \meta{floating point expression}.
+Sets the font baselineskip set by \cs{SetFontStep}, \cs{SetFontScale}, and \cs{SetFontSize} (\S\ref{subsec:fontsize}) equal to the new font size \texttimes{} the result of computing the \meta{floating point expression}.
+The font baselineskip must be greater than or equal to the font size.
\subsection{Overwriting the previous keys}
@@ -210,7 +210,7 @@ Overwrites the font size set by the keys \Key{typographic\-/scale} and \Key{\met
\KeepNextPar*
Sets the font baselineskip of \meta{font size command} to the value of \meta{skip expression}, appending a default unit of \unit{pt}.
-The font baselineskip of \meta{font size command} must be greater than or equal to its font size.
+The font baselineskip must be greater than or equal to the font size.
Overwrites the font baselineskip set by the key \Key{baselineskip\-/size\-/ratio}.
\Key{\meta{font size command}}[\meta{dimen expression}]
@@ -234,13 +234,14 @@ This section documents the commands provided by the \pkg{fontscale} package.
\KeepNextPar*
Sets and processes the \pkg{fontscale} package keys (\S\ref{sec:keys}) in \meta{key\-/value list} and then uses \cs{normalsize}.
-Adding the optional star first resets the keys to their initial values.
+Adding the optional star first resets all the \pkg{fontscale} package keys to their initial values.
+The order of the keys in \meta{key\-/value list} does not matter.
Can be used mid\-/document.
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.
-\subsection{Expandable font size parameters}
+\subsection{Expandable commands}
\label{subsec:expandable}
\cs{CurrentFontStep}
@@ -266,6 +267,15 @@ The low\-/level font command \cs{fontsize}\marg{dimen}\marg{skip} sets \cs{f@siz
This means that, if used in \meta{skip}, \cs{CurrentFontStep}, \cs{CurrentFontScale}, and \cs{CurrentFontSize} will expand to the new value\---unless they are first expanded.
This package provides \cs{SetFontSizeBaselineskip} as an alternative to \cs{fontsize} + \cs{selectfont} that avoids this issue (\S\ref{subsec:fontsize}).
+\cs{CurrentFontSizeCommand}
+\KeepNextPar*
+
+Tests if the current font size and current font baselineskip equal the font size and font baselineskip, respectively, of any font size command from \cs{tiny} to \cs{Huge}.
+If so, expands to the name of that font size command.
+This omits the backslash character and leaves only letters with catcode \num{11}.
+If not, expands to nothing.
+This package also provides a similar command \cs{PrintFontSizeCommand} (\S\ref{subsec:debug}), which is not expandable and includes the backslash character.
+
\subsection{More font size commands}
\label{subsec:fontsize}
@@ -282,10 +292,10 @@ Sets the font baselineskip equal to the new font size \texttimes{} the value of
\listheading{Three exceptions:}
\begin{itemize}
\item
- The font step must equal an integer from \num{-4} to \num{5} unless the value of the key \Key{typographic\-/scale} is \Value{musical}.
+ The font step must equal the font step of any font size command from \cs{tiny} to \cs{Huge} (Table~\ref{table:fontsteps}) unless the value of the key \Key{typographic\-/scale} is \Value{musical}.
\cs{SetFontStep} will issue an error if the font step is undefined (as explained for \cs{CurrentFontStep} in \S\ref{subsec:expandable}).
\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}, then that font size command will be used directly.
\item
Does nothing, except issue a warning, if used in math mode.
\end{itemize}
@@ -353,12 +363,13 @@ One useful way of printing example text is \cs{PrintSampleText}\allowbreak\textt
Tests if the current font size and current font baselineskip equal the font size and font baselineskip, respectively, 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 not, prints \enquote{\string\undefined}.
+This package also provides a similar command \cs{CurrentFontSizeCommand} (\S\ref{subsec:expandable}), which is expandable and omits the backslash character.
\section{Programming}
\label{sec:programming}
-This section is for \LaTeX3 programmers.
+This section documents the \pkg{expl3} programming support provided by the \pkg{fontscale} package.
\subsection
{%