diff options
author | Karl Berry <karl@freefriends.org> | 2021-02-06 22:32:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-02-06 22:32:42 +0000 |
commit | f79993ce1baaff40acde1ac02130abefc6b0e0ef (patch) | |
tree | 7c20531c9b80df2ec73181eefd999046f80ac01b /Master/texmf-dist/tex | |
parent | 39378a05890e8acd64706acf9e74410d82bf96a1 (diff) |
fontsize (6feb21)
git-svn-id: svn://tug.org/texlive/trunk@57648 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/fontsize/fontsize.sty | 329 |
1 files changed, 286 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/latex/fontsize/fontsize.sty b/Master/texmf-dist/tex/latex/fontsize/fontsize.sty index c87b7ad2a00..e161d7f6049 100644 --- a/Master/texmf-dist/tex/latex/fontsize/fontsize.sty +++ b/Master/texmf-dist/tex/latex/fontsize/fontsize.sty @@ -26,10 +26,10 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{fontsize} - [2021/01/31 v0.5 'fontsize' package. Set main font sizes (Ivan Valbusa)] + [2021/02/06 v0.6 'fontsize' package. Set main font sizes (Ivan Valbusa)] \@ifpackageloaded{xkeyval}{}{\RequirePackage{xkeyval}} \@ifpackageloaded{etoolbox}{}{\RequirePackage{etoolbox}} -\DeclareOptionX{cloname}[custom]{\def\@fontsizefilebase{#1}} +\DeclareOptionX{cloname}[fontsize]{\def\@fontsizefilebase{#1}} \DeclareOptionX{fontsize}[10]{% \expandafter\@defaultunits\expandafter\@tempdima#1 pt\relax\@nnil \edef\@tempa{#1}% @@ -191,23 +191,136 @@ \noexpand\@setfontsize\noexpand\Huge {\the\@tempdima}{\the\@tempdimb}% }% + \def\fontsize@pre{% + \ctm@setlength{\abovedisplayskip}% + {.8333\@tempdimb}{.1667\@tempdimb}{.5\@tempdimb}% + \ctm@setlength{\abovedisplayshortskip}{\z@}{.25\@tempdimb}{\z@}% + \ctm@setlength{\belowdisplayshortskip}% + {.5\@tempdimb}{.25\@tempdimb}{.25\@tempdimb}% + \setlength{\belowdisplayskip}{\abovedisplayskip}% + } + \def\fontsize@app{% + \abovedisplayskip \the\abovedisplayskip + \abovedisplayshortskip \the\abovedisplayshortskip + \belowdisplayskip \the\belowdisplayskip + \belowdisplayshortskip \the\belowdisplayshortskip + } + \setlength{\@tempdima}{0.934375\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \fontsize@pre + \edef\smallr{% + \noexpand\@setfontsize\noexpand\smallr + {\the\@tempdima}{\the\@tempdimb}% + \fontsize@app + \let\noexpand\@listi\noexpand\@listi@small + }% + \setlength{\@tempdima}{0.95625\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \fontsize@pre + \edef\smallrr{% + \noexpand\@setfontsize\noexpand\smallrr + {\the\@tempdima}{\the\@tempdimb}% + \fontsize@app + \let\noexpand\@listi\noexpand\@listi@small + }% + \setlength{\@tempdima}{0.978125\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \fontsize@pre + \edef\smallrrr{% + \noexpand\@setfontsize\noexpand\smallrrr + {\the\@tempdima}{\the\@tempdimb}% + \fontsize@app + \let\noexpand\@listi\noexpand\@listi@small + }% + \setlength{\@tempdima}{0.85313\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \fontsize@pre + \edef\footnotesizer{% + \noexpand\@setfontsize\noexpand\footnotesizer + {\the\@tempdima}{\the\@tempdimb}% + \fontsize@app + \let\noexpand\@listi\noexpand\@listi@footnotesize + }% + \setlength{\@tempdima}{0.87292\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \fontsize@pre + \edef\footnotesizerr{% + \noexpand\@setfontsize\noexpand\footnotesizerr + {\the\@tempdima}{\the\@tempdimb}% + \fontsize@app + \let\noexpand\@listi\noexpand\@listi@footnotesize + }% + \setlength{\@tempdima}{0.89271\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \fontsize@pre + \edef\footnotesizerrr{% + \noexpand\@setfontsize\noexpand\footnotesizerrr + {\the\@tempdima}{\the\@tempdimb}% + \fontsize@app + \let\noexpand\@listi\noexpand\@listi@footnotesize + }% + \setlength{\@tempdima}{0.7083375\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \edef\scriptsizer{% + \noexpand\@setfontsize\noexpand\scriptsizer + {\the\@tempdima}{\the\@tempdimb}% + }% + \setlength{\@tempdima}{0.750005\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \edef\scriptsizerr{% + \noexpand\@setfontsize\noexpand\scriptsizerr + {\the\@tempdima}{\the\@tempdimb}% + }% + \setlength{\@tempdima}{0.7916725\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \edef\scriptsizerrr{% + \noexpand\@setfontsize\noexpand\scriptsizerrr + {\the\@tempdima}{\the\@tempdimb}% + }% + \setlength{\@tempdima}{0.5416675\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \edef\tinyr{% + \noexpand\@setfontsize\noexpand\tinyr + {\the\@tempdima}{\the\@tempdimb}% + }% + \setlength{\@tempdima}{0.583335\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \edef\tinyrr{% + \noexpand\@setfontsize\noexpand\tinyrr + {\the\@tempdima}{\the\@tempdimb}% + }% + \setlength{\@tempdima}{0.6250025\@tempdimc}% + \setlength{\@tempdimb}{\@tempb\@tempdima}% + \edef\tinyrrr{% + \noexpand\@setfontsize\noexpand\tinyrrr + {\the\@tempdima}{\the\@tempdimb}% + }% \setlength{\@tempdima}{1.05\@tempdimc}% \setlength{\@tempdimb}{\@tempb\@tempdima}% + \fontsize@pre \edef\normalsizer{% \noexpand\@setfontsize\noexpand\normalsizer {\the\@tempdima}{\the\@tempdimb}% + \fontsize@app + \let\noexpand\@listi\noexpand\@listI }% \setlength{\@tempdima}{1.1\@tempdimc}% \setlength{\@tempdimb}{\@tempb\@tempdima}% + \fontsize@pre \edef\normalsizerr{% \noexpand\@setfontsize\noexpand\normalsizerr {\the\@tempdima}{\the\@tempdimb}% + \fontsize@app + \let\noexpand\@listi\noexpand\@listI }% \setlength{\@tempdima}{1.15\@tempdimc}% \setlength{\@tempdimb}{\@tempb\@tempdima}% \edef\normalsizerrr{% + \fontsize@pre \noexpand\@setfontsize\noexpand\normalsizerrr {\the\@tempdima}{\the\@tempdimb}% + \fontsize@app + \let\noexpand\@listi\noexpand\@listI }% \setlength{\@tempdima}{1.26\@tempdimc}% \setlength{\@tempdimb}{\@tempb\@tempdima}% @@ -300,11 +413,11 @@ {\the\@tempdima}{\the\@tempdimb}% }% \normalsize% -\setlength\parindent{\f@size pt}% -\setlength\headheight{\dimexpr(\f@size pt+2pt)}% -\setlength\smallskipamount{\dimexpr((\f@size pt+1pt)/4) \@plus 1\p@ \@minus 1\p@}% -\setlength\medskipamount{\dimexpr((\f@size pt+1pt)/2) \@plus 2\p@ \@minus 2\p@}% -\setlength\bigskipamount{\dimexpr(\f@size pt+1pt) \@plus 4\p@ \@minus 4\p@}% +\setlength\parindent{\@tempdimb}% +\setlength\headheight{\dimexpr(\@tempdimb+2pt)}% +\setlength\smallskipamount{\dimexpr((\@tempdimb+1pt)/4) \@plus 1\p@ \@minus 1\p@}% +\setlength\medskipamount{\dimexpr((\@tempdimb+1pt)/2) \@plus 2\p@ \@minus 2\p@}% +\setlength\bigskipamount{\dimexpr(\@tempdimb+1pt) \@plus 4\p@ \@minus 4\p@}% \setlength{\@tempdimb}{\f@baselineskip}% \ctm@setlength{\parsep}% {.3333\@tempdimb}{.1667\@tempdimb}{.0833\@tempdimb}% @@ -560,25 +673,139 @@ }\@percentchar% }% \endgroup + \begingroup\tinyr +\immediate\write\@fontfile{% + \string\def\string\tinyr{% + \string\@setfontsize\string\tinyr{\f@size}{\f@baselineskip}% + }\@percentchar% +}% +\endgroup +\begingroup\tinyrr +\immediate\write\@fontfile{% + \string\def\string\tinyrr{% + \string\@setfontsize\string\tinyrr{\f@size}{\f@baselineskip}% + }\@percentchar% +}% +\endgroup +\begingroup\tinyrrr +\immediate\write\@fontfile{% + \string\def\string\tinyrrr{% + \string\@setfontsize\string\tinyrrr{\f@size}{\f@baselineskip}% + }\@percentchar% +}% + \endgroup + \begingroup\scriptsizer + \immediate\write\@fontfile{% + \string\def\string\scriptsizer{% + \string\@setfontsize\string\scriptsizer{\f@size}{\f@baselineskip}% + }\@percentchar% + }% + \endgroup + \begingroup\scriptsizerr + \immediate\write\@fontfile{% + \string\def\string\scriptsizerr{% + \string\@setfontsize\string\scriptsizerr{\f@size}{\f@baselineskip}% + }\@percentchar% + }% +\endgroup + \begingroup\scriptsizerrr + \immediate\write\@fontfile{% + \string\def\string\scriptsizerrr{% + \string\@setfontsize\string\scriptsizerrr{\f@size}{\f@baselineskip}% + }\@percentchar% + }% + \endgroup +\def\fs@appnormal{ + \@percentchar^^J% + \@ind\string\abovedisplayskip\space \the\abovedisplayskip^^J% + \@ind\string\abovedisplayshortskip\space \the\abovedisplayshortskip^^J% + \@ind\string\belowdisplayskip\space \the\belowdisplayskip^^J% + \@ind\string\belowdisplayshortskip\space \the\belowdisplayshortskip^^J% + \@ind\string\let\string\@listi\string\@listI^^J% +} +\def\fs@appsmall{% + \@percentchar^^J% + \@ind\string\abovedisplayskip\space \the\abovedisplayskip^^J% + \@ind\string\abovedisplayshortskip\space \the\abovedisplayshortskip^^J% + \@ind\string\belowdisplayskip\space \the\belowdisplayskip^^J% + \@ind\string\belowdisplayshortskip\space \the\belowdisplayshortskip^^J% + \@ind\string\def\string\@listi{\@percentchar^^J% + \@ind\@ind\string\leftmargin\string\leftmargini^^J% + \@ind\@ind\string\topsep \the\topsep^^J% + \@ind\@ind\string\parsep \the\parsep^^J% + \@ind\@ind\string\itemsep \string\parsep^^J% + \@ind}\@percentchar^^J% +} + \begingroup\smallr\@listi +\immediate\write\@fontfile{% + \string\def\string\smallr{\@percentchar^^J% + \@ind\string\@setfontsize\string\smallr{\f@size}{\f@baselineskip}% + \fs@appsmall% + }\@percentchar% +}% +\endgroup +\begingroup\smallrr\@listi +\immediate\write\@fontfile{% + \string\def\string\smallrr{\@percentchar^^J% + \@ind\string\@setfontsize\string\smallrr{\f@size}{\f@baselineskip}% + \fs@appsmall% + }\@percentchar% +}% +\endgroup +\begingroup\smallrrr\@listi +\immediate\write\@fontfile{% + \string\def\string\smallrrr{\@percentchar^^J% + \@ind\string\@setfontsize\string\smallrrr{\f@size}{\f@baselineskip}% + \fs@appsmall% + }\@percentchar% +}% +\endgroup +\begingroup\footnotesizer\@listi +\immediate\write\@fontfile{% + \string\def\string\footnotesizer{\@percentchar^^J% + \@ind\string\@setfontsize\string\footnotesizer{\f@size}{\f@baselineskip}% + \fs@appsmall% + }\@percentchar% +}% +\endgroup +\begingroup\footnotesizerr\@listi +\immediate\write\@fontfile{% + \string\def\string\footnotesizerr{\@percentchar^^J% + \@ind\string\@setfontsize\string\footnotesizerr{\f@size}{\f@baselineskip}% + \fs@appsmall% + }\@percentchar% +}% +\endgroup +\begingroup\footnotesizerrr\@listi +\immediate\write\@fontfile{% + \string\def\string\footnotesizerrr{\@percentchar^^J% + \@ind\string\@setfontsize\string\footnotesizerrr{\f@size}{\f@baselineskip}% + \fs@appsmall% + }\@percentchar% +}% +\endgroup \begingroup\normalsizer \immediate\write\@fontfile{% - \string\def\string\normalsizer{% - \string\@setfontsize\string\normalsizer{\f@size}{\f@baselineskip}% + \string\def\string\normalsizer{\@percentchar^^J% + \@ind\string\@setfontsize\string\normalsizer{\f@size}{\f@baselineskip}% + \fs@appnormal% }\@percentchar% }% \endgroup \begingroup\normalsizerr \immediate\write\@fontfile{% - \string\def\string\normalsizerr{% - \string\@setfontsize\string\normalsizerr{\f@size}{\f@baselineskip}% - }\@percentchar% + \string\def\string\normalsizerr{\@percentchar^^J% + \@ind\string\@setfontsize\string\normalsizerr{\f@size}{\f@baselineskip}% + \fs@appnormal% + }\@percentchar% }% \endgroup \begingroup\normalsizerrr \immediate\write\@fontfile{% - \string\def\string\normalsizerrr{% - \string\@setfontsize\string\normalsizerrr{\f@size}{\f@baselineskip}% - }\@percentchar% + \string\def\string\normalsizerrr{\@percentchar^^J% + \@ind\string\@setfontsize\string\normalsizerrr{\f@size}{\f@baselineskip}% + \fs@appnormal% + }\@percentchar% }% \endgroup \begingroup\larger @@ -629,6 +856,7 @@ \string\@setfontsize\string\Largerrr{\f@size}{\f@baselineskip}% }\@percentchar% }% +\endgroup \begingroup\LARGEr \immediate\write\@fontfile{% \string\def\string\LARGEr{% @@ -649,6 +877,7 @@ \string\@setfontsize\string\LARGErrr{\f@size}{\f@baselineskip}% }\@percentchar% }% +\endgroup \begingroup\huger \immediate\write\@fontfile{% \string\def\string\huger{% @@ -669,6 +898,7 @@ \string\@setfontsize\string\hugerrr{\f@size}{\f@baselineskip}% }\@percentchar% }% +\endgroup \begingroup\Huger \immediate\write\@fontfile{% \string\def\string\Huger{% @@ -689,6 +919,7 @@ \string\@setfontsize\string\Hugerrr{\f@size}{\f@baselineskip}% }\@percentchar% }% +\endgroup \immediate\write\@fontfile{\string\normalsize}% \begingroup \immediate\write\@fontfile{% @@ -838,40 +1069,52 @@ \@onlypreamble\generateclofile \ExplSyntaxOn -\NewExpandableDocumentCommand{\getlength}{O{5}m} +\NewDocumentCommand{\printsamples} { - \fp_eval:n { round(#2,#1) } + m + m + O{tiny,tinyr,tinyrr,tinyrrr, + scriptsize,scriptsizer,scriptsizerr,scriptsizerrr, + footnotesize,footnotesizer,footnotesizerr,footnotesizerrr, + small,smallr,smallrr,smallrrr, + normalsize,normalsizer,normalsizerr,normalsizerrr, + large,larger,largerr,largerrr, + Large,Larger,Largerr,Largerrr, + LARGE,LARGEr,LARGErr,LARGErrr, + huge,huger,hugerr,hugerrr, + Huge,Huger,Hugerr,Hugerrr} +} +{ + \fontsize_printsamples:nnn { #1 } { #2 } { #3 } } -\ExplSyntaxOff -\def\fontsize@lipsum{As any dedicated reader can clearly see, the Ideal of - practical reason is a representation of, as far as I know, the - things in themselves; as I have shown elsewhere, the phenomena - should only be used as a canon for our understanding. The paralogisms - of practical reason are what first give rise to the architectonic of - practical reason. As will be shown, reason would - be made to contradict.} -\chardef\fsbslash=`\\ -\newcommand{\sizesamples}[1]{% - \def\nextitem{\par}% Separator - \renewcommand*{\do}[1]{\nextitem\bgroup\csname##1\endcsname - \noindent{\csname ##1\endcsname \texttt{\fsbslash ##1}: - \getlength[2]{\f@size}\,pt on \getlength[2]{\the\baselineskip}\,pt.} \fontsize@lipsum\par\egroup - }% How to process each item - \docsvlist{#1}% Process list +\cs_new:Nn \__fontsize_round_f:n +{ + \fp_eval:n { round(\use:c{f@#1},1) } pt } -\NewDocumentCommand \printsamples { m m O{ - normalsize,normalsizer,normalsizerr,normalsizerrr, - large,larger,largerr,largerrr, - Large,Larger,Largerr,Largerrr, - LARGE,LARGEr,LARGErr,LARGErrr, - huge,huger,hugerr,hugerrr, - Huge,Huger,Hugerr,Hugerrr} } + +\cs_new_protected:Nn \fontsize_printsamples:nnn { - \changefontsize[#1]{#2} - \subsubsection*{Text samples for #2 on #1} - \sizesamples{#3} + % group to bound the font changes + \group_begin: + % set the size + \changefontsize[#1]{#2}\selectfont + % header + \subsubsection*{Text~samples~for~#2~on~#1} + % map through the desired sizes + \clist_map_inline:nn { #3 } + { + \use:c{##1} % set the font size + \noindent\texttt{\symbol{92}##1}:~ % print the font size command + \__fontsize_round_f:n {size}~ % print the size in points + \__fontsize_round_f:n {baselineskip}.~ % print the baseline skip in points + \kant[1][1-3] % sample text + \par\addvspace{\medskipamount} % finish up + } + % close the group + \group_end: } +\ExplSyntaxOff \endinput %% %% End of file `fontsize.sty'. |