diff options
author | Norbert Preining <norbert@preining.info> | 2024-09-06 03:04:03 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-09-06 03:04:03 +0000 |
commit | 93a4705821c87595a1bb65a069b343dfe260a5c5 (patch) | |
tree | 7c4fb0b2cc924cfd1a18d248c53ff9fc9732c2ec /macros/latex/contrib | |
parent | c1db708dd774e840db02d9bd7aff2d637c469d93 (diff) |
CTAN sync 202409060304
Diffstat (limited to 'macros/latex/contrib')
39 files changed, 5048 insertions, 970 deletions
diff --git a/macros/latex/contrib/animate/ChangeLog b/macros/latex/contrib/animate/ChangeLog index 237adc19ac..1bb81e5e34 100644 --- a/macros/latex/contrib/animate/ChangeLog +++ b/macros/latex/contrib/animate/ChangeLog @@ -1,3 +1,6 @@ +2024-09-05 + * new: animation support in PDF.js, version 4.4.168+ + 2023-06-18 * fix: missing file `pstmetronome.tex' added diff --git a/macros/latex/contrib/animate/README.md b/macros/latex/contrib/animate/README.md index 1756bd8cd5..8306ef995b 100644 --- a/macros/latex/contrib/animate/README.md +++ b/macros/latex/contrib/animate/README.md @@ -10,11 +10,13 @@ This package provides an interface to create portable, JavaScript driven PDF and It supports the usual PDF making workflows, i. e. pdfLaTeX, LaTeX ⇒ `dvips` ⇒ `ps2pdf` (Ghostscript)/Distiller, (Xe)LaTeX ⇒ `(x)dvipdfmx`, LuaLaTeX, and LaTeX ⇒ `dvisvgm` for SVG. -The resulting PDF with animations can be viewed in Acrobat Reader (except on mobile devices), KDE Okular, PDF-XChange and Foxit Reader. Animated SVG are self-contained files that can be embedded into HTML using the `<object>` tag or opened directly in a Web browser, such as Firefox or Chromium. +The resulting PDF with animations can be viewed in Acrobat Reader (except on mobile devices), KDE Okular, PDF-XChange, Foxit Reader, PDF.js (PDF viewer in Firefox). For compatibility with PDF.js, animations must be built with option `method=widget`. + +Animated SVG are self-contained files that can be embedded into HTML using the `<object>` tag or opened directly in a Web browser, such as Firefox or Chromium. Note, this file only gives a summary of usage and available package and command options. Please refer to the documentation [`animate.pdf`](animate.pdf) for details and examples. -*Keywords:* include portable PDF animation SVG animation animated PDF animated SVG dvisvgm html TeX4ht web animating embed animated graphics LaTeX pdfLaTeX LuaLaTeX PSTricks pgf TikZ LaTeX-picture MetaPost inline graphics vector graphics animated GIF LaTeX dvips ps2pdf dvipdfmx XeLaTeX JavaScript Acrobat Reader KDE Okular PDF-XChange Foxit Reader Firefox Chrome Chromium +*Keywords:* include portable PDF animation SVG animation animated PDF animated SVG dvisvgm html TeX4ht web animating embed animated graphics LaTeX pdfLaTeX LuaLaTeX PSTricks pgf TikZ LaTeX-picture MetaPost inline graphics vector graphics animated GIF LaTeX dvips ps2pdf dvipdfmx XeLaTeX JavaScript Acrobat Reader KDE Okular PDF-XChange Foxit Reader PDF.js Firefox Chrome Chromium ## Usage diff --git a/macros/latex/contrib/animate/animate.pdf b/macros/latex/contrib/animate/animate.pdf Binary files differindex 518115d6af..8756c2d8ec 100644 --- a/macros/latex/contrib/animate/animate.pdf +++ b/macros/latex/contrib/animate/animate.pdf diff --git a/macros/latex/contrib/animate/animate.sty b/macros/latex/contrib/animate/animate.sty index fc126ce70a..b600a26cc7 100644 --- a/macros/latex/contrib/animate/animate.sty +++ b/macros/latex/contrib/animate/animate.sty @@ -13,7 +13,7 @@ \NeedsTeXFormat{LaTeX2e}[2022-06-01] -\def\@anim@version{2023/06/18} +\def\@anim@version{2024/09/05} \ProvidesPackage{animate} [\@anim@version\space PDF & SVG animations from files and inline graphics] @@ -530,6 +530,7 @@ /Subtype/Widget% /F 2% /FT/Btn/Ff 65537% + /A <</S/ResetForm>>% to make pdf.js happy /BS <</W 0>>% /AP <</N \@anim@framexform>>% /MK <</TP 1/I \@anim@framexform% @@ -562,6 +563,7 @@ /Subtype/Widget% \@anim@annotflag% /FT/Btn/Ff 65537% + /A <</S/ResetForm>>% /BS <</W 0>>% /AP <</N \@anim@framexform>>% /MK <</TP 1/I \@anim@framexform% @@ -2072,6 +2074,8 @@ \@anim@tooltip% \if@anim@js% /AA <</D <</S/JavaScript/JS (\@anim@btnJS{#1}{\@anim@arg})>>>>% + \else% + /A <</S/ResetForm>>% \fi% }% \if@anim@js% diff --git a/macros/latex/contrib/animate/animate.tex b/macros/latex/contrib/animate/animate.tex index cc952856e7..6fbf156167 100644 --- a/macros/latex/contrib/animate/animate.tex +++ b/macros/latex/contrib/animate/animate.tex @@ -18,7 +18,7 @@ %%%%%% /pdfmanagement-testphase %%%%%% \documentclass[a4paper]{article} \frenchspacing -\usepackage[buttonbg=0.9]{animate} +\usepackage[buttonbg=0.9,method=widget]{animate} \usepackage[UKenglish]{babel} \usepackage{pst-3dplot} \usepackage{pst-node,pst-plot,pst-tools,pst-text,pst-ode} @@ -62,7 +62,7 @@ {\itshape\normalsize}} \makeatother -\def\keywords{include portable PDF animation SVG animation animated PDF animated SVG dvisvgm html TeX4ht web animating embed animated graphics LaTeX pdfLaTeX LuaLaTeX PSTricks pgf TikZ LaTeX-picture MetaPost inline graphics vector graphics animated GIF LaTeX dvips ps2pdf dvipdfmx XeLaTeX JavaScript Acrobat Reader KDE Okular PDF-XChange Foxit Reader Firefox Chrome Chromium} +\def\keywords{include portable PDF animation SVG animation animated PDF animated SVG dvisvgm html TeX4ht Web animating embed animated graphics LaTeX pdfLaTeX LuaLaTeX PSTricks pgf TikZ LaTeX-picture MetaPost inline graphics vector graphics animated GIF LaTeX dvips ps2pdf dvipdfmx XeLaTeX JavaScript Acrobat Reader KDE Okular PDF-XChange Foxit Reader PDF.js Firefox Chrome Chromium} \hypersetup{ pdftitle={The animate Package}, pdfsubject={Documentation}, @@ -94,7 +94,7 @@ \def\@anim@sanitizeColon{}\def\@anim@sanitizeJS{}\def\@anim@endsanitize{} \expandafter\parsedate\animVersion\relax %set current date to package date \makeatother -\author{Alexander Grahn \animategraphics[autoplay,loop,height=1.8ex,nomouse]{8}{bye_}{0}{3}\protect\footnote{Animated GIF taken from \href{http://www.phpBB.com}{phpBB} forum software and burst into a set of EPS files using \href{http://www.imagemagick.org}{ImageMagick} before embedding.}% +\author{Alexander Grahn \animategraphics[autoplay,loop,height=1.8ex,nomouse]{8}{bye_}{0}{3}\protect\footnote{Animated GIF taken from \href{http://www.phpBB.com}{phpBB} forum software and burst into a set of EPS files using \href{http://www.imagemagick.org}{ImageMagick} before embedding.} \protect\footnote{Animation examples in this document have all been built with the `\texttt{method=widget}' option to make them work in PDF.js, Mozilla's PDF viewer built into the Firefox Web browser.}% %\space\protect\footnote{Animations may run slowly if viewed in the Acrobat Reader browser plugin.}% \\[1ex]\url{https://gitlab.com/agrahn/animate}} \maketitle @@ -116,7 +116,11 @@ This package provides an interface for creating PDF and SVG files with animated Package `animate' supports the usual workflows for making PDF, i.\,e. pdf\LaTeX{}, Lua\-\LaTeX{}, \LaTeX{} $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+/Distiller and \pXepLaTeX{} $\rightarrow$ \verb+(x)dvipdfmx+. For animated SVG, it supports the \verb+dvisvgm+ driver. The DVI/XDV used as input for \verb+dvisvgm+ can be generated with \LaTeX{}, Lua\LaTeX{} (in DVI mode with command `\verb+dvilualatex+') and \XeLaTeX{} (with option `\verb+--no-pdf+'). -PDF files with animations can be viewed in Acrobat Reader (except on mobile devices), KDE Okular, PDF-XChange and Foxit Reader. +PDF files with animations can be viewed in Acrobat Reader (except on mobile devices), KDE Okular, PDF-XChange, Foxit Reader, PDF.js (as Firefox built-in PDF viewer, or in other Web browsers via URL). The most recent release of PDF.js can be accessed online in a Web browser (Firefox, Chromium, Chrome, Edge, ...) via the following URL: + +\url{https://mozilla.github.io/pdf.js/web/viewer.html?file=} + +Then, to open a local PDF file in PDF.js, click \raisebox{0.5\depth}{{\fboxsep=3pt\colorbox{lightgray}{\texttt{\large>>}}}} at the right end of its tool bar. In the `Tools' menu, click on `Open'. Animated SVG produced by means of \LaTeX{} and \verb+dvisvgm+ are self-sufficient files that can be embedded into HTML using the \verb+<object>+ tag or opened directly in a Web browser, such as Chromium or Firefox. Also, presentations, such as `beamer'-class documents, with embedded animations can be exported to SVG instead of PDF and viewed in a Web browser. SVG-capable Web browsers are standard on many platforms and operating systems and thus make SVG a very portable file format. A \LaTeX{} package for embedding video and audio into SVG is also available\cite{media4svg}. @@ -133,7 +137,7 @@ The user interacts with the animation through optional animation controls or usi \item \verb+dvipdfmx+ for DVI to PDF conversion \item dvipdfmx, version $\ge 20190503$, for DVI to PDF conversion \item \verb+dvisvgm+ for DVI to SVG conversion (also requires Ghostscript) -\item PDF: Acrobat Reader, KDE Okular, PDF-XChange, Foxit Reader +\item PDF: Acrobat Reader, KDE Okular, PDF-XChange, Foxit Reader, Firefox, version $\ge130$, PDF.js, version $\ge4.4.168$ \item SVG: Chromium-based browsers for best performance \end{trivlist} @@ -391,8 +395,8 @@ nomouse Animation widget will not respond to mouse clicks. Unless the JavaScript interface, Sect.~\ref{sect:api}, p.~\pageref{sect:api}, is used to control the animation, it is recommended to also set at least one of the `\verb+autoplay+' or `\verb+controls+' options. \begin{verbatim} method=icon | widget | ocg -\end{verbatim} -The package implements three different animation methods. The `\verb+icon+' method is the default method and usually gives the best performance in terms of animation frame rate. `\verb+widget+' and `\verb+ocg+' are alternative animation methods. In rare cases (standalone animations without animation controls) method `\verb+ocg+' may lead to a better animation performance than the other two. Moreover, it allows overlaying animations with other typeset material, that is, playing animations in the page background. +\end{verbatim}\hypertarget{method}{}% +The package implements three different animation methods. The `\verb+icon+' method is the default method and usually gives the best performance in terms of animation frame rate. `\verb+widget+' and `\verb+ocg+' are alternative animation methods. Animations using the `\verb+widget+` method are supported in versions 4.4.168 and above of PDF.js, Mozilla's PDF viewer that ships as a built-in component of Firefox, but which can also be used with other Web browsers, such as Chrome or Chromium. The `\verb+ocg+' method may lead to a better animation performance than the other two in rare cases, such as standalone animations without animation controls. Moreover, `\verb+ocg+' allows an animation to be overlaid with other typeset material, that is, it can play in the page background. \begin{verbatim} measure \end{verbatim} diff --git a/macros/latex/contrib/animate/files/pstmetronome.tex b/macros/latex/contrib/animate/files/pstmetronome.tex deleted file mode 100644 index e13bd4a0da..0000000000 --- a/macros/latex/contrib/animate/files/pstmetronome.tex +++ /dev/null @@ -1,233 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% animated metronome -% this code is based to 99.9 percent on the work by Manuel Luque -% (pstricks.blogspot.com) -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\makeatletter -\pst@addfams{pst-metronome} -\define@key[psset]{pst-metronome}{theta0}{\def\psk@oscmetronomethetai{#1 }} -\psset[pst-metronome]{theta0=45} % position initiale du metronome -\define@key[psset]{pst-metronome}{M}{\def\psk@oscmetronometM{#1 }} -\psset[pst-metronome]{M=25} % masse du disque en g -\define@key[psset]{pst-metronome}{m}{\def\psk@oscmetronometm{#1 }} -\psset[pst-metronome]{m=6} % masse du curseur en g -\define@key[psset]{pst-metronome}{r}{\def\psk@oscmetronomer{#1 }} -\psset[pst-metronome]{r=1} % rayon du disque en cm -\define@key[psset]{pst-metronome}{x}{\def\psk@oscmetronomex{#1 }} -\psset[pst-metronome]{x=8.4} % position du curseur en cm par rapport à l'axe -\define@key[psset]{pst-metronome}{d}{\def\psk@oscmetronomed{#1 }} -\psset[pst-metronome]{d=3.2} % distance de l'axe au centre du disque en cm -\define@key[psset]{pst-metronome}{dt}{\def\psk@oscmetronomedt{#1 }} -\psset[pst-metronome]{dt=0.01} % pas pour RK4 -\define@key[psset]{pst-metronome}{nT}{\def\psk@oscmetronomenT{#1 }} -\psset[pst-metronome]{nT=1} % nombre de périodes représentées -%---- calculer theta(t) et thetapoint(t) -------- -\def\psmetronome{\pst@object{psmetronome}} -\def\psmetronome@i{% -\begingroup% -\use@par% - \begin@SpecialObj% - \pstVerb{% - /deg2rad {180 div 3.14159 mul} def - /rad2deg {180 mul 3.14159 div} def - /gp 9.8 def % pesanteur - /radius \psk@oscmetronomer 1e-2 mul def % en m - /OA \psk@oscmetronomed 1e-2 mul def % distance de l'axe au centre du disque en m - /xC \psk@oscmetronomex 1e-2 mul def % position du curseur en m par rapport à l'axe - /theta0 \psk@oscmetronomethetai def % en degrés - /theta0rad theta0 deg2rad def % en radians - /Md \psk@oscmetronometM 1e-3 mul def % en kg - /mc \psk@oscmetronometm 1e-3 mul def % en kg - /dt \psk@oscmetronomedt def - /nT \psk@oscmetronomenT def - % moment d'inertie du métronome - % J=1/2M*R^2+M*a^2+m*x^2 - /Ji {0.5 Md mul radius dup mul mul Md OA dup mul mul add mc xC dup mul mul add} def - /AT {4 - Ji - gp Md OA mul mc xC mul sub mul - div - sqrt - mul} def - % Pour le calcul de la période - % coefficients de l'approximation polynômiale du calcul - % de l'intégrale elliptique -% coefficient pour le calcul de l'intégrale elliptique - /m0 theta0 2 div sin def - /m1 {1 m0 dup mul sub} def - /m2 {m1 dup mul} def - /m3 {m2 m1 mul} def - /m4 {m2 dup mul} def - /m_1 {1 m1 div} def - /EllipticK { - 0.5 - 0.12498593597 m1 mul add - 0.06880248576 m2 mul add - 0.03328355376 m3 mul add - 0.00441787012 m4 mul add - m_1 ln mul - 1.38629436112 add - 0.09666344259 m1 mul add - 0.03590092383 m2 mul add - 0.03742563713 m3 mul add - 0.01451196212 m4 mul add - } def -/Tm {AT EllipticK mul} def -% tableau des valeurs de theta(t) - /W 0 def % vitesse angulaire - /theta theta0 def - /oscillateur {sin gp Md OA mul mc xC mul sub mul neg mul Ji div} def - /j1 {W dt mul} def - /k1 {theta oscillateur dt mul} def - /j2 {W k1 2 div add dt mul} def - /k2 {theta j1 2 div rad2deg add oscillateur dt mul} def - /j3 {W k2 2 div add dt mul} def - /k3 {theta j2 2 div rad2deg add oscillateur dt mul} def - /j4 {W k3 add dt mul} def - /k4 {theta j3 rad2deg add oscillateur dt mul} def - /theta2 {theta j1 rad2deg 2 j2 rad2deg j3 rad2deg add mul add j4 rad2deg add 6 div add} def -/tabTheta [ % pour l'animation - 0 theta0 % date angle -dt dt Tm nT mul{ % - theta2 % - /W2 W k1 2 k2 k3 add mul add k4 add 6 div add def - /theta theta2 def - /W W2 def - } for - ] def -/Nvaleurs tabTheta length 2 div cvi def - /W 0 def % vitesse angulaire - /theta theta0 def -/tabThetaGraph [ % pour le graphique theta(t) - 0 theta0 % date angle -0 dt Tm nT mul { % pop - theta2 % 180 div 3.14159 mul - /W2 W k1 2 k2 k3 add mul add k4 add 6 div add def - /theta theta2 def - /W W2 def - } for - ] def - /W 0 def % vitesse angulaire - /theta theta0 def -/tabThetaPoint [ % pour le graphique thetapoint(t) - 0 0 % date angle -dt dt Tm nT mul { % pop -% theta2 % 180 div 3.14159 mul - /W2 W k1 2 k2 k3 add mul add k4 add 6 div add def - W2 - /theta theta2 def - /W W2 def - } for - ] def -/tabXOSC [ % oscillations par min en fonction de x -0.5 0.1 12 {/xc exch def - /xC xc 1e-2 mul def - xc 60 Tm div % cvi - } for - ] def -/tabXbattements [ % battements par min en fonction de x -3 0.1 12 {/xc exch def - /xC xc 1e-2 mul def - xc 60 Tm div 2 mul % cvi - } for - ] def -% graduation T --> x -/tabXT [ % [T,x] - 40 1 220 {/batt exch def % battements - /Tmetronome2 120 batt div dup mul def - /A1 16 mc mul EllipticK dup mul mul def - /B1 gp Tmetronome2 mul mc mul def - /C1 gp Md mul OA mul Tmetronome2 mul neg - 8 Md mul radius dup mul mul 16 Md mul OA dup mul mul add EllipticK dup mul mul add def - /Delta B1 dup mul 4 A1 mul C1 mul sub sqrt def - /xC1 B1 neg Delta sub 2 div A1 div def - /xC2 B1 neg Delta add 2 div A1 div def - xC2 0 ge {/posC xC2 def}{/posC xC1 def} ifelse - batt posC 1e2 mul - } for - ] def -/xT { % pour une valeur particulière battement -> position du curseur - /batt exch def - /Tmetronome2 120 batt div dup mul def - /A1 16 mc mul EllipticK dup mul mul def - /B1 gp Tmetronome2 mul mc mul def - /C1 gp Md mul OA mul Tmetronome2 mul neg - 8 Md mul radius dup mul mul 16 Md mul OA dup mul mul add EllipticK dup mul mul add def - /Delta B1 dup mul 4 A1 mul C1 mul sub sqrt def - /xC1 B1 neg Delta sub 2 div A1 div def - /xC2 B1 neg Delta add 2 div A1 div def - xC2 0 ge {/posC xC2 def}{/posC xC1 def} ifelse - posC 1e2 mul - } def -/xC \psk@oscmetronomex 1e-2 mul def % position du curseur en m par rapport à l'axe -/Tm {AT EllipticK mul} def - }% - \end@SpecialObj% -\endgroup} -% -\def\psmetronomeA{\pst@object{psmetronomeA}} -\def\psmetronomeA@i{% -\begingroup% -\use@par% - \begin@SpecialObj% - \pstVerb{% - /radius \psk@oscmetronomer 1e-2 mul def % en m - /OA \psk@oscmetronomed 1e-2 mul def % distance de l'axe au centre du disque en m - /xC \psk@oscmetronomex 1e-2 mul def % position du curseur en m par rapport à l'axe - }% -\psframe[fillstyle=solid](! -0.075 \psk@oscmetronomed neg)(0.075,13) -\pscircle[fillstyle=solid,fillcolor={[rgb]{0.75 0.75 0.75}}](! 0 \psk@oscmetronomed neg){!radius 1e2 mul} -\pscircle[fillstyle=solid,linewidth=0.05](0,0){0.15} -\pscircle*[linecolor=red](0,0){0.05} -% curseur -\pspolygon[fillstyle=solid](! -0.25 \psk@oscmetronomex 0.5 sub)(! -0.5 \psk@oscmetronomex 0.5 add)(!-0.075 \psk@oscmetronomex 0.5 add)(!-0.075 \psk@oscmetronomex 0.5 sub) -\pspolygon[fillstyle=solid](! 0.25 \psk@oscmetronomex 0.5 sub)(! 0.5 \psk@oscmetronomex 0.5 add)(!0.075 \psk@oscmetronomex 0.5 add)(!0.075 \psk@oscmetronomex 0.5 sub) -\pspolygon[fillstyle=solid,fillcolor=gray](! -0.25 \psk@oscmetronomex 0.5 sub)(! -0.3 \psk@oscmetronomex 0.3 sub)(! -0.075 \psk@oscmetronomex 0.3 sub)(!-0.075 \psk@oscmetronomex 0.3 add)(!0.075 \psk@oscmetronomex 0.3 add)(!0.075 \psk@oscmetronomex 0.3 sub)(!0.3 \psk@oscmetronomex 0.3 sub)(!0.25 \psk@oscmetronomex 0.5 sub) -\pscircle[fillstyle=solid](!-0.125 \psk@oscmetronomex 0.4 sub){0.08} -\pscircle[fillstyle=solid](!0.125 \psk@oscmetronomex 0.4 sub){0.08} -% fin curseur -{\psset{linecolor=red} -\psline(!-.1 \psk@oscmetronomex)(!0.1 \psk@oscmetronomex)\psline(!0 \psk@oscmetronomex 0.1 sub)(!0 \psk@oscmetronomex 0.1 add) -\psline(! -.1 \psk@oscmetronomed neg)(!0.1 \psk@oscmetronomed neg)\psline(! 0 \psk@oscmetronomed neg 0.1 sub)(!0 \psk@oscmetronomed neg 0.1 add)} -\pnode(!0 \psk@oscmetronomex){C}% curseur -\pnode(! 0 \psk@oscmetronomed neg){D}% disque -%\pstextpath[c](0,-2ex){\psarcn[linestyle=none](D){1}{180}{0}}{\small\textsf{\textbf{m e t r o n o m e}}} -%\pstextpath[c](0,1ex){\psarc[linestyle=none](D){1}{180}{0}}{\small\textsf{\textbf{P S t r i c k s}}} - \end@SpecialObj% -\endgroup} -\psmetronome% -\pstVerb{/tabTempos [40 42 44 46 48 50 52 54 46 58 60 63 66 69 72 76 80 84 88 92 96 100 104 108 112 116 120 126 132 138 144 152 160 168 176 184 192 200 208] def}% - -\def\metronomebody{% - \pspolygon[fillstyle=solid,linewidth=2\pslinewidth,linearc=0.5,fillcolor=yellow!30](-5,-4.5)(5,-4.5)(1,14)(-1,14) - \psline(1.2,4.5)(1.2,12.5) - \psline(-1.2,4.5)(-1.2,12.5) - \multido{\i=0+2}{20}{% - \pstVerb{/BATT tabTempos \i\space get def} - \psline[linecolor=red](!1.2 BATT xT)(!0.7 BATT xT) - \uput[r](!0.7 BATT xT){\psPrintValue[PSfont=Helvetica,fontscale=6]{BATT}} - }% - \multido{\i=1+2}{19}{% - \pstVerb{/BATT tabTempos \i\space get def} - \psline[linecolor=red](!-1.2 BATT xT)(!-0.7 BATT xT) - \uput[r](!-1.3 BATT xT){\psPrintValue[PSfont=Helvetica,fontscale=6]{BATT}}}% - \rput(!0 40 xT){\textsf{\tiny GRAVE}}% - \rput(!0 46 xT){\textsf{\tiny LARGO}}% - \rput(!0 52 xT){\textsf{\tiny LENTO}}% - \rput(!0 58 xT){\textsf{\tiny ADAGIO}}% - \rput(!0 60 xT){\textsf{\tiny LARGETTO}}% - \rput(!0 66 xT){\textsf{\tiny ANDANTE}}% - \rput(!0 76 xT){\textsf{\tiny ANDANTINO}}% - \rput(!0 84 xT){\textsf{\tiny MODERATO}}% - \rput(!0 108 xT){\textsf{\tiny ALLEGRETTO}}% - \rput(!0 132 xT){\textsf{\tiny ALLEGRO}}% - \rput(!0 160 xT){\textsf{\tiny VIVACE}}% - \rput(!0 184 xT){\textsf{\tiny PRESTO}}% - \rput(!0 200 xT){\textsf{\tiny PRESTISSIMO}}% -} - -\def\pendulum#1{% - \pstVerb{/iA #1\space def /date tabTheta iA get def /Theta tabTheta iA 1 add get def}% - \rput{!Theta}{\psmetronomeA}% -} -\makeatother diff --git a/macros/latex/contrib/framedsyntax/FramedSyntax.dtx b/macros/latex/contrib/framedsyntax/FramedSyntax.dtx new file mode 100644 index 0000000000..7a7fba17b3 --- /dev/null +++ b/macros/latex/contrib/framedsyntax/FramedSyntax.dtx @@ -0,0 +1,930 @@ +% \iffalse +% !TEX encoding = UTF-8 Unicode +%<*internal> +\begingroup +\input docstrip.tex +\keepsilent +\preamble + + Copyright (C) 2024 Claudio Beccari all rights reserved. + + Distributable under the LaTeX Project Public License, + version 1.3c or higher (your choice). The latest version of + this license is at: http://www.latex-project.org/lppl.txt + +\endpreamble +\postamble +This Work has the status of `maintained' + +The Current Maintainer is Claudio Beccari + +This work consists of this file FramedSyntax.dtx, +and the derived files FramedSyntax.sty and FramedSyntax.pdf. +\endpostamble + +\askforoverwritefalse + +\generate{\file{FramedSyntax.sty}{\from{FramedSyntax.dtx}{package}}} + +\def\tmpa{plain} +\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi +\endgroup +%</internal> +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{FramedSyntax.dtx}% +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e}[2019/01/01] +%<package>\ProvidesPackage{FramedSyntax}% + [2024-09-04 v.0.2.8 Typeset command syntax within a special frame] +%<*driver> +\documentclass{ltxdoc}\errorcontextlines=100 +\hfuzz 10pt +\usepackage[utf8]{inputenc}% not really necessary +\usepackage{lmodern}% scalable fonts +\usepackage{mflogo} +\usepackage{multicol, amsmath, fancyvrb, graphicx, verbatim} +\usepackage{etoolbox, enumitem, xspace, xcolor, FramedSyntax +} +% +\providecommand*\diff{\mathop{}\!\mathrm{d}} +\providecommand\file{} +\renewcommand*\file[1]{{\normalfont\texttt{#1}}} +\providecommand\prog{} +\renewcommand*\prog[1]{{\normalfont\texttt{#1}}} +\providecommand\conta{} +\renewcommand*\conta[1]{\texttt{\slshape#1}} +\providecommand\cs{} +\renewcommand\cs[1]{{\normalfont\texttt{\char92#1}}} +\renewcommand\meta[1]{{\normalfont\textlangle\textit{#1}\textrangle}} +\renewcommand\marg[1]{\texttt{\{\meta{#1}\}}} +\providecommand\Marg{} +\renewcommand*\Marg[1]{\texttt{\{#1\}}} +\providecommand\oarg{} +\renewcommand*\oarg[1]{\texttt{[\meta{#1}]}} +\providecommand\Oarg{} +\renewcommand*\Oarg[1]{\texttt{[#1]}} +\providecommand\aarg{} +\renewcommand*\aarg[1]{\texttt{<\meta{#1}>}} +\providecommand\Aarg{} +\renewcommand*\Aarg[1]{\texttt{<#1>}} +\providecommand\parg{} +\renewcommand*\parg[1]{\texttt{(\meta{#1})}} +\providecommand\Parg{} +\renewcommand*\Parg[1]{\texttt{(#1)}} +\providecommand\pack{} +\renewcommand*\pack[1]{{\textsf{#1}}} +\let\class\pack +\providecommand\opt{} +\renewcommand*\opt[1]{{\normalfont\textsl{#1}}}\let\opz\opt +\providecommand\env{} +\renewcommand*\env[1]{{\normalfont\textit{\bfseries#1}}}\let\amb\env + +\providecommand\TB{\mbox{\normalfont\slshape TUGboat}\xspace} + +\definecolor{verdeguit}{rgb}{0, 0.40, 0} +\def\GuIT{\mbox{\color{verdeguit}\def\I{\textcolor{black}{I}}% + \fontfamily{lmr}\fontseries{m}\fontshape{sc}\selectfont +g\raisebox{-0.715ex}{\kern-0.26em u}\kern-0.13em\I\kern-0.14em t}\xspace} +\RequirePackage{etoolbox} + +\makeatletter + +\AfterEndPreamble{% +\DeclareRobustCommand{\TeX}{T\kern-.1667em + \lower.5ex\hbox{E}\kern-.125emX\@\xspace}% \TeX +\DeclareRobustCommand{\LaTeX}{L\kern-.36em% + {\sbox\z@ T% + \vbox to\ht\z@{\hbox{\check@mathfonts + \fontsize\sf@size\z@ + \math@fontsfalse\selectfont + A}% + \vss}% + }% + \kern-.15em\TeX + }% +\DeclareRobustCommand{\LaTeXe}{L\kern-.36em% + {\sbox\z@ T% + \vbox to\ht\z@{\hbox{\check@mathfonts + \fontsize\sf@size\z@ + \math@fontsfalse\selectfont + A}% + \vss}% + }% + \kern-.15em\TeX\kern-0.3em$_{\textstyle\mathrm{2e}}$ + }% +} +\makeatother + +\DeclareRobustCommand*\TeXLive{\TeX\ Live\xspace} +\DeclareRobustCommand*\MikTeX{Mik\TeX} +\DeclareRobustCommand*\MacTeX{Mac\TeX} +\DeclareRobustCommand*\pdfLaTeX{pdf\/\LaTeX} +\DeclareRobustCommand*\LuaLaTeX{Lua\LaTeX} +\DeclareRobustCommand*\XeLaTeX{X\ifdim\fontdimen1\font=0pt + \kern-0.15em\fi\lower.5ex\hbox{\rotatebox[origin=c]{180}{E}}% + \ifdim\fontdimen1\font=0pt\kern-0.15em\else\kern-0.275em\fi + \LaTeX} +\DeclareRobustCommand*\TikZ{Ti\emph{k}Z\xspace} + +%\unless\ifcsname Gr@phGrid\endcsname +%\let\originalGraphGrid\GraphGrid +%\RenewDocumentCommand\GraphGrid{r() d()}{% +%\IfValueTF{#1}{\put(#1){\originalGraphGrid(#2)}}% +% {\put(0,0){\originalGraphGrid(#2)}}}\fi + +\begin{document}\errorcontextlines=100 +\GetFileInfo{FramedSyntax.dtx} +\title{The \textsf{FramedSyntax} package} +\author{Claudio Beccari\\[1ex]\texttt{claudio.beccari(at)gmail.com}} +\date{Version \fileversion~--~Last revised \filedate.} +\maketitle +\columnseprule=0.4pt +\begin{multicols}{2} + \tableofcontents + \end{multicols} + \DocInput{FramedSyntax.dtx} +\end{document} +%</driver> +% \fi +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section*{Preface} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The \pack{FramedSyntax} package contains the necessary code to +% implement a framed block of text that is emphasised compared to +% the normal text. I found this technique very handy for writing +% the documented \TeX files that describe the new packages that +% I create, and the user manuals of those packages. As a member +% of the Italian Tug I also wrote a number of thematic guides for +% the Italian users; they seem to appreciate that the syntax of +% \LaTeX, classes and packages are written with these framed +% emphasised blocks, clearly emerging form the surrounding text. +% +% This is why I would like to share my package with the other +% \TeX users. May be they would like to use the same approach. +% I perfectly know that there are other packages and classes to +% write down documented \TeX files, such as those that +% traditionally have a \file{.dtx} file extension. Some of them +% are really powerful; I wonder why I keep using the +% \pack{docstrip.tex} file and the \class{ltxdoc} class to write +% down my documented \TeX files. The first simplest answer is +% “Because I am used to it”. The second is “Because I don't like +% to use too powerful packages, such as, for example, +% \pack{tikz}”; this package is a beautiful one, extremely +% powerful, but it is memory consuming, and computer blocking +% due to exhausted \TeX working memory occurred to me more often +% than I could stand. +% +% Dear User: if you do not like the name \pack{FramedSyntax} +% downloaded with a full and updated TeX System installation, +% copy this file to your local \texttt{texmf} directory, and +% change the file name to another name that fits your +% preferences. Never change the names of the \TeX System files +% even if you have the administrator privileges. In any case, +% since this work was inspired by a style file of mine written +% in Italian, this package already contains an alias +% \amb{Sintassi} environment with the Italian name. +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\section{What the \pack{FramedSyntax.sty} package can do} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The user can use this package and can specify the package +% options; these include the colours +% of the frame, the text, the background; the frame thickness and +% colour; the frame-text gap; the text font family, series, +% shape, and size. These settings can be global or local, +% therefore you can select some of these settings for specific +% syntax instances. +% +% Most often than not, you'll be using the default text fonts for +% the whole document. Please do not use the old Computer Modern +% fonts; they are not scalable, but may be chosen at a discrete +% set of sizes. The Latin Modern ones are stepwise continuously +% scalable, thanks to the scalable optical sizes they are built +% with. Other fonts, such as the Times, the Palatino, the +% Libertinus ones, and many others are continuously scalable +% over wide ranges. +% +% While describing and commenting the code, you will read more +% detailed comments on such font issues. +% +% In general the syntax frame fills up the whole \cs{textwidth}; +% in reality it should fill up the current \cs{linewidth}; +% within a list this frame will be shorter and indented as the +% list text. +% +% This framed syntax box will not split across a page break; +% matter of facts, the next section example height is too large +% to fit in the page, and a large white vertical space filled +% this page, in order to have the framed box completely in within +% the next section. If you need long framed texts, you should +% preferably use the \pack{tcolorbox} package (which relies on +% the extremely powerful \pack{tikz} one) and performs much +% better than my simple package, in particular it can split its +% boxes across page breaks. +% +% Warning: This small package does similar things as the +% \pack{wrapfig2} package, but such packages are not supposed +% to interfere with each other. +% +% \begin{FramedSyntax} +% \texttt{\% !TEX TS-program = } \meta{LaTeX based compiler} +% \texttt{\% !TEX encoding = UTF-8 Unicode} +% ~ +% \cs{documentclass}\oarg{options}\marg{class} +% \dots\ \meta{Packages} +% \cs{usepackage}\oarg{key=value options}\Marg{FramedSyntax} +% \dots\ \meta{Other packages} +% ~ +% \cs{begin}\Marg{document} +% \dots\ \meta{A part of document body} +% \cs{begin}\Marg{FramedSyntax} +% \dots\ \meta{Some syntax lines} +% \cs{end}\Marg{FramedSyntax} +% \dots\ \meta{Further document body} +% ~ +% \cs{end}\Marg{document} +% \end{FramedSyntax} +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\section{Usage example} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% The above framed syntax box contains a sample for using +% this package.\footnote{You may notice that the framed box width +% is a little shorter than the \cs{linewidth}, exactly 10\,pt +% shorter. This happens with this particular documentation class +% \class{ltxdoc}: I was not able to find the cause, but +% several tests with other classes proved to perform as +% expected.} +% +% In order to use this package a user should use this syntax. +% The above elementary example was done with the following +% source code. +%\begin{Verbatim}[gobble=1] +% \begin{FramedSyntax} +% \texttt{\% !TEX TS-program = } \meta{LaTeX based compiler} +% \texttt{\% !TEX encoding = UTF-8 Unicode} +% ~ +% \cs{documentclass}\oarg{options}\marg{class} +% \dots\ \meta{Packages} +% \cs{usepackage}\oarg{key=value options}\Marg{FramedSyntax} +% \dots\ \meta{Other packages} +% ~ +% \cs{begin}\Marg{document} +% \dots\ \meta{A part of document body} +% \cs{begin}\Marg{FramedSyntax} +% \dots\ \meta{Some syntax lines} +% \cs{end}\Marg{FramedSyntax} +% \dots\ \meta{Further document body} +% ~ +% \cs{end}\Marg{document} +% \end{FramedSyntax} +%\end{Verbatim} +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\section{Indexing} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The syntax macros can send their arguments to an \file{.idx} +% file. If package \pack{imakeidx} is loaded in the preamble +% and the \cs{makeindex} macro (with its own options) is used +% to activate the indexing process, the index is created +% without the need of manually running the necessary programs +% to transform the information collected into the \file{.idx} +% to the proper code into the \file{.ind} file. +% +% For example the following source code +%\begin{Verbatim}[gobble=1] +% % !TEX TS-program = pdflatex +% % !TEX encoding = UTF-8 Unicode +% \documentclass[12pt]{article} +% \usepackage{imakeidx}\makeindex +% \usepackage{FramedSyntax} +% \usepackage{kantlipsum} +% +% \begin{document} +% \kant[1] +% \begin{FramedSyntax} +% \cs{Large} +% \end{FramedSyntax} +% +% \kant[2-3] +% \begin{FramedSyntax} +% \cs{small} +% \end{FramedSyntax} +% +% \kant[4] +% +% \printindex +% +% \end{document} +%\end{Verbatim} +% produces a three page article containing dummy test, +% with a framed syntax box in each page. Both framed commands, +% introduced by means of the \cs{cs} command, are listed in the +% third page, correctly pointung to page~1 end page~2. +% Users are suggested to copy the above short code, save it in a +% testing \file{.tex} file, and compile it with \prog{pdfLaTeX}; +% with just one run the file gets compiled together with its +% index. +% +% \CheckSum{650} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\StopEventually{} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\section{The documented code} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Here the package code is defined and commented. +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\subsection{The necessary packages} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\pack{FramedSyntax} relies on a number of other packages; +% they are the following: +% \begin{macrocode} +\IfPackageLoadedF{pict2e}{\RequirePackage{pict2e}} +\IfPackageLoadedF{etoolbox}{\RequirePackage{etoolbox}} +\IfPackageLoadedF{xkeyval}{\RequirePackage{xkeyval}} +\IfPackageLoadedF{xcolor}{\RequirePackage{xcolor}} +% +% \end{macrocode} +% The last three packages are loadeed for obvious reasons, since +% they are connected to \LaTeX programming and the package +% specific functionalities. +% May be the most puzzling one is \pack{pict2e}; it is loaded in +% order to use its low level commands used to draw the frame +% with rounded corners, i.e. the lines and the corner arcs; +% they can be coloured and their thickness may be specified; +% they form closed paths that can be stroked in a specific +% colour or filled with another specific colour. +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\subsection{The syntax macros} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% These numerous commands are used to typeset in a specific +% style the command arguments, the files, classes, packages, +% options names; commands, and so on. If in any source file +% indexing is active, each command sends the relevant information +% to the \file{.idx} file. +% +% All package internal commands have names that are prefixed with +% the string \texttt{FS}, so as to avoid conflicts with similar +% named commands defined by other classes or packages. These are +% not user commands, they are only for internal use. At the +% beginning of the \amb{FramedSyntax} environment all user +% commands (that users input without this prefix) will be let to +% the internal commands, so that no interference exists and +% no clash errors take place. +% +% Notice the non prefixed names: \cs{marg} and \cs{Marg} (and +% its siblings): with the lower case initial letter the +% syntax \emph{mandatory} argument is printed in italics +% surrounded by angle brackets; with an uppercase initial letter +% the syntax \emph{mandatory} argument is printed in teletype +% and is not surrounded by angle brackets. +% Similarly syntax \emph{optional} arguments are typeset within +% square brackets but the initial letter case specifies the +% difference between an argument to be entered by the user, +% and an argument with a specific value. +% +% Since initially I wrote the package for myself, some unusual +% object names are spelled in mixed languages: for example it is +% evident that \texttt{marg} stands for \emph{mandatory +% argument} without any language mixture; the Italian word +% \texttt{stile} evidently stands for the English word +% \emph{style}; similarly \texttt{allineamento} stands for +% \emph{alignement}; \texttt{numeristyle} is in mixed languages +% but obviously it stands for \emph{numbers style}; possibly the +% only one, that may puzzle a non Italian user, is the word +% \texttt{chiave} that stands for \emph{key}. +% +% Entries for a possible index are already created in such a way +% as to use the correct language for the index in Italian or the +% index in English. Should another user prefer to create the +% index in a different language, such a user is free to redefine +% in his/her document the indexing macros defined in this +% package> +% \begin{macrocode} +\providecommand*\FSmeta[1]{\textnormal{$\langle$\textit{#1}$\rangle$}} +\providecommand*\FSmarg[1]% + {\textnormal{\texttt{\char123}\FSmeta{#1}\texttt{\char125}}} +\providecommand*\FSoarg[1]{\textnormal{\texttt{[}\FSmeta{#1}\texttt{]}}} +\providecommand*\FSArg[1]{\textnormal{\texttt{\{#1\}}}} +\let\FSMarg\FSArg +\providecommand*\FSOarg[1]{\textnormal{\texttt{[#1]}}} +\def\GT@splitargs#1,#2!{\def\@tempA{#1}\def\@tempB{#2}} +\providecommand\FSgarg[1]{\textnormal{\GT@splitargs#1!\% + \texttt{(}\FSmeta{\@tempA}\texttt{,}\FSmeta{\@tempB}\texttt{)}}} +\providecommand*\FScomando[1]{\textnormal{\texttt{\string#1}}} +\providecommand*{\FScs}[1]% +{\textnormal{\texttt{\char92#1}\index{#1@\texttt{\char92#1}|textsc}}} +\let\FScsindex\FScs +% +\providecommand*\SFSambiente[2]{% +\FScomando{\begin}\FSmarg{#1}\FSoarg{#2}\,\dots + \FScomando{\end}\FSmarg{#1}} +\providecommand*\DFSambiente[3]{% + \FScomando{\begin}\FSmarg{#1}\FSoarg{#2}\FSoarg{#3}\,\dots + \FScomando{\end}\FSmarg{#1}} +\providecommand*\BFSambiente[1]{\FScomando{\begin}\FSmarg{#1}} +\providecommand*\EFSambiente[1]{\FScomando{\end}\FSmarg{#1}} +\IfPackageLoadedF{cfr-lm}{\let\texttm\texttt \let\texttv\texttt} +% +\DeclareRobustCommand*\FSambstyle[1]{% + {\normalfont\textsf{\slshape#1}}} +\DeclareRobustCommand*\FSclassstyle[1]{% + {\normalfont\texttv{\itshape#1}}} +\DeclareRobustCommand*\FSfilestyle[1]{% + {\normalfont\texttm{\texttt{#1}}}} +\DeclareRobustCommand*\FSpackstyle[1]{% + {\normalfont\texttm{\ifbool{PDFTeX}{\textit}{\itshape}{#1}}}}% +\DeclareRobustCommand*\FSprogstyle[1]{{\normalfont\textsf{#1}}} +\DeclareRobustCommand*\FSprog[1]{\FSprogstyle{#1}% +\iflanguage{english}{\index{program!#1@\FSprogstyle{#1}|textsc}}% + {\index{programma!#1@\FSprogstyle{#1}|textsc}}}% +\DeclareRobustCommand*\FSpack[1]{\FSpackstyle{#1}% +\iflanguage{english}{\index{package!#1@\FSpackstyle{#1}|textsc}}% + {\index{pacchetto!#1@\FSpackstyle{#1}|textsc}}} +\DeclareRobustCommand*\FSclass[1]{\FSclassstyle{#1}% + \iflanguage{english}{\index{class!#1@\FSclassstyle{#1}|textsc}}% + {\index{classe!#1@\FSclassstyle{#1}|textsc}}}% +\DeclareRobustCommand*\file[1]{\FSfilestyle{#1}% + \index{file!#1@\FSfilestyle{#1}|textsc}}% +\DeclareRobustCommand*\FSamb[1]{\FSambstyle{#1}% + \iflanguage{english}% + {\index{environment!#1@\FSambstyle{#1}|textsc}}% + {\index{ambiente!#1@\FSambstyle{#1}|textsc}}}% +\DeclareRobustCommand*\FSopzstyle[1]{% + {\normalfont\textsf{\slshape{#1}}}}% +\DeclareRobustCommand*\FScontastyle[1]{{\normalfont\texttm{#1}}} +\DeclareRobustCommand*\FSstilestyle[1]{{\normalfont\texttm{#1}}} +\DeclareRobustCommand*\FSnumeristyle[1]{{\normalfont\texttm{#1}}} +\DeclareRobustCommand*\FSumisurastyle[1]{{\normalfont\texttm{#1}}} +\DeclareRobustCommand*\FSchiavestyle[1]{{\normalfont\texttm{#1}}} +\DeclareRobustCommand*\FSdescrittorestyle[1]{{\normalfont\texttm{#1}}} +\DeclareRobustCommand*\FSposizionestyle[1]{{\normalfont\texttm{#1}}} +\DeclareRobustCommand*\FSallineamentostyle[1]{{\normalfont\texttm{#1}}} +% +\DeclareRobustCommand*\FSopz[1]{\opzstyle{#1}% + \iflanguage{english}{\index{option!#1@\FSopzstyle{#1}|textsc}}% + {\index{opzione!#1@\opzstyle{#1}|textsc}}}% +\DeclareRobustCommand*\FSconta[1]{\Fcontastyle{#1}% + \iflanguage{english}{\index{counter!#1@\FScontastyle{#1}|textsc}}% + {\index{contatore!#1@\FScontastyle{#1}|textsc}}} +\DeclareRobustCommand*\FSstile[1]{\FSstilestyle{#1}% + \iflanguage{english}{\index{page style!#1@\FSstilestyle{#1}|textsc}}% + {\index{stile della pagina!#1@\FSstilestyle{#1}|textsc}}} +\DeclareRobustCommand*\FSnumeri[1]{\FSnumeristyle{#1}% + \iflanguage{english}{\index{numbering!#1@\FSnumeristyle{#1}|textsc}}% + {\index{numerazione!#1@\FSnumeristyle{#1}|textsc}}} +\DeclareRobustCommand*\FSumisura[1]{\FSumisurastyle{#1}% + \iflanguage{english}{measuring unit!#1@\FSumisurastyle{#1}|textsc}% + {\index{unità di misura!#1@\FSumisurastyle{#1}|textsc}}} +\DeclareRobustCommand*\FSchiave[1]{\FSchiavestyle{#1}% + \iflanguage{english}{\index{key!#1@\FSchiavestyle{#1}|textsc}}% + {\index{chiave!#1@\chiavestyle{#1}|textsc}}} +\DeclareRobustCommand*\FSdescrittore[1]{\FSdescrittorestyle{#1}% + \iflanguage{english}% + {\index{column descriptor!#1@\FSdescrittorestyle{#1}|textsc}}% + {\index{descrittore di colonna!#1@\FSdescrittorestyle{#1}|textsc}}} +\DeclareRobustCommand*\FSposizione[1]{\FSposizionestyle{#1}% + \iflanguage{english}% + {\index{floating object position!#1@\FSposizionestyle{#1}|textsc}}% + {\index{posizione degli oggetti flottanti!#1@\FSposizionestyle{#1}|textsc}}}% +\DeclareRobustCommand*\FSallineamento[1]{FS\allineamentostyle{#1}% + \iflanguage{english}% + {\index{allignment code!#1@\FSallineamentostyle{#1}|textsc}}% + {\index{codice di allineamento!#1@\FSallineamentostyle{#1}|textsc}}} +% +% \end{macrocode} +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\subsection{Register and colour definitions} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Here we define some length and dimension registers. +% They will be used by the local commands and environments. +% Length \cs{insertwidth} might be already defined, therefore we +% test this possibility. +% \begin{macrocode} +\newlength\SIfrthick +\newlength\SIfrgap +\newlength\SIfrwidth +\newlength\SIfrheight +\ifcsdef{insertwidth}{}{\newlength\insertwidth} +\newlength\SIXR \newlength\SIYD +\newlength\SIXL \newlength\SIYU +\newdimen\radius +\newdimen\framewidth + +\definecolor{SIbackground}{rgb}{0.95,0.95,0.95} +\definecolor{SIframe}{rgb}{0.1,0.1,0.1} +\definecolor{SItext}{rgb}{0,0,0} + +% \end{macrocode} +% The default background color is a very light gray; the default +% frame colour is a very dark gray; the default text colour is +% just black. Such colours are deemed suitable for the +% application of the framed syntax box, but when necessary users +% can use the \cs{textcolor} command to emphasise specific +% phrases. +% +% As it can be seen, these colours are defined by means of the +% colour defining macros of the \pack{xcolor} package. +% They define some default colours; but the next commands +% redefine them at the user choice; actually the user shall +% specify some \textit{key = value} options to the main syntax +% environment. +% \begin{macrocode} +\def\SetSIbgd#1{\colorlet{SIbackground}{#1}} +\def\SetSIfrm#1{\colorlet{SIframe}{#1}} +\def\SetSItxt#1{\colorlet{SItext}{#1}} + +% \end{macrocode} +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\subsection{Option settings} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The next code is the strength of the package; the definition +% of the option settings. They form an option family defined by +% the angle brackets delimited string \texttt{sintassi}. +% Therefore they cannot be redefined by any other class or +% package unless the above family name is used. +% \begin{macrocode} +\DeclareOptionX<sintassi>{fboxrule}[1pt]{\fboxrule=#1} +\DeclareOptionX<sintassi>{fboxsep}[1ex]{\fboxsep=#1} +\DeclareOptionX<sintassi>{framecolor}[SIframe]{\SetSIfrm{#1}} +\DeclareOptionX<sintassi>{backgroundcolor}[SIbackground]{\SetSIbgd{#1}} +\DeclareOptionX<sintassi>{fontstyle}[\normalfont]{#1} +\DeclareOptionX<sintassi>{radius}[\fboxsep]{\radius=#1} +\DeclareOptionX<sintassi>{insertionwidth}[\linewidth]{\insertwidth=#1} + +\DeclareOptionX*{% + \packageWarning{FramedSyntax}{`\CurrentOption' ignored}% +} + +% \end{macrocode} +% Notice that the option defining macro \cs{DeclareOptionX} +% is created by the \pack{keyvalue} package in a simplified way, +% so as to imitate the \LaTeXe syntax. +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\subsection{Activate all options} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% With just two macros we activate all options of family +% \texttt{sintassi} +% \begin{macrocode} +\ExecuteOptionsX<sintassi>{% + fboxrule, + fboxsep, + framecolor, + backgroundcolor, + fontstyle, + radius, + insertionwidth +} +\ProcessOptionsX*\relax + +% \end{macrocode} +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{A couple of useful local macros} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% The following macros are generally useful for the end users; +% the first one provides a simple means to scale the font size +% to any specified integer or fractional value. It comes useful +% when a line contained in a framed syntax box is too long and +% gets broken at the end of the box measure. According where the +% line is broken there are two ways to correct the source file: +%\begin{itemize} +%\item +% the user choses the best point where to break the line, +% inserts an explicit comment character (|\%|) +% at the end of the broken line and inserts a horizontal space +% at the beginning of the remaining part of the broken line. +%\item +% At the beginning of the environment body the user may insert a +% \cs{setfontsize} selecting the specific font size at a smaller +% integer or fractional value than the normal text size. +%\end{itemize} +% This \cs{setfontsize} macro accepts two different syntaxes in +% order to reach the same result: For example: +% +%\verb|\setfontsize{9.5}[1.1]|\par +%\verb|\setfontsize[1.1]{9.5}| +% +% In any case the base line skip value is optional and its +% default value is 1.2 times the font size. Actually the +% optional value is not the base line skip value, but it is +% the \cs{linestretch} value, i.e. the ratio between the desired +% base line skip and the font size. +% +% The second macro exploits the \pack{etoolbox} functionalities +% to define a user macro that activates an internal native \TeX +% macro protected by a |%| character. +% \begin{macrocode} +\providecommand\setfontsize{} +\RenewDocumentCommand\setfontsize{O{1.2} m O{#1}}{% + \fontsize{#2}{\fpeval{#1*#2}}\selectfont} + +\providecommand\strippt{} +\renewcommand\strippt[1]{\csuse{strip@pt}#1} + +% \end{macrocode} +% +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{The framed box requires several settings} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The following macro \cs{framedbox} in a certain sense is the +% heart of the whole construction of the \amb{FramedSyntax} +% environment. It requires 5 arguments, four mandatory ones and +% one optional. In order they are as follows +% \begin{enumerate} +% \item[\texttt{\#1}] +% mandatory: the width of the box/ +% +% \item[\texttt{\#2}] +% mandatory: the thickness of the frame. +% +% \item[\texttt{\#3}] +% mandatory: the gap width between the frame and the contents +% of the box. +% +% \item[\texttt{\#4}] +% optional: the radius of curvature of the box corners. +% +% \item[\texttt{\#5}] +% mandatory: the text to be included within the framed box +% \end{enumerate} +% Although the corner radius may be chosen, it is suggested to +% avoid specifying this optional parameter; its default value +% equals the gap width; if the frame thickness is zero, macro +% avoids tracing a frame with an invisible line. +% \begin{macrocode} +\providecommand\framedbox{} +\RenewDocumentCommand\framedbox{m m m O{#3} m}{% +\bgroup + \dimen2=#1\relax + \dimen0=\dimexpr#1-(#2+#3)*2\relax + \setbox0\hbox{\parbox{\dimen0}{#5}}% + \SIfrthick=#2\relax + \SIXR=\dimexpr\wd0/2\relax \SIXL=-\SIXR\relax + \SIYU=\dimexpr(\ht0+\dp0)/2\relax \SIYD=-\SIYU\relax + \dimen4=#1\relax % box total width + \dimen6=\dimexpr\ht0+\dp0+(#2+#3)*2\relax% box total height + \dimen8=#4\relax % corner arc radius + \edef\SIbase{\strippt{\dimen4}} + \edef\SIalt{\strippt{\dimen6}} + \edef\SIxoff{\strippt{\dimexpr0.5\dimen4}} + \edef\SIyoff{\strippt{\dimexpr0.5\dimen6}} + \unitlength=1pt + \begin{picture}(\SIbase,\SIalt)(-\SIxoff,-\SIyoff) + \Frame*{\dimen4}{\dimen6}{\dimen8}% + \ifdim\SIfrthick>0pt\Frame{\dimen4}{\dimen6}{\dimen8}\fi + \put(0,0){\makebox(0,0){\box0}}% + \end{picture} +\egroup +\ignorespaces} + +% \end{macrocode} +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{The frame} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The actual frame path may be filled with colour; the frame +% border may be coloured with its own specified colour; such +% colours are established by the FramedSyntax environment +% options or by the global options. +% +% The \cs{Frame} command requires four parameters already +% computed by the \cs{framedbox} command; in any case they are +% the following: +% \begin{enumerate} +% \item[\texttt{\#1}] +% optional: a boolean asterisk; if the asterisk is missing the +% frame contour is drawn with its colour \texttt{SIframe}; if +% the asterisk is present the contour is not drawn, but the +% framed box is filled with the \texttt{SIbackground} colour. +% \item[\texttt{\#2}] +% mandatory: overall box width. +% \item[\texttt{\#3}] +% mandatory: total box height. +% \item[\texttt{\#4}] +% mandatory: the corner arc radius. +% \end{enumerate} +% +% The following code contains the low level \pack{pict2e} +% commands to draw lines to form a closed path to be stroked or +% colour filled. They do not form a \pack{pict2e} \cs{oval}, +% although the contour is similar, because the default \cs{oval} +% cannot be filled. +% \begin{macrocode} + \providecommand\Frame{} + \RenewDocumentCommand\Frame{s m m m}{% + \bgroup + \SIXR=\dimexpr#2/2\relax \SIXL=-\SIXR% + \SIYU=\dimexpr#3/2\relax \SIYD=-\SIYU% + \IfBooleanTF{#1}{\linethickness{0pt}\color{SIbackground}}% + {\linethickness{\SIfrthick}\color{SIframe}}% + \moveto(\SIXR,\SIYD+#4)% + \circlearc{\SIXR-#4}{\SIYU-#4}{#4}{0}{90}% + \circlearc{\SIXL+#4}{\SIYU-#4}{#4}{90}{180}% + \circlearc{\SIXL+#4}{\SIYD+#4}{#4}{180}{270}% + \circlearc{\SIXR-#4}{\SIYD+#4}{#4}{270}{360}% + \closepath + \IfBooleanTF{#1}{\fillpath}{\strokepath}% + \egroup\ignorespaces} + +% \end{macrocode} + +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Filling the frame with the syntax text} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% We are almost at the end. Here we define another macro to put +% the syntax text inside the frame over the background +% colour. The next command \cs{includeframedtext} provides the +% necessary arguments to be passed to the lower level command +% \cs{framedbox}; the arguments are the following: +% \begin{enumerate} +% \item[\texttt{\#1}] +% optional: box width; default value \cs{insertwidth}, which is +% the actual boxed text width; if it is larger than +% \cs{linewidth} it is reduced to this value; in this case +% users should revise they source code in order to fix this +% little problem. +% \item[\texttt{\#2}] +% mandatory: the syntax text to be framed. +% \item[\texttt{\#3}] +% optional: the local \textit{key = value} options. +% \end{enumerate} +% +% The code is the following. +% \begin{macrocode} +\providecommand\includeframedtext{} +\RenewDocumentCommand\includeframedtext{O{\insertwidth} m O{}}% +{\bgroup + \ExecuteOptionsX<sintassi>{#3}% + \ifdimgreater{\insertwidth}{\linewidth}{\insertwidth=\linewidth}{}% + \framedbox{\insertwidth}{\fboxrule}{\fboxsep}[\radius]{#2}% +\egroup} + +% \end{macrocode} +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{The user environment} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Originally this environmente was named \amb{Sintassi}, but in +% this package we name it \amb{FramedSintax}. The opening +% statement is very long, because it must contain all the +% \cs{let} commands that allow the user to use the command names +% without the \texttt{FS} prefix; such \cs{let} equivalences are +% local because the \texttt{FS} prefixes were introduced only to +% avoid clashes with possible definitions of the same names with +% other purposes. +% +% But besides these numerous equivalences, this environment +% \amb{FramedSyntax} determines the necessary parameters to pass +% to the service macros +% +% The environment requires just two optional arguments. +% \begin{enumerate} +% \item[\texttt{\#1}] +% optional: the font size. The default value is the current +% font size. This size should be specified only when the syntax +% lines are marginally longer than the available measure and +% they get broken close to their natural length. Please, +% remember that in order to have this size specification work +% properly, it is necessary to use continuously scalable fonts. +% This command will not have any useful effect with the original +% \TeX default Computer Modern fonts; Latin Modern fonts, on +% the contrary, work very well. +% \item[\texttt{\#2}] +% optional: \textit{key = value} options that locally override +% the global default ones or those that possibly were +% specified by the user when loading this package. +% \end{enumerate} +% \begin{macrocode} +\ProvideDocumentEnvironment{FramedSyntax}{}{}{} +\RenewDocumentEnvironment{FramedSyntax}{o D(){}} +{% environment opening commands +\IfValueT{#1}{\setfontsize{#1}}% font size setting +\ExecuteOptionsX<sintassi>{#2}% key = value options + \ifdimgreater{\insertwidth}{\linewidth}% width corrrection + {\insertwidth=\linewidth}{}% +\framewidth=\insertwidth +% +\let\meta\FSmeta \let\marg\FSmarg \let\oarg\FSoarg +\let\Arg\FSArg \let\Marg\FSMarg \let\Oarg\FSOarg +\let\garg\FSgarg \let\comando\FScomando \let\cs\FScs +\let\csindex\FScs \let\Sambiente\SFSambiente +\let\Dambiente\DFSambiente +\let\Bambiente\BFSambiente \let\Eambiente\EFSambiente +\let\amb\FSamb \let\ambstyle\FSambstyle +\let\class\FSclass \let\classstyle\FSclassstyle +\let\file\FSfile \let\filestyle\FSfilestyle +\let\pack\FSpack \let\packstyle\FSpackstyle +\let\prog\FSprog \let\progstyle\FSprogstyle +\let\opz\FSopz \let\opzstyle\FSopzstyle +\let\conta\FSconta \let\contastyle\FScontastyle +\let\stile\FSstile \let\stilestyle\FSstilestyle +\let\numeri\FSnumeri \let\numerystyle\FSnumeristyle +\let\umisura\FSumisura \let\umisurastyle\FSumisurastyle +\let\chiave\FSchiave \let\chiavestyle\FSchiavestyle +\let\descrittore\FSdescrittore + \let\descrittorestyle\FSDescrittorestyle +\let\posizione\FSposizione \let\posizionestyle\FSposizionestyle +\let\allineamento\FSallineamento + \let\allineamentostyle\FSallineamentostyle + +% +\begin{lrbox}{2}% open the necessary boxes +\begin{minipage}{% + \dimexpr\framewidth-2\fboxrule-2\fboxsep}\obeylines +}{% environment closing commands +\end{minipage}\end{lrbox}% close the above boxes +\begin{flushleft}% set the syntax thext flush left +\includeframedtext{\box2}[#2] +\end{flushleft}}% + +% \end{macrocode} +% +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection%{Backwards compatibility environment \amb{Sintassi}} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% As said in the Preface, this package was inspired by a +% \file{.sty} file of mine written in Italian; I might conserve +% my older file but, since it is not so safe against macro +% definition clashes, in the several document source files I +% wrote with the previous implementation. I am going to change +% the name of the imported file, but I will conserve the +% multitude of instances of the old environment name, by an +% alias defined in this package. +% \begin{macrocode} +\NewDocumentEnvironment{Sintassi}{o D(){}}% + {\begin{FramedSyntax}[#1](#2)}{\end{FramedSyntax}} +% \end{macrocode} +%. +% +%\iffalse +%<*package> +%\fi +% +% \begin{center}\color{red}\fontsize{50}{50}\selectfont +% Enjoy \LaTeX +%\end{center} +%\iffalse +%</package> +%\fi +% \Finale + +\endinput + +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/macros/latex/contrib/framedsyntax/FramedSyntax.pdf b/macros/latex/contrib/framedsyntax/FramedSyntax.pdf Binary files differnew file mode 100644 index 0000000000..ac6862130b --- /dev/null +++ b/macros/latex/contrib/framedsyntax/FramedSyntax.pdf diff --git a/macros/latex/contrib/framedsyntax/README.txt b/macros/latex/contrib/framedsyntax/README.txt new file mode 100644 index 0000000000..29ed193569 --- /dev/null +++ b/macros/latex/contrib/framedsyntax/README.txt @@ -0,0 +1,12 @@ + README.txt file for FramedSyntax.sty 2024-09-04 v.0.2.8 + + + Distributable under the LaTeX Project Public License, + version 1.3c or higher (your choice). The latest version of + this license is at: http://www.latex-project.org/lppl.txt + + This work is "maintained" + + This work consists of this file FramedSyntax.dtx, a README.txt + file and the derived files: FramedSyntax.sty, FramedSyntax.pdf. + diff --git a/macros/latex/contrib/profcollege/doc/profcollege-doc.pdf b/macros/latex/contrib/profcollege/doc/profcollege-doc.pdf Binary files differindex 787b93d169..2cc561202d 100644 --- a/macros/latex/contrib/profcollege/doc/profcollege-doc.pdf +++ b/macros/latex/contrib/profcollege/doc/profcollege-doc.pdf diff --git a/macros/latex/contrib/profcollege/latex/PfCPropor.tex b/macros/latex/contrib/profcollege/latex/PfCPropor.tex index c5e6dcd27d..1c8aba3324 100644 --- a/macros/latex/contrib/profcollege/latex/PfCPropor.tex +++ b/macros/latex/contrib/profcollege/latex/PfCPropor.tex @@ -1,8 +1,8 @@ %%% % Proportionnalit\'e %%% -\def\filedatePropor{2024/08/04}% -\def\fileversionPropor{0.1}% +\def\filedatePropor{2024/09/04}% +\def\fileversionPropor{0.1a}% \message{-- \filedatePropor\space v\fileversionPropor}% % \setKVdefault[ClesPropor]{GrandeurA=Grandeur A,GrandeurB=Grandeur B,Largeur=1cm,Math=false,Stretch=1,ColorFill=white,CouleurTab=gray!15,Vertical=false,Simple=false,Condense=false}% @@ -205,49 +205,51 @@ \NewDocumentCommand\FlechePCG{mm}{% \begin{tikzpicture}[remember picture,overlay,node distance=\getstrut\ht]% - \node[inner sep=0pt] (MilieuH-#1) at ($(ProporG-#1)!0.25!(ProporD-#1)$) {};% - \node[inner sep=0pt] (MilieuH-#2) at ($(ProporG-#2)!0.25!(ProporD-#2)$) {};% - \node[inner sep=0pt] (MilieuB-#1) at ($(ProporG-#1)!0.75!(ProporD-#1)$) {};% - \node[inner sep=0pt] (MilieuB-#2) at ($(ProporG-#2)!0.75!(ProporD-#2)$) {};% + \node[inner sep=0pt] (MilieuH-#1) at ($(ProporH-#1)!\PfCCoeffH!(ProporB-#1)$) {};% + \node[inner sep=0pt] (MilieuH-#2) at ($(ProporH-#2)!\PfCCoeffH!(ProporB-#2)$) {};% + \node[inner sep=0pt] (MilieuB-#1) at ($(ProporH-#1)!\PfCCoeffB!(ProporB-#1)$) {};% + \node[inner sep=0pt] (MilieuB-#2) at ($(ProporH-#2)!\PfCCoeffB!(ProporB-#2)$) {};% \xintifboolexpr{#1<#2}{% \coordinate[right of=MilieuH-#1] (aux1);% - \coordinate[right of=MilieuH-#2] (aux2);% - \coordinate[left of=MilieuB-#1] (aux3);% + \coordinate[left of=MilieuH-#2] (aux2);% + \coordinate[right of=MilieuB-#1] (aux3);% \coordinate[left of=MilieuB-#2] (aux4);% - \draw[out=30,in=-30,gray] (aux3) to (aux4); + \draw[FlechePropor,gray] (aux4) -- (aux1); + \draw[out=-30,in=30,gray] (aux2) to (aux4); }{% - \coordinate[right of=MilieuH-#1] (aux1);% + \coordinate[left of=MilieuH-#1] (aux1);% \coordinate[right of=MilieuH-#2] (aux2);% \coordinate[left of=MilieuB-#1] (aux3);% - \coordinate[left of=MilieuB-#2] (aux4);% - \draw[out=-30,in=30,gray] (aux3) to (aux4); + \coordinate[right of=MilieuB-#2] (aux4);% + \draw[FlechePropor,gray] (aux1) -- (aux4); + \draw[out=30,in=-30,gray] (aux3) to (aux1); }% \draw[gray] (aux2) -- (aux3); - \draw[FlechePropor,gray] (aux4) -- (aux1); \end{tikzpicture}% }% \NewDocumentCommand\FlechePCD{mm}{% \begin{tikzpicture}[remember picture,overlay,node distance=\getstrut\ht]% - \node[inner sep=0pt] (MilieuH-#1) at ($(ProporG-#1)!0.25!(ProporD-#1)$) {};% - \node[inner sep=0pt] (MilieuH-#2) at ($(ProporG-#2)!0.25!(ProporD-#2)$) {};% - \node[inner sep=0pt] (MilieuB-#1) at ($(ProporG-#1)!0.75!(ProporD-#1)$) {};% - \node[inner sep=0pt] (MilieuB-#2) at ($(ProporG-#2)!0.75!(ProporD-#2)$) {};% + \node[inner sep=0pt] (MilieuH-#1) at ($(ProporH-#1)!\PfCCoeffH!(ProporB-#1)$) {};% + \node[inner sep=0pt] (MilieuH-#2) at ($(ProporH-#2)!\PfCCoeffH!(ProporB-#2)$) {};% + \node[inner sep=0pt] (MilieuB-#1) at ($(ProporH-#1)!\PfCCoeffB!(ProporB-#1)$) {};% + \node[inner sep=0pt] (MilieuB-#2) at ($(ProporH-#2)!\PfCCoeffB!(ProporB-#2)$) {};% \xintifboolexpr{#1<#2}{% \coordinate[right of=MilieuH-#1] (aux1);% - \coordinate[right of=MilieuH-#2] (aux2);% - \coordinate[left of=MilieuB-#1] (aux3);% + \coordinate[left of=MilieuH-#2] (aux2);% + \coordinate[right of=MilieuB-#1] (aux3);% \coordinate[left of=MilieuB-#2] (aux4);% - \draw[out=150,in=-150,gray] (aux1) to (aux2); + \draw[FlechePropor,gray] (aux3) -- (aux2); + \draw[out=-150,in=150,gray] (aux1) to (aux3); }{% - \coordinate[right of=MilieuH-#1] (aux1);% + \coordinate[left of=MilieuH-#1] (aux1);% \coordinate[right of=MilieuH-#2] (aux2);% \coordinate[left of=MilieuB-#1] (aux3);% - \coordinate[left of=MilieuB-#2] (aux4);% - \draw[out=-150,in=150,gray] (aux1) to (aux2); + \coordinate[right of=MilieuB-#2] (aux4);% + \draw[FlechePropor,gray] (aux2) -- (aux3); + \draw[out=-150,in=150,gray] (aux2) to (aux4); }% \draw[gray] (aux4) -- (aux1); - \draw[FlechePropor,gray] (aux2) -- (aux3); \end{tikzpicture}% }% diff --git a/macros/latex/contrib/profcollege/latex/ProfCollege.sty b/macros/latex/contrib/profcollege/latex/ProfCollege.sty index a7b20bf698..df794a8d86 100644 --- a/macros/latex/contrib/profcollege/latex/ProfCollege.sty +++ b/macros/latex/contrib/profcollege/latex/ProfCollege.sty @@ -2,9 +2,9 @@ % licence : Released under the LaTeX Project Public License v1.3c % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e}% -\def\filedate{2024/09/03}% +\def\filedate{2024/09/04}% \let\PfCfiledate\filedate% -\def\fileversion{0.99-A-i}% +\def\fileversion{0.99-A-j}% \let\PfCfileversion\fileversion% \ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]% diff --git a/macros/latex/contrib/regulatory/README.md b/macros/latex/contrib/regulatory/README.md index ec9a283dc9..55a5e0f4bf 100644 --- a/macros/latex/contrib/regulatory/README.md +++ b/macros/latex/contrib/regulatory/README.md @@ -1,4 +1,5 @@ # Regulatory +![CTAN Version](https://img.shields.io/ctan/v/regulatory) A LaTeX package which provides macro's for crafting regulatory documents. diff --git a/macros/latex/contrib/regulatory/doc/example1-en.pdf b/macros/latex/contrib/regulatory/doc/example1-en.pdf Binary files differindex 7bac5e0c9b..2c679dbcb1 100644 --- a/macros/latex/contrib/regulatory/doc/example1-en.pdf +++ b/macros/latex/contrib/regulatory/doc/example1-en.pdf diff --git a/macros/latex/contrib/regulatory/doc/example1-en.tex b/macros/latex/contrib/regulatory/doc/example1-en.tex index eeb17acc99..ae903d7ef0 100644 --- a/macros/latex/contrib/regulatory/doc/example1-en.tex +++ b/macros/latex/contrib/regulatory/doc/example1-en.tex @@ -19,7 +19,7 @@ % example1-nl.tex, example2-nl.tex, % example1-en.tex, example2-en.tex, % md-example.tex, example.md, -% fc-dutch.def and regulatory.sty +% regulatory.sty \documentclass[12pt,english]{article} \usepackage{babel} \usepackage[alldefs]{regulatory} diff --git a/macros/latex/contrib/regulatory/doc/example1-nl.pdf b/macros/latex/contrib/regulatory/doc/example1-nl.pdf Binary files differindex bc3f8b1d53..5bcb030bd8 100644 --- a/macros/latex/contrib/regulatory/doc/example1-nl.pdf +++ b/macros/latex/contrib/regulatory/doc/example1-nl.pdf diff --git a/macros/latex/contrib/regulatory/doc/example1-nl.tex b/macros/latex/contrib/regulatory/doc/example1-nl.tex index df01669786..513c9bce6e 100644 --- a/macros/latex/contrib/regulatory/doc/example1-nl.tex +++ b/macros/latex/contrib/regulatory/doc/example1-nl.tex @@ -19,7 +19,7 @@ % example1-nl.tex, example2-nl.tex, % example1-en.tex, example2-en.tex, % md-example.tex, example.md, -% fc-dutch.def and regulatory.sty +% regulatory.sty \documentclass[12pt,dutch]{article} \usepackage{babel} \usepackage[alldefs]{regulatory} diff --git a/macros/latex/contrib/regulatory/doc/example2-en.pdf b/macros/latex/contrib/regulatory/doc/example2-en.pdf Binary files differindex e7fdc77178..3362320b7f 100644 --- a/macros/latex/contrib/regulatory/doc/example2-en.pdf +++ b/macros/latex/contrib/regulatory/doc/example2-en.pdf diff --git a/macros/latex/contrib/regulatory/doc/example2-en.tex b/macros/latex/contrib/regulatory/doc/example2-en.tex index f47f7d0d9e..c800c7672f 100644 --- a/macros/latex/contrib/regulatory/doc/example2-en.tex +++ b/macros/latex/contrib/regulatory/doc/example2-en.tex @@ -19,7 +19,7 @@ % example1-nl.tex, example2-nl.tex, % example1-en.tex, example2-en.tex, % md-example.tex, example.md, -% fc-dutch.def and regulatory.sty +% regulatory.sty \documentclass[12pt,english]{article} \usepackage{babel} \usepackage{regulatory} diff --git a/macros/latex/contrib/regulatory/doc/example2-nl.pdf b/macros/latex/contrib/regulatory/doc/example2-nl.pdf Binary files differindex 6342318259..e2606186ca 100644 --- a/macros/latex/contrib/regulatory/doc/example2-nl.pdf +++ b/macros/latex/contrib/regulatory/doc/example2-nl.pdf diff --git a/macros/latex/contrib/regulatory/doc/example2-nl.tex b/macros/latex/contrib/regulatory/doc/example2-nl.tex index 071cce4a00..6713495658 100644 --- a/macros/latex/contrib/regulatory/doc/example2-nl.tex +++ b/macros/latex/contrib/regulatory/doc/example2-nl.tex @@ -19,7 +19,7 @@ % example1-nl.tex, example2-nl.tex, % example1-en.tex, example2-en.tex, % md-example.tex, example.md, -% fc-dutch.def and regulatory.sty +% regulatory.sty \documentclass[12pt,dutch]{article} \usepackage{babel} \usepackage{regulatory} diff --git a/macros/latex/contrib/regulatory/doc/regulatory-en.pdf b/macros/latex/contrib/regulatory/doc/regulatory-en.pdf Binary files differindex ac592a4989..c65752a189 100644 --- a/macros/latex/contrib/regulatory/doc/regulatory-en.pdf +++ b/macros/latex/contrib/regulatory/doc/regulatory-en.pdf diff --git a/macros/latex/contrib/regulatory/doc/regulatory-en.tex b/macros/latex/contrib/regulatory/doc/regulatory-en.tex index 55d4290753..e497d27fd8 100644 --- a/macros/latex/contrib/regulatory/doc/regulatory-en.tex +++ b/macros/latex/contrib/regulatory/doc/regulatory-en.tex @@ -19,7 +19,7 @@ % example1-nl.tex, example2-nl.tex, % example1-en.tex, example2-en.tex, % md-example.tex, example.md, -% fc-dutch.def and regulatory.sty +% regulatory.sty \documentclass[10pt,english]{ltxdoc} %! suppress = InclusionLoop diff --git a/macros/latex/contrib/regulatory/doc/regulatory-nl.pdf b/macros/latex/contrib/regulatory/doc/regulatory-nl.pdf Binary files differindex 9d4832ce44..d8ff64100b 100644 --- a/macros/latex/contrib/regulatory/doc/regulatory-nl.pdf +++ b/macros/latex/contrib/regulatory/doc/regulatory-nl.pdf diff --git a/macros/latex/contrib/regulatory/doc/regulatory-nl.tex b/macros/latex/contrib/regulatory/doc/regulatory-nl.tex index f5c9f47259..c8048c9025 100644 --- a/macros/latex/contrib/regulatory/doc/regulatory-nl.tex +++ b/macros/latex/contrib/regulatory/doc/regulatory-nl.tex @@ -19,7 +19,7 @@ % example1-nl.tex, example2-nl.tex, % example1-en.tex, example2-en.tex, % md-example.tex, example.md, -% fc-dutch.def and regulatory.sty +% regulatory.sty \documentclass[10pt,dutch]{ltxdoc} %! suppress = InclusionLoop diff --git a/macros/latex/contrib/regulatory/doc/regulatory-preamble.tex b/macros/latex/contrib/regulatory/doc/regulatory-preamble.tex index 50c6db1bee..0325d5aacf 100644 --- a/macros/latex/contrib/regulatory/doc/regulatory-preamble.tex +++ b/macros/latex/contrib/regulatory/doc/regulatory-preamble.tex @@ -19,7 +19,7 @@ % example1-nl.tex, example2-nl.tex, % example1-en.tex, example2-en.tex, % md-example.tex, example.md, -% fc-dutch.def and regulatory.sty +% regulatory.sty \usepackage{gitinfo-lua} \usepackage{listings} diff --git a/macros/latex/contrib/regulatory/doc/regulatory.tex b/macros/latex/contrib/regulatory/doc/regulatory.tex index fbd5d35c3d..55bcbe8c6a 100644 --- a/macros/latex/contrib/regulatory/doc/regulatory.tex +++ b/macros/latex/contrib/regulatory/doc/regulatory.tex @@ -19,7 +19,7 @@ % example1-nl.tex, example2-nl.tex, % example1-en.tex, example2-en.tex, % md-example.tex, example.md, -% fc-dutch.def and regulatory.sty +% regulatory.sty \translation{% \title{Package \package{regulatory}\thanks{This document corresponds to \textsf{regulatory}~\packageversion, written on \packagedate.}} }{% @@ -176,16 +176,14 @@ lualatex main }{, voor onderdelen.} \translation{% For ``subparagraphs'', \cmd{\abalpnum} from the \package{fmtcount}\footnote{% - The Dutch language definition is currently in progress within the \href{https://github.com/vincentb1/fmtcount/pull/51}{\package{fmtcount}} package. - In the meantime, this package includes the correct configuration for it.% - } package is used to enumerate multiple subparagraphs. + The Dutch language definition is now included into package \href{https://github.com/Xerdi/fmtcount}{\package{fmtcount}} itself. + Be sure to update the package if \texttt{fc-dutch.def} is missing} package is used to enumerate multiple subparagraphs. Suppose \cmd{\alph} were used; in that case, \option{paras} (second level) would be limited to 26 subparagraphs. With \cmd{\abalphnum}, for example, with a value of 125, the result is `\texttt{du}'. }{% Voor onderdelen wordt er gebruik gemaakt van \cmd{\abalpnum} uit pakket \package{fmtcount}\footnote{% - De Nederlandse taal definitie is momenteel nog in behandeling bij pakket \href{https://github.com/vincentb1/fmtcount/pull/51}{\package{fmtcount}}. - In de tussentijd levert dit pakket daarvoor de juist configuratie mee.% - } om meerdere onderdelen te kunnen opsommen. + De Nederlandse taal definitie is nu inbegrepen in pakket \href{https://github.com/Xerdi/fmtcount}{\package{fmtcount}} zelf. + Zorg ervoor dat het pakket up to date is als \texttt{fc-dutch.def} mist.} om meerdere onderdelen te kunnen opsommen. Stel er zou gebruik gemaakt worden van \cmd{\alph}, dan is \option{paras} beperkt tot 26 onderdelen. Bij \cmd{\abalphnum} met b\ij{}voorbeeld een waarde van 125 is `\texttt{du}' de uitkomst. } diff --git a/macros/latex/contrib/regulatory/tex/fc-dutch.def b/macros/latex/contrib/regulatory/tex/fc-dutch.def deleted file mode 100644 index ee86d49a48..0000000000 --- a/macros/latex/contrib/regulatory/tex/fc-dutch.def +++ /dev/null @@ -1,327 +0,0 @@ -%% fc-dutch.def -%% Copyright 2024 E. Nijenhuis -% -% This work 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 2005/12/01 or later. -% -% This work has the LPPL maintenance status ‘maintained’. -% -% The Current Maintainer of this work is E. Nijenhuis. -% -% This work consists of the files regulatory.tex, -% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, -% example1.bib, example2.bib, -% example1-nl.tex, example2-nl.tex, -% example1-en.tex, example2-en.tex, -% md-example.tex, example.md, -% fc-dutch.def and regulatory.sty -\ProvidesFCLanguage{dutch}[2024/01/27]% -\newcommand{\@ordinalMdutch}[2]{\edef#2{\number#1\relax.}}% -\global\let\@ordinalMdutch\@ordinalMdutch -\global\let\@ordinalFdutch\@ordinalMdutch -\global\let\@ordinalNdutch\@ordinalMdutch -\newcommand*\@@unitstringdutch[1]{% - \ifcase#1% - nul% - \or een% - \or twee% - \or drie% - \or vier% - \or vijf% - \or zes% - \or zeven% - \or acht% - \or negen% - \fi -}% -\global\let\@@unitstringdutch\@@unitstringdutch -\global\let\@@unitstringdutch\@@unitstringdutch -\newcommand*\@@tenstringdutch[1]{% - \ifcase#1% - \or tien% - \or twintig% - \or dertig% - \or veertig% - \or vijftig% - \or zestig% - \or zeventig% - \or tachtig% - \or negentig% - \or honderd% - \fi -}% -\global\let\@@tenstringdutch\@@tenstringdutch -\newcommand*\@@teenstringdutch[1]{% - \ifcase#1% - tien% - \or elf% - \or twaalf% - \or dertien% - \or veertien% - \or vijftien% - \or zestien% - \or zeventien% - \or achttien% - \or negentien% - \fi -}% -\global\let\@@teenstringdutch\@@teenstringdutch -\providecommand*{\honderd}{honderd}% -\providecommand*{\duizend}{duizend}% -\global\let\honderd\honderd -\global\let\duizend\duizend -\newcommand*\@@numberstringdutch[2]{% - \ifnum#1>99999\relax - \PackageError{fmtcount}{Out of range}% - {This macro only works for values less than 100000}% - \else - \ifnum#1<0\relax - \PackageError{fmtcount}{Negative numbers not permitted}% - {This macro does not work for negative numbers, however - you can try typing "minus" first, and then pass the modulus of - this number}% - \fi - \fi - \def#2{}% - \@strctr=#1\relax \divide\@strctr by 1000\relax - \ifnum\@strctr>1\relax - \@@numberunderhundreddutch{\@strctr}{#2}% - \appto#2{duizend}% - \else - \ifnum\@strctr=1\relax - \eappto#2{\duizend}% - \fi - \fi - \@strctr=#1\relax - \@FCmodulo{\@strctr}{1000}% - \divide\@strctr by 100\relax - \ifnum\@strctr>1\relax - \eappto#2{\@unitstring{\@strctr}honderd}% - \else - \ifnum\@strctr=1\relax - \ifnum#1>1000\relax - \appto#2{honderd}% - \else - \eappto#2{\honderd}% - \fi - \fi - \fi - \@strctr=#1\relax - \@FCmodulo{\@strctr}{100}% - \ifnum#1=0\relax - \def#2{null}% - \else - \ifnum\@strctr=1\relax - \appto#2{een}% - \else - \@@numberunderhundreddutch{\@strctr}{#2}% - \fi - \fi -}% -\global\let\@@numberstringdutch\@@numberstringdutch -\newcommand*{\@numberstringMdutch}[2]{% - \let\@unitstring=\@@unitstringdutch% - \let\@teenstring=\@@teenstringdutch% - \let\@tenstring=\@@tenstringdutch% - \def\@hundred{honderd}\def\@thousand{duizend}% - \def\@andname{en}% - \@@numberstringdutch{#1}{#2}% -}% -\global\let\@numberstringMdutch\@numberstringMdutch -\global\let\@numberstringFdutch=\@numberstringMdutch -\global\let\@numberstringNdutch=\@numberstringMdutch -\newcommand*{\@NumberstringMdutch}[2]{% - \@numberstringMdutch{#1}{\@@num@str}% - \edef#2{\noexpand\MakeUppercase\expandonce\@@num@str}% -}% -\global\let\@NumberstringMdutch\@NumberstringMdutch -\global\let\@NumberstringFdutch=\@NumberstringMdutch -\global\let\@NumberstringNdutch=\@NumberstringMdutch -\newcommand*\@@unitthstringdutch[1]{% - \ifcase#1% - nulde% - \or eerste% - \or tweede% - \or derde% - \or vierde% - \or vijfde% - \or zesde% - \or zevende% - \or achtste% - \or negende% - \fi -}% -\global\let\@@unitthstringdutch\@@unitthstringdutch -\newcommand*\@@tenthstringdutch[1]{% - \ifcase#1% - \or tiende% - \or twintigste% - \or dertigste% - \or veertigste% - \or vijftigste% - \or zestigste% - \or zeventigste% - \or tachtigste% - \or negentigste% - \fi -}% -\global\let\@@tenthstringdutch\@@tenthstringdutch -\newcommand*\@@teenthstringdutch[1]{% - \ifcase#1% - tiende% - \or elfde% - \or twaalfde% - \or dertiende% - \or veertiende% - \or vijftiende% - \or zestiende% - \or zeventiende% - \or achttiende% - \or negentiende% - \fi -}% -\global\let\@@teenthstringdutch\@@teenthstringdutch -\newcommand*\@@ordinalstringdutch[2]{% - \@orgargctr=#1\relax - \ifnum\@orgargctr>99999\relax - \PackageError{fmtcount}{Out of range}% - {This macro only works for values less than 100000}% - \else - \ifnum\@orgargctr<0\relax - \PackageError{fmtcount}{Negative numbers not permitted}% - {This macro does not work for negative numbers, however - you can try typing "minus" first, and then pass the modulus of - this number}% - \fi - \fi - \def#2{}% - \@strctr=\@orgargctr\divide\@strctr by 1000\relax - \ifnum\@strctr>1\relax - \@@numberunderhundreddutch{\@strctr}{#2}% - \@tmpstrctr=\@orgargctr\@FCmodulo{\@tmpstrctr}{1000}% - \ifnum\@tmpstrctr=0\relax - \eappto#2{\@thousandth}% - \else - \appto#2{duizend}% - \fi - \else - \ifnum\@strctr=1\relax - \ifnum\@orgargctr=1000\relax - \eappto#2{\@thousandth}% - \else - \eappto#2{\duizend}% - \fi - \fi - \fi - \@strctr=\@orgargctr% - \@FCmodulo{\@strctr}{1000}% - \divide\@strctr by 100\relax - \ifnum\@strctr>1\relax - \@tmpstrctr=\@orgargctr \@FCmodulo{\@tmpstrctr}{100}% - \ifnum\@tmpstrctr=0\relax - \ifnum\@strctr=1\relax - \eappto#2{\@hundredth}% - \else - \eappto#2{\@unitstring{\@strctr}\@hundredth}% - \fi - \else - \eappto#2{\@unitstring{\@strctr}honderd}% - \fi - \else - \ifnum\@strctr=1\relax - \@tmpstrctr=\@orgargctr \@FCmodulo{\@tmpstrctr}{100}% - \ifnum\@tmpstrctr=0\relax - \eappto#2{\@hundredth}% - \else - \ifnum\@orgargctr>1000\relax - \appto#2{honderd}% - \else - \eappto#2{\honderd}% - \fi - \fi - \fi - \fi - \@strctr=\@orgargctr% - \@FCmodulo{\@strctr}{100}% - \ifthenelse{\@strctr=0 \and \@orgargctr>0 }{}{% - \@@numberunderhundredthdutch{\@strctr}{#2}% - }% -}% -\global\let\@@ordinalstringdutch\@@ordinalstringdutch -\newcommand*{\@ordinalstringMdutch}[2]{% - \let\@unitthstring=\@@unitthstringdutch% - \let\@teenthstring=\@@teenthstringdutch% - \let\@tenthstring=\@@tenthstringdutch% - \let\@unitstring=\@@unitstringdutch% - \let\@teenstring=\@@teenstringdutch% - \let\@tenstring=\@@tenstringdutch% - \def\@thousandth{duizendste}% - \def\@hundredth{honderdste}% - \@@ordinalstringdutch{#1}{#2}% -}% -\global\let\@ordinalstringMdutch\@ordinalstringMdutch -\global\let\@ordinalstringFdutch=\@ordinalstringMdutch -\global\let\@ordinalstringNdutch=\@ordinalstringMdutch -\newcommand*{\@OrdinalstringMdutch}[2]{% - \@ordinalstringMdutch{#1}{\@@num@str}% - \def\@andname{en}% - \def\@hundred{Honderd}\def\@thousand{Duizend}% - \def\@hundredth{Honderdste}\def\@thousandth{Duizendste}% - \edef#2{\noexpand\MakeUppercase\expandonce\@@num@str}% -}% -\global\let\@OrdinalstringMdutch\@OrdinalstringMdutch -\global\let\@OrdinalstringFdutch=\@OrdinalstringMdutch -\global\let\@OrdinalstringNdutch=\@OrdinalstringMdutch -\newcommand*{\@@numberunderhundreddutch}[2]{% - \ifnum#1<10\relax - \ifnum#1>0\relax - \eappto#2{\@unitstring{#1}}% - \fi - \else - \@tmpstrctr=#1\relax - \@FCmodulo{\@tmpstrctr}{10}% - \ifnum#1<20\relax - \eappto#2{\@teenstring{\@tmpstrctr}}% - \else - \ifnum\@tmpstrctr=0\relax - \else - \eappto#2{\@unitstring{\@tmpstrctr}en}% - \fi - \@tmpstrctr=#1\relax - \divide\@tmpstrctr by 10\relax - \eappto#2{\@tenstring{\@tmpstrctr}}% - \fi - \fi -}% -\global\let\@@numberunderhundreddutch\@@numberunderhundreddutch -\newcommand*{\@@numberunderhundredthdutch}[2]{% - \ifnum#1<10\relax - \eappto#2{\@unitthstring{#1}}% - \else - \@tmpstrctr=#1\relax - \@FCmodulo{\@tmpstrctr}{10}% - \ifnum#1<20\relax - \eappto#2{\@teenthstring{\@tmpstrctr}}% - \else - \ifnum\@tmpstrctr=0\relax - \else - \eappto#2{\@unitstring{\@tmpstrctr}-en-}% - \fi - \@tmpstrctr=#1\relax - \divide\@tmpstrctr by 10\relax - \eappto#2{\@tenthstring{\@tmpstrctr}}% - \fi - \fi -}% -\global\let\@@numberunderhundredthdutch\@@numberunderhundredthdutch -\iffalse Local variables: \fi -\iffalse mode: docTeX \fi -\iffalse End: \fi -\endinput -%% -%% End of file `fc-dutch.def'. diff --git a/macros/latex/contrib/regulatory/tex/regulatory.sty b/macros/latex/contrib/regulatory/tex/regulatory.sty index 2e89a19a37..2755a8ac9b 100644 --- a/macros/latex/contrib/regulatory/tex/regulatory.sty +++ b/macros/latex/contrib/regulatory/tex/regulatory.sty @@ -19,9 +19,9 @@ % example1-nl.tex, example2-nl.tex, % example1-en.tex, example2-en.tex, % md-example.tex, example.md, -% fc-dutch.def and regulatory.sty +% regulatory.sty \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{regulatory}[2024/01/27 0.0.3 Xerdi's Regulatory Package] +\ProvidesPackage{regulatory}[2024/09/04 0.0.4 Xerdi's Regulatory Package] \RequirePackage{pgfopts} \RequirePackage{xifthen} diff --git a/macros/latex/contrib/scrhack/LICENSE.md b/macros/latex/contrib/scrhack/LICENSE.md new file mode 100644 index 0000000000..1863f2f61a --- /dev/null +++ b/macros/latex/contrib/scrhack/LICENSE.md @@ -0,0 +1,19 @@ +---------------------------------------------------------------------------- + +This work may be distributed and/or modified under the conditions of the +LaTeX Project Public License, version 1.3c of the license. 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 2005/12/01 +or later. This work has the LPPL maintenance status “maintained”. +The current maintainer and author of this work is Markus Kohm. + +---------------------------------------------------------------------------- + +Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz +in der Version 1.3c, verteilt und/oder verändert werden. Die aktuelle +Version dieser Lizenz ist http://www.latex-project.org/lppl.txt und +Version 1.3c oder später ist Teil aller Verteilungen von LaTeX 2005/12/01 +oder später. Dieses Werk hat den LPPL-Verwaltungs-Status „maintained”. +Der aktuelle Verwalter und Autor dieses Werks ist Markus Kohm. + +---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/scrhack/README.md b/macros/latex/contrib/scrhack/README.md new file mode 100644 index 0000000000..b85195ab54 --- /dev/null +++ b/macros/latex/contrib/scrhack/README.md @@ -0,0 +1,207 @@ +# Package `scrhack` + +Copyright © 2008–2024 Markus Kohm + +Release: 2024-09-04 v3.42 + +License: LPPL 1.3c + +KOMA presents the compatibility package to emulate the former +[KOMA-Script](https://www.ctan.org/pkg/koma-script) package `scrhack` as part +of the *third-party enhancements* project. + +------------------------------------------------------------------------------ + +This work may be distributed and/or modified under the conditions of +the LaTeX Project Public License, version 1.3c of the license. +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 2005/12/01 or later. + +This work has the LPPL maintenance status "maintained". + +The Current Maintainer and author of this work is Markus Kohm. + +------------------------------------------------------------------------------ + +# Abstract + +For several years +[KOMA-Script](https://www.sourceforge.net/project/koma-script) provided a +package `scrhack`, that has been made not only to improve the compatibility of +third-party packages with [KOMA-Script](https://www.ctan.org/pkg/koma-script) +classes, but also to generally improve third-party packages. The package +consisted not only in the package file `scrhack.sty` but also in several so +called hacks as separate files with extension `.hak`. In the course of +splitting off former [KOMA-Script](https://www.ctan.org/pkg/koma-script) +packages from the [KOMA-Script](https://www.ctan.org/pkg/koma-script) +collection, it was decided to create independent packages from the individual +hacks. These new independent packages then serve as replacements for the +original packages they were intended to improve. In addition, to preserve the +functionality of loading the enhancements only when the corresponding original +package is loaded, a new `scrhack` was created to do just that. + +# Installation for Users + +If you are a user, you should wait until all the packages of the third-party +enhancement project have been added to your preferred TeX distribution. Then +you can use the package manager of your TeX distribution to install all the +packages at once. + +Note: If you have installed a + [KOMA-Script](https://www.ctan.org/pkg/koma-script) before version 3.42, + you should also update + [KOMA-Script](https://www.ctan.org/pkg/koma-script) using the package + manager of your TeX distribution as soon as such an update is + availiabe. Otherwise it could happen, that the old integrated `scrhack` + of [KOMA-Script](https://www.ctan.org/pkg/koma-script) is used instead + of the new installed version. On the one hand, KOMA-Script 3.41 works + with both the integrated `scrhack` and the new standalone `scrhack`. On + the other hand, KOMA-Script from version 3.42 does not provide an + integrated `scrhack`. So installing the new standalone `scrhack` before + or at least with KOMA-Script version 3.42 is the best option. + +# Unpacking for Distributors + +Distributors should download [the distribution from +CTAN](https://www.ctan.org/pkg/scrhack). This consists in: + +* `scrhack.dtx` +* `scrhack-2023-07-07.dtx` +* `README.md` +* `LICENSE.md` +* `scrhack.pdf` +* `scrhack-2023-07-07.pdf` + +If distributors also want to distribute `scrhack.sty`, +`scrhack-2023-07-07.sty`, `float.hak`, `floatrow.hak`, `hyperref.hak`, +`listings.hak`, `lscape.hak`, `nomencl.hak`, `setspace.hak`, and +`standardsectioning.hak` they can unpack these using: + + tex scrhack.dtx + tex scrhack-2023-07-07.dtx + +Note, that you have to use `tex` not `latex`, `pdflatex`, `xelatex` or +`lualatex`! + +Note also, that a legal distribution consists at least in: + +* `scrhack.dtx` +* `scrhack-2023-07-07.dtx` +* `README.md` + +The following files are optionally, but must not be distributed without the +previous ones: + +* `LICENSE.md` +* `scrhack.sty` +* `scrhack.pdf` +* `scrhack-2023-07-07.sty` +* `scrhack-2023-07-07.pdf` +* `float.hak` +* `floatrow.hak` +* `hyperref.hak` +* `listings.hak` +* `lscape.hak` +* `nomencl.hak` +* `setspace.hak` +* `standardsectioning.hak` + + +# Unpacking and Installation for Developers + +Developers who want the current developer version of the code to be installed +for testing, should clone [the `third-party-enhancements` +repository](https://github.com/komascript/third-party-enhancements), e.g., +using + + git clone https://github.com/komascript/third-party-enhancements.git + +You can than either unpack and install all the third-party enhancements using: + + l3build install --full + +from within the main directory of the cloned respository. For installation of +`scrhack` only you could run the same command from within the +`scrhack` subdirectory. For installation without the manual omit +option `--full`, but this is not recommended for developers. + +Note: Installation of `scrhack` does make sense only if all other packages of + the third-party enhancement project are also installed. The new + `scrhack` does not work without these packages. + +Note: If you have already an installation of + [KOMA-Script](https://www.ctan.org/pkg/koma-script) before version 3.42 + in the user's texmf tree (`TEXMFHOME`), kpathsearch will usually find + the old integrated version of `scrhack`. Therefore LaTeX also will use + that old integrated version of `scrhack`. To prioritize the new + standalone version of `scrhack`, you would either have to remove + [KOMA-Script](https://www.ctan.org/pkg/koma-script) from the user's + texmf tree or copy `scrhack.sty` to the working directory from within + you are running LaTeX. Instead of the + [KOMA-Script](https://www.ctan.org/pkg/koma-script) version before 3.42 + you can, after removing that installation, also install a + [KOMA-Script](https://www.ctan.org/pkg/koma-script) version from 3.42, + e.g., [the current pre-release](https://komascript.de/current) or [the + developer version from + SourceForge](https://sourceforge.net/p/koma-script/code/HEAD/tree/trunk/). + +# How to get the Manual + +After installation you should get the user manual using: + + texdoc scrhack + +See the manual of your TeX distribution for more information. + +Developers or distributors can also build the manual from the source using: + + l3build doc + +# How to Contribute + +To become a contributor, e.g., do heavy testing. If you find an issue, please +report it using [the issue +tracker](https://github.com/komascript/third-party-enhancements/issues). + +You can also become a developer and, e.g., make new test files to the +packages. See the [`l3build`](https://ctan.org/pkg/l3build) manual for more +information about tests. If you've created a new test and think that it would +be useful. Please either do a pull request or [add a new +issue](https://github.com/komascript/third-party-enhancements/issues/new/choose) +and include your test file. + +Another kind of contribution would be to contact an author of one of the +third-party packages and convince her or him to integrate the code of the +corresponding enhancement package from this project into her or his package. + +# How to Report Issues + +If you think you have found a bug (or another kind of issue) using +`scrhack` you should use [the issue +tracker](https://github.com/komascript/third-party-enhancements/issues). Please +first search for similar issues already reported and maybe also already fixed +and closed. Maybe the replies to such a similar report would help you too. + +If your issue is new, you should report it also using [the issue +tracker](https://github.com/komascript/third-party-enhancements/issues). Please +be kind, not only when writing the report but also when reading replies and +commenting or answering. And please always add a minimal working example and +usually the relevant parts of the `log`-file to your report. Please use the +[markdown for +code](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks) +to add such files into the text of your report. The correct language +identifier for LaTeX code would be `latex`. For `log`-files you won't need any +language identifier. Usually you should not use attachments for code or +`log`-files unless you've been asked to do so. And please note, reports should +always be self-containing. External links often break and so the report become +useles. + +# How to Say Thank You for my Work + +Hey, I'm doing this as a hobby. So no need to say thank you. But I'm a vain +fop, so I'm certainly up for a quick thank you by email. On komascript.de you +can find an [explanation of my wishes](https://komascript.de/wunschliste) if +you want to give more. If you don't understand German, just click to links at +that page. diff --git a/macros/latex/contrib/scrhack/scrhack-2023-07-07.dtx b/macros/latex/contrib/scrhack/scrhack-2023-07-07.dtx new file mode 100644 index 0000000000..332c388e62 --- /dev/null +++ b/macros/latex/contrib/scrhack/scrhack-2023-07-07.dtx @@ -0,0 +1,2057 @@ +% \iffalse meta-comment +% ====================================================================== +% scrhack-2023-07-07.dtx +% Copyright © 2008–2023 Markus Kohm +% +% This work is a KOMA-Script spin-off. For the original sources of +% KOMA-Script's `scrhack.sty' see file `scrhack.dtx' in the KOMA-Script +% sources at <https://sourceforge.net/p/koma-script/code/>. +% +% Development is taking place as part of `scrhack' at +% <https://github.com/komascript/third-party-enhancements>. New issues +% should be reported there as well as known issues can be found. +% +% This work may be distributed and/or modified under the conditions of +% the LaTeX Project Public License, version 1.3c of the license. +% 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 2005/12/01 or later and of this work. +% +% This work has the LPPL maintenance status "author-maintained". +% +% The Current Maintainer and author of this work is Markus Kohm. +% +% This work consists of the file `scrhack.dtx', +% `scrhack-2023-07-07,dtx', and `README.md'. +% +% The recommended way to install `scrhack' is to use +% the package manager of your TeX distribution. +% ====================================================================== +% +%<package&identify>%%% using: package,identify +%<package&option>%%% using: package,option +%<package&body>%%% using: package,body +%<package&identity>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<*dtx> +\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi +\begingroup + \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}} + \filedate$Date: 2023-06-28 10:28:26 +0200 (Mi, 28 Jun 2023) $ + \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}} + \filerevision$Revision: 4063 $ +\endgroup +\ProvidesFile{scrhack-2023-07-07.dtx}[\filedate\space\filerevision\space +%</dtx> +%<package&identify>\ProvidesPackage{scrhack}[% +%<hyperref&identify>\ProvidesFile{hyperref.hak}[% +%<float&identify>\ProvidesFile{float.hak}[% +%<floatrow&identify>\ProvidesFile{floatrow.hak}[% +%<listings&identify>\ProvidesFile{listings.hak}[% +%<setspace&identify>\ProvidesFile{setspace.hak}[% +%<lscape&identify>\ProvidesFile{lscape.hak}[% +%<nomencl&identify>\ProvidesFile{nomencl.hak}[% +%<standardsections&identify>\ProvidesFile{standardsections.hak}[% +%<*dtx|identify> + 2024-04-17 v3.42 +%<*dtx> + source of +%</dtx> +%<*dtx|package> + legacy version of package scrhack% +%</dtx|package> +%<*hack> +%<hack> scrhack part +%<!standardsections> (hacking package +%<hyperref&identify> hyperref)% +%<float&identify> float)% +%<floatrow&identify> floatrow)% +%<listings&identify> listings)% +%<setspace&identify> setspace)% +%<lscape&identify> lscape)% +%<nomencl&identify> nomencl)% +%<standardsections&identify> (defining standard LaTeX class section headings)% +%</hack> +] +%</dtx|identify> +%<*dtx> +\ifx\documentclass\undefined + \input docstrip.tex + \generate{% + \file{scrhack-2023-07-07.sty}{% + \from{scrhack-2023-07-07.dtx}{package,identify}% + \from{scrhack-2023-07-07.dtx}{package,option}% + \from{scrhack-2023-07-07.dtx}{package,body}% + }% + \file{hyperref.hak}{% + \from{scrhack-2023-07-07.dtx}{hack,hyperref,identify}% + \from{scrhack-2023-07-07.dtx}{hack,hyperref,body}% + }% + \file{float.hak}{% + \from{scrhack-2023-07-07.dtx}{hack,float,identify}% + \from{scrhack-2023-07-07.dtx}{hack,float,body}% + }% + \file{floatrow.hak}{% + \from{scrhack-2023-07-07.dtx}{hack,floatrow,identify}% + \from{scrhack-2023-07-07.dtx}{hack,floatrow,body}% + }% + \file{listings.hak}{% + \from{scrhack-2023-07-07.dtx}{hack,listings,identify}% + \from{scrhack-2023-07-07.dtx}{hack,listings,body}% + }% + \file{setspace.hak}{% + \from{scrhack-2023-07-07.dtx}{hack,setspace,identify}% + \from{scrhack-2023-07-07.dtx}{hack,setspace,body}% + }% + \file{lscape.hak}{% + \from{scrhack-2023-07-07.dtx}{hack,lscape,identify}% + \from{scrhack-2023-07-07.dtx}{hack,lscape,body}% + }% + \file{nomencl.hak}{% + \from{scrhack-2023-07-07.dtx}{hack,nomencl,identify}% + \from{scrhack-2023-07-07.dtx}{hack,nomencl,body}% + }% + \file{standardsections.hak}{% + \from{scrhack-2023-07-07.dtx}{hack,standardsections,identify}% + \from{scrhack-2023-07-07.dtx}{hack,standardsections,body}% + }% + } +\else + \let\endbatchfile\relax +\fi +\endbatchfile +\documentclass[USenglish]{koma-script-source-doc} +\usepackage{babel} +\setcounter{StandardModuleDepth}{2} +\begin{document} + \DocInput{scrhack-2023-07-07.dtx} +\end{document} +%</dtx> +%\fi +% +% \changes{v3.03}{2009/03/12}{first version ever} +% \changes{v3.36}{2022/02/08}{switch over from \cls*{scrdoc} to +% \cls*{koma-script-source-doc}} +% \changes{v3.36}{2022/02/08}{require package \pkg*{scrlogo} instead of +% defining \cs{KOMAScript}} +% \changes{v3.36}{2022/02/08}{whole implementation documentation in English} +% \changes{v3.40}{2023/04/17}{guide names changed} +% +% \GetFileInfo{scrhack.dtx} +% \title{Legacy Version of Package \pkg*{scrhack}} +% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}} +% \date{2023-07-15} +% \maketitle +% \tableofcontents +% +% \section{User Manual} +% +% You can find the user manual of the legacy version in +% \href{file:scrhack.pdf}{the manual of \pkg*{scrhack}}. +% +% \MaybeStop{\PrintIndex} +% +% \section{Implementation of the Legacy Version of +% \texorpdfstring{\pkg*{scrhack}}{scrhack}} +% +% \changes{v3.04b}{2009/08/05}{order of commands/macros and options changed} +% +% \subsection{Options} +% +% The package uses \cs{KOMAoptions} of \pkg*{scrkbase} and needs at least the +% one of \KOMAScript{} v3.39: +% \begin{macrocode} +%<*package&option> +\RequirePackage{scrkbase}[2022-11-11] +\@ifpackagelater{scrkbase}{2023-07-14}{% + \PackageInfo{scrhack}{KOMA-Script >= 3.42 detected.\MessageBreak + In this case you should not use this legacy version of\MessageBreak + scrhack, but should be able to use the current version\MessageBreak + or even replace loading scrhack by loading really\MessageBreak + needed third-party patches, e.g., floatbytocbasic.\MessageBreak + But you are the boss ..}% +}{% + \@ifpackagelater{scrkbase}{2022-11-11}{% + \PackageWarningNoLine{scrhack}{KOMA-Script < 3.42 detected.\MessageBreak + In this case the original scrhack of that version\MessageBreak + should also be installed and used instead of this\MessageBreak + legacy package}% + }{% + \PackageError{scrhack}{incompatible KOMA-Script < v3.39 detected}{% + This error is fatal!\MessageBreak + Loading of scrhack will be aborted!}% + \expandafter\let\csname ver@scrhack.sty\endcsname\undefined + \endinput + }% +} +%</package&option> +% \end{macrocode} +% The options allow the selection of the used manipulations of other +% packages. But all these options are valid only until both \pkg*{scrhack} and +% the other package has been loaded. Later settings are invalid. +% +% +% \subsection{Used Macros and Commands} +% \label{sec:macros} +% \begin{macrocode} +%<*package&body> +% \end{macrocode} +% +% \begin{macro}{\scr@ifexpected} +% Mentioned to do (re)definitions only, if local execution of code does not +% change a command. Concrete, if (local) execution of \marg{test code} of +% \begin{quote} +% \cs{scr@ifexpected}\marg{command}\marg{test code}\marg{then +% code}\marg{else code} +% \end{quote} +% would not result in a change of \cs{\meta{command}}, the \marg{then code} +% will be executed, otherwise the \marg{else code}. +% \begin{description}\item[Note:] \meta{test code} must not have any global +% side effect!\end{description} +% \begin{macrocode} +\newcommand{\scr@ifexpected}[2]{% + \begingroup + \let\@tempa#1 + #2 + \ifx\@tempa#1 + \aftergroup\@firstoftwo + \else + \aftergroup\@secondoftwo + \fi + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\scr@hack@load} +% Conditionally loading of a hack file. +% \begin{quote} +% \cs{scr@hack@load}\marg{extension}\marg{basename}\marg{hack}% +% \marg{true code}\marg{false code} +% \end{quote} +% The first two arguments \marg{} and \marg{extension} and \marg{basename} are +% same to the internal\LaTeX{} kernel command \cs{@ifl@aded}. With \LaTeX{} +% from 2021/11/15 we even could use \cs{@ifl@aded} for the test, because it is +% not restricted to the preamble any more. But because it is restricted with +% older \LaTeX{} kernels, we test the definition of +% \cs{ver@}\meta{basename}\texttt{.}\meta{extension}. If it is defined, we +% also test the definition of \cs{ver@}\meta{basename}\texttt{.hak}. If this +% is not defined, \file{\meta{hack}.hak} is loaded and \meta{true code} is +% executed. Otherwise \meta{false code} is executed. This means: A hack file +% is only loaded, if a class or package (or other file with version) has +% already been loaded, but the hack file has not already been loaded. +% \begin{macrocode} +\newcommand*{\scr@hack@load}[2]{% + \expandafter\ifx\csname ver@#2.#1\endcsname\relax + \expandafter\@secondoftwo + \else +% \end{macrocode} +% Load a hack only once. +% \begin{macrocode} + \expandafter\ifx\csname ver@#2.hak\endcsname\relax + \expandafter\expandafter\expandafter\@firstoftwo + \else + \expandafter\expandafter\expandafter\@secondoftwo + \fi + \fi + {% + \PackageInfo{scrhack}{loading #2 hack}% + \edef\reserved@a{% + \noexpand\makeatletter\noexpand\input{#2.hak}% + \noexpand\catcode`\noexpand\@\the\catcode`\@\relax + }\reserved@a + }{% + \PackageInfo{scrhack}{ignorring #2 hack}% + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</package&body> +% \end{macrocode} +% +% \subsection{The \texorpdfstring{\pkg*{hyperref}}{hyperref} hack} +% +% Package \pkg{hyperref} places the anchor of the star variant of a heading +% after the heading, but the anchor of the normal variant before the heading +% even if the heading is not numbered because of the value of +% \cnt{secnumdepth}. The hack changes this to more consistent placing always +% before the heading. +% +% \begin{option}{hyperref} +% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}} +% \changes{v3.17}{2015/03/09}{defaults by \cs{KOMAExecuteOptions}} +% \begin{macrocode} +%<*package&option> +\KOMA@ifkey{hyperref}{@scrhack@hyperref}% +\KOMAExecuteOptions{hyperref=true}% +%</package&option> +% \end{macrocode} +% \changes{v3.04b}{2009/11/09}{loading \pkg{hyperref} hack earlier} +% \changes{v3.17}{2015/03/09}{auto deactivation for newer versions of +% \pkg{hyperref}} +% \changes{v3.18}{2015/05/22}{newer versions of \KOMAScript{} classes also +% deactivate the the hack} +% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} +% and \cs{KOMAExecuteOptions} removed} +% This is a little bit tricky, because \pkg{hyperref} loads the driver file +% via \cs{AtEndOfPackage} and the hack cannot be loaded before loading the +% driver file. Using \cs{AfterPackage*} would not be good enough therefore, +% because it would load the hack before the driver file. But using +% \cs{AtEndOfPackage} inside \cs{AfterPackage*} should delay the loading +% enough. This also works, if \pkg{hyperref} has already been loaded. In this +% case the code will be executed at the end of \pkg*{scrhack} instead of +% \pkg{hyperref}. This is no problem. +% \begin{macrocode} +%<*package&body> +\BeforePackage{hyperref}{% + \scr@ifundefinedorrelax{hy@insteadofrefstepcounter}{}{% + \PackageInfo{scrhack}{hyperref hack deactivated because of\MessageBreak + detection of KOMA-Script class, that doesn't\MessageBreak + need that hack,}% + \KOMAExecuteOptions[scrhack.sty]{hyperref=false}% + }% +} +\AfterPackage*{hyperref}{% + \if@scrhack@hyperref + \@ifpackagelater{hyperref}{2009/11/24}{% + \PackageInfo{scrhack}{hyperref hack deactivated because of\MessageBreak + detection of hyperref version, that doesn't\MessageBreak + need that hack,}% + \KOMAExecuteOptions[scrhack.sty]{hyperref=false}% + }{% + \AtEndOfPackage{% + \KOMA@key[scrhack.sty]{hyperref}[true]{% + \PackageWarning{scrhack}{option `hyperref=#1' ignored}% + \FamilyKeyStateProcessed + }% + \if@scrhack@hyperref\scr@hack@load\@pkgextension{hyperref}\fi + }% + }% + \fi +} +%</package&body> +% \end{macrocode} +% \end{option} +% +% +% \begin{macro}{\@schapter,\@spart,\@ssect} +% We do not hack \pkg{hyperref} itself, but the driver files. After loading +% \pkg{hyperref} the driver file is also loaded. Moreover, all driver files +% that re-define these commands have to be patched also. So the patch is +% related to the loading of \pkg{hyperref} instead of every single driver +% file. This have already been tested by \cs{scr@hack@load}. So we just have +% to test, whether the definition of these commands are the expected one. +% derzeit den erwarteten Inhalt haben. +% \begin{macrocode} +%<*hyperref&body> +\scr@ifexpected\@schapter{% + \def\@schapter#1{% + \H@old@schapter{#1}% + \begingroup + \let\@mkboth\@gobbletwo + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}% + \Hy@raisedlink{% + \hyper@anchorstart{\@currentHref}\hyper@anchorend + }% + \endgroup + }% +}{% + \PackageInfo{scrhack}{redefining \string\@schapter}% + \def\@schapter#1{% + \begingroup + \let\@mkboth\@gobbletwo + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}% + \Hy@raisedlink{% + \hyper@anchorstart{\@currentHref}\hyper@anchorend + }% + \endgroup + \H@old@schapter{#1}% + }% +}{% + \scr@ifexpected\@schapter{% + \def\@schapter#1{% + \begingroup + \let\@mkboth\@gobbletwo + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}% + \Hy@raisedlink{% + \hyper@anchorstart{\@currentHref}\hyper@anchorend + }% + \endgroup + \H@old@schapter{#1}% + }% + }{}{% + \PackageWarningNoLine{scrhack}{unknown \string\@schapter\space + definition found!\MessageBreak + Maybe you are using a unsupported hyperref version}% + }% +} +\scr@ifexpected\@spart{% + \def\@spart#1{% + \H@old@spart{#1}% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{part*.\the\Hy@linkcounter}% + \Hy@raisedlink{% + \hyper@anchorstart{\@currentHref}\hyper@anchorend + }% + }% +}{% + \PackageInfo{scrhack}{redefining \string\@spart}% + \def\@spart#1{% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{part*.\the\Hy@linkcounter}% + \Hy@raisedlink{% + \hyper@anchorstart{\@currentHref}\hyper@anchorend + }% + \H@old@spart{#1}% + }% +}{% + \scr@ifexpected\@spart{% + \def\@spart#1{% + \Hy@GlobalStepCount\Hy@linkcounter + \xdef\@currentHref{part*.\the\Hy@linkcounter}% + \Hy@raisedlink{% + \hyper@anchorstart{\@currentHref}\hyper@anchorend + }% + \H@old@spart{#1}% + }% + }{}{% + \PackageWarningNoLine{scrhack}{unknown \string\@spart\space + definition found!\MessageBreak + Maybe you are using a unsupported hyperref version}% + }% +} +\scr@ifexpected\@ssect{% + \def\@ssect#1#2#3#4#5{% + \H@old@ssect{#1}{#2}{#3}{#4}{#5}% + \phantomsection + }% +}{% + \PackageInfo{scrhack}{redefining \string\@ssect}% + \def\@ssect#1#2#3#4#5{% + \H@old@ssect{#1}{#2}{#3}{#4}{\phantomsection\ignorespaces#5}% + }% +}{% + \scr@ifexpected\@ssect{% + \def\@ssect#1#2#3#4#5{% + \H@old@ssect{#1}{#2}{#3}{#4}{\phantomsection\ignorespaces#5}% + }% + }{}{% + \PackageWarningNoLine{scrhack}{unknown \string\@ssect\space + definition found!\MessageBreak + Maybe you are using a unsupported hyperref version}% + }% +} +%</hyperref&body> +% \end{macrocode} +% \end{macro} +% +% +% \subsection{The \texorpdfstring{\pkg*{floatrow}}{floatrow} hack} +% +% Package \pkg{floatrow} insists in using \cs{float@listhead} for the setting +% of the headings. This is not recommended any longer since \KOMAScript~2.95 +% from July 2006! The \KOMAScript{} classes will remove the support for +% this very limited approach. Recommended is the usage of \pkg*{tocbasic}. The +% effort to do so, it very small and I do not understand, why package authors +% are not willing to use it. Because the benefit would be a lot. +% +% This hack adds \pkg*{tocbasic} usage to \pkg{floatrow}. Nevertheless it is +% more complicated than adding \pkg*{tocbasic} support into \pkg{floatrow}. +% +% \begin{option}{floatrow} +% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}} +% \changes{v3.17}{2015/03/09}{using \cs{KOMAExecuteOptions}} +% \changes{v3.34}{2021/06/03}{deactivation of the \pkg{float} hack} +% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} +% removed} +% \begin{macrocode} +%<*package&option> +\KOMA@ifkey{floatrow}{@scrhack@floatrow} +\KOMAExecuteOptions{floatrow=true} +%</package&option> +%<*package&body> +\AfterPackage*{floatrow}{% + \KOMAoptions{float=false}% + \PackageInfo{scrhack}{option `float' deactivated}% + \KOMA@key[scrhack.sty]{floatrow}{% + \PackageWarning{scrhack}{option `floatrow' ignored}% + \FamilyKeyStateProcessed + }% + \if@scrhack@floatrow\scr@hack@load\@pkgextension{floatrow}\fi +} +%</package&body> +% \end{macrocode} +% \end{option} +% +% +% \begin{command}{\DeclareNewFloatType,\listof} +% \changes{v3.25}{2018/03/16}{using \cs{DeclareTOCStyleEntry}} +% Command \cs{DeclareNewFloatType} is used to define a new float +% environment. We have to add registration of the file extension (third +% argument) with \pkg*{tocbasic}. +% Command \cs{listof} outputs the list of the float environments. Here we +% just use the corresponding macro of \pkg*{tocbasic}. +% \begin{macro}{\float@addtolists} +% The deprecated macro \cs{float@addtolists} is not needed any longer an will +% be reset to the original definition. +% \begin{macrocode} +%<*floatrow&body> +\scr@ifexpected{\DeclareNewFloatType}{% + \long\def\DeclareNewFloatType#1#2{\def\FB@captype{#1}% + \expandafter\edef\csname ftype@#1\endcsname{\the\c@float@type}% + \addtocounter{float@type}{\value{float@type}}% + \@namedef{#1name}{#1}\newcounter{#1}% + \expandafter\edef\csname fnum@#1\endcsname + {\expandafter\noexpand\csname #1name\endcsname\nobreakspace + \expandafter\noexpand\csname the#1\endcsname}% + \@namedef{the#1}{\arabic{#1}}\flnew@ext{lo#1}\@namedef{fps@#1}{tbp}% + \@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}% + \caption@setkeys[floatrow]{newfloat}{#2}\let\FR@tmp=\relax + \xdef\@tempa{\noexpand\flrow@types{\the\flrow@types \FR@tmp{#1}}}% + \@tempa}% +}{% + \scr@ifexpected{\listof}{% + \def\listof#1#2{% + \@ifundefined{ext@#1}{\flrow@error{Unknown float style `#1'}}{% + \expandafter\providecommand\csname l@#1\endcsname + {\@dottedtocline{1}{1.5em}{2.3em}}% + \float@listhead{#2}% + \begingroup\setlength{\parskip}{\z@}% + \@starttoc{\@nameuse{ext@#1}}% + \endgroup}}% + }{% + \RequirePackage{tocbasic}% + \PackageInfo{scrhack}{redefining \string\DeclareNewFloatType}% +% \end{macrocode} +% \begin{description} +% \item[Note:] It would be better to first test, if the new extension is +% already in use like done at the \pkg{float} hack. But I don't know the +% \pkg{floatrow} code good enough to make such a change! +% \end{description} +% \begin{macrocode} + \renewcommand\DeclareNewFloatType[2]{\def\FB@captype{#1}% + \expandafter\edef\csname ftype@#1\endcsname{\the\c@float@type}% + \addtocounter{float@type}{\value{float@type}}% + \@namedef{#1name}{#1}\newcounter{#1}% + \expandafter\edef\csname fnum@#1\endcsname + {\expandafter\noexpand\csname #1name\endcsname\nobreakspace + \expandafter\noexpand\csname the#1\endcsname}% + \@namedef{the#1}{\arabic{#1}}\flnew@ext{lo#1}\@namedef{fps@#1}{tbp}% + \DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em]{default}{#1}% + \caption@setkeys[floatrow]{newfloat}{#2}\let\FR@tmp=\relax + \xdef\@tempa{\noexpand\flrow@types{\the\flrow@types \FR@tmp{#1}}}% + \@tempa + \xdef\@tempa{\noexpand\addtotoclist[float]{\@nameuse{ext@\FB@captype}}% + \noexpand\setuptoc{\@nameuse{ext@\FB@captype}}{chapteratlist}% + }% + \@tempa + }% + \PackageInfo{scrhack}{redefining \string\listof}% + \renewcommand*\listof[2]{% + \@ifundefined{ext@#1}{\flrow@error{Unknown float style `#1'}}{% + \@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure + \@ifundefined{l@#1}{% + \DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em] + {default}{#1}% + }{}% + }{}% + \listoftoc[{#2}]{\csname ext@#1\endcsname}% + }% + }% + \scr@ifexpected{\float@addtolists}{% + \long\def\float@addtolists#1{% + \def\float@do##1{\addtocontents{##1}{#1}} \the\float@exts}% + }{% + \PackageInfo{scrhack}{undefining \string\float@addtolists}% + \let\float@addtolists\relax + }{% + \PackageWarningNoLine{scrhack}{unkown \string\float@addtolists\space + definition found!\MessageBreak + Maybe you are using a unsupported floatrow version}% + }% + }{% + \PackageWarningNoLine{scrhack}{unknown \string\listof\space + definition found!\MessageBreak + Maybe you are using a unsupported floatrow version}% + }% +}{% + \PackageWarningNoLine{scrhack}{unknown \string\DeclareNewFloatType\space + definition found!\MessageBreak + Maybe you are using a unsupported floatrow version}% +} +%</floatrow&body> +% \end{macrocode} +% \end{macro} +% \end{command} +% +% +% \subsection{The \texorpdfstring{\pkg*{float}}{float} hack} +% +% Package \pkg{float} insists in using \cs{float@listhead} for the setting +% of the headings. This is not recommended any longer since \KOMAScript~2.95 +% from July 2006! The \KOMAScript{} classes will remove the support for +% this very limited approach. Recommended is the usage of \pkg*{tocbasic}. The +% effort to do so, it very small and I do not understand, why package authors +% are not willing to use it. Because the benefit would be a lot. +% +% This hack adds \pkg*{tocbasic} usage to \pkg{float}. Nevertheless it is +% more complicated than adding \pkg*{tocbasic} support into \pkg{float}. +% +% \begin{option}{float} +% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}} +% \changes{v3.17}{2015/03/09}{using \cs{KOMAExecuteOptions}} +% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} +% removed} +% \begin{macrocode} +%<*package&option> +\KOMA@ifkey{float}{@scrhack@float}% +\KOMAExecuteOptions{float=true}% +%</package&option> +%<*package&body> +\AfterPackage*{float}{% + \KOMA@key[scrhack.sty]{float}{% + \PackageWarning{scrhack}{option `float' ignored}% + \FamilyKeyStateProcessed + }% + \if@scrhack@float\scr@hack@load\@pkgextension{float}\fi +} +%</package&body> +% \end{macrocode} +% \end{option} +% +% +% \begin{command}{\newfloat} +% \changes{v3.28}{2019/11/19}{\cs{ifattoclist} replaced by +% \cs{Ifattoclist}} +% \changes{v3.25}{2018/03/16}{using \cs{DeclareTOCStyleEntry}} +% We have to add registration of the file extension (third argument of +% \cs{newfloat}) with \pkg*{tocbasic}. +% \begin{command}{\listof} +% Command \cs{listof} outputs the list of the float environments. Here we +% just use the corresponding macro of \pkg*{tocbasic}. +% \begin{macro}{\float@addtolists} +% The deprecated macro \cs{float@addtolists} is not needed any longer an will +% be reset to the original definition. +% \begin{macrocode} +%<*float&body> +\scr@ifexpected{\newfloat}{% + \long\def\newfloat#1#2#3{\@namedef{ext@#1}{#3} + \let\float@do=\relax + \xdef\@tempa{\noexpand\float@exts{\the\float@exts \float@do{#3}}}% + \@tempa + \floatplacement{#1}{#2}% + \@ifundefined{fname@#1}{\floatname{#1}{#1}}{} + \expandafter\edef\csname ftype@#1\endcsname{\value{float@type}}% + \addtocounter{float@type}{\value{float@type}} + \restylefloat{#1}% + \expandafter\edef\csname fnum@#1\endcsname% + {\expandafter\noexpand\csname fname@#1\endcsname{} + \expandafter\noexpand\csname the#1\endcsname} + \@ifnextchar[%] + {\float@newx{#1}}% + {\@ifundefined{c@#1}{\newcounter{#1}\@namedef{the#1}{\arabic{#1}}}% + {}}}% +}{% + \scr@ifexpected{\listof}{% + \def\listof#1#2{% + \@ifundefined{ext@#1}{\float@error{#1}}{% + \@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}% + \float@listhead{#2}% + \begingroup\setlength{\parskip}{\z@}% + \@starttoc{\@nameuse{ext@#1}}% + \endgroup}}% + }{% + \RequirePackage{tocbasic}% + \PackageInfo{scrhack}{redefining \string\newfloat}% + \renewcommand\newfloat[3]{% + \Ifattoclist{#3}{% + \PackageError{scrhack}{extension `#3' already in use}{% + Each extension may be used only once.\MessageBreak + You, the class, or another package already uses extension + `#3'.\MessageBreak + \string\newfloat\space command will be ignored!}% + }{% + \addtotoclist[float]{#3}% + \setuptoc{#3}{chapteratlist}% + \@namedef{ext@#1}{#3}% + \let\float@do=\relax + \xdef\@tempa{\noexpand\float@exts{\the\float@exts \float@do{#3}}}% + \@tempa + \floatplacement{#1}{#2}% + \@ifundefined{fname@#1}{\floatname{#1}{#1}}{}% + \expandafter\edef\csname ftype@#1\endcsname{\value{float@type}}% + \addtocounter{float@type}{\value{float@type}} + \restylefloat{#1}% + \expandafter\edef\csname fnum@#1\endcsname% + {\expandafter\noexpand\csname fname@#1\endcsname{} + \expandafter\noexpand\csname the#1\endcsname}% + \@ifnextchar[%] + {\float@newx{#1}}% + {\@ifundefined{c@#1}{\newcounter{#1}\@namedef{the#1}{\arabic{#1}}}% + {}}}% + }% + \PackageInfo{scrhack}{redefining \string\listof}% + \renewcommand*\listof[2]{% + \@ifundefined{ext@#1}{\float@error{#1}}{% + \@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure + \@ifundefined{l@#1}{% + \DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em] + {default}{#1}% + }{}% + }{}% + \listoftoc[{#2}]{\csname ext@#1\endcsname}% + }% + }% + \scr@ifexpected{\float@addtolists}{% + \long\def\float@addtolists#1{% + \def\float@do##1{\addtocontents{##1}{#1}} \the\float@exts}% + }{% + \PackageInfo{scrhack}{undefining \string\float@addtolists}% + \let\float@addtolists\relax + }{% + \PackageWarningNoLine{scrhack}{unkown \string\float@addtolists\space + definition found!\MessageBreak + Maybe you are using a unsupported float version}% + }% + }{% + \PackageWarningNoLine{scrhack}{unknown \string\listof\space + definition found!\MessageBreak + Maybe you are using a unsupported float version}% + }% +}{% + \PackageWarningNoLine{scrhack}{unknown \string\newfloat\space + definition found!\MessageBreak + Maybe you are using a unsupported float version}% +} +%</float&body> +% \end{macrocode} +% \end{macro} +% \end{command} +% \end{command} +% +% +% \subsection{The \texorpdfstring{\pkg*{listings}}{listings} hack} +% +% Package \pkg{listing} insists in using \cs{float@listhead} for the setting +% of the headings. This is not recommended any longer since \KOMAScript~2.95 +% from July 2006! The \KOMAScript{} classes will remove the support for +% this very limited approach. Recommended is the usage of \pkg*{tocbasic}. The +% effort to do so, it very small and I do not understand, why package authors +% are not willing to use it. Because the benefit would be a lot. +% +% This hack adds \pkg*{tocbasic} usage to old versions of +% \pkg{listings}. Nevertheless it is more complicated than adding +% \pkg*{tocbasic} support into \pkg{listings}. +% +% \begin{option}{listings} +% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}} +% \changes{v3.17}{2015/03/09}{using \cs{KOMAExecuteOptions}} +% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} +% removed} +% \changes{v3.42}{2024/04/17}{automatic deactivation for new \pkg{listings}} +% Note: The deactivation of the hack for new version of \pkg{listings} cannot +% be done comparing the \pkg{listings} version, because \pkg{listings} version +% 1.10 uses \cs{AtEndOfPackage} for \cs{ProvidesPackage} and therefore the +% version is not defined when the after package hook is executed. So we test +% instead the \pkg{lstmisc} version. +% \begin{macrocode} +%<*package&option> +\KOMA@ifkey{listings}{@scrhack@listings} +\KOMAExecuteOptions{listings=true} +%</package&option> +%<*package&body> +\AfterPackage*{listings}{% + \@ifpackagelater{lstmisc}{2024/02/15}{% + \PackageInfo{scrhack}{listings hack deactivated because of\MessageBreak + detection of listings version, that doesn't\MessageBreak + need that hack,}% + \KOMAExecuteOptions[scrhack.sty]{listings=false}% + }{% + \if@scrhack@listings\scr@hack@load\@pkgextension{listings}\fi + }% + \KOMA@key[scrhack.sty]{listings}[true]{% + \PackageWarning{scrhack}{option `listings=#1' ignored}% + \FamilyKeyStateProcessed + }% +} +%</package&body> +% \end{macrocode} +% \end{option} +% +% +% \begin{macro}{\scr@do@hack@listings} +% \changes{v3.41}{2023/06/28}{patching \cs{lst@MakeCaption} to use +% \cs{ext@lstlisting}} +% \begin{command}{\lstlistoflistings} +% \cs{scr@do@hack@listings} patches \pkg{listings} to use \pkg*{tocbasic} for +% the whole output of the list of listings. This adds several new features to +% \pkg{listings}. +% \begin{macro}{\ext@lstlisting,\lst@MakeCaption,\float@addtolists} +% Macro \cs{ext@lstlisting} is defined, to make \cs{captionof} work with +% argument \texttt{lstlisting}. Additionally \cs{lst@MakeCaption} is patched +% to use the new macro. The deprecated macro \cs{float@addtolists} is not +% needed any longer an will be reset to the original definition. But, because +% \pkg{listings} delays the redefinition with \cs{AtBeginDocument} we have to +% do the same here. +% \begin{macrocode} +%<*listings&body> +\newcommand*{\scr@do@hack@listings}{% + \RequirePackage{tocbasic}% + \addtotoclist[float]{lol}% + \setuptoc{lol}{chapteratlist}% + \PackageInfo{scrhack}{redefining \string\lstlistoflistings}% + \renewcommand*{\lstlistoflistings}{\listoftoc[{\lstlistlistingname}]{lol}}% + \providecommand*{\ext@lstlisting}{lol}% + \@tempswafalse + \xpatchcmd\lst@MakeCaption + {\addcontentsline{lol}}% + {\addcontentsline{\ext@lstlisting}}% + {\PackageInfo{scrhack}{patching \string\lst@MakeCaption}\@tempswatrue}% + {\PackageWarning{scrhack}{cannot patch \string\lst@MakeCaption}}% + \@whilesw\if@tempswa\fi{% + \xpatchcmd\lst@MakeCaption + {\addcontentsline{lol}}% + {\addcontentsline{\ext@lstlisting}}% + {}% + {\@tempswafalse}% + }% + \AtBeginDocument{% + \scr@ifexpected{\float@addtolists}{% + \def\float@addtolists##1{\addtocontents{lol}{##1}}% + }{% + \PackageInfo{scrhack}{undefining \string\float@addtolists}% + \let\float@addtolists\relax + }{% + \scr@ifexpected{\float@addtolists}{% + \def\float@addtolists##1{\addtocontents{lol}{##1}% + \orig@float@addtolists{##1}}% + }{% + \PackageInfo{scrhack}{setting \string\float@addtolists\MessageBreak + to \string\orig@float@addtolists}% + \let\float@addtolists\orig@float@addtolists + }{% + \PackageWarningNoLine{scrhack}{unkown \string\float@addtolists\space + definition found!\MessageBreak + Maybe you are using a unsupported listings version}% + }% + }% + }% +% \end{macrocode} +% \begin{macro}{\lst@makecaption} +% \changes{v3.30}{2020/04/01}{setting of \cs{@captype} added} +% From version~3.30 setting of \cs{@captype} to \texttt{lstlisting} is added +% to \cs{lst@makecaption}. This adds support for usage of +% \cs{raggedlstlistingcaption} (if the user or a package author defines +% it). The change is a little bit dangerous, because it will break, if +% \pkg{listings} would add an argument to \cs{lst@makecaption}. +% \begin{macrocode} + \expandafter\def\expandafter\lst@makecaption\expandafter{% + \expandafter\def\expandafter\@captype\expandafter{% + \expandafter l\expandafter s\expandafter t\expandafter l% + \expandafter i\expandafter s\expandafter t\expandafter i% + \expandafter n\expandafter g\expandafter}\lst@makecaption + }% + \let\scr@do@hack@listings\relax +} +\scr@ifexpected{\lstlistoflistings}{% + \def\lstlistoflistings{\bgroup + \let\contentsname\lstlistlistingname + \let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lol}}% + \tableofcontents \egroup}% +}{% + \scr@do@hack@listings +}{% + \scr@ifexpected{\lstlistoflistings}{% + \def\lstlistoflistings{% + \begingroup + \@ifundefined{@restonecoltrue}{}{% + \if@twocolumn + \@restonecoltrue\onecolumn + \else + \@restonecolfalse + \fi + }% + \float@listhead{\lstlistlistingname}% + \parskip\z@\parindent\z@\parfillskip \z@ \@plus 1fil% + \@starttoc{lol}% + \@ifundefined{@restonecoltrue}{}{% + \if@restonecol\twocolumn\fi + }% + \endgroup + }% + }{% + \scr@do@hack@listings + }{% + \PackageWarningNoLine{scrhack}{unknown \string\lstlistoflistings\space + definition found!\MessageBreak + Maybe you are using a unsupported listings version}% + }% +} +%</listings&body> +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{command} +% \end{macro} +% +% +% +% \subsection{The \texorpdfstring{\pkg*{nomencl}}{nomencl} hack} +% +% With package \pkg{nomencl} and the \KOMAScript{} classes there is only a +% small disharmony between relating the ToC entry. Nevertheless the package +% can benefit from using \pkg*{tocbasic}. +% +% This hack adds \pkg*{tocbasic} usage to \pkg{nomencl}. This is done using +% \pkg{xpatch} Nevertheless it is much more complicated than adding real +% \pkg*{tocbasic} support into \pkg{nomencl}. The mess is, that every new +% release of \pkg{nomencl} changes the kind of ``support'' of +% \pkg*{tocbasic}. For some versions there isn't any such support. Other +% versions use \pkg*{tocbasic} if it has been loaded. Other versions need an +% option to activate usage of \pkg*{tocbasic}. So don't expect that the +% following hack does the correct thing for every version of \pkg{nomencl}! +% +% \begin{option}{nomencl} +% \changes{v3.23}{2017/03/31}{added} +% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} +% removed} +% \begin{macrocode} +%<*package&option> +\RequirePackage{xpatch}% +\KOMA@ifkey{nomencl}{@scrhack@nomencl} +\KOMAExecuteOptions{nomencl=true} +%</package&option> +%<*package&body> +\AfterPackage*{nomencl}{% + \KOMA@key[scrhack.sty]{nomencl}{% + \PackageWarning{scrhack}{option `nomencl' ignored}% + \FamilyKeyStateProcessed + }% + \if@scrhack@nomencl\scr@hack@load\@pkgextension{nomencl}\fi +} +%</package&body> +% \end{macrocode} +% \end{option}^^A nomencl +% +% \begin{command}{\thenomenclature} +% \changes{v3.23}{2017/03/31}{added} +% Instead of using the several definitions by cases of the several versions of +% \pkg{nomencl} we use a patch, that should remove all such cases and use +% \pkg*{tocbasic} always. +% \begin{macrocode} +%<*nomencl&body> +\RequirePackage{tocbasic} +% \end{macrocode} +% With \pkg{nomencl} > 5.0 this should be all. +% Unfortunately is isn't, because newer versions of \pkg{nomencl} need option +% \opt{tocbasic} to be set. Good luck: It is the default. So the chances +% are good, that with new versions of \pkg{nomencl} usage of \pkg*{tocbasic} is +% the default. +% \begin{macrocode} +\@ifpackagelater{nomencl}{2019/01/01}{% + \PackageInfo{scrhack}{only `tocbasic' loaded for `nomencl'}% + \expandafter\endinput +}{} +% \end{macrocode} +% Otherwise we have to patch it. +% \begin{macrocode} +\addtotoclist[nomencl]{nlo} +\addtotoclist[nomencl]{nls} +\xpatchcmd{\thenomenclature}{% + \@ifundefined{chapter}% + { + \section*{\nomname} + \if@intoc\addcontentsline{toc}{section}{\nomname}\fi% + }% + { + \chapter*{\nomname} + \if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi% + }% +}{% + \scr@hack@nomencl@head +}{% + \PackageInfo{scrhack}{\string\thenomenclature\space successfully patched}% +}{% +% \end{macrocode} +% \changes{v3.26b}{2019/01/23}{new \pkg{nomencl} 5.0} +% From \pkg{nomencl} 5.0 another code is used if the nomenclature is a +% chapter. So we need another patch: +% \begin{macrocode} + \xpatchcmd{\thenomenclature}{% + \@ifundefined{chapter}% + { + \section*{\nomname} + \if@intoc\addcontentsline{toc}{section}{\nomname}\fi% + }% + { + \chapter*{\nomname} + \markboth{\nomname}{\nomname}% + \if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi% + }% + }{% + \scr@hack@nomencl@head + }{% + \PackageInfo{scrhack}{\string\thenomenclature\space successfully patched}% + }{% +% \end{macrocode} +% \changes{v3.26b}{2019/01/23}{prepared for hoply comming \pkg{nomencl}} +% But this code is also wrong, because it breaks manual running heads, e.g., +% of page style \texttt{myheadings}. So I hope, there will be another code, +% that needs a somehow different patch: +% \begin{macrocode} + \xpatchcmd{\thenomenclature}{% + \@ifundefined{chapter}% + { + \section*{\nomname} + \if@intoc\addcontentsline{toc}{section}{\nomname}\fi% + }% + { + \chapter*{\nomname} + \@mkboth{\nomname}{\nomname}% + \if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi% + }% + }{% + \scr@hack@nomencl@head + }{% + \PackageInfo{scrhack}{\string\thenomenclature\space successfully patched}% + }{% +% \end{macrocode} +% \changes{v3.25}{2019/01/23}{emergency patch added} +% \changes{v3.30}{2020/02/25}{spurious space in warning message removed} +% If this also does not work, we try an emergency patch, that could break +% things. +% \begin{macrocode} + \xpatchcmd{\thenomenclature}{% + \@ifundefined{chapter}% + }{% + \scr@hack@nomencl@head + \@gobbletwo + }{% + \PackageWarning{scrhack}{% + using emergency patch of \string\thenomenclature.\MessageBreak + This could happen if you are using an unknown\MessageBreak + release of package `nomencl'.\MessageBreak + Mostly this patch does work too, but it also could\MessageBreak + break `nomencl`. If this happens, please deactivate\MessageBreak + the `nomencl` hack of `scrhack`% + }% + }{% + \PackageWarning{scrhack}{% + cannot patch \string\thenomenclature.\MessageBreak + This could happen if you are using an unknown\MessageBreak + release of package `nomencl'% + }% + }% + }% + }% +} +%</nomencl&body> +% \end{macrocode} +% \end{command}^^A \thenomenclature +% +% \begin{macro}{\scr@hack@nomencl@head} +% \changes{v3.23}{2017/03/31}{heading of \env{thenomenclature} by +% \pkg*{tocbasic}} +% \changes{v3.31}{2020/07/08}{internal \cs{list@fname} eliminated} +% We don't need an extra group, because \env{thenomenclature} already adds the +% group. +% \begin{macrocode} +%<*nomencl&body> +\newcommand*{\scr@hack@nomencl@head}{% + \providecommand*{\listofnlsname}{\nomname}% + \def\@currext{nls}% + \tocbasic@listhead{\nomname}% +} +%</nomencl&body> +% \end{macrocode} +% \begin{description} +% \item[Note:] Only the heading hooks of \pkg*{tocbasic} are used. The other +% hooks can be set, but would never be used! +% \end{description} +% \end{macro}^^A \scr@hack@nomencl@head +% +% \begin{macro}{\if@intoc} +% \changes{3.23}{2017/03/31}{support of \cs{if@intoc}} +% Generally we have to support \pkg{nomencl}'s option \opt{intoc} and the +% switch \cs{if@intoc}. This is done by (un-)setting \pkg*{tocbasic} feature +% \texttt{totoc}. So additional changes of the feature can be done at first +% after loading both, \pkg{nomencl} and \pkg*{scrhack}. Moreover, later changes +% of \cs{if@intoc} are not recognized. +% \begin{macrocode} +%<*nomencl&body> +\if@intoc + \setuptoc{nls}{totoc} +\fi +%</nomencl&body> +% \end{macrocode} +% \end{macro} +% +% +% \subsection{The \texorpdfstring{\pkg*{setspace}}{setspace} hack} +% +% Package \pkg{setspace} internally uses \cs{@ptsize} in a way, that only +% works as long as \cs{@ptsize} is an integer. But because \KOMAScript{} +% supports non integer font sizes, \cs{@ptsize} can also contain non-integer +% values. Moreover for \opt{11pt}, \LaTeX{} does not use a 11\,pt font but +% a 10.95\,pt font with a \len{baselineskip} of 13.6\,pt, the correct factor +% for, e.g., \cs{onehalfspacing} would be: +% \[ 10{,}95\,\mathrm{pt} \dot 1{,5} / 13{,}6\,\mathrm{pt} \equiv 1{,}208 \] +% But \pkg{setspace} uses 1.213, which would be correct for 11\,pt. Moreover +% the factor is always relative to the base font size and not the current font +% size. Because of this +% \begin{verbatim} +% \documentclass[10pt]{article} +% \usepackage{setspace} +% \begin{document} +% \large\onehalfspacing\raggedright +% Fontsize: \csname f@size\endcsname pt\\ +% Normal baselineskip: \csname f@baselineskip\endcsname\\ +% baselineskip: \the\baselineskip +% \end{document} +% \end{verbatim} +% results in another \len{baselineskip} than: +% \begin{verbatim} +% \documentclass[11pt]{article} +% \usepackage{setspace} +% \begin{document} +% \large\onehalfspacing\raggedright +% Fontsize: \csname f@size\endcsname pt\\ +% Normal baselineskip: \csname f@baselineskip\endcsname\\ +% baselineskip: \the\baselineskip +% \end{document} +% \end{verbatim} +% despite both examples use the same font size. So, to make it absolutely +% correct, the factor would have to change with every change of the font +% size. But the hack also does not do so. It just calculates the factor +% depending on the base font size an the current font size. This is enough to +% have the same \len{baselineskip} with both of the examples above. +% +% \begin{option}{setspace} +% \changes{v3.17}{2015/04/16}{added} +% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} +% removed} +% \begin{macrocode} +%<*package&option> +\KOMA@ifkey{setspace}{@scrhack@setspace} +\KOMAExecuteOptions{setspace=true} +%</package&option> +%<*package&body> +\AfterPackage*{setspace}{% + \KOMA@key[scrhack.sty]{setspace}{% + \PackageWarning{scrhack}{option `setspace' ignored}% + \FamilyKeyStateProcessed + }% + \if@scrhack@setspace\scr@hack@load\@pkgextension{setspace}\fi +} +%</package&body> +% \end{macrocode} +% \end{option} +% +% +% \begin{command}{\onehalfspacing} +% \changes{v3.17}{2015/04/16}{added} +% This selects the one half line spacing. I think, a factor with three digits +% for the decimals should be enough. +% \begin{macrocode} +%<*setspace&body> +\scr@ifexpected{\onehalfspacing}{% + \long\def\onehalfspacing{% + \setstretch{1.25}% default + \ifcase \@ptsize \relax % 10pt + \setstretch {1.25}% + \or % 11pt + \setstretch {1.213}% + \or % 12pt + \setstretch {1.241}% + \fi + }% +}{% + \renewcommand*{\onehalfspacing}{% + \@tempdima=\dimexpr (\f@size pt)*1500/ + (\dimexpr \f@baselineskip\relax)*\p@/1000\relax + \expandafter\setstretch\expandafter{\strip@pt\@tempdima}% + }% +}{% +% \end{macrocode} +% \changes{v3.39}{2023/03/15}{support for \pkg{setspace} 6.7b added} +% \begin{macrocode} + \scr@ifexpected{\onehalfspacing}{% + \long\def\onehalfspacing{% + \setstretch{1.25}% default +% DPC 6.7b guard \@ptsize + \ifx\@ptsize\@undefined\else + \ifcase \@ptsize \relax % 10pt + \setstretch {1.25}% + \or % 11pt + \setstretch {1.213}% + \or % 12pt + \setstretch {1.241}% + \fi + \fi + }% + }{% + \renewcommand*{\onehalfspacing}{% + \@tempdima=\dimexpr (\f@size pt)*1500/ + (\dimexpr \f@baselineskip\relax)*\p@/1000\relax + \expandafter\setstretch\expandafter{\strip@pt\@tempdima}% + }% + }{% + \PackageWarning{scrhack}{unknown \string\onehalfspacing\space + definition found!\MessageBreak + Maybe you are using a unsupported setpace version}% + }% +} +% \end{macrocode} +% \end{command} +% \begin{command}{\doublespacing} +% \changes{v3.17}{2015/04/16}{new} +% This selects the double line spacing. I think, a factor with three digits +% for the decimals should be enough. +% \begin{macrocode} +\scr@ifexpected{\doublespacing}{% + \long\def\doublespacing{% + \setstretch{1.667}% default + \ifcase \@ptsize \relax % 10pt + \setstretch {1.667}% + \or % 11pt + \setstretch {1.618}% + \or % 12pt + \setstretch {1.655}% + \fi + }% +}{% + \renewcommand*{\doublespacing}{% + \@tempdima=\dimexpr (\f@size pt)*2000/ + (\dimexpr \f@baselineskip\relax)*\p@/1000\relax + \expandafter\setstretch\expandafter{\strip@pt\@tempdima}% + }% +}{% +% \end{macrocode} +% \changes{v3.39}{2023/03/15}{support for \pkg{setspace} 6.7b added} +% \begin{macrocode} + \scr@ifexpected{\doublespacing}{% + \long\def\doublespacing{% + \setstretch {1.667}% default +% DPC 6.7b guard \@ptsize + \ifx\@ptsize\@undefined\else + \ifcase \@ptsize \relax % 10pt + \setstretch {1.667}% + \or % 11pt + \setstretch {1.618}% + \or % 12pt + \setstretch {1.655}% + \fi + \fi + }% + }{% + \renewcommand*{\doublespacing}{% + \@tempdima=\dimexpr (\f@size pt)*2000/ + (\dimexpr \f@baselineskip\relax)*\p@/1000\relax + \expandafter\setstretch\expandafter{\strip@pt\@tempdima}% + }% + }{% + \PackageWarning{scrhack}{unknown \string\doublespacing\space + definition found!\MessageBreak + Maybe you are using a unsupported setpace version}% + }% +} +%</setspace&body> +% \end{macrocode} +% \end{command} +% +% +% \subsection{The \texorpdfstring{\pkg*{lscape}}{lscape} hack} +% \changes{v3.18a}{2015/07/07}{\pkg{lscape} hack added} +% +% The package does change \len{textheight} inside \env{landscape} to the prior +% value of \len{textwidth}, nevertheless is does not change \len{textwidth} to +% the prior value of \len{textheight}. This is at least inconsistent. After +% asking him, David~Carlisle answered, that he does not change +% \len{textwidth}, because this could result in problems. Therefore it is very +% strange, that he does change \cs{textheight}, despite this also to problems, +% e.g., with packages \pkg{showframe} or \pkg*{scrlayer}. So the patch here +% also keeps \len{textheight} unchanged. This also has to take care for +% \pkg{pdflscape}. The patches are done using \pkg{xpatch}. +% +% +% \begin{option}{lscape} +% \changes{v3.18a}{2015/07/07}{added} +% \changes{v3.20}{2016/05/07}{loading \pkg{xpatch} in option part already} +% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} +% removed} +% \begin{macrocode} +%<*package&option> +\RequirePackage{xpatch}% +\KOMA@ifkey{lscape}{@scrhack@lscape}% +\KOMAExecuteOptions{lscape=true}% +%</package&option> +%<*package&body> +\AfterPackage*{lscape}{% + \if@scrhack@lscape\scr@hack@load\@pkgextension{lscape}\else + \KOMA@key[scrhack.sty]{lscape}{% + \PackageWarning{scrhack}{option `lscape' ignored}% + \FamilyKeyStateProcessed + }% + \fi +} +%</package&body> +% \end{macrocode} +% \end{option} +% +% \begin{command}{\landscape} +% \changes{v3.18a}{2015/07/07}{added} +% \changes{v3.20}{2016/05/07}{loading \pkg{xpatch} in option part already} +% This command is the beginning of environment \env{landscape}. This has to be +% patched using \pkg{xpatch}. +% \begin{description} +% \item[Note:] This is a load time option and cannot be changed after loading +% the package! +% \end{description} +% \begin{macrocode} +%<*lscape&body> +\xpatchcmd{\landscape}{\textheight=\vsize}{% + \if@scrhack@lscape +% \end{macrocode} +% \begin{macro}{\@outputpage} +% \changes{v3.18a}{2015/08/11}{added} +% Here the changed value of \len{textheight} is needed for initialization of +% \cs{@colht}. So we patch it to use the new internal \len{scr@LT@textheight} +% instead of \len{textheight}. +% \begin{macrocode} + \scrh@LT@textheight=\vsize + \let\scrh@LT@outputpage\@outputpage + \def\@outputpage{\scrh@LT@outputpage\global\@colht\scrh@LT@textheight}% + \else + \textheight=\vsize + \fi +}{% + \PackageInfo{scrhack}{\string\landscape\space patched to make + \string\textheight\space change optional}% +}{% + \PackageWarning{scrhack}{Cannot patch \string\landscape!\MessageBreak + Maybe you are using a unsupported lscape version}% + \@scrhack@lscapefalse +} +% \end{macrocode} +% \begin{ilength}{\scrh@LT@textheight} +% \changes{v3.18a}{2015/08/11}{new} +% \begin{macrocode} +\newlength{\scrh@LT@textheight} +%</lscape&body> +% \end{macrocode} +% \end{ilength}^^A \scrh@LT@textheight +% \end{macro}^^A \@outputpage +% \end{command}^^A \landscape +% +% +% \subsection{The standard classes sections hack} +% \label{sec:standardsections} +% The \emph{standard classes sections hack} differs from each other +% hack. First of all it does not patch a specific package but the class +% definitions of section commands from \cs{part} till +% \cs{subparagraph}. Additionally it resets several internal \LaTeX{} macros +% which are changed by \KOMAScript{} classes to their original +% definition. Last but not least it is not activated by default, but the user +% has to activate it, if he needs it. The hack has more potential to break +% things than to make things better. Because of this, there is not any support +% for using this hack and the hack shows several warning messages. +% +% \begin{option}{standardsections} +% \begin{macrocode} +%<*package&option> +\KOMA@ifkey{standardsections}{@scrhack@standardsections} +\KOMAExecuteOptions{standardsections=false} +%</package&option> +%<*package&body> +\AtEndOfPackage{% + \if@scrhack@standardsections + \PackageInfo{scrhack}{loading standard classes sections hack}% + \input{standardsections.hak}% + \fi +} +%</package&body> +% \end{macrocode} +% \end{option}^^A standardsections +% +% \begin{command}{\part,\chapter, +% \section,\subsection,\subsubsection, +% \paragraph,\subparagraph} +% The hack redefines all these commands to a definition copied from the +% standard \LaTeX{} classes version v1.4i. Copyright of this code is by the +% \LaTeX3{} Project. The complete, unmodified code can be found on +% \url{https://ctan.org/tex-archive/macros/latex/base/classes.dtx}. +% \begin{macrocode} +%<*standardsections&body> +\PackageWarningNoLine{scrhack}{% + You are loosing every kind of support because of\MessageBreak + using the dangerous standard classes sections hack!\MessageBreak + This hack can break several classes and packages.\MessageBreak + However, sometimes it is needed to make a\MessageBreak + package work% +}% +\PackageInfo{scrhack}{% + Using code from the standard LaTeX classes.\MessageBreak + For more information about this code and the\MessageBreak + license of this code, please see:\MessageBreak + https://ctan.org/tex-archive/macros/latex/base/classes.dtx +}% +\@ifpackageloaded{hyperref}{% + \PackageWarning{scrhack}{this hack should not be loaded after `hyperref'}% +}{} +\@ifpackageloaded{titlesec}{% + \PackageWarning{scrhack}{this hack should not be loaded after `titlesec'}% +}{} +\@ifpackageloaded{sectsty}{% + \PackageWarning{scrhack}{this hack should not be loaded after `sectsty'}% +}{} +\scr@ifundefinedorrelax{chapter}{% +% \end{macrocode} +% It seems to be an article class, so we use the code from +% \href{http://mirrors.ctan.org/macros/latex/base/classes.dtx}{\cls*{article}}. +% \begin{macrocode} + \scr@ifundefinedorrelax{c@part}{\newcounter{part}}{}% + \scr@ifundefinedorrelax{c@section}{\newcounter{section}}{}% + \scr@ifundefinedorrelax{c@subsection}{\newcounter{subsection}[section]}{}% + \scr@ifundefinedorrelax{c@subsubsection}{% + \newcounter{subsubsection}[subsection]}{}% + \scr@ifundefinedorrelax{c@paragraph}{% + \newcounter{paragraph}[subsubsection]}{}% + \scr@ifundefinedorrelax{c@subparagraph}{% + \newcounter{subparagraph}[paragraph]}{}% + \renewcommand\thepart {\@Roman\c@part}% + \renewcommand\thesection {\@arabic\c@section}% + \renewcommand\thesubsection {\thesection.\@arabic\c@subsection}% + \renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection}% + \renewcommand\theparagraph {\thesubsubsection.\@arabic\c@paragraph}% + \renewcommand\thesubparagraph {\theparagraph.\@arabic\c@subparagraph}% + \def\part{% + \if@noskipsec \leavevmode \fi + \par + \addvspace{4ex}% + \@afterindentfalse + \secdef\@part\@spart}% + \def\@part[#1]#2{% + \ifnum \c@secnumdepth >\m@ne + \refstepcounter{part}% + \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% + \else + \addcontentsline{toc}{part}{#1}% + \fi + {\parindent \z@ \raggedright + \interlinepenalty \@M + \normalfont + \ifnum \c@secnumdepth >\m@ne + \Large\bfseries \partname\nobreakspace\thepart + \par\nobreak + \fi + \huge \bfseries #2% + \markboth{}{}\par}% + \nobreak + \vskip 3ex + \@afterheading}% + \def\@spart#1{% + {\parindent \z@ \raggedright + \interlinepenalty \@M + \normalfont + \huge \bfseries #1\par}% + \nobreak + \vskip 3ex + \@afterheading}% + \def\section{\@startsection {section}{1}{\z@}% + {-3.5ex \@plus -1ex \@minus -.2ex}% + {2.3ex \@plus.2ex}% + {\normalfont\Large\bfseries}}% + \def\subsection{\@startsection{subsection}{2}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\large\bfseries}}% + \def\subsubsection{\@startsection{subsubsection}{3}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\normalsize\bfseries}}% + \def\paragraph{\@startsection{paragraph}{4}{\z@}% + {3.25ex \@plus1ex \@minus.2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}}% + \def\subparagraph{\@startsection{subparagraph}{5}{\parindent}% + {3.25ex \@plus1ex \@minus .2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}}% +}{% +% \end{macrocode} +% It seems to be either a book or report class. +% \begin{macrocode} + \scr@ifundefinedorrelax{c@part}{\newcounter{part}}{}% + \scr@ifundefinedorrelax{c@chapter}{\newcounter{chapter}}{}% + \scr@ifundefinedorrelax{c@section}{\newcounter{section}[chapter]}{}% + \scr@ifundefinedorrelax{c@subsection}{\newcounter{subsection}[section]}{}% + \scr@ifundefinedorrelax{c@subsubsection}{% + \newcounter{subsubsection}[subsection]}{}% + \scr@ifundefinedorrelax{c@paragraph}{% + \newcounter{paragraph}[subsubsection]}{}% + \scr@ifundefinedorrelax{c@subparagraph}{% + \newcounter{subparagraph}[paragraph]}{}% + \def\@chapapp{\chaptername}% + \scr@ifundefinedorrelax{frontmatter}{% +% \end{macrocode} +% It seems not to be a book class. +% \begin{macrocode} + \def\part{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi + \thispagestyle{plain}% + \if@twocolumn + \onecolumn + \@tempswatrue + \else + \@tempswafalse + \fi + \null\vfil + \secdef\@part\@spart} + + \def\@part[#1]#2{% + \ifnum \c@secnumdepth >-2\relax + \refstepcounter{part}% + \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% + \else + \addcontentsline{toc}{part}{#1}% + \fi + \markboth{}{}% + {\centering + \interlinepenalty \@M + \normalfont + \ifnum \c@secnumdepth >-2\relax + \huge\bfseries \partname\nobreakspace\thepart + \par + \vskip 20\p@ + \fi + \Huge \bfseries #2\par}% + \@endpart} + \def\@spart#1{% + {\centering + \interlinepenalty \@M + \normalfont + \Huge \bfseries #1\par}% + \@endpart} + \def\@endpart{\vfil\newpage + \if@twoside + \if@openright + \null + \thispagestyle{empty}% + \newpage + \fi + \fi + \if@tempswa + \twocolumn + \fi} + \def\chapter{\if@openright\cleardoublepage\else\clearpage\fi + \thispagestyle{plain}% + \global\@topnum\z@ + \@afterindentfalse + \secdef\@chapter\@schapter} + \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}#1}% + \else + \addcontentsline{toc}{chapter}{#1}% + \fi + \chaptermark{#1}% + \addtocontents{lof}{\protect\addvspace{10\p@}}% + \addtocontents{lot}{\protect\addvspace{10\p@}}% + \if@twocolumn + \@topnewpage[\@makechapterhead{#2}]% + \else + \@makechapterhead{#2}% + \@afterheading + \fi} + \def\@makechapterhead#1{% + \vspace*{50\p@}% + {\parindent \z@ \raggedright \normalfont + \ifnum \c@secnumdepth >\m@ne + \huge\bfseries \@chapapp\space \thechapter + \par\nobreak + \vskip 20\p@ + \fi + \interlinepenalty\@M + \Huge \bfseries #1\par\nobreak + \vskip 40\p@ + }} + \def\@schapter#1{\if@twocolumn + \@topnewpage[\@makeschapterhead{#1}]% + \else + \@makeschapterhead{#1}% + \@afterheading + \fi} + \def\@makeschapterhead#1{% + \vspace*{50\p@}% + {\parindent \z@ \raggedright + \normalfont + \interlinepenalty\@M + \Huge \bfseries #1\par\nobreak + \vskip 40\p@ + }} + \def\section{\@startsection {section}{1}{\z@}% + {-3.5ex \@plus -1ex \@minus -.2ex}% + {2.3ex \@plus.2ex}% + {\normalfont\Large\bfseries}}% + \def\subsection{\@startsection{subsection}{2}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\large\bfseries}}% + \def\subsubsection{\@startsection{subsubsection}{3}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\normalsize\bfseries}}% + \def\paragraph{\@startsection{paragraph}{4}{\z@}% + {3.25ex \@plus1ex \@minus.2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}}% + \def\subparagraph{\@startsection{subparagraph}{5}{\parindent}% + {3.25ex \@plus1ex \@minus .2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}}% + }{% +% \end{macrocode} +% It seems to be a book class. +% \begin{macrocode} + \scr@ifundefinedorrelax{if@mainmatter}{% + \expandafter\newif\csname if@mainmatter\endcsname + }{}% + \def\frontmatter{% + \cleardoublepage + \@mainmatterfalse + \pagenumbering{roman}}% + \def\mainmatter{% + \cleardoublepage + \@mainmattertrue + \pagenumbering{arabic}}% + \def\backmatter{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi + \@mainmatterfalse}% + \def\part{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi + \thispagestyle{plain}% + \if@twocolumn + \onecolumn + \@tempswatrue + \else + \@tempswafalse + \fi + \null\vfil + \secdef\@part\@spart}% + + \def\@part[#1]#2{% + \ifnum \c@secnumdepth >-2\relax + \refstepcounter{part}% + \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% + \else + \addcontentsline{toc}{part}{#1}% + \fi + \markboth{}{}% + {\centering + \interlinepenalty \@M + \normalfont + \ifnum \c@secnumdepth >-2\relax + \huge\bfseries \partname\nobreakspace\thepart + \par + \vskip 20\p@ + \fi + \Huge \bfseries #2\par}% + \@endpart}% + \def\@spart#1{% + {\centering + \interlinepenalty \@M + \normalfont + \Huge \bfseries #1\par}% + \@endpart}% + \def\@endpart{\vfil\newpage + \if@twoside + \if@openright + \null + \thispagestyle{empty}% + \newpage + \fi + \fi + \if@tempswa + \twocolumn + \fi}% + \def\chapter{\if@openright\cleardoublepage\else\clearpage\fi + \thispagestyle{plain}% + \global\@topnum\z@ + \@afterindentfalse + \secdef\@chapter\@schapter}% + \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}% + {\protect\numberline{\thechapter}#1}% + \else + \addcontentsline{toc}{chapter}{#1}% + \fi + \else + \addcontentsline{toc}{chapter}{#1}% + \fi + \chaptermark{#1}% + \addtocontents{lof}{\protect\addvspace{10\p@}}% + \addtocontents{lot}{\protect\addvspace{10\p@}}% + \if@twocolumn + \@topnewpage[\@makechapterhead{#2}]% + \else + \@makechapterhead{#2}% + \@afterheading + \fi}% + \def\@makechapterhead#1{% + \vspace*{50\p@}% + {\parindent \z@ \raggedright \normalfont + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \huge\bfseries \@chapapp\space \thechapter + \par\nobreak + \vskip 20\p@ + \fi + \fi + \interlinepenalty\@M + \Huge \bfseries #1\par\nobreak + \vskip 40\p@ + }}% + \def\@schapter#1{\if@twocolumn + \@topnewpage[\@makeschapterhead{#1}]% + \else + \@makeschapterhead{#1}% + \@afterheading + \fi}% + \def\@makeschapterhead#1{% + \vspace*{50\p@}% + {\parindent \z@ \raggedright + \normalfont + \interlinepenalty\@M + \Huge \bfseries #1\par\nobreak + \vskip 40\p@ + }}% + \def\section{\@startsection {section}{1}{\z@}% + {-3.5ex \@plus -1ex \@minus -.2ex}% + {2.3ex \@plus.2ex}% + {\normalfont\Large\bfseries}}% + \def\subsection{\@startsection{subsection}{2}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\large\bfseries}}% + \def\subsubsection{\@startsection{subsubsection}{3}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\normalsize\bfseries}}% + \def\paragraph{\@startsection{paragraph}{4}{\z@}% + {3.25ex \@plus1ex \@minus.2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}}% + \def\subparagraph{\@startsection{subparagraph}{5}{\parindent}% + {3.25ex \@plus1ex \@minus .2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}}% + }% +}% End of the derived code. +% \end{macrocode} +% \end{command} +% +% \begin{macro}{\@startsection} +% \KOMAScript{} classes redefine this internal \LaTeX{} kernel macro. In this +% case \cs{scr@saved@startsection} is defined, differs from +% \cs{@startsection} and has the definition found before redefining the +% original macro. We do nothing else but resetting \cs{@startsection} to this +% saved definition. +% \begin{macrocode} +\scr@ifundefinedorrelax{scr@saved@startsection}{}{% + \ifx\@startsection\scr@saved@startsection\else + \PackageWarningNoLine{scrhack}{% + Resetting \string\@startsection,\MessageBreak + because of loading standard classes sections hack% + }% + \let\@startsection\scr@saved@startsection + \fi +} +% \end{macrocode} +% \end{macro}^^A \@startsection +% +% \begin{macro}{\@sect,\@ssect,\@xsect} +% All these should be resetted to their original definitions stored in +% \cs{scr@latex@\dots}. +% \begin{macrocode} +\scr@ifundefinedorrelax{scr@latex@sect}{}{% + \ifx\@sect\scr@latex@sect\else + \PackageWarningNoLine{scrhack}{% + Resetting \string\@sect,\MessageBreak + because of loading standard classes sections hack% + }% + \let\@sect\scr@latex@sect + \fi +} +\scr@ifundefinedorrelax{scr@latex@ssect}{}{% + \ifx\@ssect\scr@latex@ssect\else + \PackageWarningNoLine{scrhack}{% + Resetting \string\@ssect,\MessageBreak + because of loading standard classes sections hack% + }% + \let\@ssect\scr@latex@ssect + \fi +} +\scr@ifundefinedorrelax{scr@latex@xsect}{}{% + \ifx\@xsect\scr@latex@xsect\else + \PackageWarningNoLine{scrhack}{% + Resetting \string\@xsect,\MessageBreak + because of loading standard classes sections hack% + }% + \let\@xsect\scr@latex@xsect + \fi +} +% \end{macrocode} +% \end{macro}^^A \@xsect,\@ssect,\@sect +% +% \begin{command}{\DeclareSectionCommand,\RedeclareSectionCommand, +% \DeclareNewSectionCommand,\ProvideSectionCommand, +% \DeclareSectionCommands,\RedeclareSectionCommands, +% \DeclareNewSectionCommands,\ProvideSectionCommands} +% These \KOMAScript{} commands do not make sense any longer after forced +% redefinition of \cs{part} \dots{} \cs{subparagraph}. They even would not +% work correctly after resetting, e.g., \cs{@startsection}. So best reaction +% is to \emph{undefine} them. +% \begin{macrocode} +\scr@ifundefinedorrelax{DeclareSectionCommand}{}{% + \PackageWarningNoLine{scrhack}{% + \string\DeclareSectionCommand\space + and all derivates deactivated,\MessageBreak + because of loading standard classes sections hack% + }% + \let\DeclareSectionCommand\undefined + \let\DeclareSectionCommands\undefined + \let\RedeclareSectionCommand\undefined + \let\RedeclareSectionCommands\undefined + \let\DeclareNewSectionCommand\undefined + \let\DeclareNewSectionCommands\undefined + \let\ProvideSectionCommand\undefined + \let\ProvideSectionCommands\undefined +} +% \end{macrocode} +% \begin{macro}{\scr@chapter@before@hyperref@patch, +% \scr@chapter@after@hyperref@patch} +% Now, definitions without respecting \pkg{hyperref} are used, so +% \pkg{hyperref} should again be able to patch them. So the hack should +% deactivate the patch deactivation of the \KOMAScript{} classes. +% \begin{macrocode} +\let\scr@chapter@before@hyperref@patch\relax +\let\scr@chapter@after@hyperref@patch\relax +% \end{macrocode} +% \end{macro} +% \end{command} +% +% \begin{macro}{\scr@osectarg} +% The \KOMAScript{} classes use this macro to store how to use the optional +% argument of section commands. But with the standard class definition the +% only possibility is to use it as running head and write it into the table of +% contents without any extended handling. So the only value, that makes sense +% is 0. +% \begin{macrocode} +\scr@ifundefinedorrelax{scr@osectarg}{}{% + \def\reserved@a{0}% + \ifx\scr@osectarg\reserved@a\else + \let\scr@osectarg\reserved@a + \PackageWarningNoLine{scrhack}{% + Extended option handling for section commands deactivated,\MessageBreak + because of loading standard classes sections hack% + }% + \fi +}% +% \end{macrocode} +% \begin{macro}{\scr@activate@xsection} +% Further changing of the value has to be deactivated. +% \begin{macrocode} +\scr@ifundefinedorrelax{scr@activate@xsection}{}{% + \renewcommand*{\scr@activate@xsection}[1]{% + \edef\scr@osectarg{#1}\def\reserved@a{0}% + \ifx\scr@osectarg\reserved@a + \else + \let\scr@osectarg\reserved@a + \PackageWarning{scrhack}{% + Because of loading the standard classes\MessageBreak + sections hack, the extended option handling\MessageBreak + of section commands failed% + }% + \fi + }% +} +% \end{macrocode} +% \end{macro}^^A \scr@activate@xsection +% \end{macro}^^A \scr@osectarg +% +% \begin{command}{\partformat,\chapterformat} +% Most \cs{\dots format} macros of \KOMAScript{} are still used, because of +% the redefinition of \cs{@seccntformat}. But \cs{part} and \cs{chapter} are +% defined without using them. +% \begin{macrocode} +\scr@ifundefinedorrelax{partformat}{}{% + \PackageWarningNoLine{scrhack}{% + Usage of \string\partformat\space + deactivated,\MessageBreak + because of loading the standard classes sections hack% + }% +} +\scr@ifundefinedorrelax{chapterformat}{}{% + \PackageWarningNoLine{scrhack}{% + Usage of \string\chapterformat\space + deactivated,\MessageBreak + because of loading the standard classes sections hack% + }% +} +% \end{macrocode} +% \end{command}^^A \chapterformat,\partformat +% +% \begin{command}{\sectionformat,\subsectionformat,\subsubsectionformat, +% \paragraphformat,\subparagraphformat} +% All these commands have to be resetted to not use the automatic dot and to +% add a \cs{quad} instead of an \cs{enskip}. +% \begin{macrocode} +\scr@ifundefinedorrelax{sectionformat}{}{% + \PackageWarningNoLine{scrhack}{% + \string\sectionformat\space set to + `\string\thesection\string\quad',\MessageBreak + because of loading the standard classes sections hack% + }% + \renewcommand*{\sectionformat}{\thesection\quad}% +} +\scr@ifundefinedorrelax{subsectionformat}{}{% + \PackageWarningNoLine{scrhack}{% + \string\subsectionformat\space set to + `\string\thesubsection\string\quad'\MessageBreak + because of loading the standard classes sections hack% + }% + \renewcommand*{\subsectionformat}{\thesubsection\quad}% +} +\scr@ifundefinedorrelax{subsubsectionformat}{}{% + \PackageWarningNoLine{scrhack}{% + \string\subsubsectionformat\space set to + `\string\thesubsubsection\string\quad'\MessageBreak + because of loading the standard classes sections hack% + }% + \renewcommand*{\subsubsectionformat}{\thesubsubsection\quad}% +} +\scr@ifundefinedorrelax{paragraphformat}{}{% + \PackageWarningNoLine{scrhack}{% + \string\paragraphformat\space set to + `\string\theparagraph\string\quad'\MessageBreak + because of loading the standard classes sections hack% + }% + \renewcommand*{\paragraphformat}{\theparagraph\quad}% +} +\scr@ifundefinedorrelax{subparagraphformat}{}{% + \PackageWarningNoLine{scrhack}{% + \string\subparagraphformat\space set to + `\string\thesubparagraph\string\quad'\MessageBreak + because of loading the standard classes sections hack% + }% + \renewcommand*{\subparagraphformat}{\thesubparagraph\quad}% +} +% \end{macrocode} +% \end{command} +% +% \begin{command}{\partlineswithprefixformat, +% \chapterlineswithprefixformat,\chapterlinesformat, +% \sectionlinesformat,\sectioncatchphraseformat} +% These \KOMAScript{} commands are not used any longer. +% \begin{macrocode} +\scr@ifundefinedorrelax{partlineswithprefixformat}{}{% + \PackageWarningNoLine{scrhack}{% + Usage of \string\partlineswithprefixformat\space deactivated,\MessageBreak + because of loading the standard classes sections hack% + }% +} +\scr@ifundefinedorrelax{chapterlineswithprefixformat}{}{% + \PackageWarningNoLine{scrhack}{% + Usage of \string\chapterlineswithprefixformat\space and\MessageBreak + \string\chapterlinesformat\space deactivated,\MessageBreak + because of using standard classes sections hack% + }% +} +\scr@ifundefinedorrelax{sectionlinesformat}{}{% + \PackageWarningNoLine{scrhack}{% + Usage of \string\sectionlinesformat\space and\MessageBreak + \string\sectioncatchphraseformat\space deactivated,\MessageBreak + because of using standard classes sections hack% + }% +} +% \end{macrocode} +% \end{command}^^A \partlineswithprefixformat … +% +% \begin{option}{headings} +% \changes{v3.39}{2022/11/11}{initial dot in member argument of option storage +% commands removed} +% The \KOMAScript{} option does not make sense any longer. So it is +% deactivated and usage will throw an error. +% \begin{macrocode} +\scr@ifundefinedorrelax{KOMAClassName}{}{% + \PackageWarningNoLine{scrhack}{% + KOMA-Script option `headings' removed,\MessageBreak + because of loading standard classes sections hack% + }% + \RelaxFamilyKey[.\KOMAClassFileName]{KOMA}{headings}% + \KOMA@kav@removekey{\KOMAClassFileName}{headings}% +} +% \end{macrocode} +% \end{option}^^A headings +% +% \begin{macro}{\scr@class@titlesec@warning} +% The warning about loading \pkg{titlesec} has to be changes, because we do +% not expect errors any longer. +% \begin{macrocode} +\def\scr@class@titlesec@warning{% + \PackageWarning{scrhack}{% + Usage of `titlesec' should work, because of\MessageBreak + loading the standard classes sections hack.\MessageBreak + However, you should know, there is not any\MessageBreak + support for this combination by the\MessageBreak + KOMA-Script author% + }% +} +%</standardsections&body> +% \end{macrocode} +% \end{macro}^^A \scr@class@titlesec@warning +% +% \subsection{Executing options} +% +% Last but not least the options have to be processed. In the generated +% package this will be done before the commands of \autoref{sec:macros}. +% \begin{macrocode} +%<*package&option> +\KOMAProcessOptions\relax +%</package&option> +% \end{macrocode} +% +% \Finale +% \PrintChanges +% +\endinput +% Local Variables: +% mode: doctex +% ispell-local-dictionary: "en_US" +% eval: (flyspell-mode 1) +% TeX-master: t +% TeX-engine: luatex-dev +% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx")) +% End: diff --git a/macros/latex/contrib/scrhack/scrhack-2023-07-07.pdf b/macros/latex/contrib/scrhack/scrhack-2023-07-07.pdf Binary files differnew file mode 100644 index 0000000000..59ae934110 --- /dev/null +++ b/macros/latex/contrib/scrhack/scrhack-2023-07-07.pdf diff --git a/macros/latex/contrib/scrhack/scrhack.dtx b/macros/latex/contrib/scrhack/scrhack.dtx new file mode 100644 index 0000000000..a14d7e2e94 --- /dev/null +++ b/macros/latex/contrib/scrhack/scrhack.dtx @@ -0,0 +1,991 @@ +% \iffalse meta-comment +% ====================================================================== +% scrhack.dtx +% Copyright © 2008–2024 Markus Kohm +% +% This work is a KOMA-Script spin-off. For the original sources of +% KOMA-Script's `scrhack.sty' see file `scrhack.dtx' in the KOMA-Script +% sources at <https://sourceforge.net/p/koma-script/code/>. +% +% Development is taking place as part of `scrhack' at +% <https://github.com/komascript/third-party-enhancements>. New issues +% should be reported there as well as known issues can be found. +% +% This work may be distributed and/or modified under the conditions of +% the LaTeX Project Public License, version 1.3c of the license. +% 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 2005/12/01 or later and of this work. +% +% This work has the LPPL maintenance status "author-maintained". +% +% The Current Maintainer and author of this work is Markus Kohm. +% +% This work consists of the file `scrhack.dtx', +% `scrhack-2023-07-07,dtx', and `README.md'. +% +% The recommended way to install `scrhack' is to use +% the package manager of your TeX distribution. +% ====================================================================== +% +%<*dtx> +\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi +\ProvidesFile{scrhack.dtx} +%</dtx> +%<package>\providecommand\DeclareRelease[3]{} +%<package>\providecommand\DeclareCurrentRelease[2]{} +%<package>\DeclareRelease{v3.41}{2023-07-07}{scrhack-2023-07-07.sty} +%<package>\DeclareCurrentRelease{}{2023-07-15} +%<*dtx|package> +%<package>\ProvidesPackage{scrhack} + [2024-09-04 v3.42 +%<dtx> sources and unpack driver of + scrhack emulation package] +%</dtx|package> +%<*dtx> +\ifx\documentclass\undefined + \input docstrip.tex + \generate{% + \file{scrhack.sty}{% + \from{scrhack.dtx}{package}% + }% + }% +\else + \let\endbatchfile\relax +\fi +\endbatchfile +\documentclass[ngerman,USenglish]{koma-script-source-doc} +\usepackage{babel} +\usepackage{csquotes} +\usepackage[style=alphabetic]{biblatex} +\begin{filecontents}[force]{\jobname.bib} +@online{pkg:koma-script, + author={Markus Kohm}, + version={3.41}, + date={2023-07-07}, + title={{\KOMAScript} --- A bundle of versatile classes and packages}, + url={https://ctan.org/pkg/koma-script}, + urldate={2023-07-14}, + note={The \KOMAScript{} bundle provides replacements for the \pkg*{article}, + \pkg*{report}, and \pkg*{book} classes with emphasis on typography and + versatility. There is also a letter class.}, +} +@manual{pkg:koma-script:manual:de, + author={Markus Kohm}, + date={2023-06-16}, + title={{\KOMAScript}}, + subtitle={Die Anleitung}, + url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-de.pdf}, + urldate={2023-07-04}, +} +@manual{pkg:koma-script:manual:en, + author={Markus Kohm}, + date={2023-06-16}, + title={{\KOMAScript}}, + subtitle={The Guide}, + url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-en.pdf}, + urldate={2023-07-14}, +} +@article{latexnews35, + author={{The {\LaTeX} Project Team}}, + shortauthor={TLT}, + year={2022}, + month={6}, + title={Issue 35}, + journal={{\LaTeX} News}, + url={http://mirrors.ctan.org/macros/latex/base/ltnews35.pdf}, + urldate={2023-07-14}, +} +\end{filecontents} +\addbibresource{\jobname.bib} +\setcounter{StandardModuleDepth}{2} +\providecommand*{\seclabel}[1]{\label{sec:#1}} +\begin{document} + \nocite{pkg:koma-script} + \DocInput{scrhack.dtx} +\end{document} +%</dtx> +%\fi +% +% \changes{v0.1}{2023/07/14}{start of \KOMAScript{} spin-off} +% +% \GetFileInfo{scrhack.dtx} +% \title{Emulating Former \href{https://komascript.de/}{\KOMAScript} Package +% \pkg*{scrhack}} +% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}} +% \date{Version \filedate{} \fileversion} +% \maketitle +% \begin{abstract} +% For several years \href{https://komascript.de/}{\KOMAScript} provided a +% package \pkg*{scrhack}, that has been made not only to improve the +% compatibility of third-party packages with +% \href{https://komascript.de/}{\KOMAScript} classes, but also to generally +% improve third-party packages. The package consisted not only in the +% package file \file{scrhack.sty} but also in several so called \emph{hacks} +% as separate files with extension \file{.hak}. In the course of splitting +% off former \href{https://komascript.de/}{\KOMAScript} packages from the +% \href{https://komascript.de/}{\KOMAScript} collection, it was decided to +% create independent packages from the individual hacks. These new +% independent packages then serve as replacements for the original packages +% they were intended to improve. In addition, to preserve the functionality +% of loading the enhancements only when the corresponding original package +% is loaded, a new \pkg*{scrhack} was created to do just that. +% \end{abstract} +% +% \tableofcontents +% +%\iffalse +%<*doc> +%\fi +% \section{History} +% \label{sec:history} +Some packages from other authors do not work well with +\href{https://komascript.de/}{\KOMAScript}. It is often very tedious for the +author of \href{https://komascript.de/}{\KOMAScript} to convince the authors +of these packages to make specific improvements. This also applies to packages +whose development has been discontinued. That's why the \pkg*{scrhack} was +created. This package alters the commands and definitions of other to work +better with \href{https://komascript.de/}{\KOMAScript}. Some changes are also +useful when using other classes. + +In the early days of \href{https://komascript.de/}{\KOMAScript}, users wanted +to handle lists of floating environments created with the \pkg{float} package +in the same way as the list of figures and list of tables created by +\href{https://komascript.de/}{\KOMAScript} itself. At that time the author of +\href{https://komascript.de/}{\KOMAScript} contacted the author of +\pkg{float} to propose an interface to support such an enhancement. A +somewhat modified form of that interface was implemented with the +\cs{float@listhead} and \cs{float@addtolists} commands. + +Later it became apparent that these two commands were not flexible enough to +fully support all of \href{https://komascript.de/}{\KOMAScript}'s +capabilities. Unfortunately, the author of \pkg{float} had already ceased +development by that point, so further changes to this package cannot be +expected. + +Other package authors have also adopted these two commands, and it became +apparent that the implementation in some packages, including \pkg{float}, +means that all these packages can only be loaded in a specific order, even +though they are otherwise unrelated to each other. + +To overcome all these disadvantages and problems, +\href{https://komascript.de/}{\KOMAScript} no longer officially supports this +old interface. Instead, \href{https://komascript.de/}{\KOMAScript} warns if +the old interface is used. At the same time, the \pkg{tocbasic} package has +been designed and implemented as a central interface for managing of table of +contents and similar content lists. This package provides many more +advantages and features than the two old commands. + +Although the effort to use this package is very small, so far the authors of +most of the packages that use the old interface have not made any adjustments. +Therefore the \KOMAScript author designed a new +package \pkg*{scrhack} as part of +\href{https://komascript.de/}{\KOMAScript}. That package contained appropriate +modifications of the packages +\pkg{float}, \pkg{floatrow}, \pkg{listings}, and later on also for +\pkg{nomencl} and some others not related to that interface. Merely loading +\pkg*{scrhack} was sufficient to make these packages recognize not only the +setting of the \href{https://komascript.de/}{\KOMAScript} option \opt{listof}, +but, e.g., also to react to the language switching features of the +\pkg{babel} package. You can find more information +about the features available by switching packages to \pkg{tocbasic} in +\autocite{pkg:koma-script:manual:en} or \autocite{pkg:koma-script:manual:de}. + +With release of version 3.42 package \pkg*{scrhack} has been removed from +\href{https://komascript.de/}{\KOMAScript}. The code of the former package has +been split into several standalone packages, that can be loaded individually +if needed. However, for compatibility and maybe for convenience there is also +a new standalone package \pkg*{scrhack} almost compatible with the old +one. + +\section{Using \texorpdfstring{\pkg*{scrhack}}{scrhack}} +\seclabel{usage} + +It is recommended to load the \pkg*{scrhack} package using: +\begin{verbatim} + \usepackage{scrhack} +\end{verbatim} +as early as possible. In particular, loading should be done before the +affected packages. The package also provides several options, one for each +hack. Usually the options are named identically to the package, that is +patched by the hack. All these options are boolean options. You can switch +such an option on assigning value \optvalue{true} or using it without +value. You can switch off such an option assigning value +\optvalue{false}. Switching off an option means to not automatically load the +corresponding enhancement package after the package, that has to be +patched. Therefore switching off an option results in not patching the +corresponding package. + +\paragraph{Notes:} +\begin{itemize} +\item From version 3.42, you cannot use \cs{KOMAoptions} or \cs{KOMAoption} + any longer to change the options. Instead loading \pkg*{scrhack} again with + other options does not result in an option clash, but in a change of the + option settings. +\item Switching off an option of an already loaded enhancement package is + ignored (with warning). It does not unload the enhancement package or switch + back to a not patched functionality. +\item Switching on an option of a not yet loaded enhancement package would + result in loading the enhancement package. +\item From version 3.42, you should no longer load package + \pkg*{scrhack}. Instead you can and should simply load the individual + enhancement package when you need it. +\item If you need the old legacy version of \pkg*{scrhack} from + \href{https://komascript.de/}{\KOMAScript} 3.41 you can use: +\begin{verbatim} + \usepackage{scrhack}[=2023-07-07] +\end{verbatim} + or +\begin{verbatim} + \usepackage{scrhack}[=v3.41] +\end{verbatim} + However, this depends on internal packages of + \href{https://komascript.de/}{\KOMAScript}. +\item The hacks of the legacy version have been frozen. So the + hacks may break with packages or \LaTeX{} versions released after + 2023-07-07. There is no support for such combinations! +\item Loading the legacy version more than once with different option setting + still results in option clash errors. +\end{itemize} + +\paragraph{Available options with \pkg*{scrhack}:} +\begin{description} +\item[\opt{float=\meta{boolean}}:] + \DescribeOption[noprint]{float=\meta{boolean}}% + \hfill initial: \optvalue{true}, default: \optvalue{true}\\ + After package \pkg{float} is loaded, load also package \pkg{floatbytocbasic} + to fix the issue explained in \autoref{sec:history}. This also provides the + full functionality of \pkg{tocbasic} to \pkg{float}. +\item[\opt{floatrow=\meta{boolean}}:] + \DescribeOption[noprint]{floatrow=\meta{boolean}}% + \hfill initial: \optvalue{true}, default: \optvalue{true}\\ + After package \pkg{floatrow} is loaded, load also package + \pkg{floatbytocbasic} to fix the issue explained in + \autoref{sec:history}. This also provides the full functionality of + \pkg{tocbasic} to \pkg{floatrow}. +\item[\opt{hyperref=\meta{boolean}}:] + \DescribeOption[noprint]{hyperref=\meta{boolean}}% + \hfill + \marginline{\raisebox{\dimexpr\ht\strutbox-\height\relax}{\Huge\textcolor{red}{!}}}% + initial: \optvalue{false}, default: \optvalue{true}\\ + Option \opt{hyperref} is deprecated. It is implemented for compatibility + reasons only. Using \opt{hyperref} without value or \opt{hyperref=true} + results in a warning. Using \opt{hyperref=false} results in an info only. +\item[\opt{listings=\meta{boolean}}:] + \DescribeOption[noprint]{listings=\meta{boolean}}% + \hfill + \marginline{\raisebox{\dimexpr\ht\strutbox-\height\relax}{\Huge\textcolor{red}{!}}}% + initial: \optvalue{false}, default: \optvalue{true}\\ + Option \opt{listings} is deprecated. It is implemented for compatibility + reasons only. Using \opt{listings} without value or \opt{listings=true} + results in a warning. Using \opt{listings=false} results in an info only. +\item[\opt{lscape=\meta{boolean}}:] + \DescribeOption[noprint]{lscape=\meta{boolean}}% + \hfill initial: \optvalue{true}, default: \optvalue{true}\\ + After package \pkg{lscape} is loaded, load also package + \pkg{lscapeenhanced} to fix an issue with detection of text height for + some packages like \pkg{scrlayer} and \pkg{showframe}. +\item[\opt{nomencl=\meta{boolean}}:] + \DescribeOption[noprint]{nomencl=\meta{boolean}}% + \hfill + \marginline{\raisebox{\dimexpr\ht\strutbox-\height\relax}{\Huge\textcolor{red}{!}}}% + initial: \optvalue{false}, default: \optvalue{true}\\ + Option \opt{nomencl} is deprecated. It is implemented for compatibility + reasons only. Using \opt{nomencl} without value or \opt{nomencl=true} + results in a warning. Using \opt{nomencl=false} results in an info only. +\item[\opt{setspace=\meta{boolean}}:] + \DescribeOption[noprint]{setspace=\meta{boolean}}% + \hfill initial: \optvalue{true}, default: \optvalue{true}\\ + After package \pkg{setspace} is loaded, load also package + \pkg{setspaceenhanced} with the same options plus options \opt{byselectfont} + and \opt{keepfontsize}. +\item[\opt{standardsectioning=\meta{boolean}}:] + \DescribeOption[noprint]{standardsectioning=\meta{boolean}}% + \hfill initial: \optvalue{false}, default: \optvalue{true}\\ + Load package \pkg{standardsectioning} to (re-)define the sectioning commands + using the code from the standard classes. If \pkg*{scrhack} is loaded + \emph{before} any class\footnote{This is detected heuristic by definition of + \cs{normalsize}. If \cs{normalsize} contains \cs{@latex@error} no class + has been loaded.} the definition is delayed until a class has been loaded. +\end{description} + +\paragraph{Available options with the legacy version:} +\begin{description} +\item[\opt{float=\meta{boolean}}:] \hfill + initial: \optvalue{true}, default: \optvalue{true}\\ + After package \pkg{float} is loaded, load \file{float.hak} to fix the issue + explained in \autoref{sec:history}. This also provides the full + functionality of \pkg{tocbasic} to \pkg{float}. +\item[\opt{floatrow=\meta{boolean}}:] \hfill + initial: \optvalue{true}, default: \optvalue{true}\\ + After package \pkg{floatrow} is loaded, load \file{floatrow.hak} to fix the + issue explained in \autoref{sec:history}. This also provides the full + functionality of \pkg{tocbasic} to \pkg{floatrow}. +\item[\opt{hyperref=\meta{boolean}}:] \hfill + initial: \optvalue{true}, default: \optvalue{true}\\ + Versions of \pkg{hyperref} before 6.79h set the link anchors after the + heading of the starred versions of commands like \cs{part*}, \cs{chapter*}, + etc. instead of before them. Since then, this problem has been resolved at + the suggestion of \KOMAScript's author. But because the change took more + than a year, a patch was added to \pkg*{scrhack}. Although this can also be + deactivated with \opt{hyperref=false}, you should instead use an up-to-date + \pkg{hyperref} release. In this case the legacy version of \pkg*{scrhack} + automatically deactivates this unnecessary patch. +\item[\opt{listings=\meta{boolean}}:] \hfill + initial: \optvalue{true}, default: \optvalue{true}\\ + After package \pkg{listings} is loaded, load \file{listings.hak} to fix the + issue explained in \autoref{sec:history}. This also provides the full + functionality of \pkg{tocbasic} to old versions of \pkg{listings}. With + newer versions, also the legacy version of \pkg*{scrhack} automatically + deactivates this unnecessary patch. +\item[\opt{lscape=\meta{boolean}}:] \hfill + initial: \optvalue{true}, default: \optvalue{true}\\ + The \pkg{lscape} package defines a \env{landscape} environment to set the + page contents, but not the header or footer in landscape mode. Inside this + environment, \len{textheight}is set to the value of \len{textwidth}, but + \len{textwidth} is not set to the former value of \len{textheight}. This is + inconsistent. As far as I know, \len{textwidth} is left unchanged because + setting it to \len{textheight} could interfere with other packages or user + commands. But changing \len{textheight} also has this potential, and indeed + it breaks, for example, \pkg{showframe} and \pkg{scrlayer}. Thus it would be + best if \len{textheight} too remained unchanged. After package \pkg{lscape} + is loaded, the legacy version of \pkg*{scrhack} loads \file{lscape.hak}, + that uses the \pkg{xpatch} package to modify the \env{landscape} + environment's start macro \cs{landscape} appropriately. + + Incidentally, the \pkg{pdflscape} package also uses \pkg{lscape}, so this + option affects the functioning of this package too. +\item[\opt{nomencl=\meta{boolean}}:] \hfill + initial: \optvalue{true}, default: \optvalue{true}\\ + After package \pkg{nomencl} is loaded, load \file{nomencl.hak} to fix the + issue explained in \autoref{sec:history}. This is a little bit more + complicated, because the \pkg*{nomencl} author has also adapted his + package to support \pkg{tocbasic}. So additional versions checks are done. +\item[\opt{setspace=\meta{boolean}}:] \hfill + initial: \optvalue{true}, default: \optvalue{true}\\ + Some packages assume that the class-internal macro \cs{@ptsize} both is + defined and expands to an integer. For compatibility, + \href{https://komascript.de/}{\KOMAScript} defines \cs{@ptsize} even if the + basic font size is something other than 10\,pt, 11\,pt, or 12\,pt. + \href{https://komascript.de/}{\KOMAScript} also allows non-integer font + sizes. So \cs{@ptsize} can, of course, also expand to a non-integer number. + + One of the packages that cannot cope with a non-integer \cs{@ptsize} is + \pkg{setspace}. Additionally, the values set by this package are always + dependent on the basic font size, even if the setting is made in the context + of another font size. The legacy version of \pkg{scrhack} loads the hack + \file{setspace.hak} after package \pkg{setspace} to solves both problems by + redefining \cs{onehalfspacing} and \cs{doublespacing} to set the spacing + relative to the actual font size. + + \textbf{Note:} if you use \pkg{setspace} with either the + \opt{onehalfspacing} or \opt{doublespacing} option, you must load + \pkg*{scrhack} first. +\item[\opt{standardsections=\meta{boolean}}] \hfill + initial: \optvalue{false}, default: \optvalue{true}\\ + Various packages assume that the sectioning commands are defined in a + specific way, corresponding to the definitions in the standard classes. But + for some classes this is not the case. For example, the + \href{https://komascript.de/}{\KOMAScript} classes use a completely + different implementation to provide many additional features. But this can + cause problems for packages that depend on the definition of the standard + classes. The legacy version of \pkg*{scrhack} offers the option to force + the sectioning commands \cs{part}, \cs{chapter}, \cs{section}, + \cs{subsection}, \cs{subsubsection}, \cs{paragraph}, and \cs{subparagraph} + to be compatible with those in the standard classes. When \cs{chapter} is + defined, the definitions are based on those in \cls{book}. When \cs{chapter} + is undefined, the definitions of \cls{article} are used. + + If you are using a \href{https://komascript.de/}{\KOMAScript} class, several + features of these classes are also deactivated as side effect. For example, + the commands to define or modify sectioning commands or option + \opt{headings} are no longer available, and commands like \cs{partformat} + have different defaults. + + Because this hack has the potential to do more harm than good, it issues + several warnings. Also it is not activated simply by loading the legacy + version of \pkg*{scrhack} package. If you want to use it, you must explicitly + activate this option when you load the package. Late activation or + deactivation is not supported. + + Since there are often less invasive solutions to fix the problem of package + incompatibilities, using this hack is not recommended. It is provided only + as a last resort for emergencies. +\end{description} +% +% \iffalse +%</doc> +% \fi +% +% \MaybeStop{\printbibliography[heading=bibintoc]\PrintIndex} +% +% \iffalse +%<*package> +%<@@=scrhack> +% \fi +% \section{Implementation} +% +% Because \pkg*{scrhack} is not longer a +% \href{https://komascript.de/}{\KOMAScript} package, it does not use the +% \texttt{KOMA} family for options any longer. Instead it uses the new +% \LaTeX{} kernel feature of key-value-options introduced in +% \autocite{latexnews35}. So we need at least \LaTeX{} 2022-06-01: +% \begin{macrocode} +\ifnum 0=\ifcsname IfFormatAtLeastTF\endcsname + \IfFormatAtLeastTF{2022-06-01}{1}{0}% + \else + 0% + \fi\relax + \PackageError{scrhack}{LaTeX kernel too old}{% + The package needs at least LaTeX 2022-06-01.\MessageBreak + This error is fatal. Loading will be aborted.% + }% + \endinput +\fi +\ExplSyntaxOn +% \end{macrocode} +% +% \subsection{Messages} +% +% We need some messages, that are not specific for only one use-case. +% \begin{itemize} +% \item If an option is ignored, because it cannot be handled after already +% loading the enhancement package. \#1 is the name option, \#2 is the +% enhancement package. +% \end{itemize} +% \begin{macrocode} +\msg_new:nnn { scrhack } { option-too-late } + { + option~`#1'~after~loading~package~`#2'~ignored. + } +% \end{macrocode} +% \begin{itemize} +% \item If an option is ignored, because it is deprecated. +% \end{itemize} +% \begin{macrocode} +\msg_new:nnn { scrhack } { deprecated-option } + { + deprecated~option~`#1'~ignored. + } +% \end{macrocode} +% +% \subsection{Emulating \file{float.hak}} +% First we declare the options using the new key-value interface: +% \begin{macrocode} +\DeclareKeys{% + float .code = \@@_switch_float:n { #1 }, + float .default:n = true, + float .usage = preamble, +} +% \end{macrocode} +% +% \ExplSyntaxOn +% \begin{macro}{\__scrhack_switch_float:n} +% \ExplSyntaxOff +% This is used to switch the state and add or remove the hook if needed. A new +% boolean is used to know, whether the hook has been put. Using +% \opt{float=true}, if package \pkg{floatbytocbasic} already has been loaded +% isn't a foul. So we just write an information to the \file{log}. But using +% \opt{float=false}, if package \pkg{floatbytocbasic} already has been loaded +% may be wrong. So we use a warning message. We also warn if a not allowed +% value is used. +% \begin{macrocode} +\bool_new:N \@@_float_bool + +\cs_new:Nn \@@_switch_float:n + { + \str_case_e:nnF { \str_foldcase:n { #1 } } + { + {true} { + \@ifpackageloaded { floatbytocbasic } + { + \msg_info:nnnn { scrhack } { option-too-late } + { float = true } { floatbytocbasic } + } + { + \bool_if:NF \@@_float_bool + { + \hook_gput_code:nnn { package/float/after } { scrhack } + { + \RequirePackage { floatbytocbasic } + } + \bool_gset_true:N \@@_float_bool + } + } + } + {false} { + \@ifpackageloaded { floatbytocbasic } + { + \msg_warning:nnnn { scrhack } { option-too-late } + { float=false } { floatbytocbasic } + } + { + \bool_if:NT \@@_float_bool + { + \hook_gremove_code:nn { package/float/after } { scrhack } + } + \bool_gset_false:N \@s@_float_bool + } + } + } + { + \msg_warning:nnn { keys } { boolean-values-only } { float } + } + } +\SetKeys{float=true} +% \end{macrocode} +% \end{macro} +% \ExplSyntaxOff +% +% \subsection{Emulating \file{floatrow.hak}} +% First we declare the options using the new key-value interface: +% \begin{macrocode} +\DeclareKeys{% + floatrow .code = \@@_switch_floatrow:n { #1 }, + floatrow .default:n = true, + floatrow .usage = preamble, +} +% \end{macrocode} +% +% \ExplSyntaxOn +% \begin{macro}{\__scrhack_switch_floatrow:n} +% \ExplSyntaxOff +% This is used to switch the state and add or remove the hook if needed. A new +% boolean is used to know, whether the hook has been put. Using +% \opt{floatrow=true}, if package \pkg{floatrowbytocbasic} already has been +% loaded isn't a foul. So we just write an information to the \file{log}. But +% using \opt{floatrow=false}, if package \pkg{floatrowbytocbasic} already has +% been loaded may be wrong. So we use a warning message. We also warn if a not +% allowed value is used. +% \begin{macrocode} +\bool_new:N \@@_floatrow_bool + +\cs_new:Nn \@@_switch_floatrow:n + { + \str_case_e:nnF { \str_foldcase:n { #1 } } + { + {true} { + \@ifpackageloaded { floatrowbytocbasic } + { + \msg_info:nnnn { scrhack } { option-too-late } + { floatrow = true } { floatrowbytocbasic } + } + { + \bool_if:NF \@@_floatrow_bool + { + \hook_gput_code:nnn { package/floatrow/after } + { scrhack } + { + \RequirePackage { floatrowbytocbasic } + } + \bool_gset_true:N \@@_floatrow_bool + } + } + } + {false} { + \@ifpackageloaded { floatrowbytocbasic } + { + \msg_warning:nnnn { scrhack } { option-too-late } + { floatrow=false } { floatrowbytocbasic } + } + { + \bool_if:NT \@@_floatrow_bool + { + \hook_gremove_code:nn { package/floatrow/after } + { scrhack } + } + \bool_gset_false:N \@s@_floatrow_bool + } + } + } + { + \msg_warning:nnn { keys } { boolean-values-only } { floatrow } + } + } +\SetKeys{floatrow=true} +% \end{macrocode} +% \end{macro} +% \ExplSyntaxOff +% +% \subsection{Emulating \file{hyperref.hak}} +% +% First we declare the options using the new key-value interface: +% \begin{macrocode} +\DeclareKeys{% + hyperref .code = \@@_switch_hyperref:n { #1 }, + hyperref .default:n = true, + hyperref .usage = preamble, +} +% \end{macrocode} +% +% \ExplSyntaxOn +% \begin{macro}{\__scrhack_switch_hyperref:n} +% \ExplSyntaxOff +% This is somehow special, because the hack is deprecated. It only has been +% needed for \pkg{hyperref} versions released before 2009-11-24, which would +% not work with the \LaTeX{} kernel version needed by this version of +% \pkg*{scrhack}. So emulating the hack does not make sense. Instead the +% initial value of the option is changed to implicit \optvalue{false} and +% switching it on explicitly does result in a warning. +% \begin{macrocode} +\cs_new:Nn \@@_switch_hyperref:n + { + \str_case_e:nnF { \str_foldcase:n { #1 } } + { + {true} { + \msg_warning:nnn { scrhack } { deprecated-option } + { hyperref=#1 } + } + {false} { + \msg_info:nnn { scrhack } { deprecated-option } + { hyperref=#1 } + } + } + { + \msg_warning:nnn { keys } { boolean-values-only } { hyperref } + } + } +% \end{macrocode} +% \end{macro} +% \ExplSyntaxOff +% +% \subsection{Emulating \file{listings.hak}} +% First we declare the options using the new key-value interface: +% \begin{macrocode} +\DeclareKeys{% + listings .code = \@@_switch_listings:n { #1 }, + listings .default:n = true, + listings .usage = preamble, +} +% \end{macrocode} +% +% \ExplSyntaxOn +% \begin{macro}{\__scrhack_switch_listings:n} +% \ExplSyntaxOff +% This is somehow special, because the hack is deprecated. It only has +% been needed for \pkg{listings} version released before 2024-02-15. So +% instead of using any patch hacks, users should update \pkg{listings}. So +% emulating the hack does not make sense. Instead the initial value of the +% option is changed to implicit \optvalue{false} and switching it on +% explicitly does result in a warning. +% \begin{macrocode} +\cs_new:Nn \@@_switch_listings:n + { + \str_case_e:nnF { \str_foldcase:n { #1 } } + { + {true} { + \msg_warning:nnn { scrhack } { deprecated-option } + { listings=#1 } + } + {false} { + \msg_info:nnn { scrhack } { deprecated-option } + { listings=#1 } + } + } + { + \msg_warning:nnn { keys } { boolean-values-only } { listings } + } + } +% \end{macrocode} +% \end{macro} +% \ExplSyntaxOff +% +% \subsection{Emulating \file{lscape.hak}} +% First we declare the options using the new key-value interface: +% \begin{macrocode} +\DeclareKeys{% + lscape .code = \@@_switch_lscape:n { #1 }, + lscape .default:n = true, + lscape .usage = preamble, +} +% \end{macrocode} +% +% \ExplSyntaxOn +% \begin{macro}{\__scrhack_switch_lscape:n} +% \ExplSyntaxOff +% This is used to switch the state and add or remove the hook if needed. A new +% boolean is used to know, whether the hook has been put. Using +% \opt{lscape=true}, if package \pkg{lscapeenhanced} already has been +% loaded isn't a foul. So we just write an information to the \file{log}. But +% using \opt{lscape=false}, if package \pkg{lscapeenhanced} already has +% been loaded may be wrong. So we use a warning message. We also warn if a not +% allowed value is used. +% \begin{macrocode} +\bool_new:N \@@_lscape_bool + +\cs_new:Nn \@@_switch_lscape:n + { + \str_case_e:nnF { \str_foldcase:n { #1 } } + { + {true} { + \@ifpackageloaded { lscapeenhanced } + { + \msg_info:nnnn { scrhack } { option-too-late } + { lscape = true } { lscapeenhanced } + } + { + \bool_if:NF \@@_lscape_bool + { + \hook_gput_code:nnn { package/lscape/after } + { scrhack } + { + \RequirePackage { lscapeenhanced } + } + \bool_gset_true:N \@@_lscape_bool + } + } + } + {false} { + \@ifpackageloaded { lscapeenhanced } + { + \msg_warning:nnnn { scrhack } { option-too-late } + { lscape=false } { lscapeenhanced } + } + { + \bool_if:NT \@@_lscape_bool + { + \hook_gremove_code:nn { package/lscape/after } + { scrhack } + } + \bool_gset_false:N \@s@_lscape_bool + } + } + } + { + \msg_warning:nnn { keys } { boolean-values-only } { lscape } + } + } +\SetKeys{lscape=true} +% \end{macrocode} +% \end{macro} +% \ExplSyntaxOff +% +% \subsection{Emulating \file{nomencl.hak}} +% +% First we declare the options using the new key-value interface: +% \begin{macrocode} +\DeclareKeys{% + nomencl .code = \@@_switch_nomencl:n { #1 }, + nomencl .default:n = true, + nomencl .usage = preamble, +} +% \end{macrocode} +% +% \ExplSyntaxOn +% \begin{macro}{\__scrhack_switch_nomencl:n} +% \ExplSyntaxOff +% This is somehow special, because the hack is deprecated. It only has been +% needed for \pkg{nomencl} versions released before 2019-01-23. So updating +% the package would be the better \emph{hack}. So emulating the hack does not +% make sense. Instead the initial value of the option is changed to implicit +% \optvalue{false} and switching it on explicitly does result in a warning. +% \begin{macrocode} +\cs_new:Nn \@@_switch_nomencl:n + { + \str_case_e:nnF { \str_foldcase:n { #1 } } + { + {true} { + \msg_warning:nnn { scrhack } { deprecated-option } + { nomencl=#1 } + } + {false} { + \msg_info:nnn { scrhack } { deprecated-option } + { nomencl=#1 } + } + } + { + \msg_warning:nnn { keys } { boolean-values-only } { nomencl } + } + } +% \end{macrocode} +% \end{macro} +% \ExplSyntaxOff +% +% +% \subsection{Emulating \file{setspace.hak}} +% First we declare the options using the new key-value interface: +% \begin{macrocode} +\DeclareKeys{% + setspace .code = \@@_switch_setspace:n { #1 }, + setspace .default:n = true, + setspace .usage = preamble, +} +% \end{macrocode} +% +% \ExplSyntaxOn +% \begin{macro}{\__scrhack_switch_setspace:n} +% \ExplSyntaxOff +% This is used to switch the state and add or remove the hook if needed. A new +% boolean is used to know, whether the hook has been put. Using +% \opt{setspace=true}, if package \pkg{setspaceenhanced} already has been loaded +% isn't a foul. So we just write an information to the \file{log}. But using +% \opt{setspace=false}, if package \pkg{setspaceenhanced} already has been loaded +% may be wrong. So we use a warning message. We also warn if a not allowed +% value is used. +% \begin{macrocode} +\bool_new:N \@@_setspace_bool + +\cs_new:Nn \@@_switch_setspace:n + { + \str_case_e:nnF { \str_foldcase:n { #1 } } + { + {true} { + \@ifpackageloaded { setspaceenhanced } + { + \msg_info:nnnn { scrhack } { option-too-late } + { setspace = true } { setspaceenhanced } + } + { + \bool_if:NF \@@_setspace_bool + { + \hook_gput_code:nnn { package/setspace/after } { scrhack } + { + \exp_last_unbraced:Ne \RequirePackage + { + [ \use:c { @raw@opt@setspace.sty }, + byselectfont, + keepfontsize ] + } + { setspaceenhanced } + } + \bool_gset_true:N \@@_setspace_bool + } + } + } + {false} { + \@ifpackageloaded { setspaceenhanced } + { + \msg_warning:nnnn { scrhack } { option-too-late } + { setspace=false } { setspaceenhanced } + } + { + \bool_if:NT \@@_setspace_bool + { + \hook_gremove_code:nn { package/setspace/after } { scrhack } + } + \bool_gset_false:N \@s@_setspace_bool + } + } + } + { + \msg_warning:nnn { keys } { boolean-values-only } { setspace } + } + } +\SetKeys{setspace=true} +% \end{macrocode} +% \end{macro} +% \ExplSyntaxOff +% +% \subsection{Emulating \file{standardsectioning.hak}} +% First we declare the options using the new key-value interface: +% \begin{macrocode} +\DeclareKeys{% + standardsections .code = \@@_switch_standardsectioning:n { #1 }, + standardsections .default:n = true, + standardsections .usage = preamble, +} +% \end{macrocode} +% +% \ExplSyntaxOn +% \begin{macro}{\__scrhack_switch_standardsectioning:n} +% \ExplSyntaxOff +% This is used to switch the state and add or remove the hook if needed. A new +% boolean is used to know, whether the hook has been put. Using +% \opt{standardsectioning=true}, if package \pkg{standardsectioning} +% already has been loaded isn't a foul. So we just write an information to the +% \file{log}. But using \opt{standardsectioning=false}, if package +% \pkg{standardsectioning} already has been loaded may be wrong. So +% we use a warning message. We also warn if a not allowed value is used. +% \begin{macrocode} +\bool_new:N \@@_standardsectioning_bool + +\cs_new:Nn \@@_switch_standardsectioning:n + { + \str_case_e:nnF { \str_foldcase:n { #1 } } + { + {true} { + \@ifpackageloaded { standardsectioning } + { + \msg_info:nnnn { scrhack } { option-too-late } + { standardsectioning = true } { standardsectioning } + } + { + \bool_if:NF \@@_standardsectioning_bool + { + \str_set:Nx \l_tmpa_str { \cs_meaning:N \normalsize } + \str_if_in:NnTF + \l_tmpa_str + { \@latex@error } + { + \hook_gput_code:nnn { class/after } { scrhack } + { + \RequirePackage { standardsectioning } + \exp_args:Nnnx \hook_gput_code:nnn + { begindocument/before } { scrhack } + { + \exp_not:N \cs_gset:Npn + \exp_after:wN \exp_not:N + \cs:w ver@standardsectioning.sty \cs_end: + { + \cs:w ver@standardsectioning.sty \cs_end: + } + } + \cs_undefine:c { var@standardsectioning.sty } + } + \bool_gset_true:N \@@_standardsectioning_bool + } + { + \RequirePackage{ standardsectioning } + \bool_gset_false:N \@@_standardsectioning_bool + } + } + } + } + {false} { + \@ifpackageloaded { standardsectioning } + { + \msg_warning:nnnn { scrhack } { option-too-late } + { standardsectioning=false } { standardsectioning } + } + { + \bool_if:NT \@@_standardsectioning_bool + { + \hook_gremove_code:nn { class/after } { scrhack } + } + \bool_gset_false:N \@s@_standardsectioning_bool + } + } + } + { + \msg_warning:nnn { keys } { boolean-values-only } { standardsectioning } + } + } +% \end{macrocode} +% \end{macro} +% \ExplSyntaxOff +% +% +% +% \subsection{Processing the options} +% Last but not least, we set the defaults and process the options. +% \begin{macrocode} +\ExplSyntaxOff +\ProcessKeyOptions\relax +% \end{macrocode} +% +% \iffalse +%</package> +% \fi +% +% \Finale +% \PrintChanges +% +% \endinput +% Local Variables: +% mode: doctex +% ispell-local-dictionary: "en_US" +% eval: (flyspell-mode 1) +% TeX-master: t +% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx")) +% End: diff --git a/macros/latex/contrib/scrhack/scrhack.pdf b/macros/latex/contrib/scrhack/scrhack.pdf Binary files differnew file mode 100644 index 0000000000..7766207b57 --- /dev/null +++ b/macros/latex/contrib/scrhack/scrhack.pdf diff --git a/macros/latex/contrib/suanpan-l3/README.md b/macros/latex/contrib/suanpan-l3/README.md index 626b8f857b..0324a0c7d5 100644 --- a/macros/latex/contrib/suanpan-l3/README.md +++ b/macros/latex/contrib/suanpan-l3/README.md @@ -3,7 +3,7 @@ The traditional Chinese 7-bids suanpan(abacus) package based on l3draw The `suanpan-l3` package is a traditional Chinese 7-bids abacus drawing package that utilizes l3draw and is developed with Expl3. It can effectively manage both upper and lower bids, while also considering bottom bid, top bid, and hanging bid. -The `suanpan-l3` package offers a unique environment for drawing abacuses, denoted as `suanpan`. Within this environment, 7 specialized macros are available for the creation of abacuses. The `\rod` macro is used to lay out a single rod, while the `\rod*` macro draws a counting point on this rod's beam. The `\rods` macro is capable of laying out a set of rods. The `\bid` macro colors the specified bid. The `\bids` macro colors all inner bids that are near the beam, while the `\bids*` macro colors all outer bids that are far from the beam. Lastly, the `\lrframe` macro is used to lay out the left and right frames of an abacus. +The `suanpan-l3` package offers a unique environment for drawing abacuses, denoted as `suanpan`. Within this environment, 8 specialized macros are available for the creation of abacuses. The `\rod` macro is used to lay out a single rod, while the `\rod*` macro draws a counting point on this rod's beam. The `\rods` macro is capable of laying out a set of rods. The `\bid` macro colors the specified bid. The `\bids` macro colors all inner bids that are near the beam, while the `\bids*` macro colors all outer bids that are far from the beam. The `\rodmark` mark the rod on beam. Lastly, the `\mkfame` macro is used to lay out the frame of an abacus. At the same time, the `suanpan-l3` package offers customization options for abacus, including line width, draw color, fill color, bid space, rod space, etc. These can be configured through package options, `suanpan` environment options, or `\suanpanset` macro. @@ -21,7 +21,7 @@ Contributing `suanpan-l3`是一个基于l3draw绘图宏包,用Expl3开发的中国传统7珠圆珠算盘排版宏包,它能够实现普通上珠、下珠和使用底珠、顶珠和悬珠的算盘排版。 -`suanpan-l3`宏包提供了唯一的一个`suanpan`排版环境用于绘制需要排版的算盘,在该环境中使用专用命令`\rod`排版一个档位,`\rod*`命令排版带计位点的档位,`\rods`命令排版一组档位,`\bid`命令为指定的算珠进行着色,`\bids`命令为指定档位的内珠进行着色,`\bids*`命令为指定的档位的外珠进行着色,`\lrframe`命令排版算盘左右边框。 +`suanpan-l3`宏包提供了唯一的一个`suanpan`排版环境用于绘制需要排版的算盘,在该环境中使用专用命令`\rod`排版一个档位,`\rod*`命令排版带计位点的档位,`\rods`命令排版一组档位,`\bid`命令为指定的算珠进行着色,`\bids`命令为指定档位的内珠进行着色,`\bids*`命令为指定的档位的外珠进行着色,`\rodmark`命令用于为档位横梁添加标记,`\mkframe`命令排版算盘边框。 同时,`suanpan-l3`宏包还为算盘排版提供线宽、颜色、间距等**外观**设置选项,可以通过宏包选项、环境选项对其进行设置,也可以通过`\suanpanset`命令实现外观属性设置。 diff --git a/macros/latex/contrib/suanpan-l3/suanpan-l3.pdf b/macros/latex/contrib/suanpan-l3/suanpan-l3.pdf Binary files differindex 339b329f0f..a9b8f502cb 100644 --- a/macros/latex/contrib/suanpan-l3/suanpan-l3.pdf +++ b/macros/latex/contrib/suanpan-l3/suanpan-l3.pdf diff --git a/macros/latex/contrib/suanpan-l3/suanpan-l3.sty b/macros/latex/contrib/suanpan-l3/suanpan-l3.sty index 551702dfdb..fad6395f51 100644 --- a/macros/latex/contrib/suanpan-l3/suanpan-l3.sty +++ b/macros/latex/contrib/suanpan-l3/suanpan-l3.sty @@ -9,13 +9,35 @@ \RequirePackage{expl3} % \ProvidesExplPackage{suanpan}{2024-08-20}{v1.0.0} % 初稿 % \ProvidesExplPackage{suanpan}{2024-08-28}{v1.1.0} % 优化(统一尺寸计算,添加空白占位) -\ProvidesExplPackage{suanpan-l3}{2024-08-30}{v1.1.1} % 更名为suanpan-l3 +% \ProvidesExplPackage{suanpan-l3}{2024-08-30}{v1.1.1} % 更名为suanpan-l3 +% \ProvidesExplPackage{suanpan-l3}{2024-08-31}{v1.1.2} % 添加empty不绘制空档选项 +% \ProvidesExplPackage{suanpan-l3}{2024-09-01}{v1.1.3} % 添加bid批处理及绘制颜色选项 +% % 将算珠与档杆绘制改为TikZ +\ProvidesExplPackage{suanpan-l3}{2024-09-04}{v1.2.0} % 添加\lab横梁文字标记命令 {draw suanpan(abacus) with LaTeX3} \RequirePackage{l3keys2e} \RequirePackage{xparse} \RequirePackage{l3draw} +\RequirePackage {tikz} + +% Expl3中载入tikz宏包库的补丁 +% \ExplSyntaxOff +% \patchcmd +% {\pgfutil@InputIfFileExists} +% {\input #1} +% {% +% \@pushfilename +% \xdef\@currname{#1}% +% \input #1 % +% \@popfilename +% } +% {}{} +% \ExplSyntaxOn +% % 添加tikz宏包的库 +% \usetikzlibrary{calc} + \cs_new:Npn \__suanpan_error:n { \msg_error:nn { suanpan(abacus) } } % 盒子容器总高度计算函数 @@ -35,6 +57,7 @@ \cs_set_nopar:Npn \__suanpan_color_select:nn #1#2 { \color_set:nn {#1} {#2} + \colorlet { #1 } { #2 } } \cs_generate_variant:Nn \__suanpan_color_select:nn {nx} @@ -45,6 +68,7 @@ \cs_set_nopar:Npn \__suanpan_color_select:nnn #1#2#3 { \color_set:nnn {#1} {#2} {#3} + \definecolor { #1 } { #2 } } \cs_generate_variant:Nn \__suanpan_color_select:nnn {nnx} @@ -63,7 +87,7 @@ \dim_set:Nn \l__suanpan_bid_sep_dim { 1.8pt } \dim_set:Nn \l__suanpan_rod_sep_dim { 4pt } \dim_set:Nn \l__suanpan_rod_d_dim { 7mm } -\dim_set:Nn \l__suanpan_frame_b_dim { 11mm } +\dim_set:Nn \l__suanpan_frame_b_dim { 13mm } % 半长度 \dim_new:N \l__suanpan_bid_h_half_dim @@ -83,6 +107,10 @@ \dim_new:N \l__suanpan_rod_upper_offset_dim % 下档杆偏移 \dim_new:N \l__suanpan_rod_lower_offset_dim +% 上档杆位置 +\dim_new:N \l__suanpan_rod_upper_dim +% 下档杆位置 +\dim_new:N \l__suanpan_rod_lower_dim % 上边框内线偏移 \dim_new:N \l__suanpan_frame_upper_inner_offset_dim % 下边框内线偏移 @@ -120,6 +148,12 @@ \dim_new:N \l__suanpan_frame_inner_upper_dim % 下边框内线位置 \dim_new:N \l__suanpan_frame_inner_lower_dim + +% 边框内线高度 +\dim_new:N \l__suanpan_frame_inner_h_dim +% 边框外线高度 +\dim_new:N \l__suanpan_frame_outer_h_dim + % 左右边框外线偏移 \dim_new:N \l__suanpan_frame_outer_lr_offset_dim % 左右边框外线圆角半径 @@ -136,13 +170,15 @@ \bool_new:N \l__suanpan_support_unit_bool \bool_set_false:N \l__suanpan_support_unit_bool \bool_new:N \l__suanpan_draft_bool +\bool_new:N \l__suanpan_empty_rod_bool % 容器(盒子) \coffin_new:N \l__suanpan_inner_bid_coffin \coffin_new:N \l__suanpan_outer_bid_coffin \coffin_new:N \l__suanpan_float_bid_coffin \coffin_new:N \l__suanpan_support_coffin -\coffin_new:N \l__suanpan_empty_support_coffin +\coffin_new:N \l_tmpc_coffin +\coffin_new:N \l_tmpd_coffin % 凭据表(Token) \tl_new:N \l__suanpan_bid_draw_color_tl @@ -208,6 +244,11 @@ % 下档杆偏移 \dim_set:Nn \l__suanpan_rod_lower_offset_dim { -\l__suanpan_frame_b_half_dim - \l__suanpan_rod_lower_h_dim } + % 上档杆位置 + \dim_set:Nn \l__suanpan_rod_upper_dim + { \l__suanpan_rod_upper_offset_dim + \l__suanpan_rod_upper_h_dim } + % 下档杆位置 + \dim_set:Nn \l__suanpan_rod_lower_dim { -\l__suanpan_frame_b_half_dim } % 上边框内线偏移 \dim_set:Nn \l__suanpan_frame_upper_inner_offset_dim { \l__suanpan_frame_b_half_dim + \l__suanpan_rod_upper_h_dim } @@ -278,6 +319,18 @@ \dim_set:Nn \l__suanpan_frame_inner_lower_dim { \l__suanpan_frame_lower_inner_offset_dim - \l__suanpan_frame_inner_linewidth_dim / 2 } + + % 边框内线高度 + \dim_set:Nn \l__suanpan_frame_inner_h_dim + { \l__suanpan_rod_upper_h_dim + + \l__suanpan_rod_lower_h_dim + + \l__suanpan_frame_b_dim } + % 边框外线高度 + \dim_set:Nn \l__suanpan_frame_outer_h_dim + { \l__suanpan_rod_upper_h_dim + + \l__suanpan_rod_lower_h_dim + + \l__suanpan_frame_b_dim * 3 } + % 左右边框外线偏移 \dim_set:Nn \l__suanpan_frame_outer_lr_offset_dim { \l__suanpan_support_d_half_dim + @@ -293,12 +346,26 @@ % ============宏包选项================= \keys_define:nn { suanpan } { + % 草稿模式 draft .choice:, - draft / true .code:n = { \bool_set_true:N \l__suanpan_draft_bool }, - draft / false .code:n = { \bool_set_false:N \l__suanpan_draft_bool }, + draft / true .code:n = {% + \bool_set_true:N \l__suanpan_draft_bool + \bool_set_false:N \l__suanpan_empty_rod_bool + }, + draft / false .code:n = {% + \bool_set_false:N \l__suanpan_draft_bool + \bool_set_true:N \l__suanpan_empty_rod_bool + }, draft .default:n = true, draft .initial:n = false, + % 是否绘制档的数值为0的算珠 + empty .choice:, + empty / true .code:n = { \bool_set_true:N \l__suanpan_empty_rod_bool }, + empty / false .code:n = { \bool_set_false:N \l__suanpan_empty_rod_bool }, + empty .default:n = true, + empty .initial:n = true, + unknown .code:n = { \msg_error:nn { suanpan } { unknown-option } } } @@ -323,7 +390,7 @@ \fp_to_dim:n { \fp_eval:n {% - \l__suanpan_frame_inner_linewidth_dim * 1.0 } + \l__suanpan_frame_inner_linewidth_dim * 0.2 } } } % 算珠线宽 @@ -332,7 +399,7 @@ \fp_to_dim:n { \fp_eval:n {% - \l__suanpan_frame_inner_linewidth_dim * 1.0 } + \l__suanpan_frame_inner_linewidth_dim * 0.2 } } } % 计算其它尺寸 @@ -371,7 +438,7 @@ roddraw* .code:n = { \__suanpan_color_select:nnn { roddrawcolor } #1 }, % 档杆填充颜色 rodfill .code:n = { \__suanpan_color_select:nn { rodfillcolor } {#1} }, - rodfill .initial:n = white, + rodfill .initial:n = black!20, rodfill* .code:n = { \__suanpan_color_select:nnn { rodfillcolor } #1 }, % 外珠绘图颜色 @@ -380,7 +447,7 @@ outerdraw* .code:n = { \__suanpan_color_select:nnn { outerdrawcolor } #1 }, % 外珠填充颜色 outerfill .code:n = { \__suanpan_color_select:nn { outerfillcolor } {#1} }, - outerfill .initial:n = white, + outerfill .initial:n = black!40, outerfill* .code:n = { \__suanpan_color_select:nnn { outerfillcolor } #1 }, % 内珠绘图颜色 @@ -399,40 +466,52 @@ \msg_new:nnn { suanpan } { unknown-option } { package~ option~ "\l_keys_key_tl"~ is~ unknown. } -% 将文档类选项传给suanpan -\ProcessKeysOptions { suanpan } - % 选项默认值 \keys_set:nn { suanpan } { linewd = 2.0pt, rodsep = 3.0pt, bidsep = 1.8pt, - scale = 1.0, + scale = 1.0, + empty = true, } +% 将文档类选项传给suanpan +\ProcessKeysOptions { suanpan } + % 构建内珠(靠近横梁,参与计数)容器(盒子) \cs_new:Nn \__suanpan_inner_bid_construct: { + % 判断是否为草稿模式 + \bool_if:NTF \l__suanpan_draft_bool + { + \tikzset{bid/.style ={ + inner~color=innerfillcolor!30, + outer~color=innerfillcolor, + draw = innerdrawcolor, + line~width=\l__suanpan_bid_linewidth_dim, + } + } + }{ + \tikzset{bid/.style = { + inner~color=innerfillcolor!30, + outer~color=innerfillcolor, + draw = innerdrawcolor, + line~width=\l__suanpan_bid_linewidth_dim, + rounded~corners=\l__suanpan_bid_arc_dim, + } + } + } + \group_begin: \hcoffin_gset:Nn \l__suanpan_inner_bid_coffin { - \draw_begin: - \color_stroke:n { innerdrawcolor } - \draw_linewidth:n { \l__suanpan_bid_linewidth_dim } - % 圆角矩形绘制较为耗时,draft模式时将绘制直角矩形 - \bool_if:NF \l__suanpan_draft_bool - { - \draw_path_corner_arc:nn{ \l__suanpan_bid_arc_dim } - { \l__suanpan_bid_arc_dim } - } - % 绘制算珠 - \draw_path_rectangle_corners:nn - { -\l__suanpan_bid_d_half_dim, \l__suanpan_bid_lower_dim} - { \l__suanpan_bid_d_half_dim, \l__suanpan_bid_upper_dim} - \color_fill:n { innerfillcolor } - \draw_path_use_clear:n { stroke, fill } - \draw_end: + \begin{tikzpicture} + \shadedraw[bid] + ( -\l__suanpan_bid_d_half_dim, \l__suanpan_bid_lower_dim) + rectangle + ( \l__suanpan_bid_d_half_dim, \l__suanpan_bid_upper_dim); + \end{tikzpicture} } \group_end: } @@ -440,52 +519,73 @@ % 构建外珠(远离横梁,不参与计数)容器(盒子) \cs_new:Nn \__suanpan_outer_bid_construct: { + % 判断是否为草稿模式 + \bool_if:NTF \l__suanpan_draft_bool + { + \tikzset{bid/.style ={ + inner~color=outerfillcolor!30, + outer~color=outerfillcolor, + draw = outerdrawcolor, + line~width=\l__suanpan_bid_linewidth_dim, + } + } + }{ + \tikzset{bid/.style ={ + inner~color=outerfillcolor!30, + outer~color=outerfillcolor, + draw = outerdrawcolor, + line~width=\l__suanpan_bid_linewidth_dim, + rounded~corners=\l__suanpan_bid_arc_dim, + } + } + } + \group_begin: \hcoffin_gset:Nn \l__suanpan_outer_bid_coffin { - \draw_begin: - \color_stroke:n { outerdrawcolor } - \draw_linewidth:n { \l__suanpan_bid_linewidth_dim } - % 圆角矩形绘制较为耗时,draft模式时将绘制直角矩形 - \bool_if:NF \l__suanpan_draft_bool - { - \draw_path_corner_arc:nn{ \l__suanpan_bid_arc_dim } - { \l__suanpan_bid_arc_dim } - } - % 绘制算珠 - \draw_path_rectangle_corners:nn - { -\l__suanpan_bid_d_half_dim, \l__suanpan_bid_lower_dim} - { \l__suanpan_bid_d_half_dim, \l__suanpan_bid_upper_dim} - \color_fill:n { outerfillcolor } - \draw_path_use_clear:n { stroke, fill } - \draw_end: + \begin{tikzpicture} + \shadedraw[bid]% + ( -\l__suanpan_bid_d_half_dim, \l__suanpan_bid_lower_dim) + rectangle + ( \l__suanpan_bid_d_half_dim, \l__suanpan_bid_upper_dim); + \end{tikzpicture} } \group_end: } % 构建浮珠容器(盒子) % 浮珠指可以在算盘中任意布置的算珠 +% #1 绘制颜色 +% #2 填充颜色 \cs_new:Npn \__suanpan_float_bid_construct:nn #1#2 { + % 判断是否为草稿模式 + \bool_if:NTF \l__suanpan_draft_bool + { + \tikzset{bid/.style ={ + line~width=\l__suanpan_bid_linewidth_dim, + } + } + }{ + \tikzset{bid/.style ={ + line~width=\l__suanpan_bid_linewidth_dim, + rounded~corners=\l__suanpan_bid_arc_dim, + } + } + } + \group_begin: \hcoffin_gset:Nn \l__suanpan_float_bid_coffin { - \draw_begin: - \color_stroke:n { #1 } - \draw_linewidth:n { \l__suanpan_bid_linewidth_dim } - % 圆角矩形绘制较为耗时,draft模式时将绘制直角矩形 - \bool_if:NF \l__suanpan_draft_bool - { - \draw_path_corner_arc:nn{ \l__suanpan_bid_arc_dim } - { \l__suanpan_bid_arc_dim } - } - % 绘制算珠 - \draw_path_rectangle_corners:nn - { -\l__suanpan_bid_d_half_dim, \l__suanpan_bid_lower_dim} - { \l__suanpan_bid_d_half_dim, \l__suanpan_bid_upper_dim} - \color_fill:n { #2 } - \draw_path_use_clear:n { stroke, fill } - \draw_end: + \begin{tikzpicture} + \shadedraw[draw = #1, + inner~color=#2!30, + outer~color=#2, + bid]% + ( -\l__suanpan_bid_d_half_dim, \l__suanpan_bid_lower_dim) + rectangle + ( \l__suanpan_bid_d_half_dim, \l__suanpan_bid_upper_dim); + \end{tikzpicture} } \group_end: } @@ -493,110 +593,111 @@ % 构建档杆容器(盒子) \cs_new:Nn \__suanpan_support_construct: { + % TikZ绘图样式 + \tikzset{% + rod/.style = {% 档杆 + inner~color=rodfillcolor!30, + outer~color=rodfillcolor, + draw=roddrawcolor, + line~width=\l__suanpan_rod_linewidth_dim, + }, + beam/.style = {% 横梁 + bottom~color=framecolor!60, + top~color=framecolor!60, + middle~color = framecolor!5, + }, + frame/.style = {% 上下梁 + bottom~color=framecolor!95, + top~color=framecolor!95, + middle~color = framecolor!15, + }, + frameinner/.style = {% 内边框线 + draw=framecolor, + line~width=\l__suanpan_frame_inner_linewidth_dim, + }, + frameouter/.style = {% 外边框线 + draw=framecolor, + line~width=\l__suanpan_frame_outer_linewidth_dim, + }, + } + \group_begin: \hcoffin_gset:Nn \l__suanpan_support_coffin { - \draw_begin: - \draw_scope_begin: - \color_stroke:n { roddrawcolor } - \draw_linewidth:n { \l__suanpan_rod_linewidth_dim } - % 绘制下杆 - \draw_path_rectangle:nn { -\l__suanpan_rod_d_half_dim, - \l__suanpan_rod_lower_offset_dim } - { \l__suanpan_rod_d_dim, - \l__suanpan_rod_lower_h_dim } - % 绘制上杆 - \draw_path_rectangle:nn { -\l__suanpan_rod_d_half_dim, - \l__suanpan_rod_upper_offset_dim } - { \l__suanpan_rod_d_dim, - \l__suanpan_rod_upper_h_dim } - \color_fill:n { rodfillcolor } - \draw_path_use_clear:n { stroke, fill } - % 绘制横梁 - \color_stroke:n { framecolor } - \draw_path_moveto:n { -\l__suanpan_support_d_half_dim, - \l__suanpan_frame_b_half_dim } - \draw_path_lineto:n { \l__suanpan_support_d_half_dim, - \l__suanpan_frame_b_half_dim } - \draw_path_moveto:n { -\l__suanpan_support_d_half_dim, - -\l__suanpan_frame_b_half_dim } - \draw_path_lineto:n { \l__suanpan_support_d_half_dim, - -\l__suanpan_frame_b_half_dim } - \draw_path_use_clear:n { stroke} - \draw_scope_end: - - % 绘制上下边框 - \draw_scope_begin: - \color_stroke:n { framecolor } - \bool_if:NT \l__suanpan_support_frame_bool - { - \draw_linewidth:n { \l__suanpan_frame_inner_linewidth_dim } - % 上边框内线 - \draw_path_moveto:n { -\l__suanpan_support_d_half_dim, - \l__suanpan_frame_upper_inner_offset_dim } - \draw_path_lineto:n { \l__suanpan_support_d_half_dim, - \l__suanpan_frame_upper_inner_offset_dim } - % 下边框内线 - \draw_path_moveto:n { -\l__suanpan_support_d_half_dim, - \l__suanpan_frame_lower_inner_offset_dim } - \draw_path_lineto:n { \l__suanpan_support_d_half_dim, - \l__suanpan_frame_lower_inner_offset_dim } - \draw_path_use_clear:n { stroke} - \draw_linewidth:n { \l__suanpan_frame_outer_linewidth_dim } - % 上边框外线 - \draw_path_moveto:n { -\l__suanpan_support_d_half_dim, - \l__suanpan_support_upper_dim } - \draw_path_lineto:n { \l__suanpan_support_d_half_dim, - \l__suanpan_support_upper_dim } - % 下边框外线 - \draw_path_moveto:n { -\l__suanpan_support_d_half_dim, - \l__suanpan_support_lower_dim } - \draw_path_lineto:n { \l__suanpan_support_d_half_dim, - \l__suanpan_support_lower_dim } - \draw_path_use_clear:n { stroke} - } - \draw_scope_end: + \begin{tikzpicture} + % 绘制下杆 + \shadedraw[rod] + ( -\l__suanpan_rod_d_half_dim, \l__suanpan_rod_lower_offset_dim ) + rectangle + ( \l__suanpan_rod_d_half_dim, \l__suanpan_rod_lower_dim ); + % 绘制上杆 + \shadedraw[rod] + ( -\l__suanpan_rod_d_half_dim, \l__suanpan_rod_upper_offset_dim ) + rectangle + ( \l__suanpan_rod_d_half_dim, \l__suanpan_rod_upper_dim ); + + % 绘制横梁 + \shade[beam] + ( -\l__suanpan_support_d_half_dim, -\l__suanpan_frame_b_half_dim ) + rectangle + ( \l__suanpan_support_d_half_dim, \l__suanpan_frame_b_half_dim ); + \draw[frameinner] + ( -\l__suanpan_support_d_half_dim, \l__suanpan_frame_b_half_dim ) + -- + ( \l__suanpan_support_d_half_dim, \l__suanpan_frame_b_half_dim ); + \draw[frameinner] + ( -\l__suanpan_support_d_half_dim, -\l__suanpan_frame_b_half_dim ) + -- + ( \l__suanpan_support_d_half_dim, -\l__suanpan_frame_b_half_dim ); + + % 绘制上梁下边线 + \draw[frameinner] + ( -\l__suanpan_support_d_half_dim, + \l__suanpan_frame_upper_inner_offset_dim ) + -- + ( \l__suanpan_support_d_half_dim, + \l__suanpan_frame_upper_inner_offset_dim ); + % 绘制上梁上边线 + \draw[frameouter] + ( -\l__suanpan_support_d_half_dim, + \l__suanpan_frame_upper_outer_offset_dim - + \l__suanpan_frame_outer_linewidth_dim) + -- + ( \l__suanpan_support_d_half_dim, + \l__suanpan_frame_upper_outer_offset_dim - + \l__suanpan_frame_outer_linewidth_dim); + + % 绘制下梁上边线 + \draw[frameinner] + ( -\l__suanpan_support_d_half_dim, + \l__suanpan_frame_lower_inner_offset_dim ) + -- + ( \l__suanpan_support_d_half_dim, + \l__suanpan_frame_lower_inner_offset_dim ); + % 绘制下梁下边线 + \draw[frameouter] + ( -\l__suanpan_support_d_half_dim, + \l__suanpan_frame_lower_outer_offset_dim + + \l__suanpan_frame_outer_linewidth_dim ) + -- + ( \l__suanpan_support_d_half_dim, + \l__suanpan_frame_lower_outer_offset_dim + + \l__suanpan_frame_outer_linewidth_dim ); % 绘制计位点(黑色圆点) \bool_if:NT \l__suanpan_support_unit_bool { - \draw_scope_begin: - \color_stroke:n { black } - \draw_path_circle:nn { 0pt, 0pt} { \l__suanpan_frame_unit_r_dim } - \bool_if:NTF \l__suanpan_draft_bool - { - \draw_path_use_clear:n { stroke } - }{ - \color_fill:n { black } - \draw_path_use_clear:n { stroke, fill } - } - \draw_scope_end: + \shade[% + inner~color=black!40, + outer~color=black!80, + ] (0pt, 0pt) circle + [radius = \l__suanpan_frame_unit_r_dim]; } - \draw_end: + \end{tikzpicture} } \group_end: } -% 构建档杆空白容器(盒子),用于占位以避免算盘总成尺寸错误 -\cs_new:Nn \__suanpan_empty_support_construct: - { - % 测量档杆容器(盒子)总宽度和高度 - \dim_set:Nn \l_tmpa_dim - { \coffin_wd:N \l__suanpan_support_coffin } - \dim_set:Nn \l_tmpb_dim - { \__suanpan_coffin_ht_plus_dp:N \l__suanpan_support_coffin } - - % 创建一个空容器(盒子) - \hcoffin_set:Nn \l__suanpan_empty_support_coffin - { - \phantom{a} - } - - % 调整为档杆宽度和高度 - \coffin_resize:Nnn \l__suanpan_empty_support_coffin - { \l_tmpa_dim } { \l_tmpb_dim } - } - % 绘制算珠 % #1: 算珠位置编号 % o o o o o o o | o o o @@ -606,7 +707,7 @@ % 其中,11是悬珠位置 % #2: 算珠类型 % 0——外珠,1——内珠,2——浮珠 -\cs_new:Npn \__suanpan_dispose_bid:nn #1#2 +\cs_new:Npn \__suanpan_bid_layout:nn #1#2 { % 算珠垂直偏移 \int_compare:nNnTF { #1 } > { 7 } @@ -639,18 +740,14 @@ \draw_scope_end: } % 函数变体 -\cs_generate_variant:Nn \__suanpan_dispose_bid:nn {xx} +\cs_generate_variant:Nn \__suanpan_bid_layout:nn {xx} % 组装一个档位 % #1: 档位编号(基于1,从左向右计数) % #2: 档位数字 \cs_new:Npn \__suanpan_assemble_rod:nn #1#2 { - % 取得档位数字对应算珠位置及内珠/外珠编号 - \prop_get:NnN \l__suanpan_rods_val_prop { #2 } \l_tmpa_tl - \clist_clear:N \l__suanpan_bids_pos_clist - \clist_set:NV \l__suanpan_bids_pos_clist \l_tmpa_tl - + \tl_set:Nn \l_tmpb_tl { #2 } % 绘制 \draw_scope_begin: % 水平方向偏移 @@ -661,11 +758,36 @@ { hc } { vc } { 0pt, -\l__suanpan_support_y_offset_dim } % 算珠 - \clist_map_inline:Nn \l__suanpan_bids_pos_clist + \int_compare:nNnTF { #2 } = { 0 } { - \clist_set:Nn \l_tmpa_clist { ##1 } - \__suanpan_dispose_bid:xx { \clist_item:Nn \l_tmpa_clist { 1 } } - { \clist_item:Nn \l_tmpa_clist { 2 } } + % 判断0值算珠是否需要绘制 + \bool_if:NT \l__suanpan_empty_rod_bool + { + % 取得档位数字对应算珠位置及内珠/外珠编号 + \prop_get:NnN \l__suanpan_rods_val_prop { #2 } \l_tmpa_tl + \clist_clear:N \l__suanpan_bids_pos_clist + \clist_set:NV \l__suanpan_bids_pos_clist \l_tmpa_tl + + \clist_map_inline:Nn \l__suanpan_bids_pos_clist + { + \clist_set:Nn \l_tmpa_clist { ##1 } + \__suanpan_bid_layout:xx { \clist_item:Nn \l_tmpa_clist { 1 } } + { \clist_item:Nn \l_tmpa_clist { 2 } } + } + } + }{ + % 不是0值算珠,需要绘制 + % 取得档位数字对应算珠位置及内珠/外珠编号 + \prop_get:NnN \l__suanpan_rods_val_prop { #2 } \l_tmpa_tl + \clist_clear:N \l__suanpan_bids_pos_clist + \clist_set:NV \l__suanpan_bids_pos_clist \l_tmpa_tl + + \clist_map_inline:Nn \l__suanpan_bids_pos_clist + { + \clist_set:Nn \l_tmpa_clist { ##1 } + \__suanpan_bid_layout:xx { \clist_item:Nn \l_tmpa_clist { 1 } } + { \clist_item:Nn \l_tmpa_clist { 2 } } + } } \draw_scope_end: } @@ -679,75 +801,214 @@ % 水平偏移 \draw_transform_xshift:n { \l__suanpan_support_d_dim * ( #1 - 1 ) } - % 空白支杆(宽度尺寸占位) - \draw_coffin_use:Nnnn \l__suanpan_empty_support_coffin - { hc } { vc } { 0pt, -\l__suanpan_support_y_offset_dim } - % 覆盖绘制 - \__suanpan_dispose_bid:xx { #2 }{ 2 } + \__suanpan_bid_layout:xx { #2 }{ 2 } + \draw_scope_end: + } + +% 为一个档位添加记录标记 +% #1: 档位编号(基于1,从左向右) +% #2: 标记内容 +\cs_new:Npn \__suanpan_rod_mark:nn #1#2 + { + \hcoffin_set:Nn \l_tmpa_coffin + { + \begin{tikzpicture} + \node at ( 0, 0 ) [font=\bfseries\Large] { #2 }; + \end{tikzpicture} + } + + \draw_scope_begin: + % 水平偏移 + \draw_transform_xshift:n { \l__suanpan_support_d_dim * ( #1 - 1 ) } + \draw_coffin_use:Nnn \l_tmpa_coffin { hc } { vc } \draw_scope_end: } -% 绘制左右边框 +% 绘制边框 % #1 第一档编号(左) % #2 最后一档编号(右) -\cs_new:Npn \__suanpan_left_right_frame:nn #1#2 +\cs_new:Npn \__suanpan_frame_layout:nn #1#2 { - % 绘制左边框 + % TikZ绘制样式 + \tikzset{% + hframe/.style ={% 上下梁 + bottom~color=framecolor!95, + top~color=framecolor!95, + middle~color = framecolor!15, + draw = framecolor, + line~width = \l__suanpan_frame_inner_linewidth_dim, + }, + vframe/.style ={% 左右梁 + left~color=framecolor!95, + right~color=framecolor!95, + middle~color = framecolor!15, + draw = framecolor, + line~width = \l__suanpan_frame_inner_linewidth_dim, + }, + mframe/.style ={% 横梁 + top~color=framecolor!60, + bottom~color=framecolor!60, + middle~color = framecolor!5, + line~width = \l__suanpan_frame_inner_linewidth_dim, + }, + frameline/.style ={% 梁连线 + draw = framecolor, + line~width = \l__suanpan_frame_inner_linewidth_dim, + }, + arcline/.style ={% 转角线 + draw = framecolor, + line~width = \l__suanpan_frame_inner_linewidth_dim, + rounded~corners = \l__suanpan_frame_inner_linewidth_dim / 2, + }, + } + + % 总宽度 + \dim_set:Nn \l_tmpa_dim { + \fp_to_dim:n { + \fp_eval:n { \l__suanpan_support_d_dim * ( #2 - #1 + 1.0) } + } + } + % 减半档宽度 + \dim_set:Nn \l_tmpb_dim { + \fp_to_dim:n { + \fp_eval:n { \l__suanpan_support_d_dim * ( #2 - #1 ) + + \l__suanpan_support_d_half_dim} + } + } + + \group_begin: + % 上下边框基础容器(盒子) + \hcoffin_set:Nn \l_tmpa_coffin + { + \begin{tikzpicture} + \shadedraw[hframe] + ( 0pt, 0pt ) -- + ++( \l_tmpa_dim, 0) -- + ++( \l__suanpan_frame_b_dim, \l__suanpan_frame_b_dim ) -- + ++( -\l__suanpan_frame_b_dim, 0 ) -- + ++( -\l_tmpa_dim, 0 ) -- + ++( -\l__suanpan_frame_b_dim, 0 ) -- + cycle; + \end{tikzpicture} + } + + % 左右边框基础容器(盒子) + \hcoffin_set:Nn \l_tmpb_coffin + { + \begin{tikzpicture} + \shadedraw[vframe] + ( 0, 0 ) -- + ++( 0, \l__suanpan_frame_inner_h_dim) -- + ++( -\l__suanpan_frame_b_dim, \l__suanpan_frame_b_dim ) -- + ++( 0, -\l__suanpan_frame_outer_h_dim ) -- + cycle; + \draw[arcline] + ( 0, 0 ) + ++( 0, \l__suanpan_frame_inner_h_dim ) + ++( 0, \l__suanpan_frame_b_dim ) + ++( 0, \l__suanpan_frame_inner_linewidth_dim * 0.9 ) + ++( -\l__suanpan_frame_b_half_dim, 0 ) -- + ++( -\l__suanpan_frame_b_half_dim, 0 ) -- + ++( -\l__suanpan_frame_inner_linewidth_dim * 0.9, 0 ) -- + ++( 0, -\l__suanpan_frame_b_half_dim ); + \draw[arcline] + ( 0, 0 ) + ++( 0, -\l__suanpan_frame_b_dim ) + ++( 0, -\l__suanpan_frame_inner_linewidth_dim * 0.9 ) + ++( -\l__suanpan_frame_b_half_dim, 0 ) -- + ++( -\l__suanpan_frame_b_half_dim, 0 ) -- + ++( -\l__suanpan_frame_inner_linewidth_dim * 0.9, 0 ) -- + ++( 0, \l__suanpan_frame_b_half_dim ); + \end{tikzpicture} + } + + % 横梁接头基础容器(盒子) + \hcoffin_set:Nn \l_tmpc_coffin + { + \begin{tikzpicture} + \shade[mframe] + ( 0pt, 0pt ) --++( 0, \l__suanpan_frame_b_dim) -- + ++(-\l__suanpan_frame_inner_linewidth_dim, 0) -- + ++(-\l__suanpan_frame_b_dim / 3, -\l__suanpan_frame_b_dim / 2) -- + ++( \l__suanpan_frame_b_dim / 3, -\l__suanpan_frame_b_dim / 2) -- + cycle; + \draw[frameline]% + ( 0, \l__suanpan_frame_b_dim) -- + ++(-\l__suanpan_frame_inner_linewidth_dim, 0) -- + ++(-\l__suanpan_frame_b_dim / 3, -\l__suanpan_frame_b_dim / 2) -- + ++( \l__suanpan_frame_b_dim / 3, -\l__suanpan_frame_b_dim / 2) -- + ++( \l__suanpan_frame_inner_linewidth_dim, 0); + \end{tikzpicture} + } + + % 布置上边框 \draw_scope_begin: - \color_stroke:n { framecolor } - \draw_linewidth:n { \l__suanpan_frame_inner_linewidth_dim } - \draw_transform_xshift:n { \l__suanpan_support_d_dim * (#1 - 1) } + \draw_transform_xshift:n { -\l__suanpan_support_d_half_dim - + \l__suanpan_frame_inner_linewidth_dim / 2 } + \draw_transform_yshift:n { \l__suanpan_frame_inner_upper_dim - + \l__suanpan_frame_inner_linewidth_dim } + \draw_coffin_use:Nnnn \l_tmpa_coffin { l } { b } + { -\l__suanpan_frame_b_dim, 0pt } + \draw_scope_end: - % 内线 - \draw_path_moveto:n { -\l__suanpan_support_d_half_dim, - \l__suanpan_frame_inner_upper_dim } - \draw_path_lineto:n { -\l__suanpan_support_d_half_dim, - \l__suanpan_frame_inner_lower_dim } - \draw_path_use_clear:n { stroke} - - % 外线 - \draw_linewidth:n { \l__suanpan_frame_outer_linewidth_dim } - \draw_path_corner_arc:nn { \l__suanpan_frame_outer_arc_dim } - { \l__suanpan_frame_outer_arc_dim } - \draw_path_moveto:n { -\l__suanpan_support_d_half_dim, - \l__suanpan_frame_outer_upper_dim } - \draw_path_lineto:n { -\l__suanpan_frame_outer_lr_offset_dim, - \l__suanpan_frame_outer_upper_dim } - \draw_path_lineto:n { -\l__suanpan_frame_outer_lr_offset_dim, - \l__suanpan_frame_outer_lower_dim } - \draw_path_lineto:n { -\l__suanpan_support_d_half_dim, - \l__suanpan_frame_outer_lower_dim } - \draw_path_use_clear:n { stroke} + % 布置下边框 + \draw_scope_begin: + \coffin_rotate:Nn \l_tmpa_coffin { 180 } + \draw_transform_xshift:n { \l_tmpa_dim - \l__suanpan_support_d_half_dim + + \l__suanpan_frame_inner_linewidth_dim / 2 } + + \draw_transform_yshift:n { \l__suanpan_frame_inner_lower_dim + + \l__suanpan_frame_inner_linewidth_dim } + \draw_coffin_use:Nnnn \l_tmpa_coffin { l } { b } + { \l__suanpan_frame_b_dim, 0pt } + \draw_scope_end: + + % 布置左边框 + \draw_scope_begin: + \draw_transform_xshift:n { -\l__suanpan_support_d_half_dim - + \l__suanpan_frame_b_dim - + \l__suanpan_frame_inner_linewidth_dim * 1.5 } + \draw_transform_yshift:n { \l__suanpan_frame_inner_lower_dim - + \l__suanpan_frame_inner_linewidth_dim } + + \draw_coffin_use:Nnnn \l_tmpb_coffin { l } { b } + { 0pt, -\l__suanpan_frame_b_dim } + \draw_scope_end: + + % 布置右边框 + \draw_scope_begin: + \coffin_rotate:Nn \l_tmpb_coffin { 180 } + \draw_transform_xshift:n { \l_tmpb_dim + + \l__suanpan_frame_b_dim + + \l__suanpan_frame_inner_linewidth_dim * 1.5}% - + \draw_transform_yshift:n { \l__suanpan_frame_inner_upper_dim + + \l__suanpan_frame_inner_linewidth_dim } + \draw_coffin_use:Nnnn \l_tmpb_coffin { l } { b } + { 0pt, \l__suanpan_frame_b_dim } + \draw_scope_end: + + % 布置左横梁接头 + \draw_scope_begin: + \draw_transform_xshift:n { -\l__suanpan_support_d_half_dim - + \l__suanpan_frame_b_dim / 3 - + \l__suanpan_frame_inner_linewidth_dim / 2 } + \draw_transform_yshift:n { -\l__suanpan_frame_b_dim / 2 - + \l__suanpan_frame_inner_linewidth_dim / 2 } + \draw_coffin_use:Nnnn \l_tmpc_coffin { l } { b } { 0pt, 0pt } \draw_scope_end: - % 绘制右边框 + % 布置右横梁接头 \draw_scope_begin: - \color_stroke:n { framecolor } - \draw_linewidth:n { \l__suanpan_frame_inner_linewidth_dim } - \draw_transform_xshift:n { \l__suanpan_support_d_dim * (#2 - 1) } - - % 内线 - \draw_path_moveto:n { \l__suanpan_support_d_half_dim, - \l__suanpan_frame_inner_upper_dim } - \draw_path_lineto:n { \l__suanpan_support_d_half_dim, - \l__suanpan_frame_inner_lower_dim } - \draw_path_use_clear:n { stroke} - - % 外线 - \draw_linewidth:n { \l__suanpan_frame_outer_linewidth_dim } - \draw_path_corner_arc:nn { \l__suanpan_frame_outer_arc_dim } - { \l__suanpan_frame_outer_arc_dim } - \draw_path_moveto:n { \l__suanpan_support_d_half_dim, - \l__suanpan_frame_outer_upper_dim } - \draw_path_lineto:n { \l__suanpan_frame_outer_lr_offset_dim, - \l__suanpan_frame_outer_upper_dim } - \draw_path_lineto:n { \l__suanpan_frame_outer_lr_offset_dim, - \l__suanpan_frame_outer_lower_dim } - \draw_path_lineto:n { \l__suanpan_support_d_half_dim, - \l__suanpan_frame_outer_lower_dim } - \draw_path_use_clear:n { stroke} + \coffin_rotate:Nn \l_tmpc_coffin { 180 } + \draw_transform_xshift:n { \l_tmpb_dim + + \l__suanpan_frame_b_dim / 3 + + \l__suanpan_frame_inner_linewidth_dim / 2 } + \draw_transform_yshift:n { \l__suanpan_frame_b_dim / 2 + + \l__suanpan_frame_inner_linewidth_dim / 2 } + \draw_coffin_use:Nnnn \l_tmpc_coffin { l } { b } { 0pt, 0pt } \draw_scope_end: + \group_end: } % 算盘排版用户接口 @@ -767,7 +1028,6 @@ \__suanpan_inner_bid_construct: \__suanpan_outer_bid_construct: \__suanpan_support_construct: - \__suanpan_empty_support_construct: % 删除#2(!b)参数取得的环境内容中的空白 \str_set:Nn \l_tmpa_str { #2 } @@ -783,7 +1043,6 @@ \draw_end: } - % TODO: 需要增加组装档位数字标记功能 \hcoffin_set:Nn \l_tmpb_coffin { % 将原图缩小50% @@ -871,28 +1130,21 @@ % 指定某档上某个算珠的颜色 % #1 档位(基于1,从左向右计数) -% #2 算珠位置(1--11,11为悬珠位置) -% #3 算珠填充颜色(绘图颜色将添加40%的黑色) -\NewDocumentCommand{ \bid }{ m m m } +% #2 算珠位置列表(1--11,11为悬珠位置) +% #3 算珠填充颜色 +% #4 算珠绘制颜色(默认为内珠绘制颜色) +\NewDocumentCommand{ \bid }{ m m m O{innerdrawcolor} } { % 构造浮珠 - \__suanpan_float_bid_construct:nn { #3!60!black }{ #3 } + \__suanpan_float_bid_construct:nn { #4 }{ #3 } - % 绘制浮珠 - \__suanpan_float_bid:nn { #1 }{ #2 } + % 构造算珠位置列表 + \clist_set:Nn \l_tmpa_clist { #2 } - % 如不是最后一个档位,则添加一个额外空白档杆以实现水平尺寸占位 - \int_compare:nNnT { #1 } < { \l__suanpan_rod_max_int } + \clist_map_inline:Nn \l_tmpa_clist { - \draw_scope_begin: - % 水平偏移 - \draw_transform_xshift:n { \l__suanpan_support_d_dim * - ( \l__suanpan_rod_max_int - 1 ) } - - % 空白支杆(水平尺寸占位) - \draw_coffin_use:Nnnn \l__suanpan_empty_support_coffin - { hc } { vc } { 0pt, -\l__suanpan_support_y_offset_dim } - \draw_scope_end: + % 绘制浮珠 + \__suanpan_float_bid:nn { #1 }{ ##1 } } } @@ -900,12 +1152,9 @@ % #1 星号命令,选择内珠或外珠 % #2 档位(基于1,从左向右计数) % #3 该档数字 -% #4 算珠填充颜色(绘图颜色将添加40%的黑色) +% #4 算珠填充颜色(绘图颜色采用原内/外珠绘制颜色) \NewDocumentCommand{ \bids }{ s m m m } { - % 构造浮珠 - \__suanpan_float_bid_construct:nn { #4!60!black }{ #4 } - % 取得档位数字对应算珠位置及内珠/外珠编号 \prop_get:NnN \l__suanpan_rods_val_prop { #3 } \l_tmpa_tl \clist_clear:N \l__suanpan_bids_pos_clist @@ -914,6 +1163,9 @@ % 星号命令,用于选择外珠着色 \IfBooleanTF{#1} { + % 构造浮珠 + \__suanpan_float_bid_construct:nn { outerdrawcolor }{ #4 } + \clist_map_inline:Nn \l__suanpan_bids_pos_clist { \clist_set:Nn \l_tmpa_clist { ##1 } @@ -924,6 +1176,9 @@ } } }{ + % 构造浮珠 + \__suanpan_float_bid_construct:nn { innerdrawcolor }{ #4 } + \clist_map_inline:Nn \l__suanpan_bids_pos_clist { \clist_set:Nn \l_tmpa_clist { ##1 } @@ -934,32 +1189,44 @@ } } } - - % 如不是最后一个档位,则添加一个额外空白档杆以实现水平尺寸占位 - \int_compare:nNnT { #1 } < { \l__suanpan_rod_max_int } - { - \draw_scope_begin: - % 水平偏移 - \draw_transform_xshift:n { \l__suanpan_support_d_dim * - ( \l__suanpan_rod_max_int - 1 ) } - - % 空白支杆(水平尺寸占位) - \draw_coffin_use:Nnnn \l__suanpan_empty_support_coffin - { hc } { vc } { 0pt, -\l__suanpan_support_y_offset_dim } - \draw_scope_end: - } } % 左右边框 -% #1 左边第一个档位(基于1,从左向右计数) -% #2 右边最后一个档位(基于1,从左向右计数) -\NewDocumentCommand{ \lrframe }{ m m } +\NewDocumentCommand{ \mkframe }{ } + { + \__suanpan_frame_layout:nn { 1 }{ \l__suanpan_rod_max_int } + } + +% 为各档添加计位标记 +% #1 起始档位(基于1,从左向右计数) +% #2 标记列表 +\NewDocumentCommand{ \rodmark }{ O{1} m } { - \__suanpan_left_right_frame:nn { #1 }{ #2 } + % 标记列表 + \clist_set:Nn \l_tmpa_clist { #2 } + + % 计数器 + \int_set:Nn \l_tmpa_int { #1 } + + % 遍历列表 + \clist_map_inline:Nn \l_tmpa_clist + { + % 输出标记 + \__suanpan_rod_mark:nn { \l_tmpa_int }{ ##1 } + + % 调整计数器 + \int_incr:N \l_tmpa_int + + % 超出最大档位 + \int_compare:nNnT { \l_tmpa_int } > { \l__suanpan_rod_max_int } + { + \clist_map_break: + } + } } % 选项设置用户接口 -\NewDocumentCommand \suanpanset { m } +\NewDocumentCommand{ \suanpanset } { m } { \IfNoValueF { #1} { diff --git a/macros/latex/contrib/suanpan-l3/suanpan-l3.tex b/macros/latex/contrib/suanpan-l3/suanpan-l3.tex index e6cf62b186..dacd7c9f0b 100644 --- a/macros/latex/contrib/suanpan-l3/suanpan-l3.tex +++ b/macros/latex/contrib/suanpan-l3/suanpan-l3.tex @@ -124,7 +124,7 @@ { \__codedoc_cmd:no {#1} { #2 } } \ExplSyntaxOff -\def\vers{\texttt{v1.1.1} } +\def\vers{\texttt{v1.2.0} } \changes{v1.0.0}{2024/08/20}{first version.} @@ -149,9 +149,9 @@ 开发的中国传统7珠圆珠算盘排版宏包,它能够实现使用普通上珠、下珠 和底珠、顶珠及悬珠的算盘排版。该宏包提供了唯一的一个 \env{suanpan}算盘排版环境及仅在该环境中使用的 \tn{rod}、 - \tn{rods}、\tn{bid}、\tn{bids}和\tn{lrframe}档杆、算珠着色和 - 边框排版命令。同时,该宏包还提供了\tn{suanpanset}命令用于对算盘 - 外观进行设置。 + \tn{rods}、\tn{bid}、\tn{bids}、\tn{rodmark}和\tn{mkframe}档杆、算珠 + 着色、横梁标记和边框排版命令。同时,该宏包还提供了\tn{suanpanset}% + 命令用于对算盘外观进行设置。 \begin{center} \begin{suanpan}[framedraw = brown2, scale = 0.45, bidsep=1.5pt, roddraw = brown3, rodfill = brown4] @@ -161,22 +161,22 @@ \rod*{4}{3} \rod*{18}{17} % 使用顶珠 - \bid{12}{9}{azure7} - \bid{13}{9}{azure7} - \bid{14}{9}{azure7} - \bid{15}{9}{azure7} - \bid{16}{9}{azure7} + \bid{12}{9}{azure5} + \bid{13}{9}{azure5} + \bid{14}{9}{azure5} + \bid{15}{9}{azure5} + \bid{16}{9}{azure5} % 使用悬珠 - \bid{17}{11}{red8} - \bid{18}{11}{red8} - \bid{19}{11}{red8} - \bid{20}{11}{red8} - \bid{21}{11}{red8} + \bid{17}{11}{red5} + \bid{18}{11}{red5} + \bid{19}{11}{red5} + \bid{20}{11}{red5} + \bid{21}{11}{red5} % 使用底珠 - \bid{11}{3}{olive7} - \bid{16}{3}{olive7} - \bid{21}{3}{olive7} - \lrframe{1}{21} + \bid{11}{3}{olive5} + \bid{16}{3}{olive5} + \bid{21}{3}{olive5} + \mkframe \end{suanpan} \end{center} \end{abstract} @@ -213,7 +213,8 @@ 在\env{suanpan}环境中,可以通过专用命令\tn{rod}% (排版算盘的一个档位),\tn{rods}(排版一组档位), - \tn{bid}(指定算珠颜色),\tn{lrframe}(排版左右边框) + \tn{bid}(指定算珠颜色),\tn{bids}(指定内/外珠颜色), + \tn{rodmark}(为档位添加标记),\tn{mkframe}(排版边框) 按需实现算盘排版。 在\oarg{外观选项}中可以通过key-value的方式设置线宽、颜色、 @@ -221,6 +222,10 @@ 通过\oarg{外观选项}设置的外观参数仅对\env{suanpan}环境局部有效。 + \begin{notezh} + \env{suanpan}环境中\textsf{不可以出现行}。 + \end{notezh} + \begin{SideBySideExample}[frame=single,numbers=left,% xrightmargin=.48\linewidth,gobble=2] \centering @@ -235,6 +240,7 @@ \subsection{\env{suanpan}环境中的专用命令} +\changes{v1.1.3}{2024/09/04}{add highlight to rod(s) and beam} \subsubsection{\tn{rod}单一档位排版命令} \begin{function}{\rod} @@ -305,17 +311,21 @@ \end{SideBySideExample} \changes{v1.0.1}{2024/08/26}{rename \tn{bidclr} to \tn{bid}.} +\changes{v1.1.3}{2024/09/01}{add draw color option to \tn{bid}, + change \texttt{pos} to clist and + set default bid draw color to \texttt{innerdrawcolor}.} +\changes{v1.1.3}{2024/09/04}{add highlight to bid(s)} \subsubsection{\tn{bid}算珠着色命令} \begin{function}{\bid} \begin{syntax} - \cs{bid} \marg{档位编号}\marg{算珠位置}\marg{算珠颜色} + \cs{bid} \marg{档位编号}\marg{位置列表}\marg{填充颜色}\oarg{绘制颜色} \end{syntax} \end{function} - 用于将\marg{档位编号}指定的档位中,用\marg{算珠位置}指定的算珠 - 设置为\marg{算珠颜色}指定的颜色。同时,该命令还将\marg{算珠颜色}% - 融合40\%黑色后用于算珠绘制颜色。 + 用于将\marg{档位编号}指定的档位中,用逗号分隔的\marg{位置列表}中 + 指定的所有算珠的填充色设置为\marg{填充颜色}指定的颜色,将其绘制 + 颜色设置为\oarg{绘制颜色}(默认为内珠绘制颜色)。 一个档位中的\marg{算珠位置}自下向上,按\enquote{$1, 2, \cdots, 11$}% 的顺序进行编号。其中下珠占\enquote{$1, 2, \cdots, 7$}的位置,上珠占 @@ -331,32 +341,37 @@ \suanpanset{scale = 0.65} \begin{suanpan} \rods{0, 0, 7, 11, 8, 19} - \bid{1}{1}{gray7} - \bid{2}{5}{gray7} - \bid{3}{6}{red8} - \bid{4}{7}{red8} - \bid{4}{8}{azure6} - \bid{4}{9}{yellow9} + \bid{1}{1}{brown5} + \bid{2}{5}{brown5} + \bid{3}{6}{red5} + \bid{4}{7}{red5} + \bid{4}{8}{azure5} + \bid{4}{9}{yellow5} \bid{5}{10}{violet5} - \bid{6}{11}{teal4} + \bid{6}{4,5,6,11}{teal4}[magenta5] \end{suanpan} \end{SideBySideExample} \changes{v1.1.0}{2024/08/28}{adde \tn{bids} macro.} +\changes{v1.1.3}{2024/09/01}{change \tn{bids} macro inner bids draw color to + \texttt{innerdrawcolor} and outter bids draw + color to \texttt{outerdrawcolor}.} + \subsubsection{\tn{bids}内珠或外珠着色命令} \begin{function}{\bids} \begin{syntax} - \cs{bids} \marg{档位编号}\marg{档位数字}\marg{算珠颜色} + \cs{bids} \marg{档位编号}\marg{档位数字}\marg{填充颜色} \end{syntax} \end{function} 用于将\marg{档位编号}指定的档位中,所有\marg{档位数字}的内珠 - 设置为\marg{算珠颜色}指定的颜色。同时,该命令还将\marg{算珠颜色}% - 融合40\%黑色后用于算珠绘制颜色。 + 设置为\marg{填充颜色}指定的颜色。同时,该命令还将 + 算珠绘制颜色设置内珠绘制颜色(\texttt{innerdrawcolor})。 宏包还为\tn{bids}命令同时提供了\tn{bids*}星号命令用于设置该档 - 所有外珠的颜色。 + 所有外珠的颜色。此时,算珠绘制颜色设置外珠绘制颜色 + (\texttt{outerdrawcolor})。 \begin{notezh} 同样,该命令只能用于\env{suanpan}环境中。该命令只能选择 @@ -370,25 +385,26 @@ \begin{suanpan} \rods{0, 0, 7, 11, 8, 19} \bids{3}{7}{teal4} - \bids*{5}{8}{azure6} + \bids*{5}{8}{azure5} \end{suanpan} \end{SideBySideExample} -\subsubsection{\tn{lrframe}左右边框排版命令} +\changes{v1.2.0}{2024/09/04}{add \tn{rodmark} macro for marking rod(s) on beams.} + +\subsubsection{\tn{rodmark}横梁标记命令} -\begin{function}{\lrframe} +\begin{function}{\rodmark} \begin{syntax} - \cs{lrframe} \marg{首档编号}\marg{末档编号} + \cs{rodmark} \oarg{起始档位}\marg{标记列表} \end{syntax} \end{function} - 用于在\marg{首档编号}指定的档位左边和\marg{末档编号}指定的档位 - 右边排版算盘的左右边框。 + 用于从\oarg{起始档位}可选项指定的档位开始,用\marg{标记列表}% + 中逗号分隔的标记在算盘横梁上为各档位添加标记。 \begin{notezh} - 同样,该命令只能用于\env{suanpan}环境中。另外,其左右边框应该 - 同时按正确第一档和最后一档档位编号绘制,否则会造成结果容器(盒子) - 尺寸异常的问题。 + 如果\marg{标记列表}中的标记数量超出从\oarg{起始档位}开始的 + 档位数,多余的标记将被忽略。 \end{notezh} \begin{SideBySideExample}[frame=single,numbers=left,% @@ -396,8 +412,41 @@ \centering \suanpanset{scale = 0.65} \begin{suanpan} + \rods{0, 2, 6, 6, 9, 0} + \rodmark{4,3,2,1,0,-1} + \end{suanpan} +\end{SideBySideExample} + +\begin{SideBySideExample}[frame=single,numbers=left,% + xrightmargin=.48\linewidth,gobble=2] + \centering + \suanpanset{scale = 0.65} + \begin{suanpan} + \rods{0, 2, 6, 6, 9, 0} + \rodmark[2]{千,百,十,个} + \end{suanpan} +\end{SideBySideExample} + +\changes{v1.1.3}{2024/09/04}{highlight all frame and remove arguments of \tn{lrframe}, + at the same time change \tn{lrframe} to \tn{mkframe}.} + +\subsubsection{\tn{mkframe}边框排版命令} + +\begin{function}{\mkframe} + \begin{syntax} + \cs{mkframe} + \end{syntax} +\end{function} + + 用于排版算盘的边框。 + +\begin{SideBySideExample}[frame=single,numbers=left,% + xrightmargin=.48\linewidth,gobble=2] + \centering + \suanpanset{scale = 0.65} + \begin{suanpan} \rods{0, 6, 12, 18, 0} - \lrframe{1}{5} + \mkframe \end{suanpan} \end{SideBySideExample} @@ -452,6 +501,8 @@ \end{option} \oarg{draft}选项会将算珠用矩形表示,取消其圆角效果,从而加快编译速度。 + 同时,草稿选项还会将空档算珠绘制选项\oarg{empty}设置为\texttt{false}, + 也就是不绘制空档上的算珠。 \begin{notezh} 在草稿模式下算盘排版会与期望的排版结果有出入。 @@ -467,6 +518,31 @@ \end{suanpan} \end{SideBySideExample} +\changes{v1.1.2}{2024/08/31}{add empty option to remove bids on empty rod.} + +\subsection{是否绘制空档算珠选项} + +\begin{option}{ opt = empty, desc = {= \meta{空档选项}}, init=true } + 设置是否绘制空档算珠选项。 +\end{option} + + \oarg{empty}选项用于选择是否绘制空档上的算珠,如果不绘制, + 在一定程度上可以加快编译速度。 + + \begin{notezh} + 如有需要,可以使用\tn{bid}或\tn{bids*}命令为空档绘制算珠。 + \end{notezh} + +\begin{SideBySideExample}[frame=single,numbers=left,% + xrightmargin=.53\linewidth,gobble=2] + \centering + \suanpanset{scale = 0.65} + \begin{suanpan}[empty = false] + \rods{0, 6, 12, 18, 0} + \bids*{5}{0}{gray6} + \end{suanpan} +\end{SideBySideExample} + \subsection{线宽选项} \begin{option}{ opt = linewd, desc = {= \meta{线宽选项}}, init=2pt } @@ -475,7 +551,7 @@ \oarg{linewd}选项用于设置算盘边框内线线宽,同时会将 边框外线设置为linewd的7.00倍,将档杆和算珠线宽 - 设置为linewd的1.00倍。 + 设置为linewd的0.2倍。 \begin{SideBySideExample}[frame=single,numbers=left,% xrightmargin=.40\linewidth,gobble=2] @@ -598,7 +674,7 @@ \begin{SideBySideExample}[frame=single,numbers=left,% xrightmargin=.37\linewidth,gobble=2] \centering - \suanpanset{scale = 0.65, outerdraw = yellow4} + \suanpanset{scale = 0.65, outerdraw = red8} \begin{suanpan} \rods{0, 6, 0} \end{suanpan} @@ -613,7 +689,7 @@ \begin{SideBySideExample}[frame=single,numbers=left,% xrightmargin=.37\linewidth,gobble=2] \centering - \suanpanset{scale = 0.65, outerfill = yellow9} + \suanpanset{scale = 0.65, outerfill = yellow6} \begin{suanpan} \rods{0, 6, 0} \end{suanpan} @@ -643,7 +719,7 @@ \begin{SideBySideExample}[frame=single,numbers=left,% xrightmargin=.37\linewidth,gobble=2] \centering - \suanpanset{scale = 0.65, innerfill = red9} + \suanpanset{scale = 0.65, innerfill = red5} \begin{suanpan} \rods{0, 6, 0} \end{suanpan} @@ -674,13 +750,14 @@ effectively manage both upper and lower bids, while also considering bottom bid, top bid, and hanging bid. This package offers a unique environment for drawing suanpan, -denoted as \env{suanpan}. Within this environment, 7 specialized macros +denoted as \env{suanpan}. Within this environment, 8 specialized macros are available for the creation of suanpan. The \tn{rod} macro is used to lay out a single rod, while the \tn{rod*} macro draws a counting point on this rod’s beam. The \tn{rods} macro is capable of laying out a set of rods. The \tn{bid} macro colors the specified bid. The \tn{bids} macro colors all inner bids that are near the beam, while the \tn{bids*} macro colors -all outer bids that are far from the beam. Lastly, the \tn{lrframe} macro +all outer bids that are far from the beam. The \tn{rodmark} macro mark all rods +on beam. Lastly, the \tn{mkframe} macro is used to lay out the left and right frames of an abacus. At the same time, the package offers customization options for suanpan, @@ -697,22 +774,22 @@ options, or the \tn{suanpanset} macro. \rod*{4}{3} \rod*{18}{17} % top bid - \bid{12}{9}{azure7} - \bid{13}{9}{azure7} - \bid{14}{9}{azure7} - \bid{15}{9}{azure7} - \bid{16}{9}{azure7} + \bid{12}{9}{azure5} + \bid{13}{9}{azure5} + \bid{14}{9}{azure5} + \bid{15}{9}{azure5} + \bid{16}{9}{azure5} % hanging bid - \bid{17}{11}{red8} - \bid{18}{11}{red8} - \bid{19}{11}{red8} - \bid{20}{11}{red8} - \bid{21}{11}{red8} + \bid{17}{11}{red5} + \bid{18}{11}{red5} + \bid{19}{11}{red5} + \bid{20}{11}{red5} + \bid{21}{11}{red5} % bottom bid - \bid{11}{3}{olive7} - \bid{16}{3}{olive7} - \bid{21}{3}{olive7} - \lrframe{1}{21} + \bid{11}{3}{olive5} + \bid{16}{3}{olive5} + \bid{21}{3}{olive5} + \mkframe \end{suanpan} \end{center} @@ -731,7 +808,7 @@ options, or the \tn{suanpanset} macro. Typesetting 7-bids Chinese suanpan with \oarg{options}. Within the \env{suanpan} environment, \tn{rod}, \tn{rod*}, \tn{rods}, \tn{bid}, - \tn{bids}, \tn{bids*} and \tn{lrframe} 7 specialized macros + \tn{bids}, \tn{bids*}, \tn{rodmark} and \tn{mkframe} 8 specialized macros are available for the creation of suanpan. \oarg{options} is a key-value list for line width, draw color, fill color, @@ -739,6 +816,10 @@ options, or the \tn{suanpanset} macro. \oarg{options} is environment's local setting. + \begin{noteen} + You should remove all blank line in \env{suanpan} environment. + \end{noteen} + \begin{SideBySideExample}[frame=single,numbers=left,% xrightmargin=.48\linewidth,gobble=2] \centering @@ -823,18 +904,16 @@ options, or the \tn{suanpanset} macro. \begin{function}{\bid} \begin{syntax} - \cs{bid} \marg{num}\marg{pos}\marg{color} + \cs{bid} \marg{num}\marg{pos list}\marg{fill color}\oarg{draw color} \end{syntax} \end{function} The \tn{bid} macro fills the specified bid. - The \marg{num} is the same as for \tn{rod}; the \marg{color} argument - defines the fill color and the \marg{pos} argument tells which bid has to - be colored in \marg{num} rod. - - This macro also blends \marg{color} by 40\% black to be used for bid - drawing color. + The \marg{num} is the same as for \tn{rod}; the \marg{fill color} argument + defines the fill color and the comma-seperated \marg{pos list} argument tells + which bid has to be colored in \marg{num} rod. The \oarg{draw color} argument + gives the draw color. The \marg{pos} in a rod is numbered from the bottom up in the order $1, 2, \cdots, 11$. The lower deck bids occupies position @@ -847,14 +926,14 @@ options, or the \tn{suanpanset} macro. \suanpanset{scale = 0.65} \begin{suanpan} \rods{0, 0, 7, 11, 8, 19} - \bid{1}{1}{gray7} - \bid{2}{5}{gray7} - \bid{3}{6}{red8} - \bid{4}{7}{red8} - \bid{4}{8}{azure6} - \bid{4}{9}{yellow9} + \bid{1}{1}{brown5} + \bid{2}{5}{brown5} + \bid{3}{6}{red5} + \bid{4}{7}{red5} + \bid{4}{8}{azure5} + \bid{4}{9}{yellow5} \bid{5}{10}{violet5} - \bid{6}{11}{teal4} + \bid{6}{4,5,6,11}{teal4}[magenta5] \end{suanpan} \end{SideBySideExample} @@ -871,10 +950,11 @@ options, or the \tn{suanpanset} macro. \marg{num} and \marg{color} are the same as for \tn{bid}; the \marg{val} argument is the same as for \tn{rod}. - The \marg{color} is fill color for inner bids. it also blends - \marg{color} by 40\% black to be used for inner bids drawing color. + The \marg{color} is fill color for inner bids. it also set + \texttt{innercolor} to be used for inner bids drawing color. The starred version \tn{bids*} is used to color outer bids of \marg{num} rod. + it also set \texttt{outercolor} to be used for inner bids drawing color. \begin{noteen} This macro can only select the inner bids or the outer bids for coloring, @@ -888,23 +968,58 @@ options, or the \tn{suanpanset} macro. \begin{suanpan} \rods{0, 0, 7, 11, 8, 19} \bids{3}{7}{teal4} - \bids*{5}{8}{azure6} + \bids*{5}{8}{azure5} \end{suanpan} \end{SideBySideExample} -\subsubsection{\tn{lrframe}---left and right frame} +\subsubsection{\tn{rodmark} rod(s) marking on beam} -\begin{function}{\lrframe} +\begin{function}{\rodmark} \begin{syntax} - \cs{lrframe} \marg{first num}\marg{last num} + \cs{rodmark} \oarg{st}\marg{maker list} \end{syntax} \end{function} - The \tn{lrframe} macro is used to lay out the left and right frames of - a suanpan. + The \tn{rodmark} macro marks the rod(s) on the beam. - The \marg{first num} argument tells which rod is the first rod and - the \marg{last num} argument tells which rod is the last rod. + The \oarg{st} argument is the start rod and \marg{marker list} + is the marker list. + + \begin{noteen} + If the number of \marg{marker List} exceeds the number of + rods from \oarg{st}, the excess markers will be ignored. + \end{noteen} + +\begin{SideBySideExample}[frame=single,numbers=left,% + xrightmargin=.48\linewidth,gobble=2] + \centering + \suanpanset{scale = 0.65} + \begin{suanpan} + \rods{0, 2, 6, 6, 9, 0} + \rodmark{4,3,2,1,0,-1} + \end{suanpan} +\end{SideBySideExample} + +\begin{SideBySideExample}[frame=single,numbers=left,% + xrightmargin=.48\linewidth,gobble=2] + \centering + \suanpanset{scale = 0.65} + \begin{suanpan} + \rods{0, 2, 6, 6, 9, 0} + \rodmark[2]{Q,C,X,I} + \end{suanpan} +\end{SideBySideExample} + +\subsubsection{\tn{mkframe}---layout frame} + +\begin{function}{\mkframe} + \begin{syntax} + \cs{mkframe} + \end{syntax} +\end{function} + + The \tn{mkframe} macro is used to lay out the frames of + a suanpan. \begin{SideBySideExample}[frame=single,numbers=left,% xrightmargin=.48\linewidth,gobble=2] @@ -912,7 +1027,7 @@ options, or the \tn{suanpanset} macro. \suanpanset{scale = 0.65} \begin{suanpan} \rods{0, 6, 12, 18, 0} - \lrframe{1}{5} + \mkframe \end{suanpan} \end{SideBySideExample} @@ -961,9 +1076,12 @@ The ``|=true|'' in the \marg{option}|=true| for Boolean types can be omitted. Draft mode. \end{option} -The \oarg{draft} option speeds up compilation by canceling + The \oarg{draft} option speeds up compilation by canceling bids rounded corner effect. + At the same time \oarg{draft} option will set the \oarg{empty} option + to \texttt{false} to remove all bids on empty rod. + \begin{noteen} Suanpan layout in draft mode may differ from the desired layout. \end{noteen} @@ -978,6 +1096,29 @@ The \oarg{draft} option speeds up compilation by canceling \end{suanpan} \end{SideBySideExample} +\subsection{empty} + +\begin{option}{ opt = empty, desc = {= \meta{empty}}, init=true } + Remove bids on empty rod or not. +\end{option} + + The \oarg{empty} option will remove all bids on empty rod. + + \begin{noteen} + If necessary, you can use the \tn{bid} or \tn{bids*} macro to + draw bid(s) for the empty rod. + \end{noteen} + +\begin{SideBySideExample}[frame=single,numbers=left,% + xrightmargin=.53\linewidth,gobble=2] + \centering + \suanpanset{scale = 0.65} + \begin{suanpan}[empty=false] + \rods{0, 6, 12, 18, 0} + \bids*{5}{0}{gray6} + \end{suanpan} +\end{SideBySideExample} + \subsection{line width} \begin{option}{ opt = linewd, desc = {= \meta{linewd}}, init=2pt } @@ -1111,7 +1252,7 @@ The \oarg{draft} option speeds up compilation by canceling \begin{SideBySideExample}[frame=single,numbers=left,% xrightmargin=.37\linewidth,gobble=2] \centering - \suanpanset{scale = 0.65, outerdraw = yellow4} + \suanpanset{scale = 0.65, outerdraw = red8} \begin{suanpan} \rods{0, 6, 0} \end{suanpan} @@ -1126,7 +1267,7 @@ The \oarg{draft} option speeds up compilation by canceling \begin{SideBySideExample}[frame=single,numbers=left,% xrightmargin=.37\linewidth,gobble=2] \centering - \suanpanset{scale = 0.65, outerfill = yellow9} + \suanpanset{scale = 0.65, outerfill = yellow6} \begin{suanpan} \rods{0, 6, 0} \end{suanpan} @@ -1156,7 +1297,7 @@ The \oarg{draft} option speeds up compilation by canceling \begin{SideBySideExample}[frame=single,numbers=left,% xrightmargin=.37\linewidth,gobble=2] \centering - \suanpanset{scale = 0.65, innerfill = red9} + \suanpanset{scale = 0.65, innerfill = red5} \begin{suanpan} \rods{0, 6, 0} \end{suanpan} |