Try to use l3keys.

This commit is contained in:
2025-09-02 16:42:46 -05:00
parent d8286a0904
commit d8ee8bf058
8 changed files with 159 additions and 94 deletions

View File

@@ -1,3 +1,5 @@
\ProvidesFile{commonincludes.def}[2025-09-02 v1.0]
\RequirePackage{PrimeTeX/packages/Boxout}
\RequirePackage{PrimeTeX/packages/Caption}

View File

@@ -1,42 +0,0 @@
\ifthenelse{\boolean{isElectronic}}{
\newgeometry{
inner = 0.75in,
top = 66pt, % 11/12in
marginratio = 2:3,
}
\savegeometry{smallMargin}
\newgeometry{
inner = 24pt, % 1/3in
top = 0.25in,
marginratio = 2:3,
}
\savegeometry{tinyMargin}
}{
\newgeometry{
twoside = true,
inner = 0.75in,
top = 66pt, % 11/12in
marginratio = 2:3,
}
\savegeometry{smallMargin}
\newgeometry{
twoside = true,
inner = 24pt, % 1/3in
top = 0.25in,
marginratio = 2:3,
}
\savegeometry{tinyMargin}
}
\restoregeometry
\NewDocumentEnvironment{SmallMargin}{O{0.0in} O{-0.25in}}{
\clearpage
\loadgeometry{smallMargin}
\setlength{\insideheaderoffset}{#1}
\setlength{\outsideheaderoffset}{#2}
\pagestyle{fancy}
}{
\clearpage
\pagestyle{fancy}
\restoregeometry
}

View File

@@ -6,8 +6,8 @@
\RequirePackage{PrimeTeX/packages/Tables}
\RequirePackage{calc}
\providelength{\boxoutpadding}[1em]
\providelength{\boxoutrule}[1pt]
\ProvideLength{\boxoutpadding}[1em]
\ProvideLength{\boxoutrule}[1pt]
\NewTblrEnviron{tblrBoxout}
\SetTblrInner[tblrBoxout]{

View File

@@ -15,7 +15,7 @@
% Define a justification style that is ragged on the side toward the outside of
% the page. I. e. RaggedRight on
\RequirePackage{changepage}
%\RequirePackage{ifthen}
\DeclareCaptionJustification{RaggedOutside}{%
\ifthenelse{\boolean{isElectronic}}{%
\RaggedRight%

View File

@@ -7,7 +7,7 @@
\RequirePackage{xcolor}
\definecolorset{HTML}{Prime}{}{%
Gray, 474c63;% #474c63 Blue, saturation -> 17%
Gray, 4d505d;% #4d505d Blue, saturation -> 10%
Red, 91192d;% #91192d Tetradic
Orange, 914119;% #914119 Split complementary
Yellow, 917d19;% #917d19 Complementary
@@ -22,7 +22,7 @@
% Lightness ≈ 18%
\definecolorset{HTML}{PrimeDark}{}{%
Gray, 262836;% #262836
Gray, 292b32;% #292b32
Red, 4e0d18;% #4e0d18
Orange, 4e230d;% #4e230d
Yellow, 4e430d;% #4e430d
@@ -37,7 +37,7 @@
% Lightness ≈ 49%
\definecolorset{HTML}{PrimeBright}{}{%
Gray, 686f91;% #686f91
Gray, 727587;% #727587
Red, d42542;% #d42542
Orange, d46025;% #d46025
Yellow, d4b725;% #d4b725
@@ -52,7 +52,7 @@
% Lightness ≈ 64%
\definecolorset{HTML}{PrimeLight}{}{%
Gray, 9499b3;% #9499b3
Gray, 9b9eac;% #9b9eac
Red, e46378;% #e46378
Orange, e48f63;% #e48f63
Yellow, e4d063;% #e4d063
@@ -67,7 +67,7 @@
% Lightness ≈ 64%
\definecolorset{HTML}{PrimePastel}{}{%
Gray, c2c5d4;% #c2c5d4
Gray, c6c8d0;% #c6c8d0
Red, f0a6b2;% #f0a6b2
Orange, f0bfa6;% #f0bfa6
Yellow, f0e4a6;% #f0e4a6
@@ -82,7 +82,7 @@
% Lightness ≈ 95%
\definecolorset{HTML}{PrimePale}{}{%
Gray, eff0f5;% #eff0f5
Gray, f0f1f4;% #eff0f5
Red, fbe9ec;% #fbe9ec
Orange, fbefe9;% #fbefe9
Yellow, fbf8e9;% #fbf8e9

View File

@@ -7,10 +7,10 @@
\RequirePackage{wrapfig2}
\providelength{\iconsize}[0.25in]
\ProvideLength{\iconsize}[0.25in]
\providelength{\@InlineGraphicHeight}[12pt]
\providelength{\@InlineGraphicOffset}[-2pt]
\ProvideLength{\@InlineGraphicHeight}[12pt]
\ProvideLength{\@InlineGraphicOffset}[-2pt]
\NewDocumentCommand{\InlineGraphic}{
O{\@InlineGraphicHeight}
@@ -89,34 +89,95 @@
\RequirePackage{tabularray}
\providelength{\twinfigspace}[3pt]
\providelength{\twinfigwidth}[
\textwidth / 2 + \bigfloatoverhang - \twinfigspace
\ProvideLength{\twinfigspace}[3pt]
\ProvideLength{\twinfigwidth}[
\textwidth / 2 + \bigfloatoverhang * 3 / 2 - \twinfigspace
]
\ExplSyntaxOn
\dim_new:N \l_twinfig_overhang
\dim_new:N \l_twinfig_width
\dim_new:N \l_twinfig_space
\fp_new:N \l_twinfig_offset
\str_new:N \l_twinfig_placement
\str_new:N \l_twinfig_valign
\keys_define:nn{twinfig}{
overhang .dim_set:N = \l_twinfig_overhang,
overhang .initial:e = \bigfloatoverhang,
}
\keys_define:nn{twinfig}{
placement .str_set:N = \l_twinfig_placement,
placement .initial:n = {htpb},%\bigfloatplacement,
}
\keys_define:nn{twinfig}{
offset .fp_set:N = \l_twinfig_offset,
offset .initial:n = {2.0},%\bigfloatoffsetratio,
}
\keys_define:nn{twinfig}{
valign .str_set:N = \l_twinfig_valign,
valign .initial:n = {m},
}
\keys_define:nn{twinfig}{
width .dim_set:N = \l_twinfig_width,
width .initial:n = {3.14in},%\twinfigwidth,
}
\keys_define:nn{twinfig}{
space .dim_set:N = \l_twinfig_space,
space .initial:n = {3pt},%\twinfigspace,
}
\keys_log:nn{twinfig}{overhang}
\keys_log:nn{twinfig}{placement}
\keys_log:nn{twinfig}{offset}
\keys_log:nn{twinfig}{valign}
\keys_log:nn{twinfig}{width}
\keys_log:nn{twinfig}{space}
\typeout{\the\l_twinfig_overhang}
\typeout{\l_twinfig_placement}
\typeout{\fp_use:N \l_twinfig_offset}
\typeout{\l_twinfig_valign}
\typeout{\the\l_twinfig_width}
\typeout{\the\l_twinfig_space}
\ProcessKeyOptions[twinfig]
\NewDocumentCommand{\twinfig}{%
% Big Float overhang.
O{\bigfloatoverhang}
% Float placement.
O{htpb}
% BigFloat offset ratio.
O{\bigfloatoffsetratio}
% First graphic file.
% #1: Big Float overhang.
%O{\bigfloatoverhang}
% #2: Float placement.
%O{htpb}
% #3: BigFloat offset ratio.
%O{\bigfloatoffsetratio}
% #1: Key=value options.
O{}
% #2: First graphic file.
m
% First label.
% #3: First label.
>{\TrimSpaces}m
% First caption.
% #4: First caption.
>{\TrimSpaces}m
% Second graphic file.
% #5: Second graphic file.
m
% Second label.
% #6: Second label.
>{\TrimSpaces}m
% Second caption.
% #7: Second caption.
>{\TrimSpaces}m
% #8: Image vertical alignment.
%O{m}
}{%
\begin{BigFloat}[figure][#1][#2][#3]%
\keys_set:nn{twinfig}{#1}%
\typeout{\the\l_twinfig_overhang}
\typeout{\l_twinfig_placement}
\typeout{\fp_use:N \l_twinfig_offset}
\typeout{\l_twinfig_valign}
\typeout{\the\l_twinfig_width}
\typeout{\the\l_twinfig_space}
\begin{BigFloat}[figure][\l_twinfig_overhang][\l_twinfig_placement][\l_twinfig_offset]%
\begin{tblr}{%
colspec = {*{2}{Q[c,m,wd=\twinfigwidth]}},%
colspec = {*{2}{Q[c,\l_twinfig_valign,wd=\l_twinfig_width]}},%
hlines = {0pt},
%vlines,% For debugging. Comment out when done.
hborder{1,Z} = {%
@@ -128,26 +189,26 @@
rightspace = 0pt,%
},%
vborder{2} = {%
leftspace = \twinfigspace,%
rightspace = \twinfigspace,%
leftspace = \l_twinfig_space,%
rightspace = \l_twinfig_space,%
},%
}%
\vfill
\captionsetup{type=figure}%
\includegraphics[%
keepaspectratio,width=\twinfigwidth%
]{#4}%
\captionof{figure}{#6}%
\label{fig:#5}
keepaspectratio,width=\l_twinfig_width%
]{#2}%
\captionof{figure}{#4}%
\label{fig:#3}
\vfill%
&%
\vfill
\captionsetup{type=figure}%
\includegraphics[%
keepaspectratio,width=\twinfigwidth%
]{#7}%
\captionof{figure}{#9}%
\label{fig:#8}
keepaspectratio,width=\l_twinfig_width%
]{#5}%
\captionof{figure}{#7}%
\label{fig:#6}
\vfill%
\\%
\end{tblr}%

View File

@@ -3,8 +3,8 @@
\RequirePackage{PrimeTeX/packages/Layout}
\providelength{\insideheaderoffset}[\bigfloatoverhang]
\providelength{\outsideheaderoffset}[
\ProvideLength{\insideheaderoffset}[\bigfloatoverhang]
\ProvideLength{\outsideheaderoffset}[
\bigfloatoverhang * \real{\bigfloatoffsetratio}
]

View File

@@ -4,9 +4,7 @@
% Suppress warning about \showhyphens being changed.
\let\CheckCommand\providecommand
\RequirePackage{ifthen}
\NewDocumentCommand{\providelength}{m O{0pt}}{%
\NewDocumentCommand{\ProvideLength}{m O{0pt}}{%
\ifdeflength{#1}{% It is already defined!
}{% Not defined, so define it!
\newlength{#1}%
@@ -60,8 +58,8 @@
\RequirePackage{calc}
\RequirePackage[strict]{changepage}
\providelength{\marparwidth}[\marginparsep + \marginparwidth]
\providelength{\contentwidth}[\textwidth + \marparwidth]
\ProvideLength{\marparwidth}[\marginparsep + \marginparwidth]
\ProvideLength{\contentwidth}[\textwidth + \marparwidth]
\RequirePackage[
debug,
@@ -114,10 +112,11 @@
}%
}{}
\newcommand{\bigfloatoffsetratio}{2}
\newcommand{\bigfloatoffsetratio}{2.0}
% Maximum width adjustment to fit 2 16x9 screensots on one page.
\providelength{\bigfloatoverhang}[0.54in]
\ProvideLength{\bigfloatoverhang}[0.54in]
\newcommand{\bigfloatplacement}{htpb}
\floatstyle{plain}
\newfloat{generic}{htpb}{lgf}
@@ -128,9 +127,9 @@
% #2: Overhang: the distance that the BigFloat extends into the margins.
O{\bigfloatoverhang}
% #3: Float position: where the float may appear on the page.
O{htpb}
% #4: Offset: the distance to offset the center of the BigFloat from the center
% of the text block.
O{\bigfloatplacement}
% #4: Offset: the ratio between the overhangs on the inside and outside of
% BigFloat.
O{\bigfloatoffsetratio}
% #5: Body: what appears in the BigFloat.
+b
@@ -149,3 +148,48 @@
\end{SmartAdjustWidth}%
\end{#1}%
}{}
\AtBeginDocument{
\ifthenelse{\boolean{isElectronic}}{
\newgeometry{
inner = 0.75in,
top = 66pt, % 11/12in
marginratio = 2:3,
}
\savegeometry{smallMargin}
\newgeometry{
inner = 24pt, % 1/3in
top = 0.25in,
marginratio = 2:3,
}
\savegeometry{tinyMargin}
}{
\newgeometry{
twoside = true,
inner = 0.75in,
top = 66pt, % 11/12in
marginratio = 2:3,
}
\savegeometry{smallMargin}
\newgeometry{
twoside = true,
inner = 24pt, % 1/3in
top = 0.25in,
marginratio = 2:3,
}
\savegeometry{tinyMargin}
}
\restoregeometry
\NewDocumentEnvironment{SmallMargin}{O{0.0in} O{-0.25in}}{
\clearpage
\loadgeometry{smallMargin}
\setlength{\insideheaderoffset}{#1}
\setlength{\outsideheaderoffset}{#2}
\pagestyle{fancy}
}{
\clearpage
\pagestyle{fancy}
\restoregeometry
}
}