diff options
Diffstat (limited to 'macros')
37 files changed, 2225 insertions, 1014 deletions
diff --git a/macros/latex/contrib/calculatoritems/doc/calculatoritems-doc.pdf b/macros/latex/contrib/calculatoritems/doc/calculatoritems-doc.pdf Binary files differindex 2d7e1bbce2..9170411eca 100644 --- a/macros/latex/contrib/calculatoritems/doc/calculatoritems-doc.pdf +++ b/macros/latex/contrib/calculatoritems/doc/calculatoritems-doc.pdf diff --git a/macros/latex/contrib/calculatoritems/tex/calculatoritems.sty b/macros/latex/contrib/calculatoritems/tex/calculatoritems.sty index 4c99ecbb59..34516d08fc 100644 --- a/macros/latex/contrib/calculatoritems/tex/calculatoritems.sty +++ b/macros/latex/contrib/calculatoritems/tex/calculatoritems.sty @@ -2,9 +2,11 @@ % licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{calculatoritems}[2025/01/25 0.1.1 Menus from classic calculators] +\ProvidesPackage{calculatoritems}[2025/02/03 0.1.3 Menus from classic calculators] %====HISTORIQUE +% v 0.1.3 New styles for graph math+ +% v 0.1.2 New version with resizebox (better render and calc) % v 0.1.1 Sample keys + fonts config for LUA + shortcut with img pdf % v 0.1.0 Initial version @@ -21,7 +23,8 @@ \@ifpackageloaded{fontspec}{}{\RequirePackage{fontspec}} \newfontfamily\fontNWKS{SourceCodePro-Medium}[Scale=MatchLowercase] %numworks \newfontfamily\fontCASIOA{AnonymousPro}[Scale=MatchLowercase] %casio35 - \newfontfamily\fontCASIOB{AlegreyaSans}[Scale=MatchLowercase] %casio90 + %\newfontfamily\fontCASIOB{AlegreyaSans}[Scale=MatchLowercase] %casio90 + \newfontfamily\fontCASIOB{FreeSans}[Scale=MatchLowercase] %casio90 \newfontfamily\fontTI{AnonymousPro}[Scale=MatchLowercase] %ti \newfontfamily\fontHP{AlegreyaSans}[Scale=MatchLowercase] %ti \newfontfamily\fontKEY{Inconsolatazi4}[Scale=MatchLowercase] %global keys @@ -54,6 +57,8 @@ \newcommand\nwkstri{\footnotesize\textcolor{orange}{$\blacktriangleright$}} \fi \RequirePackage{xstring} +\RequirePackage{settobox} +\RequirePackage{ifthen} \RequirePackage{calc} \RequirePackage{simplekv} \RequirePackage{tcolorbox} @@ -67,6 +72,7 @@ \newlength\calcsimmenusmenutc \newlength\calcsimmenusitemtc \newlength\calcsimmenusdepth +\newlength\calcsimmenusheight \newcommand\tidots{\scalebox{0.44}[0.55]{...}} \newcommand\casiodots{\circledtext[resize=real,width=0.75em]{$\cdots$}} @@ -75,26 +81,27 @@ enhanced,fontupper=\calcsimmenusfont,nobeforeafter,% box align=base,boxsep=\calcsimmenusfsep,% boxrule=0.8pt,left=0pt,right=0pt,top=0pt,% - bottom=\dimexpr1pt-\calcsimmenusdepth\relax,no borderline + bottom=-\calcsimmenusfsep + %bottom=\dimexpr1pt-\calcsimmenusdepth\relax,no borderline } } \tcbset{casiotcmenunoir/.style={% width=\calcsimmenusmenutc,colframe=black,colback=black,% colupper=white,sharp corners,rounded corners=southeast,% - arc=3pt,arc is angular,add to width=1pt + arc=3pt,arc is angular,add to width=2pt } } \tcbset{casiotcmenublanc/.style={% enhanced,frame hidden,width=\calcsimmenusmenutc,% colframe=black,colback=white,colupper=black,% - sharp corners,add to width=1pt, + sharp corners,add to width=2pt, borderline north={0.75pt}{0pt}{black}, borderline west={0.75pt}{0pt}{black} } } \tcbset{casiotcitemnoir/.style={% width=\calcsimmenusmenutc,colframe=black,% - colback=black,colupper=white,sharp corners,add to width=1pt + colback=black,colupper=white,sharp corners,add to width=2pt } } \tcbset{casiotcitemsel/.style={% @@ -107,7 +114,8 @@ fontupper=\calcsimmenusfont,nobeforeafter,% box align=base,boxsep=\calcsimmenusfsep,% boxrule=0.8pt,left=0pt,right=0pt,top=0pt,% - bottom=\dimexpr1pt-\calcsimmenusdepth\relax,% + bottom=-\calcsimmenusfsep + %bottom=\dimexpr1pt-\calcsimmenusdepth\relax,% } } \tcbset{casioqdmenunoir/.style={% @@ -127,31 +135,34 @@ } \tcbset{casioqditemsel/.style={% width=\calcsimmenusitemtc,sharp corners,colframe=black,% - colback=black,colupper=white,sharp corners + colback=black,colupper=white,sharp corners,add to width=2pt } } - +\tcbset{casiomathtab/.style={% + width=\calcsimmenusitemtc,sharp corners,colframe=black,% + colback=black,colupper=white,sharp corners,add to width=2pt +} +} \tcbset{vignettemenunwks/.style={% top=\dimexpr0.45pt+0.5\calcsimmenusfsep\relax,bottom=\dimexpr1pt-\calcsimmenusdepth\relax,% left=2pt,right=2pt,fontupper=\calcsimmenusfont,nobeforeafter,% box align=base,boxrule=0.45pt,boxsep=0.5\calcsimmenusfsep,sharp corners=all } } - \tcbset{vignettemenuti/.style={% size=tight,boxrule=0.45pt,fontupper=\calcsimmenusfont,% - nobeforeafter,left=0.45pt,right=0.45pt,top=0.15pt,bottom=0.15pt,box align=base + nobeforeafter,left=0.45pt,right=0.45pt,top=0.15pt,% + bottom=0.15pt,box align=base } } - \tcbset{vignettemenuhp/.style={% enhanced,fontupper=\calcsimmenusfont,nobeforeafter,% box align=base,boxsep=\calcsimmenusfsep,% boxrule=0.8pt,left=0pt,right=0pt,top=0pt,% - bottom=\dimexpr1pt-\calcsimmenusdepth\relax,% + bottom=-\calcsimmenusfsep + %bottom=\dimexpr1pt-\calcsimmenusdepth\relax,% } } - \tcbset{vignettemenuhpnorth/.style={% width=\calcsimmenusmenutc,colupper=white,colback=darkgray!90,colframe=darkgray,% sharp corners=north,add to width=2pt @@ -167,7 +178,6 @@ colback=cyan!15,colupper=black,sharp corners } } - \tcbset{vignettemenuhpitem/.style={% sharp corners,colframe=cyan!15,colback=cyan!15,colupper=black,sharp corners } @@ -195,6 +205,40 @@ colorfont=black } +%testing with resizebox, but carefull with width & height... +\newsavebox{\calcitembox} +\newsavebox{\calcglobitembox} +\newsavebox{\calcglobitemvbox} +\newlength\calcboxwidth +\newlength\calcboxheight +\newcommand\calcboxiftoobig[3]{% + % #1: Width to check against, like \textwidth + % #2: Height to check against, like \textwidth + % #3: The content, like a tabular + \savebox{\calcitembox}{\calcsimmenusfont#3}% + \settowidth{\calcboxwidth}{\usebox{\calcitembox}}%on stocke la largeur + \settototalheight{\calcboxheight}{\usebox{\calcitembox}}%on stocke la hauteur + \ifthenelse{\calcboxwidth < #1}%on commence par la largeur + {% + \ifthenelse{\calcboxheight < #2}%on continue avec la hauteur + {% + \usebox{\calcitembox}%tout est ok, on ne touche à rien, et on laisse tel quel + }% + {% + \resizebox*{\calcboxwidth}{#2}{\usebox{\calcitembox}}%largeur ok mais resize hauteur + }% + }% + {% + \ifthenelse{\calcboxheight < #2}%on continue avec la hauteur + {% + \resizebox*{#1}{\calcboxheight}{\usebox{\calcitembox}}%largeur ko mais hauteur ok + }% + {% + \resizebox*{#1}{#2}{\usebox{\calcitembox}}%largeur ko et hauteur ko + }% + }% +} + \NewDocumentCommand\CalcItemMenu{ O{} m }{% \restoreKV[calcsimmenus]% \setKV[calcsimmenus]{#1}% @@ -202,12 +246,12 @@ {% \IfEq{\calcsimmenustype}{}%white bg {% - {\setlength{\fboxsep}{\calcsimmenusfsep}\fcolorbox{black}{white}{\vphantom{qH}\calcsimmenusfont#2}}% + {\setlength{\fboxsep}{\calcsimmenusfsep}\fcolorbox{black}{white}{\vphantom{()}\calcsimmenusfont#2}}% }% {}% \IfEq{\calcsimmenustype}{black}%black bg {% - {\setlength{\fboxsep}{\calcsimmenusfsep}\fcolorbox{black}{black}{\vphantom{qH}\calcsimmenusfont\textcolor{white}{#2}}}% + {\setlength{\fboxsep}{\calcsimmenusfsep}\fcolorbox{black}{black}{\vphantom{()}\calcsimmenusfont\textcolor{white}{#2}}}% }% {}% {}% @@ -215,99 +259,121 @@ {}% \IfEq{\calcsimmenusmodel}{35+}% {% - \settowidth{\calcsimmenusmenutc}{\hbox{\calcsimmenusfont MMMM}}% - \addtolength{\calcsimmenusmenutc}{2pt}% + \savebox{\calcglobitembox}{\calcsimmenusfont XXXX}% + \savebox{\calcglobitemvbox}{\calcsimmenusfont ()}% + \settowidth{\calcsimmenusmenutc}{\usebox{\calcglobitembox}}%on stocke la largeur + \settototalheight{\calcsimmenusheight}{\usebox{\calcglobitemvbox}}%on stocke la hauteur + %\settowidth{\calcsimmenusmenutc}{\hbox{\calcsimmenusfont MMMM}}% + %\addtolength{\calcsimmenusmenutc}{2pt}% \settowidth{\calcsimmenusitemtc}{\hbox{\calcsimmenusfont MMMMMMMMMMMMMMMMMMM}}% - \settodepth{\calcsimmenusdepth}{\hbox{\calcsimmenusfont gH}}% - \IfEq{\calcsimmenuslen}{auto}% - {% - \StrLen{#2}[\calcsimmenusnbchar]% - \xdef\calcsimmenushscale{\fpeval{min(4/(\calcsimmenusnbchar),1)}}% - \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% - }% - {% - \xdef\calcsimmenushscale{\fpeval{min(4/(\calcsimmenuslen),1)}}% - \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% - }% + %\settodepth{\calcsimmenusdepth}{\hbox{\calcsimmenusfont qXX/}}% + % \IfEq{\calcsimmenuslen}{auto}% + % {% + % \StrLen{#2}[\calcsimmenusnbchar]% + % \xdef\calcsimmenushscale{\fpeval{min(4/(\calcsimmenusnbchar),1)}}% + % \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% + % }% + % {% + % \xdef\calcsimmenushscale{\fpeval{min(4/(\calcsimmenuslen),1)}}% + % \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% + % }% \IfEq{\calcsimmenustype}{}%white menu {% - {\tcbox[tcbox width=minimum center,casiotc,casiotcmenublanc]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% + {\tcbox[tcbox width=minimum center,casiotc,casiotcmenublanc]{\vphantom{()}\calcboxiftoobig{\calcsimmenusmenutc}{\calcsimmenusheight}{#2}}}% }% {}% \IfEq{\calcsimmenustype}{bmenu}%black menu {% - {\tcbox[tcbox width=minimum center,casiotc,casiotcmenunoir]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% + {\tcbox[tcbox width=minimum center,casiotc,casiotcmenunoir]{\vphantom{()}\calcboxiftoobig{\calcsimmenusmenutc}{\calcsimmenusheight}{#2}}}% }% {}% \IfEq{\calcsimmenustype}{item}%item {% - {\tcbox[tcbox width=minimum center,casiotc,casiotcitemnoir]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% + {\tcbox[tcbox width=minimum center,casiotc,casiotcitemnoir]{\vphantom{()}\calcboxiftoobig{\calcsimmenusmenutc}{\calcsimmenusheight}{#2}}}% }% {}% \IfEq{\calcsimmenustype}{itemsel}%item sel {% - {\tcbox[tcbox width=minimum left,casiotc,casiotcitemsel]{\makebox[\calcsimmenusitemtc]{\vphantom{qH}{#2}\hfill{\calcsimmenusrsymb}}}}% + {\tcbox[tcbox width=minimum left,casiotc,casiotcitemsel]{\makebox[\calcsimmenusitemtc]{\vphantom{()}{#2}\hfill{\calcsimmenusrsymb}}}}% }% {}% }% {}% \IfEq{\calcsimmenusmodel}{90+}% {% - \settowidth{\calcsimmenusmenutc}{\hbox{\calcsimmenusfont MMMMM}}% - \addtolength{\calcsimmenusmenutc}{2pt}% - \settowidth{\calcsimmenusitemtc}{\hbox{\calcsimmenusfont MMMMMMMMMMMMMMMMMMMMMM}}% - \settodepth{\calcsimmenusdepth}{\hbox{\calcsimmenusfont gH}}% - \IfEq{\calcsimmenuslen}{auto}% - {% - \StrLen{#2}[\calcsimmenusnbchar]% - \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenusnbchar),1)}}% - \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% - }% - {% - \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenuslen),1)}}% - \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% - }% + \savebox{\calcglobitembox}{\calcsimmenusfont XXXXX}% + \savebox{\calcglobitemvbox}{\calcsimmenusfont ()}% + \settowidth{\calcsimmenusmenutc}{\usebox{\calcglobitembox}}%on stocke la largeur + \settototalheight{\calcsimmenusheight}{\usebox{\calcglobitemvbox}}%on stocke la hauteur + %\settowidth{\calcsimmenusmenutc}{\hbox{\calcsimmenusfont XXXXX}}% + %\settototalheight{\calcsimmenusheight}{\hbox{\calcsimmenusfont qXXX/}}% + %\addtolength{\calcsimmenusmenutc}{2pt}% + \settowidth{\calcsimmenusitemtc}{\hbox{\calcsimmenusfont XXXXXXXXXXXXXXXXXXXX}}% + \settodepth{\calcsimmenusdepth}{\hbox{\calcsimmenusfont qXXX/}}% + % \IfEq{\calcsimmenuslen}{auto}% + % {% + % \StrLen{#2}[\calcsimmenusnbchar]% + % \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenusnbchar),1)}}% + % \xdef\calcsimmenusvscale{0.95}%{\fpeval{0.95*\calcsimmenushscale}}% + % }% + % {% + % \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenuslen),1)}}% + % \xdef\calcsimmenusvscale{0.95}%{\fpeval{0.95*\calcsimmenushscale}}% + % }% \IfEq{\calcsimmenustype}{}%white menu {% - {\tcbox[tcbox width=minimum center,casioqd,casioqdmenublanc]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% + {\tcbox[tcbox width=minimum center,casioqd,casioqdmenublanc]{\vphantom{()}\calcboxiftoobig{\calcsimmenusmenutc}{\calcsimmenusheight}{#2}}}% + %{\tcbox[tcbox width=minimum center,casioqd,casioqdmenublanc]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% }% {}% \IfEq{\calcsimmenustype}{bmenu}%black menu {% - {\tcbox[tcbox width=minimum center,casioqd,casioqdmenunoir,overlay={\path[fill=\calcsimmenusbg]($(frame.south east) + (0.1pt,-0.1pt)$) -- ++ (0pt,3.2pt) -- ++ (-3.2pt,-3.2pt) -- cycle;}]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% + {\tcbox[tcbox width=minimum center,casioqd,casioqdmenunoir,overlay={\path[fill=\calcsimmenusbg]($(frame.south east) + (0.1pt,-0.1pt)$) -- ++ (0pt,3.2pt) -- ++ (-3.2pt,-3.2pt) -- cycle;}]{\vphantom{()}\calcboxiftoobig{\calcsimmenusmenutc}{\calcsimmenusheight}{#2}}}% + %{\tcbox[tcbox width=minimum center,casioqd,casioqdmenunoir,overlay={\path[fill=\calcsimmenusbg]($(frame.south east) + (0.1pt,-0.1pt)$) -- ++ (0pt,3.2pt) -- ++ (-3.2pt,-3.2pt) -- cycle;}]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% }% {}% \IfEq{\calcsimmenustype}{item}%item {% - {\tcbox[tcbox width=minimum center,casioqd,casioqditemnoir]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% + {\tcbox[tcbox width=minimum center,casioqd,casioqditemnoir]{\vphantom{()}\calcboxiftoobig{\calcsimmenusmenutc}{\calcsimmenusheight}{#2}}}% + %{\tcbox[tcbox width=minimum center,casioqd,casioqditemnoir]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% }% {}% \IfEq{\calcsimmenustype}{itemsel}%item {% - {\tcbox[tcbox width=minimum left,casioqd,casioqditemsel]{\makebox[\calcsimmenusitemtc]{\vphantom{qH}{#2}\hfill{\calcsimmenusrsymb}}}}% + {\tcbox[tcbox width=minimum left,casioqd,casioqditemsel]{\makebox[\calcsimmenusitemtc]{\vphantom{()}{#2}\hfill{\calcsimmenusrsymb}}}}% }% {}% }% {}% \IfEq{\calcsimmenusmodel}{math+}% {% - \settowidth{\calcsimmenusmenutc}{\hbox{\calcsimmenusfont MMMMM}}% - \addtolength{\calcsimmenusmenutc}{2pt}% - \settowidth{\calcsimmenusitemtc}{\hbox{\calcsimmenusfont MMMMMMMMMMMMMMMMMMMM}}% - \settodepth{\calcsimmenusdepth}{\hbox{\calcsimmenusfont gH}}% - \IfEq{\calcsimmenuslen}{auto}% + %\settodepth{\calcsimmenusdepth}{\hbox{\calcsimmenusfont gH}}% + % \IfEq{\calcsimmenuslen}{auto}% + % {% + % \StrLen{#2}[\calcsimmenusnbchar]% + % \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenusnbchar),1)}}% + % \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% + % }% + % {% + % \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenuslen),1)}}% + % \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% + % }% + \IfEq{\calcsimmenustype}{}%black menu {% - \StrLen{#2}[\calcsimmenusnbchar]% - \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenusnbchar),1)}}% - \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% + \settowidth{\calcsimmenusitemtc}{\hbox{\calcsimmenusfont MMMMMMMMMMMMMMMMMMMM}}% + {\tcbox[tcbox width=minimum left,casioqd,casioqditemnoir]{\makebox[\calcsimmenusitemtc]{\vphantom{qH}{#2}\hfill{\calcsimmenusrsymb}}}}% }% + {}% + \IfEq{\calcsimmenustype}{smenu}%black menu {% - \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenuslen),1)}}% - \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% + \settowidth{\calcsimmenusitemtc}{\hbox{\calcsimmenusfont MMMMMMMMMMMMM}}% + {\tcbox[tcbox width=minimum left,casioqd,casioqditemnoir]{\makebox[\calcsimmenusitemtc]{\vphantom{qH}{#2}\hfill{\calcsimmenusrsymb}}}}% }% - \IfEq{\calcsimmenustype}{}%white menu + {}% + \IfEq{\calcsimmenustype}{tab}%tab {% - {\tcbox[tcbox width=minimum left,casioqd,casioqditemnoir]{\makebox[\calcsimmenusitemtc]{\vphantom{qH}{#2}\hfill{\calcsimmenusrsymb}}}}% + \settowidth{\calcsimmenusitemtc}{\hbox{\calcsimmenusfont MMMMMMMMMMM}}% + {\tcbox[tcbox width=minimum center,casioqd,casiomathtab]{\vphantom{()}{#2}}}%{\makebox[\calcsimmenusitemtc]{\vphantom{qH}{#2}}}}% }% {}% }% @@ -369,28 +435,32 @@ {}% \IfEq{\calcsimmenusmodel}{hp}% {% - \settowidth{\calcsimmenusmenutc}{\hbox{\calcsimmenusfont MMMMM}}% - \addtolength{\calcsimmenusmenutc}{2pt}% + \savebox{\calcglobitembox}{\calcsimmenusfont XXXXXX}% + \savebox{\calcglobitemvbox}{\calcsimmenusfont ()}% + \settowidth{\calcsimmenusmenutc}{\usebox{\calcglobitembox}}%on stocke la largeur + \settototalheight{\calcsimmenusheight}{\usebox{\calcglobitemvbox}}%on stocke la hauteur + %\settowidth{\calcsimmenusmenutc}{\hbox{\calcsimmenusfont MMMMM}}% + %\addtolength{\calcsimmenusmenutc}{2pt}% \settowidth{\calcsimmenusitemtc}{\hbox{\calcsimmenusfont MMMMMMMMMMMMMMMMMMMMM}}% \settodepth{\calcsimmenusdepth}{\hbox{\calcsimmenusfont gH}}% - \IfEq{\calcsimmenuslen}{auto}% - {% - \StrLen{#2}[\calcsimmenusnbchar]% - \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenusnbchar),1)}}% - \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% - }% - {% - \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenuslen),1)}}% - \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% - }% + % \IfEq{\calcsimmenuslen}{auto}% + % {% + % \StrLen{#2}[\calcsimmenusnbchar]% + % \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenusnbchar),1)}}% + % \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% + % }% + % {% + % \xdef\calcsimmenushscale{\fpeval{min(5/(\calcsimmenuslen),1)}}% + % \xdef\calcsimmenusvscale{\fpeval{0.95*\calcsimmenushscale}}% + % }% \IfEq{\calcsimmenustype}{}%bottom rounded {% - {\tcbox[tcbox width=minimum center,vignettemenuhp,vignettemenuhpnorth]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% + {\tcbox[tcbox width=minimum center,vignettemenuhp,vignettemenuhpnorth]{\vphantom{()}\calcboxiftoobig{\calcsimmenusmenutc}{\calcsimmenusheight}{#2}}}% }% {}% \IfEq{\calcsimmenustype}{ritem}%rounded item {% - {\tcbox[tcbox width=minimum center,vignettemenuhp,vignettemenuhpround]{\vphantom{qH}\scalebox{\calcsimmenushscale}[\calcsimmenusvscale]{#2}}}% + {\tcbox[tcbox width=minimum center,vignettemenuhp,vignettemenuhpround]{\vphantom{()}\calcboxiftoobig{\calcsimmenusmenutc}{\calcsimmenusheight}{#2}}}% }% {}% \IfEq{\calcsimmenustype}{item}%item @@ -535,21 +605,6 @@ }% } -%testing ?? -%\newsavebox{\jamBox} -%\newlength{\jamWidth} -%\newcommand{\jamIfToBig}[2]{% -% % #1: Size to check against, like \textwidth -% % #2: The content, like a tabular -% \savebox{\jamBox}{#2}% -% \settowidth{\jamWidth}{\usebox{\jamBox}}% -% %\the\jamWidth -- \the#1 -% \ifthenelse{\jamWidth < #1}% -% {\usebox{\jamBox}}% -% {\resizebox{#1}{!}{\usebox{\jamBox}}% -% }% -%} - \def\samplecharacterskeyx{azertyuiopqsdfghjklmwxcvbn123456789AZERTYUIOPQSDFGHJKLMWXCVBN} \NewDocumentCommand\CalcKey{ O{} m }{% @@ -964,14 +1019,84 @@ }% }% +%=====SHORTCUTS FOR TI OS (ti-83-plus-large.ttf) +\newcommand\osfontTIsto{\char"2192} +\newcommand\osfontTItri{\char"25B6} +\newcommand\osfontTIiit{\char"2139} +\newcommand\osfontTIint{\char"222B} +\newcommand\osfontTIeit{\char"212F} +\newcommand\osfontTIpi{\char"03C0} +\newcommand\osfontTIsum{\char"03A3} +\newcommand\osfontTIsqrt{\char"221A} +\newcommand\osfontTIdelta{\char"0394} + +%=====SHORTCUTS FOR TICE OS (TICELargeSmooth.otf) +\newcommand\osfontTICEnit{\char"F00E} +\newcommand\osfontTICEuseq{\char"0155} +\newcommand\osfontTICEvseq{\char"0156} +\newcommand\osfontTICEwseq{\char"0157} +\newcommand\osfontTICEtri{\char"F014} +\newcommand\osfontTICEint{\char"222B} +\newcommand\osfontTICEleq{\char"2264} +\newcommand\osfontTICEneq{\char"2260} +\newcommand\osfontTICEgeq{\char"2265} +\newcommand\osfontTICEsto{\char"2192} +\newcommand\osfontTICEiit{\char"2148} +\newcommand\osfontTICEeit{\char"212F} +\newcommand\osfontTICEpi{\char"03C0} +\newcommand\osfontTICEdelta{\char"0394} +\newcommand\osfontTICEsum{\char"03A3} +\newcommand\osfontTICEsqrt{\char"221A} + +%=====SHORTCUTS FOR CASIO FX (casio-fx-9860gii.ttf) +\newcommand\osfontCASIOFXsto{\char"2192} +\newcommand\osfontCASIOFXpi{\char"03C0} +\newcommand\osfontCASIOFXtri{\char"25B8} +\newcommand\osfontCASIOFXsqrt{\char"221A} +\newcommand\osfontCASIOFXsum{\char"2211} +\newcommand\osfontCASIOFXint{\char"222B} +\newcommand\osfontCASIOFXibd{\char"2139} +\newcommand\osfontCASIOFXebd{\char"212F} + +%=====SHORTCUTS FOR CASIO CG (casio-fx-cg50-sizea.otf) +\newcommand\osfontCASIOCGpi{\char"03C0} +\newcommand\osfontCASIOCGsto{\char"2192} +\newcommand\osfontCASIOCGsqrt{\char"221A} +\newcommand\osfontCASIOCGsum{\char"2211} +\newcommand\osfontCASIOCGleq{\char"2264} +\newcommand\osfontCASIOCGgeq{\char"2265} + +%=====SHORTCUTS FOR CASIO CW (ClassWizMathCW-Regular.otf) +\newcommand\osfontCASIOCWpi{\char"01D70B} +\newcommand\osfontCASIOCWsum{\char"2211} +\newcommand\osfontCASIOCWint{\char"222B} +\newcommand\osfontCASIOCWtri{\char"25B8} +\newcommand\osfontCASIOCWxit{\char"01D465} +\newcommand\osfontCASIOCWyit{\char"01D466} +\newcommand\osfontCASIOCWzit{\char"01D467} +\newcommand\osfontCASIOCWiit{\char"01D486} +\newcommand\osfontCASIOCWeit{\char"01D48A} +\newcommand\osfontCASIOCWsto{\char"2192} +\newcommand\osfontCASIOCWsqrt{\char"221A} + +%=====SHORTCUTS FOR NUMWORKS (CartographCF-Light.otf) +\newcommand\osfontNWKSpi{\char"03C0} +\newcommand\osfontNWKSsqrt{\char"221A} +\newcommand\osfontNWKSsto{\char"2192} +\newcommand\osfontNWKSsum{\char"2211} +\newcommand\osfontNWKSleq{\char"2264} +\newcommand\osfontNWKSneq{\char"2260} +\newcommand\osfontNWKSgeq{\char"2265} +\newcommand\osfontNWKStri{\char"25BA} + \fi %SHORTCUTS (with pdf files, not included) \@ifpackageloaded{inlinegraphicx}{}{\RequirePackage{inlinegraphicx}} -\NewDocumentCommand\inckeycalc{ s O{} m m }{% - \IfFileExists{calcitems_#3_#4.pdf}% +\NewDocumentCommand\inckeycalc{ s O{} m m O{pdf} }{% + \IfFileExists{calcitems_#3_#4.#5}% {% - \IfBooleanTF{#1}{\includegraphics[#2]{calcitems_#3_#4.pdf}}{\inlinegraphics[#2]{calcitems_#3_#4.pdf}}% + \IfBooleanTF{#1}{\includegraphics[#2]{calcitems_#3_#4.#5}}{\inlinegraphics[#2]{calcitems_#3_#4.#5}}% }% {% \IfBooleanTF{#1}{\includegraphics[#2]{example-image.pdf}}{\inlinegraphics[#2]{example-image.pdf}}% diff --git a/macros/latex/contrib/customenvs/doc/customenvs-doc-en.pdf b/macros/latex/contrib/customenvs/doc/customenvs-doc-en.pdf Binary files differindex b92c8bcc3b..255d6a1355 100644 --- a/macros/latex/contrib/customenvs/doc/customenvs-doc-en.pdf +++ b/macros/latex/contrib/customenvs/doc/customenvs-doc-en.pdf diff --git a/macros/latex/contrib/customenvs/doc/customenvs-doc-en.tex b/macros/latex/contrib/customenvs/doc/customenvs-doc-en.tex index de85d9f12b..7fbad611c4 100644 --- a/macros/latex/contrib/customenvs/doc/customenvs-doc-en.tex +++ b/macros/latex/contrib/customenvs/doc/customenvs-doc-en.tex @@ -34,8 +34,8 @@ \usepackage[margin=1.5cm]{geometry} \setlength{\parindent}{0pt} -\def\TPversion{0.2.6} -\def\TPdate{04/11/2024} +\def\TPversion{0.3.0} +\def\TPdate{03/02/2025} \usepackage{tcolorbox} \sethlcolor{lightgray!25} \NewDocumentCommand\MontreCode{ m }{% @@ -77,7 +77,7 @@ \begin{tabular}{c} \texttt{Cédric Pierquet}\\ {\ttfamily c pierquet -- at -- outlook . fr}\\ - \texttt{\url{https://github.com/cpierquet/customenvs}} + \texttt{\url{https://forge.apps.education.fr/pierquetcedric/packages-latex}} \end{tabular} \end{center} @@ -111,6 +111,10 @@ \section{History} +\verb|v0.3.0|~:~~~Bugfix with \textsf{beamer} + +\verb|v0.2.7|~:~~~Key for mixing answers in MCQ + \verb|v0.2.6|~:~~~Whell of skills, speedometer \verb|v0.2.5|~:~~~Bugfix with exercices (\textsf{[fr]} macro) @@ -183,6 +187,7 @@ Loaded packages are Due to limitations, \MontreCode{enumitem}/\MontreCode{multicol}/\MontreCode{tabularray}\MontreCode{fontawesome5} can be \textit{un}loaded by \MontreCode{customenvs} (user must load them manually) via options : \begin{itemize} + \item \MontreCode{$\mathtt{\langle}$beamer$\mathtt{\rangle}$} for using with \textsf{beamer} ; \item \MontreCode{$\mathtt{\langle}$noenum$\mathtt{\rangle}$} ; \item \MontreCode{$\mathtt{\langle}$nomulticol$\mathtt{\rangle}$} ; \item \MontreCode{$\mathtt{\langle}$notblr$\mathtt{\rangle}$} ; @@ -228,6 +233,7 @@ The avalailable \MontreCode{options} are : \end{itemize} \item \MontreCode{FontLabels} : \MontreCode{\textbackslash bfseries} by default ; \item \MontreCode{SpaceLabels} : \MontreCode{\textbackslash kern5pt} by default ; + \item \MontreCode{Shuffle}, for mixing answers : \MontreCode{false} by default ; \item \MontreCode{Swap}, for ACBD instead of ABCD : \MontreCode{false} by default. \end{itemize} @@ -244,6 +250,10 @@ Specific options for \MontreCode{tblr} are given between last optionnal argument \begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25] \AnswersMCQ[Lines]{Answer A § Answer B § Answer C § Answer D} + +\AnswersMCQ[Lines,Shuffle]{Answer A1 § Answer B1 § Answer C1 § Answer D1} + +\AnswersMCQ[Lines,Shuffle]{Answer A2 § Answer B2 § Answer C2 § Answer D2} \end{demohigh} \begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25] @@ -299,7 +309,7 @@ The idea is to : \end{codehigh} \begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25] -\ListItemsChoice[keys]{macro}{listname}(numbers)<enumitem options> +\ListItemsChoice[keys]{macro}{listname}(numbers)<enumitem options>!beamer options! \end{codehigh} The available \MontreCode{keys} are : @@ -320,15 +330,16 @@ The fourth argument, mandatory and between \MontreCode{(...)} give : \item the numbers of picked itemps, within \MontreCode{num1,num2,...}. \end{itemize} +The next argument, optional and between \MontreCode{<...>} gives specific options to \MontreCode{enumitem} environment. -The last argument, optional and between \MontreCode{<...>} gives specific options to \MontreCode{enumitem} environment. +The last argument, between \MontreCode{!..!} gives specific options to \MontreCode{enumitem} environment with \MontreCode{beamer}. \medskip Controls are done : \begin{itemize} - \item to verify that the liste doesn't exist (for the creation) ; + \item to verify that the list doesn't exist (for the creation) ; \item to verify that that the list still exist (for the display). \end{itemize} @@ -448,13 +459,11 @@ The last argument, mandatory and between \MontreCode{(...)} give the list of cat \pagebreak -\pagebreak - \section{Score banner} \subsection{Global use} -The idea is to insert a score banner, with customizations. +The idea is to insert a score banner, with customization. \begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25] ScoreBanner[keys]{number} @@ -583,7 +592,7 @@ Regarding the bubble creation commands, \MontreCode{\textbackslash InSMS} and \M The idea is to propose a banner, made with \TikZ, to present for example a title. -The global style is fixed, but few customizations are possible. +The global style is fixed, but few customization are possible. \begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25] \tkzBannerTri[keys]{number}{title} diff --git a/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.pdf b/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.pdf Binary files differindex ad524e7e96..a9d31123c9 100644 --- a/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.pdf +++ b/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.pdf diff --git a/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.tex b/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.tex index 9d508cf5c0..8540f5131b 100644 --- a/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.tex +++ b/macros/latex/contrib/customenvs/doc/customenvs-doc-fr.tex @@ -39,8 +39,8 @@ \usepackage[margin=1.5cm]{geometry} \setlength{\parindent}{0pt} -\def\TPversion{0.2.6} -\def\TPdate{4 novembre 2024} +\def\TPversion{0.3.0} +\def\TPdate{3 février 2025} \usepackage{tcolorbox} \tcbuselibrary{listingsutf8} %\usepackage{eurosym} @@ -72,7 +72,7 @@ morekeywords={\ReponsesQCM,MultiCols,\CreerListeItems,\ListeChoixItems,\TableauCompetences,\CrayonDeCompetences,\StyleEnvtExo,\StyleEnvtExoDefaut,\TitreExo,\ipsum,EnvSMS,\SMSrec,\SMSenv,BoiteSimple,\SujetTitreExo,\CircledNumber,\AffVignette,\BoiteArrondie,\ChangerDisplaySkip,\celcouleur,\celfusion,\lignetxt,\colonnetxt,\celnumbreak,\celtxt,\BandeauScore,\InsererImage,\tkzBannerTri,\NiveauDiffExos,\tkzEtoiles,\tkzGrilleAuto,\tkzAutoGridLocal,\tkzAutoGridActivate,\tkzFlecheEvasee,PanneauAutoroute,\AfficheSoldes,\tbcmarker,\VilleDist,\RoueNiveaux,EnvRoueNiveaux,\PlacerIconeNiveau,\PlacerIconesNiveaux,\MiniCompteurNiveaux,\tkzspeedometer},% keywordstyle={\color{green!50!black}},% classoffset=3,% - morekeywords={Largeur,Filets,EspacesCL,NbCols,Labels,PoliceLabels,EspaceLabels,Swap,Type,CoeffEspVert,EpTrait,Alea,LargeurNivs,Niveaux,NoticeNiveaux,Titre,PolTitre,PolNotice,PolComp,LigneSep,CouleurNotice,CouleurNiveaux,CouleurFond,Note,Notice,PoliceCateg,PoliceBloc,Couleurs,LargeurBloc,Echelle,NoirBlanc,Libelle,EpTrait,Police,Type,ComplementTitre,Titre,CodeDebut,Couleur,EchelleImage,Decoration,Trait,Avatar,AffAvatar,NoirBlanc,CouleurE,CouleurR,CouleurFond,Hauteur,Largeur,PoliceTxt,CouleurTitre,AlignH,bg,txt,bthick,bcol,raise,Type,EspH,Fond,Texte,Style,Dense,Avant,AvantS,Apres,ApresS,Global,align,width,Legende,CouleurFond,Hauteur,Ratio,AffLegende,Couleurs,EchelleSymboles,Symboles,vRemplir,vOffset,vCentrer,height,width,blockwidth,collight,colmedium,coldar,coltxt,fonttxt,swap,maincolor,logo,type,num,dispblock,customtype,Couleur,AlignV,Offset,NiveauMax,pasX,pasY,grilleauto,TailleFleche,Direction,Coeff,TypeFleche,Deplacement,LineCap,Epaisseur,CouleurCartouche,Fleches,CouleurFond,CouleurTitre,PoliceCartouche,TypeFleche,EspacementV,OffsetFleches,Dernier,PoliceEntete,PolicePrix,PoliceReduc,OffsetReduc,AgrandirReduc,Rayon,Police,ListeNiveaux,Marqueur,Pos,Echelle,Couleurs,Taille},% + morekeywords={Largeur,Filets,EspacesCL,NbCols,Labels,Melange,PoliceLabels,EspaceLabels,Swap,Type,CoeffEspVert,EpTrait,Alea,LargeurNivs,Niveaux,NoticeNiveaux,Titre,PolTitre,PolNotice,PolComp,LigneSep,CouleurNotice,CouleurNiveaux,CouleurFond,Note,Notice,PoliceCateg,PoliceBloc,Couleurs,LargeurBloc,Echelle,NoirBlanc,Libelle,EpTrait,Police,Type,ComplementTitre,Titre,CodeDebut,Couleur,EchelleImage,Decoration,Trait,Avatar,AffAvatar,NoirBlanc,CouleurE,CouleurR,CouleurFond,Hauteur,Largeur,PoliceTxt,CouleurTitre,AlignH,bg,txt,bthick,bcol,raise,Type,EspH,Fond,Texte,Style,Dense,Avant,AvantS,Apres,ApresS,Global,align,width,Legende,CouleurFond,Hauteur,Ratio,AffLegende,Couleurs,EchelleSymboles,Symboles,vRemplir,vOffset,vCentrer,height,width,blockwidth,collight,colmedium,coldar,coltxt,fonttxt,swap,maincolor,logo,type,num,dispblock,customtype,Couleur,AlignV,Offset,NiveauMax,pasX,pasY,grilleauto,TailleFleche,Direction,Coeff,TypeFleche,Deplacement,LineCap,Epaisseur,CouleurCartouche,Fleches,CouleurFond,CouleurTitre,PoliceCartouche,TypeFleche,EspacementV,OffsetFleches,Dernier,PoliceEntete,PolicePrix,PoliceReduc,OffsetReduc,AgrandirReduc,Rayon,Police,ListeNiveaux,Marqueur,Pos,Echelle,Couleurs,Taille},% keywordstyle={\color{orange}} },% #1 @@ -118,7 +118,7 @@ \begin{tabular}{c} \texttt{Cédric Pierquet}\\ {\ttfamily c pierquet -- at -- outlook . fr}\\ - \texttt{\url{https://github.com/cpierquet/customenvs}} + \texttt{\url{https://forge.apps.education.fr/pierquetcedric/packages-latex}} \end{tabular} \end{center} @@ -152,6 +152,10 @@ \section{Historique} +\verb|v0.3.0|~:~~~Compatibilité accrue avec \textsf{beamer} + +\verb|v0.2.7|~:~~~Clé \texttt{[Melange]} pour les QCMs + \verb|v0.2.6|~:~~~Roue des compétences / speedometer \verb|v0.2.5|~:~~~Correction du fonctionnement de \texttt{EnvtExo} @@ -170,23 +174,23 @@ \verb|v0.1.8|~:~~~Nutriscore -\verb|v0.1.7|~:~~~~Possibilité de créer des vignettes \textsf{perso} +\verb|v0.1.7|~:~~~Possibilité de créer des vignettes \textsf{perso} -\verb|v0.1.6|~:~~~~Patch \textsf{displayskip} + Patches \textsf{pas-tableur} +\verb|v0.1.6|~:~~~Patch \textsf{displayskip} + Patches \textsf{pas-tableur} -\verb|v0.1.5|~:~~~~La librairie \texttt{babel} de \TikZ\ n'est plus chargée +\verb|v0.1.5|~:~~~La librairie \texttt{babel} de \TikZ\ n'est plus chargée -\verb|v0.1.5|~:~~~~Vignettes + Numéros encerclés + Création de boîtes 'simples' +\verb|v0.1.5|~:~~~Vignettes + Numéros encerclés + Création de boîtes 'simples' -\verb|v0.1.4|~:~~~~Commande pour du texte dans une boîte arrondie, de hauteur 'figée' + 'Chat' SMS +\verb|v0.1.4|~:~~~Commande pour du texte dans une boîte arrondie, de hauteur 'figée' + 'Chat' SMS -\verb|v0.1.3|~:~~~~Environnement/commande pour des exercices, avec personnalisation(s) +\verb|v0.1.3|~:~~~Environnement/commande pour des exercices, avec personnalisation(s) -\verb|v0.1.2|~:~~~~Crayon de compétences +\verb|v0.1.2|~:~~~Crayon de compétences -\verb|v0.1.1|~:~~~~Tableaux de compétences +\verb|v0.1.1|~:~~~Tableaux de compétences -\verb|v0.1.0|~:~~~~Version initiale +\verb|v0.1.0|~:~~~Version initiale \pagebreak @@ -240,6 +244,7 @@ Les packages chargés sont : À noter que, pour des raisons de compatibilité (ou d'incompatibilité), les packages \MontreCode{enumitem}/\MontreCode{multicol}/\MontreCode{tabularray}/\MontreCode{xcolor}/\MontreCode{fontawesome5} peuvent ne pas être chargés par \MontreCode{customenvs} (auxquels cas l'utilisateur devra les avoir chargés pour faire fonctionner certains environnements) via les options : \begin{itemize} + \item \MontreCode{$\mathtt{\langle}$beamer$\mathtt{\rangle}$} (pour assurer une compatibilité avec \textsf{beamer}); \item \MontreCode{$\mathtt{\langle}$nonenum$\mathtt{\rangle}$} ; \item \MontreCode{$\mathtt{\langle}$nonmulticol$\mathtt{\rangle}$} ; \item \MontreCode{$\mathtt{\langle}$nontblr$\mathtt{\rangle}$} ; @@ -286,6 +291,7 @@ Les \MontreCode{options} disponibles sont : \end{itemize} \item \MontreCode{PoliceLabels} pour la police des labels, \MontreCode{\textbackslash bfseries} par défaut ; \item \MontreCode{EspaceLabels} pour gérer l'espacement entre le label et la réponse, et valant \MontreCode{\textbackslash kern5pt} par défaut ; + \item \MontreCode{Melange} pour mélanger les réponses, et valant \MontreCode{false} par défaut ; \item \MontreCode{Swap} pour afficher les (4) réponses en mode 2 colonnes sous la forme ACBD ou ABCD, et valant \MontreCode{false} par défaut. \end{itemize} @@ -302,6 +308,10 @@ Les options spécifiques, optionnelles et entre \MontreCode{<...>}, sont pour le \begin{DemoCode}{} \ReponsesQCM[Filets]{Réponse A § Réponse B § Réponse C § Réponse D} + +\ReponsesQCM[Filets,Melange]{Réponse A1 § Réponse B1 § Réponse C1 § Réponse D1} + +\ReponsesQCM[Filets,Melange]{Réponse A2 § Réponse B2 § Réponse C2 § Réponse D2} \end{DemoCode} \begin{DemoCode}{} @@ -441,7 +451,7 @@ L'idée est donc de proposer une environnement \textit{simplifié} intégrant un De plus, si le multi-colonnes est destiné à accueillir une liste, les items seront correctement alignés avec une liste sans multi-colonnes. \begin{DemoCode}{listing only} -\begin{MultiCols}[options](nbcols)<options enumitem> +\begin{MultiCols}[options](nbcols)<options enumitem>!options beamer! %corps \end{MutiCols} \end{DemoCode} @@ -462,6 +472,8 @@ Le nombre de colonnes, obligatoire, est à donner entre \MontreCode{(...)}. L'argument optionnel et entre \MontreCode{<...>} est passé à l'environnement \MontreCode{enumitem} ou \MontreCode{itemize} si spécifié. +Le dernier argument, entre \MontreCode{!...!}, permet de spécifier des options pour l'environnement \MontreCode{enumitem} avec \MontreCode{beamer}. + \subsection{Exemples} \begin{DemoCode}{} @@ -527,7 +539,7 @@ L'idée est ici de : \end{DemoCode} \begin{DemoCode}{listing only} -\ListeChoixItems[clés]{macro}{nomliste}(numéros)<options enumitem> +\ListeChoixItems[clés]{macro}{nomliste}(numéros)<options enumitem>!options beamer! \end{DemoCode} Les \MontreCode{clés} disponibles sont : @@ -550,7 +562,9 @@ Le quatrième argument, obligatoire et entre \MontreCode{(...)} permet de spéci \item les items à afficher, sous la forme \MontreCode{num1,num2,...}. \end{itemize} -Le dernier argument, optionnel et entre \MontreCode{<...>} correspond à des options spécifiques à passer à l'environnement de liste \MontreCode{enumitem} créé. +L'avant-dernier argument, optionnel et entre \MontreCode{<...>} correspond à des options spécifiques à passer à l'environnement de liste \MontreCode{enumitem} créé. + +Le dernier argument, entre \MontreCode{!...!}, permet de spécifier des options pour l'environnement \MontreCode{enumitem} avec \MontreCode{beamer}. \medskip diff --git a/macros/latex/contrib/customenvs/tex/customenvs.sty b/macros/latex/contrib/customenvs/tex/customenvs.sty index ef5f36f42f..762e973b31 100644 --- a/macros/latex/contrib/customenvs/tex/customenvs.sty +++ b/macros/latex/contrib/customenvs/tex/customenvs.sty @@ -1,11 +1,14 @@ % Author..........: C. Pierquet -% licence.........: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf +% licence.........: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt % source pencil...: CC-BY-SA 4.0 https://tex.stackexchange.com/questions/504092/replicating-a-fancy-bordered-text-style-in-latex/504145#504145 \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{customenvs}[2024/11/04 0.2.6 Custom classic environments] +\ProvidesPackage{customenvs}[2025/02/03 0.3.0 Custom classic environments] %====HISTORIQUE +% v 0.3.0 Beamer compatibility (?) +% v 0.2.8 Position absolue d'un objet dans une page +% v 0.2.7 Mélange des réponses des QCMs % v 0.2.6 Roue des compétences / SkillsWheel / speedometer % v 0.2.5 Modification mineure des points dans l'environnement EnvtExo % v 0.2.4 Petite boîte marker @@ -28,6 +31,8 @@ \newif\if@enum\@enumtrue% \DeclareOption{nonenum}{\@enumfalse}% \DeclareOption{noenum}{\@enumfalse}% +\newif\if@beamer\@beamerfalse% +\DeclareOption{beamer}{\@beamertrue\@enumfalse}% \newif\if@tblr\@tblrtrue% \DeclareOption{nontblr}{\@tblrfalse}% \DeclareOption{notblr}{\@tblrfalse}% @@ -82,6 +87,8 @@ } %====QCMs +\NewList{TmpListeReponsesQCM} + \defKV[reponsesqcm]{% NbCols=\def\RepQCMNbCol{#1},% PoliceLabels=\def\RepQCMFonte{#1},% @@ -99,7 +106,8 @@ Labels={a.},% EspaceLabels=\kern5pt,% Swap=false,% - Largeur=0.99\linewidth + Largeur=0.99\linewidth,% + Melange=false } \NewDocumentCommand\QCMFormatteLabel{ m m }{%1=typelabel,%3=caractère @@ -151,45 +159,98 @@ \xdef\RepQCMLabelC{\QCMFormatteLabel{\RepQCMTypeLabel}{3}\RepQCMSpace}% \xdef\RepQCMLabelD{\QCMFormatteLabel{\RepQCMTypeLabel}{4}\RepQCMSpace}% }{}% - %en fonction du nb de colonnes - \IfEq{\QCMNbRep}{2}%2réponses - {% - \ifboolKV[reponsesqcm]{Filets}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% - \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] \\ - \end{tblr}% - }% - {}% - \IfEq{\QCMNbRep}{3}%3réponses - {% - \ifboolKV[reponsesqcm]{Filets}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% - \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] & \RepQCMLabelC\QCMListereponses[3] \\ - \end{tblr}% - }% - {}% - \IfEq{\QCMNbRep}{4}%4réponses + %en fonction du nb de colonnes et du shuffle + \ifboolKV[reponsesqcm]{Melange}% {% - \IfEq{\RepQCMNbCol}{4}%4colonnes + \ClearList{TmpListeReponsesQCM}% + \IfEq{\QCMNbRep}{2}%2réponses {% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[1]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[2]}% \ifboolKV[reponsesqcm]{Filets}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% - \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] & \RepQCMLabelC\QCMListereponses[3] & \RepQCMLabelD\QCMListereponses[4] \\ + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + \RepQCMLabelA\TmpListeReponsesQCM[0] & \RepQCMLabelB\TmpListeReponsesQCM[1] \\ \end{tblr}% }% + {}% + \IfEq{\QCMNbRep}{3}%3réponses + {% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[1]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[2]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[3]}% + \ifboolKV[reponsesqcm]{Filets}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% + \RepQCMLabelA\TmpListeReponsesQCM[0] & \RepQCMLabelB\TmpListeReponsesQCM[1] & \RepQCMLabelC\TmpListeReponsesQCM[2] \\ + \end{tblr}% + }% + {}% + \IfEq{\QCMNbRep}{4}%4réponses + {% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[1]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[2]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[3]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[4]}% + \IfEq{\RepQCMNbCol}{4}%4colonnes + {% + \ifboolKV[reponsesqcm]{Filets}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% + \RepQCMLabelA\TmpListeReponsesQCM[0] & \RepQCMLabelB\TmpListeReponsesQCM[1] & \RepQCMLabelC\TmpListeReponsesQCM[2] & \RepQCMLabelD\TmpListeReponsesQCM[3] \\ + \end{tblr}% + }% + {% + \ifboolKV[reponsesqcm]{Filets}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + \RepQCMLabelA\TmpListeReponsesQCM[0] & \ifboolKV[reponsesqcm]{Swap}{\RepQCMLabelB\TmpListeReponsesQCM[1]}{\RepQCMLabelC\TmpListeReponsesQCM[1]} \\ + \ifboolKV[reponsesqcm]{Swap}{\RepQCMLabelC\TmpListeReponsesQCM[2]}{\RepQCMLabelB\TmpListeReponsesQCM[2]} & \RepQCMLabelD\TmpListeReponsesQCM[3] \\ + \end{tblr}% + }% + }% + {}% + }% + {% + \IfEq{\QCMNbRep}{2}%2réponses {% \ifboolKV[reponsesqcm]{Filets}% {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% - \RepQCMLabelA\QCMListereponses[1] & \ifboolKV[reponsesqcm]{Swap}{\RepQCMLabelB\QCMListereponses[2]}{\RepQCMLabelC\QCMListereponses[3]} \\ - \ifboolKV[reponsesqcm]{Swap}{\RepQCMLabelC\QCMListereponses[3]}{\RepQCMLabelB\QCMListereponses[2]} & \RepQCMLabelD\QCMListereponses[4] \\ + \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] \\ + \end{tblr}% + }% + {}% + \IfEq{\QCMNbRep}{3}%3réponses + {% + \ifboolKV[reponsesqcm]{Filets}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% + \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] & \RepQCMLabelC\QCMListereponses[3] \\ \end{tblr}% }% + {}% + \IfEq{\QCMNbRep}{4}%4réponses + {% + \IfEq{\RepQCMNbCol}{4}%4colonnes + {% + \ifboolKV[reponsesqcm]{Filets}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% + \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] & \RepQCMLabelC\QCMListereponses[3] & \RepQCMLabelD\QCMListereponses[4] \\ + \end{tblr}% + }% + {% + \ifboolKV[reponsesqcm]{Filets}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + \RepQCMLabelA\QCMListereponses[1] & \ifboolKV[reponsesqcm]{Swap}{\RepQCMLabelB\QCMListereponses[2]}{\RepQCMLabelC\QCMListereponses[3]} \\ + \ifboolKV[reponsesqcm]{Swap}{\RepQCMLabelC\QCMListereponses[3]}{\RepQCMLabelB\QCMListereponses[2]} & \RepQCMLabelD\QCMListereponses[4] \\ + \end{tblr}% + }% + }% + {}% }% - {}% } %====CENTRAGE @@ -221,15 +282,24 @@ EpTrait=0pt } -\NewDocumentEnvironment{MultiCols}{ O{} r() D<>{} }% +\NewDocumentEnvironment{MultiCols}{ O{} r() D<>{} d!! }% {% \useKVdefault[multicolsperso]% \setKV[multicolsperso]{#1}% \CoeffEspaceMulticols[\useKV[multicolsperso]{CoeffEspVert}]% \setlength{\columnseprule}{\useKV[multicolsperso]{EpTrait}}% \begin{multicols}{#2}% - \IfStrEq{\useKV[multicolsperso]{Type}}{enum}{\begin{enumerate}[#3]}{}% - \IfStrEq{\useKV[multicolsperso]{Type}}{item}{\begin{itemize}[#3]}{}% + %enum beamer or not + \IfNoValueTF{#4}% + {% + \IfStrEq{\useKV[multicolsperso]{Type}}{enum}{\begin{enumerate}[#3]}{}% + \IfStrEq{\useKV[multicolsperso]{Type}}{item}{\begin{itemize}[#3]}{}% + }% + {% + \IfStrEq{\useKV[multicolsperso]{Type}}{enum}{\begin{enumerate}[#4][#3]}{}% + \IfStrEq{\useKV[multicolsperso]{Type}}{item}{\begin{itemize}[#4][#3]}{}% + }% + %==on teste si on a un argument optionnel pour beamer... }% {% \IfStrEq{\useKV[multicolsperso]{Type}}{enum}{\end{enumerate}}{}% @@ -254,7 +324,7 @@ Type=enum } -\NewDocumentCommand\ListeChoixItems{ O{} m m r() D<>{} }{%1=options,2=série des items,3=nomsérie,4=liste choix,5=options enum +\NewDocumentCommand\ListeChoixItems{ O{} m m r() D<>{} d!! }{%1=options,2=série des items,3=nomsérie,4=liste choix,5=options enum,%6=beamer ? %on teste si la liste considérée existe... \@ifIsList{#3}% {% @@ -270,16 +340,33 @@ \xintFor* ##1 in {\xintCSVtoList{#2}}\do{\InsertLastItem{#3}{##1}} }% %création de l'environnement - \IfStrEq{\ChoixTypeSerie}{enum}% - {\begin{enumerate}[#5]}{}% - \IfStrEq{\ChoixTypeSerie}{item}% - {\begin{itemize}[#5]}{}% - \IfSubStr{\ChoixTypeSerie}{MultiCols}% + %==on teste si on a un argument optionnel pour beamer... + \IfNoValueTF{#6}% + {% + \IfStrEq{\ChoixTypeSerie}{enum}% + {\begin{enumerate}[#5]}{}% + \IfStrEq{\ChoixTypeSerie}{item}% + {\begin{itemize}[#5]}{}% + \IfSubStr{\ChoixTypeSerie}{MultiCols}% + {% + \StrBetween[1,2]{\ChoixTypeSerie}{/}{/}[\ChoixTypeMulticols]% + \StrBehind[2]{\ChoixTypeSerie}{/}[\NbMulticols]% + \begin{MultiCols}[Type=\ChoixTypeMulticols](\NbMulticols)<#5>% + }{}% + }% {% - \StrBetween[1,2]{\ChoixTypeSerie}{/}{/}[\ChoixTypeMulticols]% - \StrBehind[2]{\ChoixTypeSerie}{/}[\NbMulticols]% - \begin{MultiCols}[Type=\ChoixTypeMulticols](\NbMulticols)<#5>% - }{}% + \IfStrEq{\ChoixTypeSerie}{enum}% + {\begin{enumerate}[#6][#5]}{}% + \IfStrEq{\ChoixTypeSerie}{item}% + {\begin{itemize}[#6][#5]}{}% + \IfSubStr{\ChoixTypeSerie}{MultiCols}% + {% + \StrBetween[1,2]{\ChoixTypeSerie}{/}{/}[\ChoixTypeMulticols]% + \StrBehind[2]{\ChoixTypeSerie}{/}[\NbMulticols]% + \begin{MultiCols}[Type=\ChoixTypeMulticols](\NbMulticols)<#5>!#6!% + }{}% + }% + %==multicols %items choisis \ifboolKV[itemchoisir]{Alea}% {% @@ -1529,7 +1616,8 @@ Labels={a.},% SpaceLabels=\kern5pt,% Swap=false,% - Width=0.99\linewidth + Width=0.99\linewidth,% + Shuffle=false } \NewDocumentCommand\MCQFormatLabel{ m m }{%1=typelabel,%3=caractère @@ -1582,44 +1670,97 @@ \xdef\RepQCMLabelD{\MCQFormatLabel{\RepQCMTypeLabel}{4}\RepQCMSpace}% }{}% %en fonction du nb de colonnes - \IfEq{\QCMNbRep}{2}%2réponses + \ifboolKV[answersmcq]{Shuffle}% {% - \ifboolKV[answersmcq]{Lines}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% - \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] \\ - \end{tblr}% - }% - {}% - \IfEq{\QCMNbRep}{3}%3réponses - {% - \ifboolKV[answersmcq]{Lines}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% - \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] & \RepQCMLabelC\QCMListereponses[3] \\ - \end{tblr}% - }% - {}% - \IfEq{\QCMNbRep}{4}%4réponses - {% - \IfEq{\RepQCMNbCol}{4}%4colonnes + \ClearList{TmpListeReponsesQCM}% + \IfEq{\QCMNbRep}{2}%2réponses {% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[1]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[2]}% \ifboolKV[answersmcq]{Lines}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% - {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% - \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] & \RepQCMLabelC\QCMListereponses[3] & \RepQCMLabelD\QCMListereponses[4] \\ + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + \RepQCMLabelA\TmpListeReponsesQCM[0] & \RepQCMLabelB\TmpListeReponsesQCM[1] \\ \end{tblr}% }% + {}% + \IfEq{\QCMNbRep}{3}%3réponses + {% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[1]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[2]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[3]}% + \ifboolKV[answersmcq]{Lines}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% + \RepQCMLabelA\TmpListeReponsesQCM[0] & \RepQCMLabelB\TmpListeReponsesQCM[1] & \RepQCMLabelC\TmpListeReponsesQCM[2] \\ + \end{tblr}% + }% + {}% + \IfEq{\QCMNbRep}{4}%4réponses + {% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[1]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[2]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[3]}% + \InsertRandomItem{TmpListeReponsesQCM}{\QCMListereponses[4]}% + \IfEq{\RepQCMNbCol}{4}%4colonnes + {% + \ifboolKV[answersmcq]{Lines}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% + \RepQCMLabelA\TmpListeReponsesQCM[0] & \RepQCMLabelB\TmpListeReponsesQCM[1] & \RepQCMLabelC\TmpListeReponsesQCM[2] & \RepQCMLabelD\TmpListeReponsesQCM[3] \\ + \end{tblr}% + }% + {% + \ifboolKV[answersmcq]{Lines}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + \RepQCMLabelA\TmpListeReponsesQCM[0] & \ifboolKV[answersmcq]{Swap}{\RepQCMLabelB\TmpListeReponsesQCM[1]}{\RepQCMLabelC\TmpListeReponsesQCM[1]} \\ + \ifboolKV[answersmcq]{Swap}{\RepQCMLabelC\TmpListeReponsesQCM[2]}{\RepQCMLabelB\TmpListeReponsesQCM[2]} & \RepQCMLabelD\TmpListeReponsesQCM[3] \\ + \end{tblr}% + }% + }% + {}% + }% + {% + \IfEq{\QCMNbRep}{2}%2réponses {% \ifboolKV[answersmcq]{Lines}% {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% - \RepQCMLabelA\QCMListereponses[1] & \ifboolKV[answersmcq]{Swap}{\RepQCMLabelB\QCMListereponses[2]}{\RepQCMLabelC\QCMListereponses[3]} \\ - \ifboolKV[answersmcq]{Swap}{\RepQCMLabelC\QCMListereponses[3]}{\RepQCMLabelB\QCMListereponses[2]} & \RepQCMLabelD\QCMListereponses[4] \\ + \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] \\ + \end{tblr}% + }% + {}% + \IfEq{\QCMNbRep}{3}%3réponses + {% + \ifboolKV[answersmcq]{Lines}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{3}{X[b,l]}},#3}}% + \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] & \RepQCMLabelC\QCMListereponses[3] \\ \end{tblr}% }% + {}% + \IfEq{\QCMNbRep}{4}%4réponses + {% + \IfEq{\RepQCMNbCol}{4}%4colonnes + {% + \ifboolKV[answersmcq]{Lines}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{4}{X[b,l]}},#3}}% + \RepQCMLabelA\QCMListereponses[1] & \RepQCMLabelB\QCMListereponses[2] & \RepQCMLabelC\QCMListereponses[3] & \RepQCMLabelD\QCMListereponses[4] \\ + \end{tblr}% + }% + {% + \ifboolKV[answersmcq]{Lines}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,hlines,vlines,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + {\begin{tblr}{rowsep=\RepQCMOffsetLgn,colsep=\RepQCMOffsetCol,width=\RepQCMLarg,colspec={*{2}{X[b,l]}},#3}}% + \RepQCMLabelA\QCMListereponses[1] & \ifboolKV[answersmcq]{Swap}{\RepQCMLabelB\QCMListereponses[2]}{\RepQCMLabelC\QCMListereponses[3]} \\ + \ifboolKV[answersmcq]{Swap}{\RepQCMLabelC\QCMListereponses[3]}{\RepQCMLabelB\QCMListereponses[2]} & \RepQCMLabelD\QCMListereponses[4] \\ + \end{tblr}% + }% + }% + {}% }% - {}% } %====ITEMCHOICE @@ -1637,7 +1778,7 @@ Type=enum } -\NewDocumentCommand\ListItemsChoice{ O{} m m r() D<>{} }{%1=options,2=série des items,3=nomsérie,4=liste choix,5=options enum +\NewDocumentCommand\ListItemsChoice{ O{} m m r() D<>{} d!! }{%1=options,2=série des items,3=nomsérie,4=liste choix,5=options enum,%6=options beamer ? %on teste si la liste considérée existe... \@ifIsList{#3}% {% @@ -1653,10 +1794,24 @@ \xintFor* ##1 in {\xintCSVtoList{#2}}\do{\InsertLastItem{#3}{##1}} }% %création de l'environnement - \IfStrEq{\ChoixTypeSerie}{enum}% - {\begin{enumerate}[#5]}{}% - \IfStrEq{\ChoixTypeSerie}{item}% - {\begin{itemize}[#5]}{}% + \IfNoValueTF{#6}% + {% + \IfStrEq{\ChoixTypeSerie}{enum}% + {\begin{enumerate}[#5]}{}% + \IfStrEq{\ChoixTypeSerie}{item}% + {\begin{itemize}[#5]}{}% + }% + {% + \IfStrEq{\ChoixTypeSerie}{enum}% + {\begin{enumerate}[#6][#5]}{}% + \IfStrEq{\ChoixTypeSerie}{item}% + {\begin{itemize}[#6][#5]}{}% + }% + % \IfStrEq{\ChoixTypeSerie}{enum}% + % {\begin{enumerate}[#5]}{}% + % \IfStrEq{\ChoixTypeSerie}{item}% + % {\begin{itemize}[#5]}{}% + %==multicols \IfSubStr{\ChoixTypeSerie}{MultiCols}% {% \StrBetween[1,2]{\ChoixTypeSerie}{/}{/}[\ChoixTypeMulticols]% @@ -3538,4 +3693,33 @@ \end{tikzpicture}% } +%====POSITION ABSOLUE DANS LA PAGE +\defKV[absposobject]{scale=\def\absposobject@scale{#1},anchor=\def\absposobject@anchor{#1}} +\setKVdefault[absposobject]{scale={},anchor={north west}} +\NewDocumentCommand\absposobject{ O{} m m m }{% + \restoreKV[absposobject]% + \setKV[absposobject]{#1}% + \IfStrEq{\absposobject@scale}{}% + {% + \begin{tikzpicture}[remember picture,overlay] \node[inner sep=0pt,outer sep=0pt] at ($([xshift=#2,yshift=#3]current page.\absposobject@anchor)$) {#4}; \end{tikzpicture}% + }% + {% + \begin{tikzpicture}[remember picture,overlay] \node[inner sep=0pt,outer sep=0pt,scale=\absposobject@scale] at ($([xshift=#2,yshift=#3]current page.\absposobject@anchor)$) {#4}; \end{tikzpicture}% + }% +} + +\defKV[absposobjet]{Echelle=\def\absposobject@scale{#1},Ancre=\def\absposobject@anchor{#1}} +\setKVdefault[absposobjet]{Echelle={},Ancre={north west}} +\NewDocumentCommand\objetposabs{ O{} m m m }{% + \restoreKV[absposobjet]% + \setKV[absposobjet]{#1}% + \IfStrEq{\absposobject@scale}{}% + {% + \begin{tikzpicture}[remember picture,overlay] \node[inner sep=0pt,outer sep=0pt] at ($([xshift=#2,yshift=#3]current page.\absposobject@anchor)$) {#4}; \end{tikzpicture}% + }% + {% + \begin{tikzpicture}[remember picture,overlay] \node[inner sep=0pt,outer sep=0pt,scale=\absposobject@scale] at ($([xshift=#2,yshift=#3]current page.\absposobject@anchor)$) {#4}; \end{tikzpicture}% + }% +} + \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/dashrule/README b/macros/latex/contrib/dashrule/README new file mode 100644 index 0000000000..a152fc444b --- /dev/null +++ b/macros/latex/contrib/dashrule/README @@ -0,0 +1,49 @@ + +--------------------------------------+ + | DASHRULE: Dashed rules in LaTeX | + | By Scott Pakin, scott+dash@pakin.org | + +--------------------------------------+ + + +Description +----------- + +The dashrule package makes it easy to draw a huge variety of dashed +rules (i.e., lines) in LaTeX. dashrule provides a command, +\hdashrule, which is a cross between LaTeX's \rule and PostScript's +setdash command. \hdashrule draws horizontally dashed rules using the +same syntax as \rule, but with an additional, setdash-like parameter +that specifies the pattern of dash segments and the space between +those segments. Because dashrule's rules are constructed internally +using \rule (as opposed to, e.g., PostScript \specials) they are fully +compatible with every LaTeX back-end processor. + + +Installation +------------ + +There's nothing special about building dashrule: + + latex dashrule.ins <== Generate dashrule.sty + latex dashrule.dtx <== Produce the documentation (dashrule.dvi) + makeindex -s gind.ist dashrule <== Generate an index + latex dashrule.dtx <== Incorporate the index into the document + +If you're new to this, see +http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages for more +information on installing packages. + + +Copyright and license +--------------------- + +Copyright (C) 2013 Scott Pakin, scott+dash@pakin.org + +This package may be distributed and/or modified under the conditions +of the LaTeX Project Public License, either version 1.3c of this +license or (at your option) any later version. The latest version of +this license is in: + + http://www.latex-project.org/lppl.txt + +and version 1.3c or later is part of all distributions of LaTeX version +2006/05/20 or later. diff --git a/macros/latex/contrib/dashrule/README.md b/macros/latex/contrib/dashrule/README.md deleted file mode 100644 index c8364b275d..0000000000 --- a/macros/latex/contrib/dashrule/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# The `dashrulex` package -Draw dashed rules (v1.02b) - -## Abstract -The `dashrulex` package provides a flexible solution for drawing dashed rules in the body, and currently provides two commands `\hdashrule` and `\hanyrule`. It's written in LaTeX3 and can be used as an alternative to the `dashrule` package. - -## License -This work may be distributed and/or modified under the conditions of the CC-BY 4.0 License. The latest version of this license is in https://creativecommons.org/licenses/by/4.0/legalcode - -## Website -| [Gitee](https://gitee.com/texno3/dashrulex) | [Github](https://github.com/texno3/dashrulex) | [CTAN](https://ctan.org/pkg/dashrulex) | - -## Maintainer -Qu Yi<br/> -Email: toquyi@163.com
\ No newline at end of file diff --git a/macros/latex/contrib/dashrule/dashrule.dtx b/macros/latex/contrib/dashrule/dashrule.dtx new file mode 100644 index 0000000000..34c1ec916a --- /dev/null +++ b/macros/latex/contrib/dashrule/dashrule.dtx @@ -0,0 +1,450 @@ +% \iffalse meta-comment +% +% Copyright (C) 2013 by Scott Pakin <scott+dash@pakin.org> +% ------------------------------------------------------- +% +% This file may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3c or later is part of all distributions of LaTeX +% version 2006/05/20 or later. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{dashrule.dtx} +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%<package>\ProvidesPackage{dashrule} +%<*package> + [2013/03/28 v1.3 Dashed rules] +%</package> +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{dashrule} +\usepackage{titlesec} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{dashrule.dtx} + \PrintChanges + \PrintIndex +\end{document} +%</driver> +% \fi +% +% \CheckSum{64} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{v1.0}{2001/04/23}{Initial version} +% +% \GetFileInfo{dashrule.dtx} +% +% \DoNotIndex{\addtocounter,\csname,\DeclareRobustCommand,\def,\else,\empty} +% \DoNotIndex{\endcsname,\expandafter,\fi,\hbox,\hskip,\hspace,\ifodd,\ifx} +% \DoNotIndex{\let,\mbox,\newcounter,\relax,\setcounter} +% +% ^^A Precede every section title with a dashed rule. +% \titleformat{\section} +% {\unskip\vskip 2.3ex plus 0.2ex +% \vbox{\noindent\hdashrule[0pt][x]{\fill}{1pt}{5pt}\rule{5pt}{1pt}} +% \vskip 2.3ex plus 0.2ex} +% {\normalfont\Large\bfseries\thesection} +% {1em} +% {\normalfont\Large\bfseries} +% +% +% \title{The \textsf{dashrule} package\thanks{This document +% corresponds to \textsf{dashrule}~\fileversion, dated \filedate.}} +% \author{Scott Pakin \\ \texttt{scott+dash@pakin.org}} +% +% \maketitle +% +% \begin{abstract} +% The \textsf{dashrule} package makes it easy to draw a huge variety +% of dashed rules (i.e., lines) in \LaTeX. \textsf{dashrule} provides +% a command, |\hdashrule|, which is a cross between \LaTeX's |\rule| +% and PostScript's |setdash| command. |\hdashrule| draws horizontally +% dashed rules using the same syntax as |\rule| but with an +% additional, |setdash|-like parameter that specifies the pattern of +% dash segments and the space between those segments. Because +% \textsf{dashrule}'s rules are constructed internally using |\rule| +% (as opposed to, e.g., PostScript |\special|s) they are fully +% compatible with every \LaTeX{} back-end processor. +% \end{abstract} +% +% +% \section{Usage} +% +% \DescribeMacro{\hdashrule} +% \LaTeX's |\rule| command draws a rectangular blob of ink with a given +% width, height, and distance above the baseline. The +% \textsf{dashrule} package introduces an analogous command, +% |\hdashrule|, which draws the same blob of ink, but horizontally +% dashed. |\hdashrule| takes five parameters, two of which are +% optional: +% +% \bigskip +% \noindent\hspace{-\leftmargini}% +% \fbox{\texttt{\string\hdashrule} +% \oarg{raise} \oarg{leader} \marg{width} \marg{height} \marg{dash}} +% \bigskip +% +% The \meta{raise}, \meta{width}, and \meta{height} parameters have the +% same meaning as in \LaTeX's |\rule| macro: the distance to raise the +% rule above the baseline and the width and height of the rule. +% +% Because |\hdashrule| is implemented in terms of \TeX's primitive +% leader commands (|\leaders|, |\cleaders|, and |\xleaders|), the dash +% pattern must be repeated an integral number of times. \meta{leader} +% specifies what to do with the extra whitespace (always less than the +% width of the dash pattern) that this requirement introduces. The +% default, which corresponds to \TeX's |\leaders| command, adds space to +% both ends of the rule so the dash patterns from multiple |\hdashrule|s +% line up. If \meta{leader} is~|c|, which corresponds to \TeX's +% |\cleaders| command, an equal amount of whitespace is added to both +% ends of the rule. If \meta{leader} is~|x|, which corresponds to +% \TeX's |\xleaders| command, the whitespace is divided up, and the same +% amount of whitespace separates each repetition of the dash pattern. +% +% The \meta{dash} argument specifies the dash pattern and is analogous +% to the \textit{array} argument to PostScript's |setdash| function. +% That is, it is a list of space-separated \meta{dimen}s that alternate +% ``on'' and ``off'' distances. For instance, ``|2pt 1pt|'' means a +% 2\,pt.\ rule, followed by a 1\,pt.\ gap, followed by a 2\,pt.\ rule, +% followed by a 1\,pt.\ gap, and so forth. An odd number of +% \meta{dimen}s is no different; ``|2pt|'' alternates 2\,pt.\ rules and +% 2\,pt.\ gaps, and ``|1pt 2pt 3pt|'' repeats ``1\,pt.\ rule, +% 2\,pt.\ gap, 3\,pt.\ rule, 1\,pt.\ gap, 2\,pt.\ rule, 3\,pt.\ gap.'' +% As a special case, an empty \meta{dash} argument draws a solid rule. +% +% +% \section{Examples} +% +% The following are some typical ways to use |\hdashrule|. Each example +% changes from the previous in only one parameter. For clarity, +% underlines are used to indicate modified text, and the rule is +% bracketed by an upper- and lowercase~``X''. +% +% \begin{center} +% \renewcommand{\arraystretch}{1.5} +% \newcommand{\chg}[1]{\underbar{\texttt{#1}}} +% \begin{tabular}{l@{\qquad}l} +% |\rule{2cm}{1pt}| & +% X\rule{2cm}{1pt}x \\ +% +% |\|\chg{hdashrule}|{2cm}{1pt}|\chg{\char`\{\char`\}} & +% X\hdashrule{2cm}{1pt}{}x \\ +% +% |\hdashrule{2cm}{1pt}{|\chg{1pt}|}| & +% X\hdashrule{2cm}{1pt}{1pt}x \\ +% +% |\hdashrule{|\chg{4cm}|}{1pt}{1pt}| & +% X\hdashrule{4cm}{1pt}{1pt}x \\ +% +% |\hdashrule|\chg{[0.5ex]}|{4cm}{1pt}{1pt}| & +% X\hdashrule[0.5ex]{4cm}{1pt}{1pt}x \\ +% +% |\hdashrule[0.5ex]{4cm}{1pt}{|\chg{3mm}|}| & +% X\hdashrule[0.5ex]{4cm}{1pt}{3mm}x \\ +% +% |\hdashrule[0.5ex]{4cm}{|\chg{1mm}|}{3mm}| & +% X\hdashrule[0.5ex]{4cm}{1mm}{3mm}x \\ +% +% |\hdashrule[0.5ex]{4cm}{1mm}{3mm |\chg{3pt}|}| & +% X\hdashrule[0.5ex]{4cm}{1mm}{3mm 3pt}x \\ +% +% |\hdashrule[0.5ex]{4cm}{1mm}{%| \\[-1.5ex] +% | 3mm 3pt |\chg{1mm 2pt}|}| & +% X\hdashrule[0.5ex]{4cm}{1mm}{3mm 3pt 1mm 2pt}x \\ +% \end{tabular} +% \end{center} +% +% \bigskip +% \noindent +% These next examples show the effect of using different leader types. +% Each leader is used with both a 4\,cm~wide rule and a 3\,cm~wide rule. +% +% \begin{center} +% \renewcommand{\arraystretch}{1.25} +% \newcommand{\chg}[1]{\underbar{\texttt{#1}}} +% \begin{tabular}{l@{\qquad}l} +% |\hdashrule[0.5ex]{4cm}{1mm}{8mm 2pt}| & +% X\hdashrule[0.5ex]{4cm}{1mm}{8mm 2pt}x \\ +% +% |\hdashrule[0.5ex]{3cm}{1mm}{8mm 2pt}| & +% X\hdashrule[0.5ex]{3cm}{1mm}{8mm 2pt}x \\[2ex] +% +% |\hdashrule[0.5ex]|\chg{[c]}|{4cm}{1mm}{8mm 2pt}| & +% X\hdashrule[0.5ex][c]{4cm}{1mm}{8mm 2pt}x \\ +% +% |\hdashrule[0.5ex]|\chg{[c]}|{3cm}{1mm}{8mm 2pt}| & +% X\hdashrule[0.5ex][c]{3cm}{1mm}{8mm 2pt}x \\[2ex] +% +% |\hdashrule[0.5ex][|\chg{x}|]{4cm}{1mm}{8mm 2pt}| & +% X\hdashrule[0.5ex][x]{4cm}{1mm}{8mm 2pt}x \\ +% +% |\hdashrule[0.5ex][|\chg{x}|]{3cm}{1mm}{8mm 2pt}| & +% X\hdashrule[0.5ex][x]{3cm}{1mm}{8mm 2pt}x \\ +% \end{tabular} +% \end{center} +% +% \noindent +% Notice how the dashes in the first pair of |\hdashrule|s line up; the +% rules in the second pair each have an equal amount of whitespace on +% either side of the rule; and the rules in the third pair have extra +% spaces within the dash pattern itself instead of around it. The +% |x|~qualifier is rarely useful for dashed rules because it alters the +% pattern itself. However, |x| does enable rules with long dashes to +% better fill a comparatively small width, as in the following example: +% +% \begin{center} +% \renewcommand{\arraystretch}{1.25} +% \begin{tabular}{l@{\qquad}l} +% |\hdashrule[0.5ex][x]{3in}{2pt}{2cm 0pt}| \\ +% X\hdashrule[0.5ex][x]{3in}{2pt}{2cm 0pt}x +% \end{tabular} +% \end{center} +% +% \noindent +% The gaps in the above are clearly wider than~|0pt|, but they \emph{are} +% evenly spaced. +% +% +% \section{Differences from \texttt{setdash}} +% +% |\hdashrule| is different from PostScript's |setdash| command in the +% following ways: +% +% \begin{itemize} +% \item |setdash| takes on/off values in terms of PostScript points +% (\TeX{} ``big points'' or~``|bp|''), while |\hdashrule| requires +% explicit units. +% +% \item There is no equivalent of |setdash|'s \textit{offset} +% parameter to specify a starting offset into the pattern. If you're +% desperate you can fake \textit{offset} with a leading |\rule| and +% |\hspace|. +% \end{itemize} +% +% +% \StopEventually{^^A +% \section{Future Work} +% +% \textsf{dashrule} \fileversion{} supports only horizontally dashed +% rules. Future versions (if any) may support vertically dashed rules +% as well. For the time being, the \textsf{graphicx} package's +% \texttt{\string\rotatebox} can be used to define a +% \texttt{\string\vdashrule} in terms of a rotated +% \texttt{\string\hdashrule}. +% +% The next logical step after adding a \texttt{\string\vdashrule} is +% to support dashed rectangles, which would be composed of +% \texttt{\string\hdashrule}s and \texttt{\string\vdashrule}s. Other +% possible enhancements would be a way of drawing dotted lines, +% presumably composed from the limited set of circle characters +% available in \LaTeX's fonts. +% } +% +% +% \section{Implementation} +% +% We load the \textsf{ifmtarg} package to help check if the final +% argument to |\hdashrule| is empty. +% \begin{macrocode} +\RequirePackage{ifmtarg} +% \end{macrocode} +% +% \begin{macro}{\hdr@do@rule} +% This macro is exactly like \LaTeX's |\rule| except that the optional +% argument is required, and it has the side effect of pointing +% |\hdr@do@something| to |\hdr@do@skip|. +% \begin{macrocode} +\def\hdr@do@rule[#1]#2#3{% + \rule[#1]{#2}{#3}% + \let\hdr@do@something=\hdr@do@skip +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hdr@do@skip} +% This macro takes the same arguments as |\hdr@do@rule|, but instead of +% drawing a rule, it inserts an equivalent amount of horizontal +% whitespace. Additionally, it points |\hdr@do@something| to +% |\hdr@do@rule| as a side effect. +% \begin{macrocode} +\def\hdr@do@skip[#1]#2#3{% + \hspace*{#2}% + \let\hdr@do@something=\hdr@do@rule +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\c@hdr@segments} +% \begin{macro}{\hdr@tally@segments} +% Dash patterns containing an odd number of segments are treated +% differently from dash patterns containing an even number of segments. +% We therefore define a macro, |\hdr@tally@segments|, which counts the +% number of space-separated segments in a dash pattern and stores the +% tally in the |hdr@segments| counter. Note that |hdr@segments| should +% be initialized to~|0| before invoking |\hdr@tally@segments|. +% \begin{macrocode} +\newcounter{hdr@segments} +\def\hdr@tally@segments#1 {% + \ifx#1!% + \else + \addtocounter{hdr@segments}{1}% + \expandafter\hdr@tally@segments + \fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\hdashrule} +% This is the only macro in \textsf{dashrule}'s external interface. +% (|\hdashrule@ii| does most of the work for |\hdashrule|, though.) All +% |\hdashrule| itself does is invoke |\hdashrule@i| with its first +% optional argument or~|0.0pt| if none was provided. |\hdashrule@i|, in +% turn, invokes |\hdashrule@ii| with the two optional arguments, +% supplying |\empty| as the default value of the second optional +% argument. +% \changes{v1.1}{2008/04/27}{Preceded the invocation of +% \texttt{\string\string\string\@testopt} with an empty box so that +% \texttt{\string\string\string\hdashrule} can now begin a paragraph} +% \begin{macrocode} +\DeclareRobustCommand{\hdashrule}{\mbox{}\@testopt{\hdashrule@i}{0pt}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hdashrule@i} +% Supply |\empty| as the default second argument and call +% |\hdashrule@ii|. +% \begin{macrocode} +\def\hdashrule@i[#1]{\@testopt{\hdashrule@ii[#1]}\empty} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hdashrule@ii} +% Now we can do the real work for |\hdashrule|. |\hdashrule@ii| takes +% the following parameters: +% +% \begin{center} +% \begin{tabular}{ccccc} +% |#1| & |#2| & |#3| & |#4| & |#5| \\ +% \oarg{raise} & \oarg{leader} & \marg{width} & \marg{height} & \marg{dash} +% \end{tabular} +% \end{center} +% +% \noindent +% The \meta{raise}, \meta{width}, and \meta{height} parameters have the +% same meaning as in \LaTeX's |\rule| macro. \meta{leader} specifies +% the \TeX\ leader function to use to fill \meta{width} amount of +% space. It should be |c| for |\cleaders|, |x| for |\xleaders|, or +% nothing for ordinary |\leaders|. The \meta{dash} argument specifies +% the dash pattern and is analogous to the \textit{array} argument to +% PostScript's |setdash| function. That is, it is a list of +% space-separated \meta{dimen}s that alternate ``on'' and ``off'' +% distances. +% \begin{macrocode} +\def\hdashrule@ii[#1][#2]#3#4#5{% +% \end{macrocode} +% \end{macro} +% +% If the final argument, \meta{dash}, is empty, we fall back to using an +% ordinary |\rule| command. This is not terribly useful in practice but +% does make |\hdashrule| behave more like PostScript's |setdash|. +% \begin{macrocode} + \@ifmtarg{#5}{% + \rule[#1]{#3}{#4}% + }{% +% \end{macrocode} +% Here begins the common case, in which the \meta{dash} argument is +% nonempty. +% +% \begin{macro}{\hdr@do@something} +% The |\hdr@do@something| alias alternates between |\hdr@do@rule| +% and |\hdr@do@skip|, starting with |\hdr@do@rule|. +% \begin{macrocode} + \let\hdr@do@something=\hdr@do@rule +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\hdr@parse@dash} +% For every space-separated \meta{dimen} in \meta{dash}, we invoke +% |\hdr@do@something| to draw a rule or a space, as appropriate. We +% define |\hdr@parse@dash| within |\hdashrule@ii| so we don't have to +% pass in |\hdashrule@ii|'s~|#1| and~|#4| on every invocation. +% \begin{macrocode} + \def\hdr@parse@dash##1 {% + \ifx##1!% + \else + \hdr@do@something[#1]{##1}{#4}% + \expandafter\hdr@parse@dash + \fi + }% +% \end{macrocode} +% We now count the number of segments in the dash pattern so we can +% determine if we have an even or odd number of them. +% \begin{macrocode} + \setcounter{hdr@segments}{0}% + \hdr@tally@segments#5 ! +% \end{macrocode} +% Finally, we invoke |\leaders|, |\cleaders|, or |\xleaders| to draw the +% dashed line, repeating the pattern until \meta{width} space is filled. +% The trick here is that odd-lengthed pattern descriptions must be +% repeated to yield the complete pattern. For instance, the pattern +% ``|1pt|'' is actually short for ``1\,pt.\ rule, 1\,pt.\ space,'' and +% ``|2pt 4pt 6pt|'' is an abridged version of ``2\,pt.\ rule, 4\,pt.\ +% space, 6\,pt.\ rule, 2\,pt.\ space, 4\,pt.\ rule, 6\,pt.\ space.'' +% Although it is valid to repeat even-lengthed patterns as well---an +% earlier draft of |\hdashrule@ii| did just that---this produces +% inferior results because \TeX's various leader commands do not split +% boxes. The longer the pattern, the less likely it will fit snugly +% into the given width. +% \changes{v1.2}{2009/08/08}{Ended the rule with an empty box to enable +% \texttt{\string\string\string\hdashrule} to work within a +% \texttt{tabular} cell. Thanks to Piazza Luca for the bug report} +% \changes{v1.3}{2013/03/28}{Prevented spurious spaces from being introduced +% into the output. Thanks to Halil \c{S}en for the bug report} +% \begin{macrocode} + \ifodd\c@hdr@segments + \csname#2leaders\endcsname + \hbox{\hdr@parse@dash#5 #5 ! }% + \hskip#3% + \else + \csname#2leaders\endcsname + \hbox{\hdr@parse@dash#5 ! }% + \hskip#3% + \fi + \mbox{}% + }% +} +% \end{macrocode} +% \end{macro} +% +% \Finale +\endinput diff --git a/macros/latex/contrib/dashrule/dashrule.ins b/macros/latex/contrib/dashrule/dashrule.ins new file mode 100644 index 0000000000..c8c6105ce5 --- /dev/null +++ b/macros/latex/contrib/dashrule/dashrule.ins @@ -0,0 +1,55 @@ +%% +%% Copyright (C) 2013 by Scott Pakin <scott+dash@pakin.org> +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.3c of this license +%% or (at your option) any later version. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2006/05/20 or later. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/dashrule} + +\preamble + +This is a generated file. + +Copyright (C) 2013 by Scott Pakin <scott+dash@pakin.org> + +This file may be distributed and/or modified under the conditions of +the LaTeX Project Public License, either version 1.3c of this license +or (at your option) any later version. The latest version of this +license is in: + + http://www.latex-project.org/lppl.txt + +and version 1.3c or later is part of all distributions of LaTeX +version 2006/05/20 or later. + +\endpreamble + +\generate{\file{dashrule.sty}{\from{dashrule.dtx}{package}}} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* dashrule.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file dashrule.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile diff --git a/macros/latex/contrib/dashrule/dashrule.pdf b/macros/latex/contrib/dashrule/dashrule.pdf Binary files differnew file mode 100644 index 0000000000..900999dd03 --- /dev/null +++ b/macros/latex/contrib/dashrule/dashrule.pdf diff --git a/macros/latex/contrib/dashrule/dashrulex.pdf b/macros/latex/contrib/dashrule/dashrulex.pdf Binary files differdeleted file mode 100644 index f6a96b5b89..0000000000 --- a/macros/latex/contrib/dashrule/dashrulex.pdf +++ /dev/null diff --git a/macros/latex/contrib/dashrule/dashrulex.sty b/macros/latex/contrib/dashrule/dashrulex.sty deleted file mode 100644 index 14f0291754..0000000000 --- a/macros/latex/contrib/dashrule/dashrulex.sty +++ /dev/null @@ -1,119 +0,0 @@ -% -% ***************** THE DASHRULEX PACKAGE ***************** -% -% Copyright (C) 2024-2025 by Qu Yi <toquyi@163.com> -% -% This work may be distributed and/or modified under the -% conditions of the CC-BY 4.0 License. -% The latest version of this license is in -% https://creativecommons.org/licenses/by/4.0/legalcode -\NeedsTeXFormat{LaTeX2e}[2012/02/12] -\RequirePackage{xparse} -\ProvidesExplPackage{dashrulex}{2025/02/01}{1.02b} - {Draw dashed rules} -\DeclareDocumentCommand{\hdashrule}{O{0pt}O{x}mmm} - { - \tl_if_blank:nTF {#5} - { - \str_if_eq:nnTF {#3} { \fill } - { - \use:x - { - \exp_not:c { #2leaders } - \hrule\@height\dim_eval:n { #1 + #4 }\@depth -\dim_eval:n {#1} - } - \hfill - } - { - \exp_last_unbraced:Nx - \rule { [\dim_eval:n {#1}]{\dim_eval:n {#3}}{\dim_eval:n {#4}} } - } - } - { - \drx@fill@mbox{#3} - { - \use:c { #2leaders } - \hbox:n - { - \clist_map_inline:nn {#5} - { \drx@parse@dash{#1}{#4}{##1} } - } - \skip_horizontal:n {#3} - } - \mbox{} - } - } -\cs_new_protected:Npn \drx@fill@mbox #1 - { \str_if_eq:nnTF {#1} { \fill } { \mbox{}\use:n } { \mbox } } -\ExplSyntaxOff -\NewDocumentCommand{\drx@parse@dash} - {mm>{\SplitArgument{1}{:}}m} - {\drx@parse@dash@inner{#1}{#2}#3} -\ExplSyntaxOn -\cs_set_protected:Npn \drx@parse@dash@inner #1#2#3#4 - { - \IfNoValueTF{#4} - {\vrulemod[#1]{#3}{#2}\skip_horizontal:n {#3}} - {\vrulemod[#1]{#3}{#2}\skip_horizontal:n {#4}} - } -\NewDocumentCommand{\hanyrule}{O{x}mm} - { - \drx@fill@mbox{#2} - { - \use:c { #1leaders } - \hbox:n { \clist_map_inline:nn {#3} {##1} } - \skip_horizontal:n {#2} - } - \mbox{} - } - -\int_new:N \l__drx_vrule_counter_int -\int_set:Nn \l__drx_vrule_counter_int { 1 } -\dim_new:N \l__drx_vrule_height_dim -\tl_new:N \l__drx_tmpa_tl -\cs_new_protected:Npn \drx@step@counter@height #1 - { - \int_incr:N \l__drx_vrule_counter_int - \dim_add:Nn \l__drx_vrule_height_dim {#1} - } -\cs_new_protected:Npn \drx@eval@rule #1#2 - { - \exp_last_unbraced:Nx - \rule { {\dim_eval:n {#1}}{\dim_eval:n {#2}} } - } -\NewDocumentCommand{\vrulemod}{O{0pt}oomm} - { - \group_begin: - \IfValueT{#2} - { - \tl_set:Nn \l__drx_tmpa_tl { [\dim_eval:n {#2}] } - \IfValueT{#3}{\tl_put_right:Nn \l__drx_tmpa_tl { [\dim_eval:n {#3}] }} - } - \exp_last_unbraced:Nx \raisebox - { {\dim_eval:n {#1}}\l__drx_tmpa_tl } - { - \clist_map_inline:nn {#5} - { - \int_compare:nNnTF { \l__drx_vrule_counter_int } > { 1 } - { - \int_if_even:nTF { \l__drx_vrule_counter_int } - { \drx@step@counter@height{##1} } - { - \exp_last_unbraced:Nx \tex_kern:D { -\dim_eval:n {#4} } - \exp_args:NV - \raisebox \l__drx_vrule_height_dim - {\drx@eval@rule{#4}{##1}} - \drx@step@counter@height{##1} - } - } - { - \drx@eval@rule{#4}{##1} - \drx@step@counter@height{##1} - } - } - } - \group_end: - } -\endinput -% -% End of file `dashrulex.sty'.
\ No newline at end of file diff --git a/macros/latex/contrib/dashrule/dashrulex.tex b/macros/latex/contrib/dashrule/dashrulex.tex deleted file mode 100644 index 2f76815875..0000000000 --- a/macros/latex/contrib/dashrule/dashrulex.tex +++ /dev/null @@ -1,102 +0,0 @@ -\PassOptionsToPackage{svgnames}{xcolor} -\documentclass[load-preamble+]{cnltx-doc} - -\usepackage{hologo,enumitem,dashrulex,tikz,codehigh} -\usepackage[noto]{newtxmath} -\setcnltx - { - package = dashrulex, - title = dashrulex, - version = v1.02b, - date = 2025/02/01, - authors = Qu Yi, - title = \dashrulex{} package, - info = Draw dashed rules, - email = toquyi@163.com, - url = https://github.com/texno3/dashrulex, - abstract = - { - The \pkg*{dashrulex} package provides a flexible solution for drawing dashed rules in the body, and currently provides two commands \cs{hdashrule} and \cs{hanyrule}. It's written in \hologo{LaTeX3} and can be used as an alternative to the \pkg*{dashrule} package. - }, - color-scheme = blue, - title-format = \LARGE - } -\makeatletter -\newcommand{\splitmeta}[3][\code{,}]{\meta{#2}#1\meta{#3}} -\newcommand{\newsplitarg}[4][\splitmeta] - { - \newcommand{#2}[2] - {\code{\textcolor{argument}{#3\textnormal{#1{##1}{##2}}#4}}} - } -\newcommand{\kvsplit}[3] - { - \item\code{\option{#1}\cnltx@isvalue\splitmarg{#2}{#3}} - \cnltx@checkdefault{\hfill\newline} - } -\newsplitarg{\splitoarg}{[}{]} -\newsplitarg{\splitmarg}{\{}{\}} -\newsplitarg{\splitdarg}{(}{)} -\newnote{\newtag}[1]{\textcolor{red}{#1}} -\renewcommand{\emph}[1]{\textcolor{red}{#1}} -\renewcommand{\cnltx@write@lastname}{} -\renewcommand{\cnltxpackagenameformat}[1]{\textcolor{cnltx}{\textsf{#1}}} -\setlist{nosep,topsep = \smallskipamount} -\setlist[description,1]{leftmargin = \parindent} -\setlist[itemize,1]{leftmargin = *} -\SetCodeHighStyle[default]{2}{cs} -\colorlet{link}{DeepPink} -\makeatother - -\begin{document} -\section{Preface} -Sometimes it is necessary to draw dashed rules when writing documents, such as guides in the table of contents and indexes, horizontal lines in headers and footers, and even adding horizontal lines after headings. Macro packages such as \pkg*{dashrule} and \pkg*{nccrules} are available to accomplish this. Considering that \pkg*{dashrule} has not been updated for a long time, \pkg*{dashrulex} rewrites it using \hologo{LaTeX3} syntax and enhances it a bit. - -\section{User commands} -\begin{commands} - \command{hdashrule}[\oarg{raise}\oarg{leader}\marg{width}\marg{thickness list}\marg{dash rules}] - This command is used to draw a dashed line, based on the \cs{rule} command, and the same as the \cs{rule} command when the \meta{dash rules} are empty. \meta{raise} is the vertical offset of the rule. \meta{leader} is the alignment of the dashed line fill, which can be empty, \code{c}, or \code{x} (the \textcolor{red}{default}), corresponding to the \cs{leaders}, \cs{cleaders}, and \cs{xleaders} commands, respectively. \meta{width} is the length of the dashed line, which can be set to \cs{fill} when used to fill the remaining part of the current text line. \meta{thickness list} stands for \textcolor{red}{vertical} dashed line rules, separated by \textcolor{red}{commas} and written as \fbox{\splitmeta{height 1}{height a}\code{,...}}, where \meta{height 1} denotes the height of a solid line and \meta{height a} denotes the height of a blank space. \meta{dash rules} stands for \textcolor{red}{horizontal} dashed line rules, which expressed as \fbox{\splitmeta[\code{:}]{length 1}{length a}\code{,}\splitmeta[\code{:}]{length 2}{length b}\code{,...}}, where \meta{length 1} represents the length of the solid line and \meta{length a} represents the length of the blank space, such as \fbox{\code{5pt:2pt,3pt}}, if the blank space is empty, then it is equal to the solid line length. -\begin{demohigh} -1X\rule{2cm}{1pt}x \\ -2X\hdashrule{2cm}{1pt}{}x \\ -3X\hdashrule{2cm}{1pt}{1pt}x \\ -4X\hdashrule{4cm}{1pt}{1pt}x \\ -5X\hdashrule[0.5ex]{4cm}{1pt}{1pt}x \\ -6X\hdashrule[0.5ex]{4cm}{1pt}{3mm}x \\ -7X\hdashrule[0.5ex]{4cm}{1mm}{3mm}x \\ -8X\hdashrule[0.5ex]{4cm-3mm}{1mm}{3mm}\vrulemod[0.5ex]{3mm}{1mm}x \\ -9X\hdashrule[0.5ex]{4cm}{1mm}{3mm:3pt}x \\ -10X\hdashrule[0.5ex]{4cm}{1mm}{3mm:3pt,1mm:2pt}x \\ -11X\hdashrule[0.5ex]{4cm}{2pt,1pt,1pt}{3mm:3pt,1mm:2pt}x -\end{demohigh} - \command{vrulemod}[\oarg{raise}\oarg{height}\oarg{depth}\marg{width}\marg{thickness list}] - The vertical model used to fill the dashed line. \meta{thickness list} is consistent with the \cs{hdashrule} command, \meta{width} represents the length of the component, and the three optional parameters are consistent with those of the \cs{raisebox} command. - \command{hanyrule}[\oarg{leader}\marg{width}\marg{symbol list}] - This command sets the length of the dashed line and fills it with arbitrary symbols. \meta{symbol list} can be more than one symbol and they are separated by \textcolor{red}{commas}. Symbols are best packed in boxes of a certain length, as spacing between symbols is not provided. -\begin{demohigh} -\newcommand{\dblblock} - {% - \tikz[color=teal] - { - \draw[line width=0.8mm](0mm,1.1mm)--(3mm,1.1mm); - \draw[line width=0.3mm](0mm,0mm)--(3mm,0mm); - }% - } -1X\hanyrule[]{5cm}{\makebox[8pt]{$\cdot$}}x \\ -2X\hanyrule[c]{5cm}{\makebox[8pt]{$\cdot$}}x \\ -3X\hanyrule[x]{5cm}{\makebox[8pt]{$\cdot$}}x \\ -4X\hanyrule[x]{5cm}{\makebox[8pt][l]{$\cdot$}}x \\ -5X\hanyrule[x]{5cm}{\makebox[8pt][r]{$\cdot$}}x \\ -6X\hanyrule[x]{5cm}{\makebox[8pt]{$\cdot$},\makebox[8pt]{$\circ$}}x \\ -7X\hanyrule[x]{5cm}{\makebox[5mm]{\vrulemod{3mm}{2pt,1pt,1pt}}}x \\ -8X\hanyrule[x]{5cm}{\makebox[5mm]{\dblblock}}x -\end{demohigh} -\end{commands} - -\section{Known issues} -Currently only horizontal dashed line drawing is supported, with future plans to support vertical dashed lines, and even box dashed borders and so on. - -\appendix -\nocite{*} -\AddToHook{cmd/printindex/before}{\clearpage} - -\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/fontscale/CHANGELOG.md b/macros/latex/contrib/fontscale/CHANGELOG.md index 85128562a9..3b0fe877bd 100644 --- a/macros/latex/contrib/fontscale/CHANGELOG.md +++ b/macros/latex/contrib/fontscale/CHANGELOG.md @@ -7,6 +7,12 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.1.0] - 2025-02-03 + +### Added +- `fontscale-code.tex` +- `fontscale-code.pdf` + ## [v3.0.6] - 2025-01-17 ### Changed diff --git a/macros/latex/contrib/fontscale/beery.cls b/macros/latex/contrib/fontscale/beery.cls index 2f64408d4f..95a4674c31 100644 --- a/macros/latex/contrib/fontscale/beery.cls +++ b/macros/latex/contrib/fontscale/beery.cls @@ -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 } -% CUSTOM MACROS +% 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 + \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 } + { + \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} } } -\NewDocumentCommand \cls { >{ \TrimSpaces } m } { \textsf {#1} \@ } -\NewDocumentCommand \env { >{ \TrimSpaces } m } { \texttt {#1} \@ } -\NewDocumentCommand \pkg { >{ \TrimSpaces } m } { \textsf {#1} \@ } -\NewDocumentCommand \latin { >{ \TrimSpaces } m } { \textit {#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 + { + \msg_error:nne { beery } { math-mode-error } + { \token_to_str:N \KeepNextPar } + } { - \int_compare:nNnT \prevgraf = 1 - { \nobreak \@afterheading } + \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@linespread \footnotesep } \coffin_new:N \l__beery_footnote_coffin @@ -275,11 +430,11 @@ { \fp_to_dim:n { - ( 1.2 * \f@linespread - 1 ) - * \dim_to_fp:n { \l_fontscale_footnotesize_size_dim } + ( 1.2 * \f@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 diff --git a/macros/latex/contrib/fontscale/fontscale-code.pdf b/macros/latex/contrib/fontscale/fontscale-code.pdf Binary files differnew file mode 100644 index 0000000000..702e6f2e16 --- /dev/null +++ b/macros/latex/contrib/fontscale/fontscale-code.pdf diff --git a/macros/latex/contrib/fontscale/fontscale-code.tex b/macros/latex/contrib/fontscale/fontscale-code.tex new file mode 100644 index 0000000000..d4621c59d1 --- /dev/null +++ b/macros/latex/contrib/fontscale/fontscale-code.tex @@ -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 diff --git a/macros/latex/contrib/fontscale/fontscale-table-classic.tex b/macros/latex/contrib/fontscale/fontscale-table-classic.tex index ca8dd3db1f..a4cfc95ec2 100644 --- a/macros/latex/contrib/fontscale/fontscale-table-classic.tex +++ b/macros/latex/contrib/fontscale/fontscale-table-classic.tex @@ -1,4 +1,4 @@ -\ProvidesFile{fontscale-table-classic.tex}[2025-01-17] +\ProvidesFile{fontscale-table-classic.tex}[2025-02-03] \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 b97dae8091..f894e492d4 100644 --- a/macros/latex/contrib/fontscale/fontscale-table-font-steps.tex +++ b/macros/latex/contrib/fontscale/fontscale-table-font-steps.tex @@ -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 diff --git a/macros/latex/contrib/fontscale/fontscale-table-musical.tex b/macros/latex/contrib/fontscale/fontscale-table-musical.tex index 3f98cdee5e..9bb75076e4 100644 --- a/macros/latex/contrib/fontscale/fontscale-table-musical.tex +++ b/macros/latex/contrib/fontscale/fontscale-table-musical.tex @@ -1,4 +1,4 @@ -\ProvidesFile{fontscale-table-musical.tex}[2025-01-17] +\ProvidesFile{fontscale-table-musical.tex}[2025-02-03] \begin{table} \centering diff --git a/macros/latex/contrib/fontscale/fontscale.pdf b/macros/latex/contrib/fontscale/fontscale.pdf Binary files differindex 7cefae81b9..9710159c7a 100644 --- a/macros/latex/contrib/fontscale/fontscale.pdf +++ b/macros/latex/contrib/fontscale/fontscale.pdf diff --git a/macros/latex/contrib/fontscale/fontscale.sty b/macros/latex/contrib/fontscale/fontscale.sty index faf0700b03..297139a444 100644 --- a/macros/latex/contrib/fontscale/fontscale.sty +++ b/macros/latex/contrib/fontscale/fontscale.sty @@ -1,15 +1,17 @@ -% Package : fontscale -- A flexible interface for setting font sizes -% Copyright : 2024-2025 (c) Oliver Beery <beeryoliver@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@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@size and \f@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@size and \f@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@size pt } \skip_set:Nn \l_fontscale_baselineskip_skip { \f@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 diff --git a/macros/latex/contrib/fontscale/fontscale.tex b/macros/latex/contrib/fontscale/fontscale.tex index 80fa434af7..e320814bd6 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 3.0.6\quad{}17 January 2025 +Version 3.1.0\quad{}3 February 2025 \section{Introduction} @@ -77,18 +77,18 @@ For this reason, you may want to set the document class font size option close t \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} 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@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 @@ Table~\ref{table:fontsteps} displays the font step of each font size command. \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 @@ Set the package keys using \cs{fontscalesetup}\marg{key$\,=\,$value list} (\S\re {% The key \texorpdfstring - {\texttt{typographic-scale}} + {\Key{typographic-scale}} {typographic-scale}% } \label{subsec:typographicscale} @@ -150,7 +149,7 @@ They have been used since the sixteenth century and are the default font sizes o 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 @@ The font sizes are calculated using the formula:% \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 key \Key{musical\slash{}ratio} sets the musical ratio to the result of compu 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 @@ Table~\ref{table:musical} displays the font size of each font size command when {% The key \texorpdfstring - {\texttt{baselineskip-size-ratio}} + {\Key{baselineskip-size-ratio}} {baselineskip-size-ratio}% } \label{subsec:baselineskipsizeratio} @@ -278,7 +277,7 @@ Sets and processes the \pkg{fontscale} package keys (\S\ref{sec:keys}) in \meta{ 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 @@ This package provides expandable commands that expand to the current font step, 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 @@ Sets the font baselineskip equal to the new font size \texttimes{} the value of \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 @@ Sets the font baselineskip equal to the new font size \texttimes{} the value of \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 @@ One useful way of printing sample text is \cs{PrintSampleText}\allowbreak\texttt \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. diff --git a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf Binary files differindex 722121dd37..108ab55fe6 100644 --- a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf +++ b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.pdf diff --git a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex index 704c498ab7..cb4430abea 100644 --- a/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex +++ b/macros/latex/contrib/jeuxcartes/doc/JeuxCartes-doc.tex @@ -69,11 +69,11 @@ \setlength{\parindent}{0pt} \definecolor{LightGray}{gray}{0.9} -\def\TPversion{0.2.8} -\def\TPdate{13 septembre 2023} +\def\TPversion{0.3.0} +\def\TPdate{3 février 2025} \usepackage[most]{tcolorbox} -\usepackage[outputdir=build]{minted} +\usepackage{minted2} \tcbuselibrary{minted} \usepackage[french]{babel} @@ -146,7 +146,7 @@ \begin{tabular}{c} \texttt{Cédric Pierquet}\\ {\ttfamily c pierquet -- at -- outlook . fr}\\ - \texttt{\url{https://github.com/cpierquet/JeuxCartes}} + \texttt{\url{https://forge.apps.education.fr/pierquetcedric/packages-latex}} \end{tabular} } @@ -211,6 +211,8 @@ Une commande pour des cartes en version \og miniatures \fg{} (individuelle, main \part{Historique} +{\small \bverb|v0.3.0|~:~~~~Macros pour des jeux 'complets'. + {\small \bverb|v0.2.8|~:~~~~Correction d'un bug mineur sur les commandes 'multicartes'. {\small \bverb|v0.2.7|~:~~~~Retour en arrière sur les cartes de Tarot \textsf{v2} qui sont supprimées (pb de licence). @@ -538,6 +540,31 @@ Les commandes pour créer des \textit{mains} sont obligatoirement liées à des \MainCartesJeu[options]{<liste de cartes>} \end{codetex} +\subsection{Jeux complets} + +\begin{codeidee} +\cmaj{0.3.0} Des macros sont disponibles pour créer des mains complètes (sans donner toutes les cartes !). + +La configuration est \textit{fixée} et les jeux disponibles sont \textsf{Poker/Belote/Tarot} (sans \textsf{Jokers}). +\end{codeidee} + +\begin{codetex}[listing only] +%belote tri par couleur (P/C/T/K) +\JeuCompletBeloteTriCoul +%belote tri par hauteur (P/C/T/K) +\JeuCompletBeloteTriHaut + +%poker tri par couleur (P/C/T/K) +\JeuCompletPokerTriCoul +%poker tri par hauteur (P/C/T/K) +\JeuCompletPokerTriHaut + +%tarot tri par couleur (P/C/T/K) +\JeuCompletTarotTriCoul +%tarot tri par hauteur (P/C/T/K) +\JeuCompletTarotTriHaut +\end{codetex} + \subsection{Clés et options} \begin{codecles} @@ -583,24 +610,37 @@ Les exemples proposés dans cette documentation permettent de se rendre compte d \begin{codetex}[] \MainCartesJeu[TypeJeu=Uno,EspH=1.75]% {9B § P4 § P2J § 1R § 7R § PTV § 2J § 5J § 9B § PTR § 5V} +\end{codetex} -\smallskip - +\begin{codetex}[] \MainCartesJeu[TypeJeu=Tarot,EspH=1,EspV=-0.15,Hauteur=2.25]% {Exc § 1AT § CC § 8T § 2K § 5AT § 2AT § DP § 7T § 10C § 19AT § VP} +\end{codetex} -\smallskip - +\begin{codetex}[] Ça c'est une belle poignée ! \MainCartesJeu[Inverse,Eventail,Hauteur=3,TypeJeu=Tarot,EspH=0,EspV=0.1]% {Exc § 1AT § 2AT § 3AT § 4AT § 5AT § 6AT § % 10AT § 11AT § 15AT § 16AT § 19AT § 20AT § 21AT} +\end{codetex} -\smallskip - +\begin{codetex}[] Et un chien qui en a : \MainCartesJeu[Eventail,Hauteur=2,TypeJeu=Tarot,EspH=0.5,EspV=0.15,Rotation=20]% {DK § 10AT § 16AT § VP § 1AT} \end{codetex} +\begin{codetex}[] +\MainCartesJeu[Hauteur=1.75,EspH=1.25]{\JeuCompletBeloteTriHaut} +\end{codetex} + +\begin{codetex}[] +\MainCartesJeu[Hauteur=1.75,StyleJeu=v2,Eventail,Rotation=3.75,EspH=0.01,EspV=0.05] + {\JeuCompletBeloteTriHaut} +\end{codetex} + +\begin{codetex}[] +\MainCartesJeu[Hauteur=1.75,StyleJeu=bicycl,EspH=1]{\JeuCompletPokerTriCoul} +\end{codetex} + \pagebreak \section{Mains aléatoires} diff --git a/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty b/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty index 575e251551..9176d69688 100644 --- a/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty +++ b/macros/latex/contrib/jeuxcartes/tex/JeuxCartes.sty @@ -1,5 +1,5 @@ % Author.........................: C. Pierquet -% licence........................: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf +% licence........................: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt % Poker v1 cards Image's Licence.: LGPL-2.1 license https://github.com/htdebeer/SVG-cards % Poker v2 cards Image's Licence.: Public Domain https://tekeye.uk/playing_cards/svg-playing-cards % Poker v3 cards Image's Licence.: Public Domain https://www.me.uk/cards/ @@ -11,7 +11,8 @@ % Uno v1 cards Image's Licence.: MIT License https://eperezcosano.github.io/uno-part1/ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{JeuxCartes}[2023/09/13 v0.2.8 Jeux de cartes] +\ProvidesPackage{JeuxCartes}[2025/02/03 v0.3.0 Jeux de cartes] +% 0.3.0 Macro pour des jeux complets (fixés) % 0.2.8 Correction de bugs mineurs % 0.2.7 Retour en arrière design v2 tarot (pb de licence) % 0.2.5 Correction d'un dysfonctionnement avec le J qui peut désormais être utilisé en MiniCarte avec le Joker [en] + MiniMains [en] @@ -43,6 +44,14 @@ %librairies tikz \usetikzlibrary{calc,scopes} +%------Jeux complets +\def\JeuCompletBeloteTriHaut{7P§7C§7T§7K § 8P§8C§8T§8K § 9P§9C§9T§9K § 10P§10C§10T§10K § VP§VC§VT§VK § DP§DC§DT§DK § RP§RC§RT§RK § AP§AC§AT§AK} +\def\JeuCompletBeloteTriCoul{7P§8P§9P§10P§VP§DP§RP§AP § 7C§8C§9C§10C§VC§DC§RC§AC § 7T§8T§9T§10T§VT§DT§RT§AT § 7K§8K§9K§10K§VK§DK§RK§AK } +\def\JeuCompletPokerTriHaut{2P§2C§2T§2K § 3P§3C§3T§3K § 4P§4C§4T§4K § 5P§5C§5T§5K § 6P§6C§6T§6K § 7P§7C§7T§7K § 8P§8C§8T§8K § 9P§9C§9T§9K § 10P§10C§10T§10K § VP§VC§VT§VK § DP§DC§DT§DK § RP§RC§RT§RK § AP§AC§AT§AK} +\def\JeuCompletPokerTriCoul{2P§3P§4P§5P§6P§7P§8P§9P§10P§VP§DP§RP§AP § 2C§3C§4C§5C§6C§7C§8C§9C§10C§VC§DC§RC§AC § 2T§3T§4T§5T§6T§7T§8T§9T§10T§VT§DT§RT§AT § 2K§3K§4K§5K§6K§7K§8K§9K§10K§VK§DK§RK§AK } +\def\JeuCompletTarotTriHaut{2P§2C§2T§2K § 3P§3C§3T§3K § 4P§4C§4T§4K § 5P§5C§5T§5K § 6P§6C§6T§6K § 7P§7C§7T§7K § 8P§8C§8T§8K § 9P§9C§9T§9K § 10P§10C§10T§10K § VP§VC§VT§VK § CP§CC§CT§CK DP§DC§DT§DK § RP§RC§RT§RK § AP§AC§AT§AK § Exc§1AT§2AT§2AT§3AT§4AT§5AT§6AT§7AT§8AT§9AT§10AT§11AT§12AT§13AT§14AT§15AT§16AT§17AT§18AT§19AT§20AT§21AT} +\def\JeuCompletTarotTriCoul{2P§3P§4P§5P§6P§7P§8P§9P§10P§VP§CP§DP§RP§AP § 2C§3C§4C§5C§6C§7C§8C§9C§10C§VC§CC§DC§RC§AC § 2T§3T§4T§5T§6T§7T§8T§9T§10T§VT§CT§DT§RT§AT § 2K§3K§4K§5K§6K§7K§8K§9K§10K§VK§CK§DK§RK§AK § Exc§1AT§2AT§2AT§3AT§4AT§5AT§6AT§7AT§8AT§9AT§10AT§11AT§12AT§13AT§14AT§15AT§16AT§17AT§18AT§19AT§20AT§21AT} + %------Commande en ligne (includegraphics) via raisebox/rotatebox ou tikz \defKV[AffCarteJeu]{% Hauteur=\def\AffCarteJeuHauteur{#1},% diff --git a/macros/latex/contrib/jsonparse/README.md b/macros/latex/contrib/jsonparse/README.md index dd3d3f3d80..5d2af60cdb 100644 --- a/macros/latex/contrib/jsonparse/README.md +++ b/macros/latex/contrib/jsonparse/README.md @@ -1,4 +1,4 @@ -![Version 1.1.0](https://img.shields.io/badge/version-1.1.0-blue) +![Version 1.1.1](https://img.shields.io/badge/version-1.1.1-blue) ![Jason, the JSON parsing horse](https://github.com/jasperhabicht/jsonparse/assets/6378801/ddfddc70-bf5f-4121-ba45-4b9128875d85) diff --git a/macros/latex/contrib/jsonparse/jsonparse-doc.pdf b/macros/latex/contrib/jsonparse/jsonparse-doc.pdf Binary files differindex 3d2df34916..0998727d6c 100644 --- a/macros/latex/contrib/jsonparse/jsonparse-doc.pdf +++ b/macros/latex/contrib/jsonparse/jsonparse-doc.pdf diff --git a/macros/latex/contrib/jsonparse/jsonparse-doc.tex b/macros/latex/contrib/jsonparse/jsonparse-doc.tex index 927859880e..7ade9c65fd 100644 --- a/macros/latex/contrib/jsonparse/jsonparse-doc.tex +++ b/macros/latex/contrib/jsonparse/jsonparse-doc.tex @@ -11,8 +11,8 @@ % This work has the LPPL maintenance status `maintained'. % \documentclass[a4paper]{article} -\def\jsonparsefileversion{1.1.0} -\def\jsonparsefiledate{30 January 2025} +\def\jsonparsefileversion{1.1.1} +\def\jsonparsefiledate{3 February 2025} \usepackage[T1]{fontenc} \usepackage{Alegreya} @@ -22,6 +22,9 @@ \usepackage{geometry, longtable, booktabs, siunitx, tcolorbox, hyperref} \geometry{margin=25mm, left=45mm} +\usepackage{pgfplots} +\pgfplotsset{compat=1.18} + \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} @@ -229,6 +232,7 @@ \changes{v1.0.2}{2025/01/23}{Support for Unicode surrogate pairs.} \changes{v1.0.3}{2025/01/26}{Test for valid JSON numbers expandable.} \changes{v1.1.0}{2025/01/30}{Unified names of user functions; renaming key for keywords.} +\changes{v1.1.1}{2025/02/03}{Added option to store result of mapped inline function.} \begin{document} \vspace*{-1cm} @@ -504,9 +508,9 @@ Finally, the first optional argument of the command can be used to pass options For reasons of backward compatibility, the command \macro{\JSONParseArrayValuesMap} is defined as alias of \macro{\JSONParseArrayMapFunction}. \begin{macrodef} -|\JSONParseArrayMapInline|{<token variable>}{<key>}{<inline function>} +|\JSONParseArrayMapInline|[<options>]{<token variable>}{<key>}{<inline function>} \end{macrodef} -The command \macro{\JSONParseArrayMapInline} takes as first argument a token variable holding a parsed JSON string or JSON file and as second argument a key to select an array in the JSON data. The third parameter can contain any code where the index of the current item is represented by \macro{#1}. +The command \macro{\JSONParseArrayMapInline} takes as first mandatory argument a token variable holding a parsed JSON string or JSON file and as second mandatory argument a key to select an array in the JSON data. The last argument can contain any code where the index of the current item is represented by \macro{#1}. Using the above example, the mechanism could be implemented as follows: @@ -544,6 +548,38 @@ Making use of the commands \macro{\JSONParseSetKeys} and \macro{\JSONParseSetVal Note that the underscores in the names of the keys can be printed without changing to math mode in the above example because all JSON data is stored as string where all characters (except for spaces and tabs) have category code 12 (``other''). +\begin{macrodef} +|store in|={<token variable>} +\end{macrodef} + +The command \macro{\JSONParseArrayMapInline} accepts as option set in the optional argument the key \macro{store in} which takes a token variable into which the result of the mapped inline function should be stored. It is important to note that the inline function needs to be fully expandable. For example, it is not possible to use \macro{\JSONParseValue} in the code of the inline function while \macro{\JSONParseExpandableValue} is allowed. + +Storing the result of the mapped inline function can be helpful if JSON data should be reformatted for use in a plotting functions. An example for a use case with PGFplots is shown below. In this example, the parsed JSON string \macro{{ "data": [ [0,0], [1,-1], [2,1] ] }} was stored in the token variable \macro{\myJSONplotdata}. + +\JSONParse{\myJSONplotdata}{ { "data": [ [0,0], [1,-1], [2,1] ] } } +\pgfplotsset{width=5.25cm} + +\begin{codeexamplecolumns} +\JSONParseArrayMapInline +[store in={\myJSONplotcoords}] + {\myJSONplotdata}{data}{ + ( + \JSONParseExpandableValue + {\myJSONplotdata}{data[#1][0]} + , + \JSONParseExpandableValue + {\myJSONplotdata}{data[#1][1]} + ) +} + +\begin{tikzpicture} + \begin{axis} + \addplot coordinates + {\myJSONplotcoords}; + \end{axis} +\end{tikzpicture} +\end{codeexamplecolumns} + \subsection{Externalizing parsed JSON data}\label{sec:externalizing} Parsing large and complex JSON files can take quite a while. In order to speed up follow-up compilation runs, this package provides a way to store parsed JSON data for future use. Once a file for externalization has been created, the package will try to load the data from this file instead of parsing the JSON data again. @@ -628,7 +664,7 @@ This key can be set using \macro{\JSONParseSet}. It can also be set locally as o \subsubsection{Keys affecting the typesetting} -Information about the keys \macro{escape} and \macro{rescan} can be found above in section \ref{sec:escaping}. Information about the keys \macro{code before} and \macro{code after} can be found above in the description to the command \macro{\JSONParseArrayMapFunction}. +Information about the keys \macro{escape} and \macro{rescan} can be found above in section \ref{sec:escaping}. Information about the keys \macro{code before} and \macro{code after} can be found above in the description to the command \macro{\JSONParseArrayMapFunction}. Information about the key \macro{store in} can be found above in the description to the command \macro{\JSONParseArrayMapInline}. \begin{macrodef} keyword/|true|={<string>} diff --git a/macros/latex/contrib/jsonparse/jsonparse.sty b/macros/latex/contrib/jsonparse/jsonparse.sty index f2a37013c2..cb4bff5cd0 100644 --- a/macros/latex/contrib/jsonparse/jsonparse.sty +++ b/macros/latex/contrib/jsonparse/jsonparse.sty @@ -10,7 +10,7 @@ % % This work has the LPPL maintenance status `maintained'. % -\ProvidesExplPackage {jsonparse} {2025-01-30} {1.1.0} +\ProvidesExplPackage {jsonparse} {2025-02-03} {1.1.1} {A handy way to parse, store and access JSON data from files or strings in LaTeX documents} \msg_new:nnn { jsonparse } { old-kernel } { @@ -46,7 +46,8 @@ \msg_new:nnn { jsonparse } { nested-non-expandable } { \msg_error_text:n { jsonparse } \iow_newline: - Nested ~ use ~ of ~ \token_to_str:N \JSONParseValue \c_space_tl not ~ allowed. \iow_newline: + Non-expandable ~ commands ~ such ~ as ~ \token_to_str:N \JSONParseValue \c_space_tl + not ~ allowed ~ in ~ inline ~ function. \iow_newline: Use ~ \token_to_str:N \JSONParseExpandableValue \c_space_tl instead. } @@ -125,8 +126,9 @@ \str_new:N \l__jsonparse_carriage_return_str \str_new:N \l__jsonparse_horizontal_tab_str -\tl_new:N \l__jsonparse_map_before_tl -\tl_new:N \l__jsonparse_map_after_tl +\tl_new:N \l__jsonparse_array_map_code_before_tl +\tl_new:N \l__jsonparse_array_map_code_after_tl +\tl_new:N \g__jsonparse_array_map_store_in_tl \clist_new:N \l__jsonparse_unused_keys_clist @@ -237,8 +239,12 @@ rescan .default:n = { true } , rescan .initial:n = { true } , rescan .groups:n = { output } , - code ~ before .tl_set:N = \l__jsonparse_map_before_tl , - code ~ after .tl_set:N = \l__jsonparse_map_after_tl + code ~ before .tl_set:N = \l__jsonparse_array_map_code_before_tl , + code ~ after .tl_set:N = \l__jsonparse_array_map_code_after_tl +} + +\keys_define:nn { jsonparse / map } { + store ~ in .tl_gset:N = \g__jsonparse_array_map_store_in_tl } \cs_new_protected:Npn \__jsonparse_warning_unused_keys: { @@ -253,6 +259,7 @@ \keys_set_known:nnN { jsonparse / global } {#1} \l__jsonparse_unused_keys_clist \keys_set_known:noN { jsonparse / parse } { \l__jsonparse_unused_keys_clist } \l__jsonparse_unused_keys_clist \keys_set_known:noN { jsonparse / typeset } { \l__jsonparse_unused_keys_clist } \l__jsonparse_unused_keys_clist + \keys_set_known:noN { jsonparse / map } { \l__jsonparse_unused_keys_clist } \l__jsonparse_unused_keys_clist \__jsonparse_warning_unused_keys: } @@ -263,6 +270,8 @@ \cs_new:Npn \str_foldcase:n { \str_casefold:n } } +\exp_args_generate:n { NoV } + \cs_generate_variant:Nn \file_input:n { e } \cs_generate_variant:Nn \tl_gset:Nn { Ne , ce } \cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno , Nne } @@ -299,6 +308,7 @@ \prg_generate_conditional_variant:Nnn \seq_if_in:Nn { Ne } { F } \prg_generate_conditional_variant:Nnn \str_if_eq:nn { en , eV } { T , F , TF } \prg_generate_conditional_variant:Nnn \str_if_eq:nn { Vn } { p } +\prg_generate_conditional_variant:Nnn \str_if_in:nn { ee } { T } % === @@ -318,9 +328,11 @@ \bool_if:NTF \l__jsonparse_compat_bool { \prop_new:N \g_jsonparse_entries_prop \prop_new:N \l__jsonparse_temp_prop + \prop_new:N \l__jsonparse_temp_copy_prop } { \prop_new_linked:N \g_jsonparse_entries_prop \prop_new_linked:N \l__jsonparse_temp_prop + \prop_new_linked:N \l__jsonparse_temp_copy_prop } \tl_new:N \g__jsonparse_json_tl @@ -906,11 +918,11 @@ \NewDocumentCommand { \JSONParseFilter } { m m m } { \__jsonparse_warning_undefined_prop:N #2 \group_begin: - \tl_set_eq:NN \l__jsonparse_temp_tl #2 - \jsonparse_filter:Nn \l__jsonparse_temp_tl {#3} - \exp_last_unbraced:Nf + \prop_set_eq:NN \l__jsonparse_temp_prop #2 + \jsonparse_filter:Nn \l__jsonparse_temp_prop {#3} + \exp_args:NNNV \group_end: - \tl_set:NV #1 \l__jsonparse_temp_tl + \tl_set:Nn #1 \l__jsonparse_temp_prop } % === @@ -1210,10 +1222,10 @@ \NewDocumentCommand { \JSONParseKeys } { m m } { \__jsonparse_warning_undefined_prop:N #1 \group_begin: - \tl_set_eq:NN \l__jsonparse_temp_tl #1 - \jsonparse_filter:Nn \l__jsonparse_temp_tl {#2} + \prop_set_eq:NN \l__jsonparse_temp_copy_prop #1 + \jsonparse_filter:Nn \l__jsonparse_temp_copy_prop {#2} \bool_set_true:N \l__jsonparse_prop_map_first_bool - \jsonparse_parse_keys:NN \l__jsonparse_temp_tl \l__jsonparse_keys_tl + \jsonparse_parse_keys:NN \l__jsonparse_temp_prop \l__jsonparse_keys_tl \tl_use:N \l__jsonparse_keys_tl \group_end: } @@ -1224,13 +1236,13 @@ \tl_new:N #1 } \group_begin: - \tl_set_eq:NN \l__jsonparse_temp_tl #2 - \jsonparse_filter:Nn \l__jsonparse_temp_tl {#3} + \prop_set_eq:NN \l__jsonparse_temp_copy_prop #2 + \jsonparse_filter:Nn \l__jsonparse_temp_copy_prop {#3} \bool_set_true:N \l__jsonparse_prop_map_first_bool - \jsonparse_parse_keys:NN \l__jsonparse_temp_tl \l__jsonparse_keys_tl - \exp_last_unbraced:Nf + \jsonparse_parse_keys:NN \l__jsonparse_temp_prop \l__jsonparse_keys_tl + \exp_args:NNNV \group_end: - \exp_args:NNe \jsonparse_parse_to_prop:Nn #1 { \l__jsonparse_keys_tl } + \jsonparse_parse_to_prop:Nn #1 \l__jsonparse_keys_tl } \cs_new:Npn \__jsonparse_get_array_index:w [ #1 ] #2 \q_stop { @@ -1262,9 +1274,9 @@ \NewDocumentCommand { \JSONParseArrayCount } { m m } { \__jsonparse_warning_undefined_prop:N #1 \group_begin: - \tl_set_eq:NN \l__jsonparse_temp_tl #1 - \jsonparse_filter:Nn \l__jsonparse_temp_tl {#2} - \jsonparse_array_count:NN \l__jsonparse_temp_tl \l__jsonparse_array_count_int + \prop_set_eq:NN \l__jsonparse_temp_copy_prop #1 + \jsonparse_filter:Nn \l__jsonparse_temp_copy_prop {#2} + \jsonparse_array_count:NN \l__jsonparse_temp_copy_prop \l__jsonparse_array_count_int \int_use:N \l__jsonparse_array_count_int \group_end: } @@ -1275,12 +1287,12 @@ \tl_new:N #1 } \group_begin: - \tl_set_eq:NN \l__jsonparse_temp_tl #2 - \jsonparse_filter:Nn \l__jsonparse_temp_tl {#3} - \jsonparse_array_count:NN \l__jsonparse_temp_tl \l__jsonparse_array_count_int - \exp_last_unbraced:Nf + \prop_set_eq:NN \l__jsonparse_temp_copy_prop #2 + \jsonparse_filter:Nn \l__jsonparse_temp_copy_prop {#3} + \jsonparse_array_count:NN \l__jsonparse_temp_copy_prop \l__jsonparse_array_count_int + \exp_args:NNNV \group_end: - \tl_set:NV #1 \l__jsonparse_array_count_int + \tl_set:Nn #1 \l__jsonparse_array_count_int } \cs_new_protected:Npn \__jsonparse_array_use:n #1 { @@ -1291,7 +1303,7 @@ } \bool_if:NTF \l__jsonparse_rescan_bool { \exp_args:Ne \__jsonparse_rescan:n { - \prop_item:Ne \l__jsonparse_temp_tl { + \prop_item:Ne \l__jsonparse_temp_copy_prop { \l__jsonparse_array_sep_left_str \bool_if:NTF \l__jsonparse_zero_based_bool { \int_eval:n { #1 - 1 } @@ -1306,7 +1318,7 @@ } } } { - \prop_item:Ne \l__jsonparse_temp_tl { + \prop_item:Ne \l__jsonparse_temp_copy_prop { \l__jsonparse_array_sep_left_str \bool_if:NTF \l__jsonparse_zero_based_bool { \int_eval:n { #1 - 1 } @@ -1327,9 +1339,9 @@ \group_begin: \keys_set_known:nn { jsonparse / typeset } {#1} \l__jsonparse_unused_keys_clist \__jsonparse_warning_unused_keys: - \tl_set_eq:NN \l__jsonparse_temp_tl #2 - \jsonparse_filter:Nn \l__jsonparse_temp_tl {#3} - \jsonparse_array_count:NN \l__jsonparse_temp_tl \l__jsonparse_array_count_int + \prop_set_eq:NN \l__jsonparse_temp_copy_prop #2 + \jsonparse_filter:Nn \l__jsonparse_temp_copy_prop {#3} + \jsonparse_array_count:NN \l__jsonparse_temp_copy_prop \l__jsonparse_array_count_int \str_set:Ne \l__jsonparse_array_values_key_str {#4} \tl_set:Nn \l__jsonparse_array_values_insert_tl {#5} \bool_set_true:N \l__jsonparse_prop_map_first_bool @@ -1361,7 +1373,7 @@ \bool_if:NTF \l__jsonparse_rescan_bool { \tl_gset:cn { JSONParseArrayValue \l__jsonparse_array_keys_index_roman_tl } { \exp_args:Ne \__jsonparse_rescan:n { - \prop_item:Ne \l__jsonparse_temp_tl { + \prop_item:Ne \l__jsonparse_temp_copy_prop { \l__jsonparse_array_sep_left_str \JSONParseArrayIndex \l__jsonparse_array_sep_right_str @@ -1372,7 +1384,7 @@ } } { \tl_gset:ce { JSONParseArrayValue \l__jsonparse_array_keys_index_roman_tl } { - \prop_item:Ne \l__jsonparse_temp_tl { + \prop_item:Ne \l__jsonparse_temp_copy_prop { \l__jsonparse_array_sep_left_str \JSONParseArrayIndex \l__jsonparse_array_sep_right_str @@ -1400,7 +1412,7 @@ \bool_if:NTF \l__jsonparse_rescan_bool { \tl_gset:Nn \JSONParseArrayValue { \exp_args:Ne \__jsonparse_rescan:n { - \prop_item:Ne \l__jsonparse_temp_tl { + \prop_item:Ne \l__jsonparse_temp_copy_prop { \l__jsonparse_array_sep_left_str \JSONParseArrayIndex \l__jsonparse_array_sep_right_str @@ -1409,7 +1421,7 @@ } } { \tl_gset:Ne \JSONParseArrayValue { - \prop_item:Ne \l__jsonparse_temp_tl { + \prop_item:Ne \l__jsonparse_temp_copy_prop { \l__jsonparse_array_sep_left_str \JSONParseArrayIndex \l__jsonparse_array_sep_right_str @@ -1448,9 +1460,9 @@ \group_begin: \keys_set_known:nn { jsonparse / typeset } {#1} \l__jsonparse_unused_keys_clist \__jsonparse_warning_unused_keys: - \tl_set_eq:NN \l__jsonparse_temp_tl #2 - \jsonparse_filter:Nn \l__jsonparse_temp_tl {#3} - \jsonparse_array_count:NN \l__jsonparse_temp_tl \l__jsonparse_array_count_int + \prop_set_eq:NN \l__jsonparse_temp_copy_prop #2 + \jsonparse_filter:Nn \l__jsonparse_temp_copy_prop {#3} + \jsonparse_array_count:NN \l__jsonparse_temp_copy_prop \l__jsonparse_array_count_int \clist_set:Nn \l__jsonparse_array_map_keys_clist {#4} \cs_set_eq:NN \__jsonparse_array_map_function_cs: #5 \clist_if_empty:NF \l__jsonparse_array_map_keys_clist { @@ -1458,10 +1470,10 @@ \clist_map_function:NN \l__jsonparse_array_map_keys_clist \__jsonparse_array_map_function_generate_cs:n } - \l__jsonparse_map_before_tl + \l__jsonparse_array_map_code_before_tl \int_step_function:nN { \l__jsonparse_array_count_int } \__jsonparse_array_map_function:n - \l__jsonparse_map_after_tl + \l__jsonparse_array_map_code_after_tl \group_end: } @@ -1475,23 +1487,53 @@ } % === -\cs_new:Npn \__jsonparse_array_map_inline:n #1 { } +\cs_new:Npn \__jsonparse_warning_function_expandable: { + \str_if_in:eeT { \tl_to_str:o { \__jsonparse_array_map_inline_code:n { } } } + { \c_backslash_str JSONParseValue } + { \msg_error:nn { jsonparse } { nested-non-expandable } } +} + +\cs_new:Npn \__jsonparse_array_map_inline_code:n #1 { } -\NewDocumentCommand { \JSONParseArrayMapInline } { m m +m } { - \__jsonparse_warning_undefined_prop:N #1 - \cs_gset:Npn \__jsonparse_array_map_inline:n ##1 {#3} +\cs_new:Npn \__jsonparse_array_map_inline:nn #1#2 { + \tl_if_empty:NT \g__jsonparse_array_map_store_in_tl { + \__jsonparse_array_map_inline_aux:nn {#1} {#2} + } +} + +\cs_new:Npn \__jsonparse_array_map_inline_aux:nn #1#2 { + \int_step_function:nnN { + \bool_if:nTF {#1} { 0 } { 1 } + } {#2} \__jsonparse_array_map_inline_code:n +} +\cs_generate_variant:Nn \__jsonparse_array_map_inline_aux:nn { oV } + +\NewDocumentCommand { \JSONParseArrayMapInline } { O{} m m +m } { + \__jsonparse_warning_undefined_prop:N #2 + \cs_gset:Npn \__jsonparse_array_map_inline_code:n ##1 {#4} \group_begin: - \tl_set_eq:NN \l__jsonparse_temp_tl #1 - \jsonparse_filter:Nn \l__jsonparse_temp_tl {#2} - \jsonparse_array_count:NN \l__jsonparse_temp_tl \l__jsonparse_array_count_int + \keys_set_known:nn { jsonparse / map } {#1} \l__jsonparse_unused_keys_clist + \__jsonparse_warning_unused_keys: + \prop_set_eq:NN \l__jsonparse_temp_copy_prop #2 + \jsonparse_filter:Nn \l__jsonparse_temp_copy_prop {#3} + \jsonparse_array_count:NN \l__jsonparse_temp_copy_prop \l__jsonparse_array_count_int \bool_if:NT \l__jsonparse_zero_based_bool { \int_decr:N \l__jsonparse_array_count_int } - \exp_last_unbraced:Nf + \tl_if_empty:NF \g__jsonparse_array_map_store_in_tl { + \__jsonparse_warning_function_expandable: + \exp_last_unbraced:No \tl_if_exist:NF \g__jsonparse_array_map_store_in_tl { + \exp_last_unbraced:No \tl_new:N \g__jsonparse_array_map_store_in_tl + } + \exp_last_unbraced:No \tl_gset:Ne \g__jsonparse_array_map_store_in_tl { + \__jsonparse_array_map_inline_aux:oV { \l__jsonparse_zero_based_bool } + \l__jsonparse_array_count_int + } + } + \exp_args:NNoV \group_end: - \int_step_function:nVN { - \bool_if:NTF \l__jsonparse_zero_based_bool { 0 } { 1 } - } \l__jsonparse_array_count_int \__jsonparse_array_map_inline:n + \__jsonparse_array_map_inline:nn { \l__jsonparse_zero_based_bool } + \l__jsonparse_array_count_int } % === diff --git a/macros/latex/contrib/recorder-fingering/README.md b/macros/latex/contrib/recorder-fingering/README.md index 0ce46ec1a0..7cf808d937 100644 --- a/macros/latex/contrib/recorder-fingering/README.md +++ b/macros/latex/contrib/recorder-fingering/README.md @@ -1,6 +1,6 @@ # recorder-fingering -Version 1.3b October 17, 2023 +Version 1.4 February 2, 2025 The `recorder-fingering` package provides support for generating fingering diagrams for baroque fingering recorders and the tin whistle. Standard fingerings are provided for recorders in both C and F, and the tin whistle in D, along with methods to create and display alternate fingerings for trills, etc. diff --git a/macros/latex/contrib/recorder-fingering/recorder-fingering.pdf b/macros/latex/contrib/recorder-fingering/recorder-fingering.pdf Binary files differindex 79360b17c4..196d766c71 100644 --- a/macros/latex/contrib/recorder-fingering/recorder-fingering.pdf +++ b/macros/latex/contrib/recorder-fingering/recorder-fingering.pdf diff --git a/macros/latex/contrib/recorder-fingering/recorder-fingering.sty b/macros/latex/contrib/recorder-fingering/recorder-fingering.sty index 63e16d0ec3..7be990f092 100644 --- a/macros/latex/contrib/recorder-fingering/recorder-fingering.sty +++ b/macros/latex/contrib/recorder-fingering/recorder-fingering.sty @@ -26,9 +26,9 @@ % % recorder-fingering.tex, recorder-fingering.pdf % -% Version 1.3b 2023/07/17 +% Version 1.4 2025/02/02 \NeedsTeXFormat{LaTeX2e}[2022/11/01] -\ProvidesPackage{recorder-fingering}[2023/10/17 v1.3b Recorder fingering diagrams] +\ProvidesPackage{recorder-fingering}[2025/02/02 v1.4 Recorder fingering diagrams] \RequirePackage{tikz} \usetikzlibrary{calc} \RequirePackage{graphicx} @@ -59,14 +59,18 @@ hole/.style={circle,draw,##1}, 0/.style={fill=none}, % open hole t/.style={node split half=0}, % thumb half hole h/.style={node split half=-90}, % finger half hole -top double/.style={circle,minimum size=7pt,inner sep=0pt,draw,##1}, -bottom double/.style={circle,minimum size=6pt,inner sep=0pt,draw,##1}, +o/.style={fill=none,font={\textbullet},inner sep=.5pt,align=center}, % hole closed if required +top double rev/.style={circle,minimum size=7pt,inner sep=0pt,draw,##1}, +bottom double rev/.style={circle,minimum size=6pt,inner sep=0pt,draw,##1}, +top double/.style={circle,minimum size=6pt,inner sep=0pt,draw,##1}, +bottom double/.style={circle,minimum size=7pt,inner sep=0pt,draw,##1}, nodes={anchor=center} }} \ExplSyntaxOn % Error messages \msg_new:nnnn {recorder-fingering}{too-few}{\\You\ haven't\ provided\ enough\ holes!}{Fingerings\ must\ specify\ all\ 8\ holes\ (thumb\ +\ all\ 7\ fingers)} +\msg_new:nnnn {recorder-fingering}{o-not-allowed}{\\You\ can’t\ use\ this\ hole\ specification\ in\ holes\ 6\ and\ 7\ !}{Only\ 0,1,2\ are\ permitted\ here.} \msg_new:nnnn {recorder-fingering}{key-exists}{\\This\ fingering\ is\ already\ defined!}{Use\ the\ starred\ version\ of\ the\ command\ or\ \token_to_str:N \AddFingerings\ instead\ to\ override\ existing\ fingerings.} \msg_new:nnnn {recorder-fingering}{wrong-instrument}{\\This\ command\ only\ permits\ F, \ C,\ and\ D\ fingerings!}{} \msg_new:nnnn {recorder-fingering}{deprecated}{\\This\ command\ is\ deprecated.\ Please\ use\ \token_to_str:N \Alto\ or\ \token_to_str:N \Soprano\ instead.}{} @@ -126,14 +130,22 @@ nodes={anchor=center} \tl_new:N \l_fingering_three_tl \tl_new:N \l_fingering_four_tl \tl_new:N \l_fingering_five_tl -\tl_new:N \l_fingering_bell_tl +\tl_new:N \l_fingering_bell_tl +\tl_new:N \l_fingering_six_seven_half_top_tl +\tl_new:N \l_fingering_six_seven_half_bot_tl +\tl_new:N \l_fingering_six_bot_tl +\tl_new:N \l_fingering_six_top_tl +\tl_new:N \l_fingering_seven_bot_tl +\tl_new:N \l_fingering_seven_top_tl +\tl_new:N \l_fingering_top_double_style_tl +\tl_new:N \l_fingering_bot_double_style_tl + \tl_const:Nn \c_fingering_thumb_tl {0.5} \tl_const:Nn \c_fingering_six_tl {3.0} \tl_const:Nn \c_fingering_six_seven_x_tl {0.15} -\tl_const:Nn \c_fingering_six_top_tl {3.5} -\tl_const:Nn \c_fingering_six_bot_tl {3.575} -\tl_const:Nn \c_fingering_seven__top_tl {4.0} -\tl_const:Nn \c_fingering_seven_bot_tl {4.075} +\tl_const:Nn \c_fingering_six_seven_half_one_tl {1} +\tl_const:Nn \c_fingering_six_seven_half_zero_tl {0} + % Manage the thumb offset parameters @@ -153,10 +165,34 @@ nodes={anchor=center} {\fingering_offset_zero:} } +% Manage the orientation of the double holes for the revdouble option +\cs_new:Nn \fingering_reverse_double: { + \tl_set:Nn \l_fingering_six_seven_half_top_tl {1} + \tl_set:Nn \l_fingering_six_seven_half_bot_tl {0} + \tl_set:Nn \l_fingering_six_bot_tl {3.575} + \tl_set:Nn \l_fingering_six_top_tl {3.5} + \tl_set:Nn \l_fingering_seven_bot_tl {4.075} + \tl_set:Nn \l_fingering_seven_top_tl {4.0} + \tl_set:Nn \l_fingering_top_double_style_tl {top~double~rev} + \tl_set:Nn \l_fingering_bot_double_style_tl {bottom~double~rev} +} + +\cs_new:Nn \fingering_default_double: { + \tl_set:Nn \l_fingering_six_seven_half_top_tl {0} + \tl_set:Nn \l_fingering_six_seven_half_bot_tl {1} + \tl_set:Nn \l_fingering_six_bot_tl {3.5} + \tl_set:Nn \l_fingering_six_top_tl {3.575} + \tl_set:Nn \l_fingering_seven_bot_tl {4.0} + \tl_set:Nn \l_fingering_seven_top_tl {4.075} + \tl_set:Nn \l_fingering_top_double_style_tl {top~double} + \tl_set:Nn \l_fingering_bot_double_style_tl {bottom~double} +} + \tl_new:N \l_fingering_top_bottom_space_tl \tl_new:N \l_fingering_trill_offset_tl \bool_new:N \l_fingering_trill_offset_LR_bool + % Macro to set hole positions for each instrument (R=recorder, W=tin whistle) \cs_new:Nn \l_fingering_set_hole_positions:n { \str_case:nn {#1}{ @@ -202,7 +238,8 @@ nodes={anchor=center} \prop_get:NnN \l_fingering_pointer_prop {RPointer} \l_fingering_trill_pointer_tl}, trilldir / LR .code:n = { \bool_set_true:N \l_fingering_trill_offset_LR_bool }, - trilldir.initial:n = LR + trilldir.initial:n = LR, + revdouble.bool_set:N = \l_fingering_revdouble_bool, } @@ -221,6 +258,9 @@ nodes={anchor=center} { \clist_set:Nn \l_fingering_holes_clist {#1} \l_fingering_set_hole_positions:n {R} +\bool_if:nTF {\l_fingering_revdouble_bool} + {\fingering_reverse_double:} + {\fingering_default_double:} \clist_clear:N \l_fingering_topholes_clist \int_step_inline:nn { 4 } { \clist_pop:NNF \l_fingering_holes_clist \l_fingering_tmpa_tl { \msg_error:nn { recorder-fingering } { too-few }} @@ -245,39 +285,39 @@ nodes={anchor=center} \node[hole=\l_fingering_tmpa_tl]~at~(0,-\l_fingering_five_tl)~{}; % display the bottom two paired holes \clist_pop:NN \l_fingering_holes_clist \l_fingering_tmpa_tl - \int_case:nnTF {\l_fingering_tmpa_tl}{ - {0} {\node[top~double=0]~at~ - (\c_fingering_six_seven_x_tl,-\c_fingering_six_top_tl)~{}; - \node[bottom~double=0]~at~ - (-\c_fingering_six_seven_x_tl,-\c_fingering_six_bot_tl)~{};} - {2} {\node[top~double=1,]~at~ - (\c_fingering_six_seven_x_tl,-\c_fingering_six_top_tl)~{}; - \node[bottom~double=1]~at~ - (-\c_fingering_six_seven_x_tl,-\c_fingering_six_bot_tl)~{};} - {1} {\node[top~double=1]~at~ - (\c_fingering_six_seven_x_tl,-\c_fingering_six_top_tl)~{}; - \node[bottom~double=0]~at~ - (-\c_fingering_six_seven_x_tl,-\c_fingering_six_bot_tl)~{};} + \str_case:enTF {\l_fingering_tmpa_tl}{ + {0} {\node[\l_fingering_top_double_style_tl=0]~at~ + (\c_fingering_six_seven_x_tl,-\l_fingering_six_top_tl)~{}; + \node[\l_fingering_bot_double_style_tl=0]~at~ + (-\c_fingering_six_seven_x_tl,-\l_fingering_six_bot_tl)~{};} + {2} {\node[\l_fingering_top_double_style_tl=1,]~at~ + (\c_fingering_six_seven_x_tl,-\l_fingering_six_top_tl)~{}; + \node[\l_fingering_bot_double_style_tl=1]~at~ + (-\c_fingering_six_seven_x_tl,-\l_fingering_six_bot_tl)~{};} + {1} {\node[\l_fingering_top_double_style_tl=\l_fingering_six_seven_half_top_tl]~at~ + (\c_fingering_six_seven_x_tl,-\l_fingering_six_top_tl)~{}; + \node[\l_fingering_bot_double_style_tl=\l_fingering_six_seven_half_bot_tl]~at~ + (-\c_fingering_six_seven_x_tl,-\l_fingering_six_bot_tl)~{};} } {} - {} + {\msg_error:nn { recorder-fingering } { o-not-allowed }} \clist_pop:NN \l_fingering_holes_clist \l_fingering_tmpa_tl - \int_case:nnTF {\l_fingering_tmpa_tl}{ - {0} {\node[top~double=0,]~at~ - (\c_fingering_six_seven_x_tl,-\c_fingering_seven__top_tl)~{}; - \node[bottom~double=0]~at~ - (-\c_fingering_six_seven_x_tl,-\c_fingering_seven_bot_tl)~{};} - {2} {\node[top~double=1,]~at~ - (\c_fingering_six_seven_x_tl,-\c_fingering_seven__top_tl)~{}; - \node[bottom~double=1]~at~ - (-\c_fingering_six_seven_x_tl,-\c_fingering_seven_bot_tl)~{};} - {1} {\node[top~double=1,]~at~ - (\c_fingering_six_seven_x_tl,-\c_fingering_seven__top_tl)~{}; - \node[bottom~double=0]~at~ - (-\c_fingering_six_seven_x_tl,-\c_fingering_seven_bot_tl)~{};} + \str_case:enTF {\l_fingering_tmpa_tl}{ + {0} {\node[\l_fingering_top_double_style_tl=0,]~at~ + (\c_fingering_six_seven_x_tl,-\l_fingering_seven_top_tl)~{}; + \node[\l_fingering_bot_double_style_tl=0]~at~ + (-\c_fingering_six_seven_x_tl,-\l_fingering_seven_bot_tl)~{};} + {2} {\node[\l_fingering_top_double_style_tl=1,]~at~ + (\c_fingering_six_seven_x_tl,-\l_fingering_seven_top_tl)~{}; + \node[\l_fingering_bot_double_style_tl=1]~at~ + (-\c_fingering_six_seven_x_tl,-\l_fingering_seven_bot_tl)~{};} + {1} {\node[\l_fingering_top_double_style_tl=\l_fingering_six_seven_half_top_tl]~at~ + (\c_fingering_six_seven_x_tl,-\l_fingering_seven_top_tl)~{}; + \node[\l_fingering_bot_double_style_tl=\l_fingering_six_seven_half_bot_tl]~at~ + (-\c_fingering_six_seven_x_tl,-\l_fingering_seven_bot_tl)~{};} } {} - {} + {\msg_error:nn { recorder-fingering } { o-not-allowed }} % display the bell hole if present \clist_if_empty:NTF \l_fingering_holes_clist {} @@ -414,29 +454,29 @@ nodes={anchor=center} % Trill version of the commands; this allows you to store trill holes % with a key name, so that the trill doesn’t have to be specified manually -\NewDocumentCommand{\Ftrill}{m}{ - \prop_get:NnNTF \l_fingering_trill_F_prop {#1} \l_fingering_tmpa_tl +\NewDocumentCommand{\Ftrill}{O{}m}{ + \prop_get:NnNTF \l_fingering_trill_F_prop {#2} \l_fingering_tmpa_tl {\group_begin: - \keys_set:nx {fingering} {trill={\l_fingering_tmpa_tl}} - \prop_get:NnN \l_fingering_F_prop {#1} \l_fingering_tmpb_tl + \keys_set:nx {fingering} {#1,trill={\l_fingering_tmpa_tl}} + \prop_get:NnN \l_fingering_F_prop {#2} \l_fingering_tmpb_tl \fingering_generate_recorder_fingering:V \l_fingering_tmpb_tl \group_end:} {\msg_error:nn {recorder-fingering} {key-not-found}} } -\NewDocumentCommand{\Ctrill}{m}{ - \prop_get:NnNTF \l_fingering_trill_C_prop {#1} \l_fingering_tmpa_tl +\NewDocumentCommand{\Ctrill}{O{}m}{ + \prop_get:NnNTF \l_fingering_trill_C_prop {#2} \l_fingering_tmpa_tl {\group_begin: - \keys_set:nx {fingering} {trill={\l_fingering_tmpa_tl}} - \prop_get:NnN \l_fingering_C_prop {#1} \l_fingering_tmpb_tl + \keys_set:nx {fingering} {#1,trill={\l_fingering_tmpa_tl}} + \prop_get:NnN \l_fingering_C_prop {#2} \l_fingering_tmpb_tl \fingering_generate_recorder_fingering:V \l_fingering_tmpb_tl \group_end:} {\msg_error:nn {recorder-fingering} {key-not-found}} } -\NewDocumentCommand{\Dtrill}{m}{ - \prop_get:NnNTF \l_fingering_trill_D_prop {#1} \l_fingering_tmpa_tl +\NewDocumentCommand{\Dtrill}{O{}m}{ + \prop_get:NnNTF \l_fingering_trill_D_prop {#2} \l_fingering_tmpa_tl {\group_begin: - \keys_set:nx {fingering} {trill={\l_fingering_tmpa_tl}} - \prop_get:NnN \l_fingering_D_prop {#1} \l_fingering_tmpb_tl + \keys_set:nx {fingering} {#1,trill={\l_fingering_tmpa_tl}} + \prop_get:NnN \l_fingering_D_prop {#2} \l_fingering_tmpb_tl \fingering_generate_recorder_fingering:V \l_fingering_tmpb_tl \group_end:} {\msg_error:nn {recorder-fingering} {key-not-found}} @@ -635,9 +675,9 @@ nodes={anchor=center} Eb = {1,1,1,1,1,1,1,0}, E = {1,1,1,1,1,1,0,0}, F = {1,1,1,1,1,0,2,2}, - Gb = {1,1,1,1,0,1,1,0}, + Gb = {1,1,1,1,0,1,2,0}, G = {1,1,1,1,0,0,0,0}, - Ab = {1,1,1,0,1,1,0,0}, + Ab = {1,1,1,0,1,1,1,0}, A = {1,1,1,0,0,0,0,0}, Bb = {1,1,0,1,1,0,0,0}, B = {1,1,0,0,0,0,0,0}, @@ -651,7 +691,7 @@ nodes={anchor=center} g = {t,1,1,1,0,0,0,0}, ab = {t,1,1,0,1,0,0,0}, a = {t,1,1,0,0,0,0,0}, - bb = {t,1,1,0,0,1,2,1}, + bb = {t,1,1,0,1,1,2,0}, b = {t,1,1,0,1,1,0,0}, c' = {t,1,0,0,1,1,0,0}, db' = {t,1,0,1,1,0,2,2,1}, @@ -698,7 +738,6 @@ nodes={anchor=center} \prop_set_from_keyval:Nn \l_fingering_C_sharp_flat_prop { C# = {Db}, D# = {Eb}, - Bb = {F}, F# = {Gb}, G# = {Ab}, A# = {Bb}, diff --git a/macros/latex/contrib/recorder-fingering/recorder-fingering.tex b/macros/latex/contrib/recorder-fingering/recorder-fingering.tex index 9dc25632aa..63f77e30f2 100644 --- a/macros/latex/contrib/recorder-fingering/recorder-fingering.tex +++ b/macros/latex/contrib/recorder-fingering/recorder-fingering.tex @@ -31,7 +31,7 @@ \DefineShortVerb{\|} \title{The \texttt{recorder-fingering} package} \author{Alan Munn\\amunn@msu.edu} -\date{Version 1.3b\\October 17, 2023} +\date{Version 1.4\\February 2, 2025} \lstset{% basicstyle=\ttfamily\small, @@ -52,7 +52,6 @@ \renewcommand{\abstractname}{\sffamily Abstract} - \begin{document} \maketitle \thispagestyle{empty} @@ -101,6 +100,7 @@ trilldir = <L/R/LR> & trill arrows uniformly to the Left or Right, or top 3 hole Lpointer = <left trill pointer> & changes the left pointer for trills\\ Rpointer = <right trill pointer> & changes the right pointer for trills\\ trill = \{<list of holes>\} & add a trill marker at each hole position in the list (local use only)\\ +revdouble & reverse the orientation of the double holes to show a player’s perspective\\ \bottomrule \end{tabularx} \caption{Display options} @@ -114,15 +114,17 @@ The trill arrow direction can be specified using the |trilldir| parameter. Setti The |Lpointer| and |Rpointer| parameters set the left and right trill pointers. The default values are |Lpointer={$\rightarrow$}| and |Rpointer={$\leftarrow$}|. +The |revdouble| parameter reverses the orientation of the double holes to make them appear from a player’s perspective rather than looking at the recorder from the front (the default). This parameter really only makes sense to be used globally, although it can also be used locally if needed. + You can set the parameters individually for any particular display command, but most likely you'll want global settings. To set the parameters globally use the command |\fingeringSetup| e.g. |\fingeringSetup{width=12pt,thumboffset=false}| makes all diagrams use an inline thumb hole and 12pt width. \begin{table}[htpb] \centering -\begin{tabular}{TTT} -\bs Alto\{c\} & \bs Soprano[width=10pt,thumboffset=false]\{f\} & \bs Alto[trill=3]\{C\}\\ +\begin{tabular}{TTTT} +\bs Alto\{c\} & \bs Soprano[width=10pt,thumboffset=false]\{f\} & \bs Alto[trill=3]\{C\} & \bs Alto[revdouble]{G}\\ \\ -\Alto{c} & \Soprano[width=10pt,thumboffset=false]{f} & \Alto[trill=3]{C} +\Alto{c} & \Soprano[width=10pt,thumboffset=false]{f} & \Alto[trill=3]{C} & \Alto[revdouble]{G} \end{tabular} \caption{Example fingering commands} \end{table} @@ -139,10 +141,11 @@ Fingerings are specified using an 8 (and possibly 9) element comma separated lis \begin{tabularx}{.8\textwidth}{t{r}X} \toprule 0 & open hole\\ -1 & closed hole (positions 0-6); or single closed hole (recorder positions 6,7)\\ +1 & closed hole (positions 0-5); or single closed hole (recorder positions 6,7)\\ 2 & double closed hole (recorder positions 6,7 only)\\ t & half hole (thumb)\\ -h & half hole (positions 1-6)\\ +h & half hole (positions 1-5)\\ +o & optionally closed (positions 0-5) represented as an open hole with a dot\\ \bottomrule \end{tabularx} \caption{Hole states} @@ -211,7 +214,8 @@ Here are some examples of how to add new fingerings and trills. \AddFingerings{F}{ altD = {1,0,1,1,1,1,0,0}, altE = {1,0,1,1,0,0,0,0}, -altAb = {t,1,1,1,1,1,1,0} +altAb = {t,1,1,1,1,1,1,0}, +altG# = {0,o,1,1,1,1,2,0} } \AddTrills{F}{ BbA = {{0,1,1,1,1,1,0,0},{5}}, @@ -225,16 +229,19 @@ C#D ={{1,1,1,0,1,1,1,0},{4,5}} \AddFingerings{F}{ altD = {1,0,1,1,1,1,0,0}, altE = {1,0,1,1,0,0,0,0}, -altAb = {t,1,1,1,1,1,1,0} +altAb = {t,1,1,1,1,1,1,0}, +altG# = {0,o,1,1,1,1,2,0} } \Alto{altD}\quad \Alto{altE}\quad -\Alto{altAb} +\Alto{altAb}\quad +\Alto{altG#} \end{lstlisting} \Alto{altD}\quad \Alto{altE}\quad -\Alto{altAb} +\Alto{altAb}\quad +\Alto{altG#} \begin{lstlisting} \AddTrills{F}{ @@ -256,15 +263,17 @@ C#D ={{1,1,1,0,1,1,1,0},{4,5}} \Ctrill{ef#}\quad \Ctrill{gab} \end{lstlisting} -\Soprano{alte}\quad +\Soprano[revdouble]{alte}\quad \Ctrill{ef#}\quad \Ctrill{gab} \clearpage \section{Version History} -Version 0.5 of this package (the initial version) was in response to a \href{https://tex.stackexchange.com/q/674847/2693}{TeX.se question} and used a substantially different set of user commands. The current version (1.x) is more flexible and has a more useable user interface. Version 1.1 added support for trill annotation, and added a separation between the left and right hand holes. Version 1.2 added support for the tin whistle. Version 1.3 added dedicated trill fingering commands. Bug reports and feature requests are welcome at the \href{https://github.com/amunn/recorder-fingering/issues}{GitHub bug tracker}. +Version 0.5 of this package (the initial version) was in response to a \href{https://tex.stackexchange.com/q/674847/2693}{TeX.se question} and used a substantially different set of user commands. The current version (1.x) is more flexible and has a more useable user interface. Version 1.1 added support for trill annotation, and added a separation between the left and right hand holes. Version 1.2 added support for the tin whistle. Version 1.3 added dedicated trill fingering commands. Version 1.4 added a new hole state |o| to denote a closed if required hole (following the practice in the Moeck fingering charts). It also fixed some typos in the built-in fingerings, and bug with options for trill commands and added a parameter to change the orientation of the double holes. Bug reports and feature requests are welcome at the \href{https://github.com/amunn/recorder-fingering/issues}{GitHub bug tracker}. \section{Acknowledgements} -This is my first attempt to write a package using |expl3|. Thanks to Jonathan P. Spratte for suggesting how to split fingering vectors and the various LaTeX development team members (David Carlisle, Ulrike Fischer, Phelype Olenik and Joseph Wright) who have answered random |expl3| questions in the TeX.se chat. Thanks to Bob Tennent, whose suggestions resulted in version 1.1. Thanks also to all the TeX.se users who have both asked and answered questions on the site. Your questions encourage new packages like this one and your answers help make the code better. Thanks to Charles-Albert Lehalle for the suggestion to add the tin whistle. +This is my first attempt to write a package using |expl3|. Thanks to Jonathan P. Spratte for suggesting how to split fingering vectors and the various LaTeX development team members (David Carlisle, Ulrike Fischer, Phelype Olenik and Joseph Wright) who have answered random |expl3| questions in the TeX.se chat. Thanks to Bob Tennent, whose suggestions resulted in version 1.1. Thanks also to all the TeX.se users who have both asked and answered questions on the site. Your questions encourage new packages like this one and your answers help make the code better. Thanks to Charles-Albert Lehalle for the suggestion to add the tin whistle. Thanks to GitHub user |voh9eepah| for the suggestions that led to version 1.4. +voh9eepah + \section{Sources} The core fingerings for recorders are taken from \textcite{Wollitz1981}. The core fingerings for the tin whistle are taken from \textcite{GreyLarsenWhistleFingerings}. The sample recorder trill fingerings are from \textcite{BlockisRecorderFingerings}. diff --git a/macros/texinfo/latest/texinfo.tex b/macros/texinfo/latest/texinfo.tex index 97a589c898..d6213d30e1 100644 --- a/macros/texinfo/latest/texinfo.tex +++ b/macros/texinfo/latest/texinfo.tex @@ -3,9 +3,9 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2024-11-04.20} +\def\texinfoversion{2025-01-31.21} % -% Copyright 1985, 1986, 1988, 1990-2024 Free Software Foundation, Inc. +% Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc. % % This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as @@ -156,8 +156,9 @@ % Give the space character the catcode for a space. \def\spaceisspace{\catcode`\ =10\relax} -% Likewise for ^^M, the end of line character. -\def\endlineisspace{\catcode13=10\relax} +% Used to ignore an active newline that may appear immediately after +% a macro name. +{\catcode13=\active \gdef\ignoreactivenewline{\let^^M\empty}} \chardef\dashChar = `\- \chardef\slashChar = `\/ @@ -957,6 +958,10 @@ where each line of input produces a line of output.} \ifx\byeerror\relax\else\errmessage{\byeerror}\fi \tracingstats=1\ptexend} +% set in \donoderef below, but we need to define this here so that +% conditionals balance inside the large \ifpdf ... \fi blocks below. +\newif\ifnodeseen +\nodeseenfalse \message{pdf,} % adobe `portable' document format @@ -975,6 +980,11 @@ where each line of input produces a line of output.} \newif\ifpdf \newif\ifpdfmakepagedest +\newif\ifluatex +\ifx\luatexversion\thisisundefined\else + \luatextrue +\fi + % % For LuaTeX % @@ -982,8 +992,7 @@ where each line of input produces a line of output.} \newif\iftxiuseunicodedestname \txiuseunicodedestnamefalse % For pdfTeX etc. -\ifx\luatexversion\thisisundefined -\else +\ifluatex % Use Unicode destination names \txiuseunicodedestnametrue % Escape PDF strings with converting UTF-16 from UTF-8 @@ -1072,12 +1081,17 @@ where each line of input produces a line of output.} \fi \fi +\newif\ifxetex +\ifx\XeTeXrevision\thisisundefined\else + \xetextrue +\fi + \newif\ifpdforxetex \pdforxetexfalse \ifpdf \pdforxetextrue \fi -\ifx\XeTeXrevision\thisisundefined\else +\ifxetex \pdforxetextrue \fi @@ -1167,58 +1181,90 @@ with PDF output, and none of those formats could be found. (.eps cannot be supported due to the design of the PDF format; use regular TeX (DVI output) for that.)} +% definitions for pdftex or luatex with pdf output \ifpdf + % Strings in PDF outlines can either be ASCII, or encoded in UTF-16BE + % with BOM. Unfortunately there is no simple way with pdftex to output + % UTF-16, so we have to do some quite convoluted expansion games if we + % find the string contains a non-ASCII codepoint if we want these to + % display correctly. We generated the UTF-16 sequences in + % \DeclareUnicodeCharacter and we access them here. + % + \def\defpdfoutlinetextunicode#1{% + \def\pdfoutlinetext{#1}% + % + % Make UTF-8 sequences expand to UTF-16 definitions. + \passthroughcharsfalse \utfbytespdftrue + \utfviiidefinedwarningfalse + % + % Completely expand, eliminating any control sequences such as \code, + % leaving only possibly \utfbytes. + \let\utfbytes\relax + \pdfaccentliterals + \xdef\pdfoutlinetextchecked{#1}% + \checkutfbytes + }% + % Check if \utfbytes occurs in expansion. + \def\checkutfbytes{% + \expandafter\checkutfbytesz\pdfoutlinetextchecked\utfbytes\finish + }% + \def\checkutfbytesz#1\utfbytes#2\finish{% + \def\after{#2}% + \ifx\after\empty + % No further action needed. Output ASCII string as-is, as converting + % to UTF-16 is somewhat slow (and uses more space). + \global\let\pdfoutlinetext\pdfoutlinetextchecked + \else + \passthroughcharstrue % pass UTF-8 sequences unaltered + \xdef\pdfoutlinetext{\pdfoutlinetext}% + \expandafter\expandutfsixteen\expandafter{\pdfoutlinetext}\pdfoutlinetext + \fi + }% % - % Color manipulation macros using ideas from pdfcolor.tex, - % except using rgb instead of cmyk; the latter is said to render as a - % very dark gray on-screen and a very dark halftone in print, instead - % of actual black. The dark red here is dark enough to print on paper as - % nearly black, but still distinguishable for online viewing. We use - % black by default, though. - \def\rgbDarkRed{0.50 0.09 0.12} - \def\rgbBlack{0 0 0} - % - % rg sets the color for filling (usual text, etc.); - % RG sets the color for stroking (thin rules, e.g., normal _'s). - \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} + \catcode2=1 % begin-group character + \catcode3=2 % end-group character % - % Set color, and create a mark which defines \thiscolor accordingly, - % so that \makeheadline knows which color to restore. - \def\curcolor{0 0 0}% - \def\setcolor#1{% - \ifx#1\curcolor\else - \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% - \domark - \pdfsetcolor{#1}% - \xdef\curcolor{#1}% - \fi - } + % argument should be pure UTF-8 with no control sequences. convert to + % UTF-16BE by inserting null bytes before bytes < 128 and expanding + % UTF-8 multibyte sequences to saved UTF-16BE sequences. + \def\expandutfsixteen#1#2{% + \bgroup \asciitounicode + \passthroughcharsfalse + \let\utfbytes\asis + % + % for Byte Order Mark (BOM) + \catcode"FE=12 + \catcode"FF=12 + % + % we want to treat { and } in #1 as any other ASCII bytes. however, + % we need grouping characters for \scantokens and definitions/assignments, + % so define alternative grouping characters using control characters + % that are unlikely to occur. + % this does not affect 0x02 or 0x03 bytes arising from expansion as + % these are tokens with different catcodes. + \catcode"02=1 % begin-group character + \catcode"03=2 % end-group character + % + \expandafter\xdef\expandafter#2\scantokens{% + ^^02^^fe^^ff#1^^03}% + % NB we need \scantokens to provide both the open and close group tokens + % for \xdef otherwise there is an e-TeX error "File ended while + % scanning definition of..." + % NB \scantokens is a e-TeX command which is assumed to be provided by + % pdfTeX. + % + \egroup + }% % - \let\maincolor\rgbBlack - \pdfsetcolor{\maincolor} - \edef\thiscolor{\maincolor} - \def\currentcolordefs{} + \catcode2=12 \catcode3=12 % defaults % - \def\makefootline{% - \baselineskip24pt - \line{\pdfsetcolor{\maincolor}\the\footline}% - } + % Color support % - \def\makeheadline{% - \vbox to 0pt{% - \vskip-22.5pt - \line{% - \vbox to8.5pt{}% - % Extract \thiscolor definition from the marks. - \getcolormarks - % Typeset the headline with \maincolor, then restore the color. - \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% - }% - \vss - }% - \nointerlineskip - } + % rg sets the color for filling (usual text, etc.); + % RG sets the color for stroking (thin rules, e.g., normal _'s). + \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} % + % PDF outline support % \pdfcatalog{/PageMode /UseOutlines} % @@ -1315,18 +1361,15 @@ output) for that.)} \def\pdfoutlinetext{#1}% \else \ifx \declaredencoding \utfeight - \ifx\luatexversion\thisisundefined - % For pdfTeX with UTF-8. - % TODO: the PDF format can use UTF-16 in bookmark strings, - % but the code for this isn't done yet. - % Use ASCII approximations. - \passthroughcharsfalse - \def\pdfoutlinetext{#1}% - \else + \ifluatex % For LuaTeX with UTF-8. % Pass through Unicode characters for title texts. \passthroughcharstrue - \def\pdfoutlinetext{#1}% + \pdfaccentliterals + \xdef\pdfoutlinetext{#1}% + \else + % For pdfTeX with UTF-8. + \defpdfoutlinetextunicode{#1}% \fi \else % For non-Latin-1 or non-UTF-8 encodings. @@ -1348,11 +1391,6 @@ output) for that.)} % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1} % - % by default, use black for everything. - \def\urlcolor{\rgbBlack} - \let\linkcolor\rgbBlack - \def\endlink{\setcolor{\maincolor}\pdfendlink} - % % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% @@ -1416,6 +1454,10 @@ output) for that.)} \def\unnsecentry{\numsecentry}% \def\unnsubsecentry{\numsubsecentry}% \def\unnsubsubsecentry{\numsubsubsecentry}% + % + % Treat index initials like @section. Note that this is the wrong + % level if the index is not at the level of @appendix or @chapter. + \def\idxinitialentry{\numsecentry}% \readdatafile{toc}% % % Read toc second time, this time actually producing the outlines. @@ -1437,6 +1479,8 @@ output) for that.)} \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% \def\numsubsubsecentry##1##2##3##4{% count is always zero \dopdfoutline{##1}{}{##3}{##4}}% + \def\idxinitialentry##1##2##3##4{% + \dopdfoutline{##1}{}{idx.##1.##2}{##4}}% % % PDF outlines are displayed using system fonts, instead of % document fonts. Therefore we cannot use special characters, @@ -1450,6 +1494,7 @@ output) for that.)} % we use for the index sort strings. % \indexnofonts + \ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning \setupdatafile % We can have normal brace characters in the PDF outlines, unlike % Texinfo index files. So set that up. @@ -1458,6 +1503,10 @@ output) for that.)} \catcode`\\=\active \otherbackslash \input \tocreadfilename \endgroup + \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end + } + \def\dopdfoutlinecontents{% + \expandafter\dopdfoutline\expandafter{\putwordTOC}{}{txi.CONTENTS}{}% } {\catcode`[=1 \catcode`]=2 \catcode`{=\other \catcode`}=\other @@ -1484,55 +1533,16 @@ output) for that.)} \else \let \startlink \pdfstartlink \fi - % make a live url in pdf output. - \def\pdfurl#1{% - \begingroup - % it seems we really need yet another set of dummies; have not - % tried to figure out what each command should do in the context - % of @url. for now, just make @/ a no-op, that's the only one - % people have actually reported a problem with. - % - \normalturnoffactive - \def\@{@}% - \let\/=\empty - \makevalueexpandable - % do we want to go so far as to use \indexnofonts instead of just - % special-casing \var here? - \def\var##1{##1}% - % - \leavevmode\setcolor{\urlcolor}% - \startlink attr{/Border [0 0 0]}% - user{/Subtype /Link /A << /S /URI /URI (#1) >>}% - \endgroup} - % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may - % be a simple number, or a list of numbers in the case of an index - % entry. - \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} - \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} - \def\maketoks{% - \expandafter\poptoks\the\toksA|ENDTOKS|\relax - \ifx\first0\adn0 - \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 - \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 - \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 - \else - \ifnum0=\countA\else\makelink\fi - \ifx\first.\let\next=\done\else - \let\next=\maketoks - \addtokens{\toksB}{\the\toksD} - \ifx\first,\addtokens{\toksB}{\space}\fi - \fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next} - \def\makelink{\addtokens{\toksB}% - {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdfmakeurl#1{% + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + }% + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % \def\pdflink#1{\pdflinkpage{#1}{#1}}% \def\pdflinkpage#1#2{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \setcolor{\linkcolor}#2\endlink} - \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else % non-pdf mode \let\pdfmkdest = \gobble @@ -1541,13 +1551,12 @@ output) for that.)} \let\setcolor = \gobble \let\pdfsetcolor = \gobble \let\pdfmakeoutlines = \relax -\fi % \ifx\pdfoutput +\fi % % For XeTeX % -\ifx\XeTeXrevision\thisisundefined -\else +\ifxetex % % XeTeX version check % @@ -1573,45 +1582,8 @@ output) for that.)} \fi % % Color support - % - \def\rgbDarkRed{0.50 0.09 0.12} - \def\rgbBlack{0 0 0} - % \def\pdfsetcolor#1{\special{pdf:scolor [#1]}} % - % Set color, and create a mark which defines \thiscolor accordingly, - % so that \makeheadline knows which color to restore. - \def\setcolor#1{% - \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% - \domark - \pdfsetcolor{#1}% - } - % - \def\maincolor{\rgbBlack} - \pdfsetcolor{\maincolor} - \edef\thiscolor{\maincolor} - \def\currentcolordefs{} - % - \def\makefootline{% - \baselineskip24pt - \line{\pdfsetcolor{\maincolor}\the\footline}% - } - % - \def\makeheadline{% - \vbox to 0pt{% - \vskip-22.5pt - \line{% - \vbox to8.5pt{}% - % Extract \thiscolor definition from the marks. - \getcolormarks - % Typeset the headline with \maincolor, then restore the color. - \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% - }% - \vss - }% - \nointerlineskip - } - % % PDF outline support % % Emulate pdfTeX primitive @@ -1649,11 +1621,6 @@ output) for that.)} \safewhatsit{\pdfdest name{\pdfdestname} xyz}% } % - % by default, use black for everything. - \def\urlcolor{\rgbBlack} - \def\linkcolor{\rgbBlack} - \def\endlink{\setcolor{\maincolor}\pdfendlink} - % \def\dopdfoutline#1#2#3#4{% \setpdfoutlinetext{#1} \setpdfdestname{#3} @@ -1667,7 +1634,6 @@ output) for that.)} % \def\pdfmakeoutlines{% \begingroup - % % For XeTeX, counts of subentries are not necessary. % Therefore, we read toc only once. % @@ -1686,6 +1652,11 @@ output) for that.)} \def\numsubsubsecentry##1##2##3##4{% \dopdfoutline{##1}{4}{##3}{##4}}% % + % Note this is at the wrong level unless the index is in an @appendix + % or @chapter. + \def\idxinitialentry##1##2##3##4{% + \dopdfoutline{##1}{2}{idx.##1.##2}{##4}}% + % \let\appentry\numchapentry% \let\appsecentry\numsecentry% \let\appsubsecentry\numsubsecentry% @@ -1700,15 +1671,23 @@ output) for that.)} % Therefore, the encoding and the language may not be considered. % \indexnofonts + \pdfaccentliterals + \ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning + % \setupdatafile % We can have normal brace characters in the PDF outlines, unlike % Texinfo index files. So set that up. \def\{{\lbracecharliteral}% \def\}{\rbracecharliteral}% \catcode`\\=\active \otherbackslash - \input \tocreadfilename + \input \tocreadfilename\relax + \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end \endgroup } + \def\dopdfoutlinecontents{% + \expandafter\dopdfoutline\expandafter + {\putwordTOC}{1}{txi.CONTENTS}{txi.CONTENTS}% + } {\catcode`[=1 \catcode`]=2 \catcode`{=\other \catcode`}=\other \gdef\lbracecharliteral[{]% @@ -1721,7 +1700,7 @@ output) for that.)} % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315, % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings. % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). -% + % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces @@ -1736,55 +1715,17 @@ output) for that.)} \edef\temp{#1}% \expandafter\skipspaces\temp|\relax } - % make a live url in pdf output. - \def\pdfurl#1{% - \begingroup - % it seems we really need yet another set of dummies; have not - % tried to figure out what each command should do in the context - % of @url. for now, just make @/ a no-op, that's the only one - % people have actually reported a problem with. - % - \normalturnoffactive - \def\@{@}% - \let\/=\empty - \makevalueexpandable - % do we want to go so far as to use \indexnofonts instead of just - % special-casing \var here? - \def\var##1{##1}% - % - \leavevmode\setcolor{\urlcolor}% - \special{pdf:bann << /Border [0 0 0] - /Subtype /Link /A << /S /URI /URI (#1) >> >>}% - \endgroup} + \def\pdfmakeurl#1{% + \special{pdf:bann << /Border [0 0 0] + /Subtype /Link /A << /S /URI /URI (#1) >> >>}% + } \def\endlink{\setcolor{\maincolor}\special{pdf:eann}} - \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} - \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} - \def\maketoks{% - \expandafter\poptoks\the\toksA|ENDTOKS|\relax - \ifx\first0\adn0 - \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 - \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 - \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 - \else - \ifnum0=\countA\else\makelink\fi - \ifx\first.\let\next=\done\else - \let\next=\maketoks - \addtokens{\toksB}{\the\toksD} - \ifx\first,\addtokens{\toksB}{\space}\fi - \fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next} - \def\makelink{\addtokens{\toksB}% - {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{\pdflinkpage{#1}{#1}}% \def\pdflinkpage#1#2{% \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}% \setcolor{\linkcolor}#2\endlink} - \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -% + % % % @image support % @@ -1841,6 +1782,164 @@ output) for that.)} } \fi +% common definitions and code for pdftex, luatex and xetex +\ifpdforxetex + % The dark red here is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. We use + % black by default, though. + \def\rgbDarkRed{0.50 0.09 0.12} + \def\rgbBlack{0 0 0} + % + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\curcolor{0 0 0}% + \def\setcolor#1{% + \ifx#1\curcolor\else + \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + \xdef\curcolor{#1}% + \fi + } + % + \let\maincolor\rgbBlack + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\currentcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% + }% + \vss + }% + \nointerlineskip + } + % + % by default, use black for everything. + \def\urlcolor{\rgbBlack} + \let\linkcolor\rgbBlack + % + % make a live url in pdf output. + \def\pdfurl#1{% + \begingroup + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty + \makevalueexpandable + % do we want to go so far as to use \indexnofonts instead of just + % special-casing \var here? + \def\var##1{##1}% + % + \leavevmode\setcolor{\urlcolor}% + \pdfmakeurl{#1}% + \endgroup} + % + % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may + % be a simple number, or a list of numbers in the case of an index + % entry. + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\fi + +\ifpdforxetex + % for pdftex. + {\catcode`^^cc=13 + \gdef\pdfaccentliteralsutfviii{% + % For PDF outline only. Unicode combining accents follow the + % character they modify. Note we need at least the first byte + % of the UTF-8 sequences to have an active catcode to allow the + % definitions to do their magic. + \def\"##1{##1^^cc^^88}% U+0308 + \def\'##1{##1^^cc^^81}% U+0301 + \def\,##1{##1^^cc^^a7}% U+0327 + \def\=##1{##1^^cc^^85}% U+0305 + \def\^##1{##1^^cc^^82}% U+0302 + \def\`##1{##1^^cc^^80}% U+0300 + \def\~##1{##1^^cc^^83}% U+0303 + \def\dotaccent##1{##1^^cc^^87}% U+0307 + \def\H##1{##1^^cc^^8b}% U+030B + \def\ogonek##1{##1^^cc^^a8}% U+0328 + \def\ringaccent##1{##1^^cc^^8a}% U+030A + \def\u##1{##1^^cc^^8c}% U+0306 + \def\ubaraccent##1{##1^^cc^^b1}% U+0331 + \def\udotaccent##1{##1^^cc^^a3}% U+0323 + \def\v##1{##1^^cc^^8c}% U+030C + % this definition of @tieaccent will only work with exactly two characters + % in argument as we need to insert the combining character between them. + \def\tieaccent##1{\tieaccentz##1}% + \def\tieaccentz##1##2{##1^^cd^^a1##2} % U+0361 + }}% + % + % for xetex and luatex, which both support extended ^^^^ escapes and + % process the Unicode codepoint as a single token. + \gdef\pdfaccentliteralsnative{% + \def\"##1{##1^^^^0308}% + \def\'##1{##1^^^^0301}% + \def\,##1{##1^^^^0327}% + \def\=##1{##1^^^^0305}% + \def\^##1{##1^^^^0302}% + \def\`##1{##1^^^^0300}% + \def\~##1{##1^^^^0303}% + \def\dotaccent##1{##1^^^^0307}% + \def\H##1{##1^^^^030b}% + \def\ogonek##1{##1^^^^0328}% + \def\ringaccent##1{##1^^^^030a}% + \def\u##1{##1^^^^0306}% + \def\ubaraccent##1{##1^^^^0331}% + \def\udotaccent##1{##1^^^^0323}% + \def\v##1{##1^^^^030c}% + \def\tieaccent##1{\tieaccentz##1}% + \def\tieaccentz##1##2{##1^^^^0361##2} % U+0361 + }% + % + % use the appropriate definition + \ifluatex + \let\pdfaccentliterals\pdfaccentliteralsnative + \else + \ifxetex + \let\pdfaccentliterals\pdfaccentliteralsnative + \else + \let\pdfaccentliterals\pdfaccentliteralsutfviii + \fi + \fi +\fi % \message{fonts,} @@ -2772,15 +2871,15 @@ end % @cite unconditionally uses \sl with \smartitaliccorrection. \def\cite#1{{\sl #1}\smartitaliccorrection} -% @var unconditionally uses \sl. This gives consistency for -% parameter names whether they are in @def, @table @code or a -% regular paragraph. -% To get ttsl font for @var when used in code context, @set txicodevaristt. -% The \null is to reset \spacefactor. +% By default, use ttsl font for @var when used in code context. +% To unconditionally use \sl for @var, @clear txicodevaristt. This +% gives consistency for parameter names whether they are in @def, +% @table @code or a regular paragraph. \def\aftersmartic{} \def\var#1{% \let\saveaftersmartic = \aftersmartic \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% + % The \null is to reset \spacefactor. % \ifflagclear{txicodevaristt}% {\def\varnext{{{\sl #1}}\smartitaliccorrection}}% @@ -2788,7 +2887,6 @@ end \varnext } -% To be removed after next release \def\SETtxicodevaristt{}% @set txicodevaristt \let\i=\smartitalic @@ -2808,7 +2906,7 @@ end \def\ii#1{{\it #1}} % italic font % @b, explicit bold. Also @strong. -\def\b#1{{\bf #1}} +\def\b#1{{\bf \defcharsdefault #1}} \let\strong=\b % @sansserif, explicit sans. @@ -3039,9 +3137,7 @@ end \unhbox0\ (\urefcode{#1})% \fi \else - \ifx\XeTeXrevision\thisisundefined - \unhbox0\ (\urefcode{#1})% DVI, always show arg and url - \else + \ifxetex % For XeTeX \ifurefurlonlylink % PDF plus option to not display url, show just arg @@ -3051,6 +3147,8 @@ end % visibility, if the pdf is eventually used to print, etc. \unhbox0\ (\urefcode{#1})% \fi + \else + \unhbox0\ (\urefcode{#1})% DVI, always show arg and url \fi \fi \else @@ -3670,15 +3768,24 @@ $$% {\font\thisecfont = #1ctt\ecsize \space at \nominalsize}% % else {\ifx\curfontstyle\bfstylename - % bold: - \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize + \etcfontbold{#1}% \else - % regular: - \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \ifrmisbold + \etcfontbold{#1}% + \else + % regular: + \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space + at \nominalsize + \fi \fi}% \thisecfont } +\def\etcfontbold#1{% + % bold: + \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize +} + % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. @@ -5528,7 +5635,6 @@ might help (with 'rm \jobname.?? \jobname.??s')% \def\initial{% \bgroup - \initialglyphs \initialx } @@ -5551,7 +5657,10 @@ might help (with 'rm \jobname.?? \jobname.??s')% % % No shrink because it confuses \balancecolumns. \vskip 1.67\baselineskip plus 1\baselineskip - \leftline{\secfonts \kern-0.05em \secbf #1}% + \doindexinitialentry{#1}% + \initialglyphs + \leftline{% + \secfonts \kern-0.05em \secbf #1}% % \secfonts is inside the argument of \leftline so that the change of % \baselineskip will not affect any glue inserted before the vbox that % \leftline creates. @@ -5561,6 +5670,32 @@ might help (with 'rm \jobname.?? \jobname.??s')% \egroup % \initialglyphs } +\def\doindexinitialentry#1{% + \ifpdforxetex + \global\advance\idxinitialno by 1 + \def\indexlbrace{\{} + \def\indexrbrace{\}} + \def\indexbackslash{\realbackslash} + \def\indexatchar{\@} + \writetocentry{idxinitial}{\asis #1}{IDX\the\idxinitialno}% + % The @asis removes a pair of braces around e.g. {@indexatchar} that + % are output by texindex. + % + \vbox to 0pt{}% + % This vbox fixes the \pdfdest location for double column formatting. + % Without it, the \pdfdest is output above topskip glue at the top + % of a column as this glue is not added until the first box. + \pdfmkdest{idx.\asis #1.IDX\the\idxinitialno}% + \fi +} + +% No listing in TOC +\def\idxinitialentry#1#2#3#4{} + +% For index initials. +\newcount\idxinitialno \idxinitialno=1 + + \newdimen\entryrightmargin \entryrightmargin=0pt @@ -6782,12 +6917,13 @@ might help (with 'rm \jobname.?? \jobname.??s')% % Prepare to read what we've written to \tocfile. % -\def\startcontents#1{% +\def\startcontents#1#2{% % If @setchapternewpage on, and @headings double, the contents should % start on an odd page, unlike chapters. \contentsalignmacro \immediate\closeout\tocfile % + #2% % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. \chapmacro{#1}{Yomitfromtoc}{}% @@ -6818,7 +6954,7 @@ might help (with 'rm \jobname.?? \jobname.??s')% % Normal (long) toc. % \def\contents{% - \startcontents{\putwordTOC}% + \startcontents{\putwordTOC}{\contentsmkdest}% \openin 1 \tocreadfilename\space \ifeof 1 \else \findsecnowidths @@ -6834,9 +6970,13 @@ might help (with 'rm \jobname.?? \jobname.??s')% \contentsendroman } +\def\contentsmkdest{% + \pdfmkdest{txi.CONTENTS}% +} + % And just the chapters. \def\summarycontents{% - \startcontents{\putwordShortTOC}% + \startcontents{\putwordShortTOC}{}% % \let\partentry = \shortpartentry \let\numchapentry = \shortchapentry @@ -7925,7 +8065,7 @@ might help (with 'rm \jobname.?? \jobname.??s')% {\rm\enskip}% hskip 0.5 em of \rmfont }{}% % - \boldbrax + \parenbrackglyphs % arguments will be output next, if any. } @@ -7935,7 +8075,10 @@ might help (with 'rm \jobname.?? \jobname.??s')% \def\^^M{}% for line continuation \df \ifdoingtypefn \tt \else \sl \fi \ifflagclear{txicodevaristt}{}% - {\def\var##1{{\setregularquotes \ttsl ##1}}}% + % use \ttsl for @var in both @def* and @deftype*. + % the kern prevents an italic correction at end, which appears + % too much for ttsl. + {\def\var##1{{\setregularquotes \ttsl ##1\kern 0pt }}}% #1% \egroup } @@ -7952,8 +8095,9 @@ might help (with 'rm \jobname.?? \jobname.??s')% \let\lparen = ( \let\rparen = ) % Be sure that we always have a definition for `(', etc. For example, -% if the fn name has parens in it, \boldbrax will not be in effect yet, -% so TeX would otherwise complain about undefined control sequence. +% if the fn name has parens in it, \parenbrackglyphs will not be in +% effect yet, so TeX would otherwise complain about undefined control +% sequence. { \activeparens \gdef\defcharsdefault{% @@ -7963,49 +8107,28 @@ might help (with 'rm \jobname.?? \jobname.??s')% } \globaldefs=1 \defcharsdefault - \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\parenbrackglyphs{\let(=\opnr\let)=\cpnr\let[=\lbrb\let]=\rbrb} \gdef\magicamp{\let&=\amprm} } \let\ampchar\& -\newcount\parencount - -% If we encounter &foo, then turn on ()-hacking afterwards -\newif\ifampseen -\def\amprm#1 {\ampseentrue{\rm\ }} - -\def\parenfont{% - \ifampseen - % At the first level, print parens in roman, - % otherwise use the default font. - \ifnum \parencount=1 \rm \fi - \else - % The \sf parens (in \boldbrax) actually are a little bolder than - % the contained text. This is especially needed for [ and ] . - \sf - \fi -} -\def\infirstlevel#1{% - \ifampseen - \ifnum\parencount=1 - #1% - \fi - \fi -} -\def\bfafterword#1 {#1 \bf} +\def\amprm#1 {{\rm\ }} +\newcount\parencount +% opening and closing parentheses in roman font \def\opnr{% + \ptexslash % italic correction \global\advance\parencount by 1 - {\parenfont(}% - \infirstlevel \bfafterword + {\sf(}% } -\def\clnr{% - {\parenfont)}% - \infirstlevel \sl +\def\cpnr{% + \ptexslash % italic correction + {\sf)}% \global\advance\parencount by -1 } \newcount\brackcount +% left and right square brackets in bold font \def\lbrb{% \global\advance\brackcount by 1 {\bf[}% @@ -8535,7 +8658,7 @@ might help (with 'rm \jobname.?? \jobname.??s')% \expandafter\xdef\csname\the\macname\endcsname{% \begingroup \noexpand\spaceisspace - \noexpand\endlineisspace + \noexpand\ignoreactivenewline \noexpand\expandafter % skip any whitespace after the macro name. \expandafter\noexpand\csname\the\macname @@@\endcsname}% \expandafter\xdef\csname\the\macname @@@\endcsname{% @@ -8836,8 +8959,13 @@ might help (with 'rm \jobname.?? \jobname.??s')% \ifx\lastnode\empty\else \setref{\lastnode}{#1}% \global\let\lastnode=\empty + \setnodeseenonce \fi } +\def\setnodeseenonce{ + \global\nodeseentrue + \let\setnodeseenonce\relax +} % @nodedescription, @nodedescriptionblock - do nothing for TeX \parseargdef\nodedescription{} @@ -9575,7 +9703,9 @@ might help (with 'rm \jobname.?? \jobname.??s')% % For pdfTeX and LuaTeX <= 0.80 \dopdfimage{#1}{#2}{#3}% \else - \ifx\XeTeXrevision\thisisundefined + \ifxetex + \doxeteximage{#1}{#2}{#3}% + \else % For epsf.tex % \epsfbox itself resets \epsf?size at each figure. \setbox0 = \hbox{\ignorespaces #2}% @@ -9583,9 +9713,6 @@ might help (with 'rm \jobname.?? \jobname.??s')% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi \epsfbox{#1.eps}% - \else - % For XeTeX - \doxeteximage{#1}{#2}{#3}% \fi \fi % @@ -9931,25 +10058,24 @@ directory should work if nowhere else does.} \newif\iftxinativeunicodecapable \newif\iftxiusebytewiseio -\ifx\XeTeXrevision\thisisundefined - \ifx\luatexversion\thisisundefined - \txinativeunicodecapablefalse - \txiusebytewiseiotrue - \else +\ifxetex + \txinativeunicodecapabletrue + \txiusebytewiseiofalse +\else + \ifluatex \txinativeunicodecapabletrue \txiusebytewiseiofalse + \else + \txinativeunicodecapablefalse + \txiusebytewiseiotrue \fi -\else - \txinativeunicodecapabletrue - \txiusebytewiseiofalse \fi % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex % for non-UTF-8 (byte-wise) encodings. % \def\setbytewiseio{% - \ifx\XeTeXrevision\thisisundefined - \else + \ifxetex \XeTeXdefaultencoding "bytes" % For subsequent files to be read \XeTeXinputencoding "bytes" % For document root file % Unfortunately, there seems to be no corresponding XeTeX command for @@ -9958,8 +10084,7 @@ directory should work if nowhere else does.} % place of non-ASCII characters. \fi - \ifx\luatexversion\thisisundefined - \else + \ifluatex \directlua{ local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub local function convert_char (char) @@ -10068,8 +10193,7 @@ directory should work if nowhere else does.} \fi % lattwo \fi % ascii % - \ifx\XeTeXrevision\thisisundefined - \else + \ifxetex \ifx \declaredencoding \utfeight \else \ifx \declaredencoding \ascii @@ -10352,11 +10476,15 @@ directory should work if nowhere else does.} \gdef\UTFviiiDefined#1{% \ifx #1\relax - \message{\linenumber Unicode char \string #1 not defined for Texinfo}% + \ifutfviiidefinedwarning + \message{\linenumber Unicode char \string #1 not defined for Texinfo}% + \fi \else \expandafter #1% \fi } +\newif\ifutfviiidefinedwarning +\utfviiidefinedwarningtrue % Give non-ASCII bytes the active definitions for processing UTF-8 sequences \begingroup @@ -10366,8 +10494,8 @@ directory should work if nowhere else does.} % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp % substituting ~ and $ with a character token of that value. - \def\UTFviiiLoop{% - \global\catcode\countUTFx\active + \gdef\UTFviiiLoop{% + \catcode\countUTFx\active \uccode`\~\countUTFx \uccode`\$\countUTFx \uppercase\expandafter{\UTFviiiTmp}% @@ -10375,7 +10503,7 @@ directory should work if nowhere else does.} \ifnum\countUTFx < \countUTFy \expandafter\UTFviiiLoop \fi} - + % % For bytes other than the first in a UTF-8 sequence. Not expected to % be expanded except when writing to auxiliary files. \countUTFx = "80 @@ -10409,6 +10537,16 @@ directory should work if nowhere else does.} \else\expandafter\UTFviiiFourOctets\expandafter$\fi }}% \UTFviiiLoop + % + % for pdftex only, used to expand ASCII to UTF-16BE. + \gdef\asciitounicode{% + \countUTFx = "20 + \countUTFy = "80 + \def\UTFviiiTmp{% + \def~{\nullbyte $}}% + \UTFviiiLoop + } + {\catcode0=11 \gdef\nullbyte{^^00}}% \endgroup \def\globallet{\global\let} % save some \expandafter's below @@ -10433,8 +10571,8 @@ directory should work if nowhere else does.} \fi } -% These macros are used here to construct the name of a control -% sequence to be defined. +% These macros are used here to construct the names of macros +% that expand to the definitions for UTF-8 sequences. \def\UTFviiiTwoOctetsName#1#2{% \csname u8:#1\string #2\endcsname}% \def\UTFviiiThreeOctetsName#1#2#3{% @@ -10442,6 +10580,35 @@ directory should work if nowhere else does.} \def\UTFviiiFourOctetsName#1#2#3#4{% \csname u8:#1\string #2\string #3\string #4\endcsname}% +% generate UTF-16 from codepoint +\def\utfsixteentotoks#1#2{% + \countUTFz = "#2\relax + \ifnum \countUTFz > 65535 + % doesn't work for codepoints > U+FFFF + % we don't define glyphs for any of these anyway, so it doesn't matter + #1={U+#2}% + \else + \countUTFx = \countUTFz + \divide\countUTFx by 256 + \countUTFy = \countUTFx + \multiply\countUTFx by 256 + \advance\countUTFz by -\countUTFx + \uccode`,=\countUTFy + \uccode`;=\countUTFz + \ifnum\countUTFy = 0 + \uppercase{#1={\nullbyte\string;}}% + \else\ifnum\countUTFz = 0 + \uppercase{#1={\string,\nullbyte}}% + \else + \uppercase{#1={\string,\string;}}% + \fi\fi + % NB \uppercase cannot insert a null byte + \fi +} + +\newif\ifutfbytespdf +\utfbytespdffalse + % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX), % provide a definition macro to replace a Unicode character; % this gets used by the @U command @@ -10458,18 +10625,22 @@ directory should work if nowhere else does.} \countUTFz = "#1\relax \begingroup \parseXMLCharref - - % Give \u8:... its definition. The sequence of seven \expandafter's - % expands after the \gdef three times, e.g. % + % Completely expand \UTFviiiTmp, which looks like: % 1. \UTFviiTwoOctetsName B1 B2 % 2. \csname u8:B1 \string B2 \endcsname % 3. \u8: B1 B2 (a single control sequence token) + \xdef\UTFviiiTmp{\UTFviiiTmp}% % - \expandafter\expandafter - \expandafter\expandafter - \expandafter\expandafter - \expandafter\gdef \UTFviiiTmp{#2}% + \ifpdf + \toksA={#2}% + \utfsixteentotoks\toksB{#1}% + \expandafter\xdef\UTFviiiTmp{% + \noexpand\ifutfbytespdf\noexpand\utfbytes{\the\toksB}% + \noexpand\else\the\toksA\noexpand\fi}% + \else + \expandafter\gdef\UTFviiiTmp{#2}% + \fi % \expandafter\ifx\csname uni:#1\endcsname \relax \else \message{Internal error, already defined: #1}% @@ -10479,8 +10650,9 @@ directory should work if nowhere else does.} \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp \endgroup} % - % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp - % to the corresponding UTF-8 sequence. + % Given the value in \countUTFz as a Unicode code point, set + % \UTFviiiTmp to one of the \UTVviii*OctetsName macros followed by + % the corresponding UTF-8 sequence. \gdef\parseXMLCharref{% \ifnum\countUTFz < "20\relax \errhelp = \EMsimple @@ -10540,7 +10712,7 @@ directory should work if nowhere else does.} } % Suppress ligature creation from adjacent characters. -\ifx\luatexversion\thisisundefined +\ifluatex \def\nolig{{}} \else % Braces do not suppress ligature creation in LuaTeX, e.g. in of{}fice @@ -11325,6 +11497,25 @@ directory should work if nowhere else does.} % \global\mathchardef\checkmark="1370% actually the square root sign \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}% + % + % These are all the combining accents. We need these empty definitions + % at present for the sake of PDF outlines. + \DeclareUnicodeCharacter{0300}{}% + \DeclareUnicodeCharacter{0301}{}% + \DeclareUnicodeCharacter{0302}{}% + \DeclareUnicodeCharacter{0303}{}% + \DeclareUnicodeCharacter{0305}{}% + \DeclareUnicodeCharacter{0306}{}% + \DeclareUnicodeCharacter{0307}{}% + \DeclareUnicodeCharacter{0308}{}% + \DeclareUnicodeCharacter{030A}{}% + \DeclareUnicodeCharacter{030B}{}% + \DeclareUnicodeCharacter{030C}{}% + \DeclareUnicodeCharacter{0323}{}% + \DeclareUnicodeCharacter{0327}{}% + \DeclareUnicodeCharacter{0328}{}% + \DeclareUnicodeCharacter{0331}{}% + \DeclareUnicodeCharacter{0361}{}% }% end of \unicodechardefs % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command) @@ -11463,12 +11654,12 @@ directory should work if nowhere else does.} \pdfhorigin = 1 true in \pdfvorigin = 1 true in \else - \ifx\XeTeXrevision\thisisundefined - \special{papersize=#8,#7}% - \else + \ifxetex \pdfpageheight #7\relax \pdfpagewidth #8\relax % XeTeX does not have \pdfhorigin and \pdfvorigin. + \else + \special{papersize=#8,#7}% \fi \fi % @@ -11668,21 +11859,21 @@ directory should work if nowhere else does.} #1#2#3=\countB\relax } -\ifx\XeTeXrevision\thisisundefined - \ifx\luatexversion\thisisundefined +\ifxetex % XeTeX + \mtsetprotcode\textrm + \def\mtfontexpand#1{} +\else + \ifluatex % LuaTeX + \mtsetprotcode\textrm + \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax} + \else \ifpdf % pdfTeX \mtsetprotcode\textrm \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax} \else % TeX \def\mtfontexpand#1{} \fi - \else % LuaTeX - \mtsetprotcode\textrm - \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax} \fi -\else % XeTeX - \mtsetprotcode\textrm - \def\mtfontexpand#1{} \fi @@ -11691,18 +11882,18 @@ directory should work if nowhere else does.} \def\microtypeON{% \microtypetrue % - \ifx\XeTeXrevision\thisisundefined - \ifx\luatexversion\thisisundefined + \ifxetex % XeTeX + \XeTeXprotrudechars=2 + \else + \ifluatex % LuaTeX + \adjustspacing=2 + \protrudechars=2 + \else \ifpdf % pdfTeX \pdfadjustspacing=2 \pdfprotrudechars=2 \fi - \else % LuaTeX - \adjustspacing=2 - \protrudechars=2 \fi - \else % XeTeX - \XeTeXprotrudechars=2 \fi % \mtfontexpand\textrm @@ -11713,18 +11904,18 @@ directory should work if nowhere else does.} \def\microtypeOFF{% \microtypefalse % - \ifx\XeTeXrevision\thisisundefined - \ifx\luatexversion\thisisundefined + \ifxetex % XeTeX + \XeTeXprotrudechars=0 + \else + \ifluatex % LuaTeX + \adjustspacing=0 + \protrudechars=0 + \else \ifpdf % pdfTeX \pdfadjustspacing=0 \pdfprotrudechars=0 \fi - \else % LuaTeX - \adjustspacing=0 - \protrudechars=0 \fi - \else % XeTeX - \XeTeXprotrudechars=0 \fi } |