Rewrite Float commands in Latex3 and move them to new Floats package.
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
|
||||
\RequirePackage{PrimeTeX/packages/DocProperties}
|
||||
|
||||
\RequirePackage{PrimeTeX/packages/Floats}
|
||||
|
||||
% Load graphicx before Fonts because the menukeys package causes a conflict.
|
||||
% Graphics package for including images
|
||||
\RequirePackage[final]{graphicx}
|
||||
|
||||
@@ -62,25 +62,31 @@
|
||||
}%
|
||||
}{}
|
||||
|
||||
\ExplSyntaxOn
|
||||
\NewDocumentEnvironment{BigBoxout}{
|
||||
% #1: Overhang, passed to BigFloat argument #1.
|
||||
O{\bigfloatoverhang}
|
||||
O{\c_BigFloat_overhang_dim}
|
||||
% #2: Float placement, passed to BigFloat argument #2.
|
||||
O{htpb}
|
||||
O{h,t,p,b}
|
||||
% #3: Offset ratio, passed to BigFloat argument #3.
|
||||
O{\bigfloatoffsetratio}
|
||||
O{\c_BigFloat_offset_fp}
|
||||
% #4: Label, passed to Boxout argument #1.
|
||||
>{\TrimSpaces}m
|
||||
% #5: Tabularray colpec, passed to Boxout argument #2.
|
||||
% #5: Tabularray colspec, passed to Boxout argument #2.
|
||||
O{X[l,h]}
|
||||
% #6: Caption, passed to Boxout argument #3.
|
||||
m
|
||||
% #7: [Ww] for warning box, if present passed to Boxout argument #4.
|
||||
o
|
||||
% #5: Body, passed to Boxout.
|
||||
% #8: Body, passed to Boxout.
|
||||
+b
|
||||
}{
|
||||
\begin{BigFloat}[generic][#1][#2][#3]%
|
||||
\begin{BigFloat}[
|
||||
type = generic,
|
||||
overhang = #1,
|
||||
placement = {#2},
|
||||
offset = #3,
|
||||
]%
|
||||
\IfNoValueTF{#7}{%
|
||||
\begin{Boxout}{#4}[#5]{#6}%
|
||||
#8%
|
||||
@@ -92,6 +98,7 @@
|
||||
}%
|
||||
\end{BigFloat}%
|
||||
}{}
|
||||
\ExplSyntaxOff
|
||||
|
||||
\NewDocumentEnvironment{WrapBoxout}{
|
||||
% position [l,r,i,o]
|
||||
|
||||
301
packages/Floats.sty
Normal file
301
packages/Floats.sty
Normal file
@@ -0,0 +1,301 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
%\ProvidesPackage{PrimeTeX/packages/Floats}[2025-09-03]
|
||||
\ProvidesExplPackage{PrimeTeX/packages/Floats}{2025-09-03}{1.0}{
|
||||
Custom Float Environments.
|
||||
}
|
||||
|
||||
% I think this redefines how float environments evaluate the placement argument,
|
||||
% allowing a command in the argument to be expanded before it is used. Otherwise
|
||||
% it thinks we are trying to use the literal command name as the placement.
|
||||
\def\ExpEnvOption#1#2[#3]{%
|
||||
\expandafter\@expenvopt\expandafter{#3}{#1}{#2}
|
||||
}
|
||||
\def\@expenvopt#1#2#3{#2{#3}[#1]}
|
||||
|
||||
\floatstyle{plain}
|
||||
\newfloat{generic}{htpb}{lgf}
|
||||
|
||||
% Maximum width adjustment to fit 2 16x9 screensots on one page.
|
||||
\dim_const:Nn \c_BigFloat_overhang_dim {0.54in}
|
||||
\str_const:Nn \c_BigFloat_type_str {generic}
|
||||
\clist_const:Nn \c_BigFloat_placement_clist {h,t,p,b}
|
||||
\fp_const:Nn \c_BigFloat_offset_fp {2.0}
|
||||
|
||||
\ProvideLength{\BigFloatOverhang}[\dim_use:N \c_BigFloat_overhang_dim]
|
||||
\NewDocumentCommand{\BigFloatOffset}{}{\fp_use:N \c_BigFloat_offset_fp}
|
||||
|
||||
\str_new:N \l_BigFloat_placement_str
|
||||
|
||||
\keys_define:nn{BigFloat}{
|
||||
type .choices:nn = {figure,generic,table}{
|
||||
\str_set:Ne \l_BigFloat_type_str {\l_keys_choice_tl}
|
||||
},
|
||||
type .default:e = {\c_BigFloat_type_str},
|
||||
% type .initial:e = {\c_BigFloat_type_str},
|
||||
|
||||
overhang .dim_set:N = \l_BigFloat_overhang_dim,
|
||||
overhang .default:e = {\c_BigFloat_overhang_dim},
|
||||
% overhang .initial:e = {\c_BigFloat_overhang_dim},
|
||||
|
||||
placement .multichoices:nn = {b,H,h,p,t}{
|
||||
\str_put_right:Ne \l_BigFloat_placement_str {\l_keys_choice_tl}
|
||||
},
|
||||
|
||||
offset .fp_set:N = \l_BigFloat_offset_fp,
|
||||
offset .default:e = {\c_BigFloat_offset_fp},
|
||||
% offset .initial:e = {\c_BigFloat_offset_fp},
|
||||
}
|
||||
|
||||
\NewDocumentEnvironment{BigFloat}{
|
||||
% #1: Key=value options.
|
||||
O{}
|
||||
% #2: Body: what appears in the BigFloat.
|
||||
+b
|
||||
}{%
|
||||
\keys_set:nn{BigFloat}{#1}%
|
||||
\str_if_empty:NT \l_BigFloat_placement_str {
|
||||
\str_set:Ne \l_BigFloat_placement_str {
|
||||
\clist_use:Nn \c_BigFloat_placement_clist {}
|
||||
}
|
||||
}
|
||||
\ExpEnvOption%
|
||||
\begin{\l_BigFloat_type_str}[\l_BigFloat_placement_str]% float environment
|
||||
\begin{SmartAdjustWidth}{%
|
||||
|
||||
\fp_to_dim:n {
|
||||
-\l_BigFloat_overhang_dim
|
||||
}%
|
||||
}{%
|
||||
\fp_to_dim:n {%
|
||||
-\l_BigFloat_overhang_dim
|
||||
* \l_BigFloat_offset_fp
|
||||
}%
|
||||
}%
|
||||
\begin{minipage}{\linewidth}%
|
||||
\ifthenelse{\boolean{isDraft}}{%
|
||||
{\color{layout}\rule{\textwidth}{1pt}\zws}%
|
||||
#2%
|
||||
}{%
|
||||
#2%
|
||||
}%
|
||||
\end{minipage}%
|
||||
\end{SmartAdjustWidth}%
|
||||
\end{\l_BigFloat_type_str}%
|
||||
}{}
|
||||
|
||||
\clist_const:Nn \c_CenterFig_placement_clist {h, t, p, b}
|
||||
|
||||
\str_new:N \l_CenterFig_placement_str
|
||||
|
||||
\keys_define:nn{CenterFig}{
|
||||
placement .multichoices:nn = {b,H,h,p,t}{
|
||||
\str_put_right:Ne \l_CenterFig_placement_str {\l_keys_choice_tl}
|
||||
},
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\CenterFig}{
|
||||
% Key-value options passed to \includegraphics.
|
||||
O{}
|
||||
% Key-value options.
|
||||
O{}
|
||||
% Graphic file.
|
||||
m
|
||||
% Label.
|
||||
>{\TrimSpaces}m
|
||||
% Caption.
|
||||
m
|
||||
}{
|
||||
\keys_set:nn{CenterFig}{#2}%
|
||||
\str_if_empty:NT \l_CenterFig_placement_str {
|
||||
\str_set:Ne \l_CenterFig_placement_str {
|
||||
\clist_use:Nn \c_CenterFig_placement_clist {}
|
||||
}
|
||||
}
|
||||
\ExpEnvOption
|
||||
\begin{figure}[\l_CenterFig_placement_str]%
|
||||
\Centering%
|
||||
\includegraphics[keepaspectratio,#1]{#3}%
|
||||
\caption{#5}%
|
||||
\label{fig:#4}%
|
||||
\end{figure}%
|
||||
}
|
||||
|
||||
\keys_define:nn{BigFig}{
|
||||
overhang .dim_set:N = \l_BigFig_overhang_dim,
|
||||
overhang .initial:e = {\c_BigFloat_overhang_dim},
|
||||
% overhang .default:e = {\c_BigFloat_overhang_dim},
|
||||
|
||||
placement .clist_set:N= \l_BigFig_placement_clist,
|
||||
|
||||
offset .fp_set:N = \l_BigFig_offset_fp,
|
||||
offset .initial:e = {\c_BigFloat_offset_fp},
|
||||
% offset .default:e = {\c_BigFloat_offset_fp},
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\BigFig}{
|
||||
% Key=value options.
|
||||
O{}
|
||||
% Graphic file.
|
||||
m
|
||||
% Label.
|
||||
>{\TrimSpaces}m
|
||||
% Caption.
|
||||
m
|
||||
}{%
|
||||
\keys_set:nn{BigFig}{#1}
|
||||
\begin{BigFloat}[
|
||||
type = figure,
|
||||
overhang = \l_BigFig_overhang_dim,
|
||||
placement:e = \l_BigFig_placement_clist,
|
||||
offset = \l_BigFig_offset_fp,
|
||||
]%
|
||||
\captionsetup{type=figure}%
|
||||
\includegraphics[keepaspectratio,width=\linewidth]{#2}%
|
||||
\Centering\captionof{figure}{#4}%\par
|
||||
\label{fig:#3}%
|
||||
\end{BigFloat}%
|
||||
}
|
||||
|
||||
\keys_define:nn{DoubleBigFig}{
|
||||
overhang .dim_set:N = \l_DoubleBigFig_overhang_dim,
|
||||
overhang .initial:e = {\c_BigFloat_overhang_dim},
|
||||
% overhang .default:e = {\c_BigFloat_overhang_dim},
|
||||
|
||||
offset .fp_set:N = \l_DoubleBigFig_offset_fp,
|
||||
offset .initial:e = {\c_BigFloat_offset_fp},
|
||||
% offset .default:e = {\c_BigFloat_offset_fp},
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\DoubleBigFig}{%
|
||||
% Key=value options.
|
||||
O{}
|
||||
% First graphic filename.
|
||||
m
|
||||
% First graphic label.
|
||||
>{\TrimSpaces}m
|
||||
% First graphic caption.
|
||||
m
|
||||
% Second graphic filename.
|
||||
m
|
||||
% Second graphic label.
|
||||
>{\TrimSpaces}m
|
||||
% Second Graphic caption.
|
||||
m
|
||||
}{%
|
||||
\keys_set:nn{DoubleBigFig}{#1}
|
||||
\begin{BigFloat}[
|
||||
type = figure,
|
||||
overhang = \l_DoubleBigFig_overhang_dim,
|
||||
placement = {p},
|
||||
offset = \l_DoubleBigFig_offset_fp,
|
||||
]%
|
||||
\captionsetup{type=figure}%
|
||||
\includegraphics[keepaspectratio,width=\textwidth]{#2}%
|
||||
\Centering\captionof{figure}{#4}%
|
||||
\label{fig:#3}
|
||||
\bigskip
|
||||
\captionsetup{type=figure}%
|
||||
\includegraphics[keepaspectratio,width=\textwidth]{#5}%
|
||||
\Centering\captionof{figure}{#7}%
|
||||
\label{fig:#6}%
|
||||
\end{BigFloat}%
|
||||
}
|
||||
|
||||
\dim_const:Nn \c_TwinFig_space_dim {3pt}
|
||||
\dim_const:Nn \c_TwinFig_width_dim {
|
||||
\textwidth / 2 + \c_BigFloat_overhang_dim * 3 / 2 - \c_TwinFig_space_dim
|
||||
}
|
||||
|
||||
\ProvideLength{\TwinFigWidth}[\dim_use:N \c_TwinFig_width_dim]
|
||||
|
||||
\keys_define:nn{TwinFig}{
|
||||
overhang .dim_set:N = \l_TwinFig_overhang_dim,
|
||||
overhang .initial:e = {\c_BigFloat_overhang_dim},
|
||||
% overhang .default:e = {\c_BigFloat_overhang_dim},
|
||||
|
||||
placement .clist_set:N= \l_TwinFig_placement_clist,
|
||||
placement .initial:e = {\c_BigFloat_placement_clist},
|
||||
% placement .default:e = {\c_BigFloat_placement_clist},
|
||||
|
||||
offset .fp_set:N = \l_TwinFig_offset_fp,
|
||||
offset .initial:e = {\c_BigFloat_offset_fp},
|
||||
% offset .default:e = {\c_BigFloat_offset_fp},
|
||||
|
||||
valign .choices:nn = {b,f,h,m,t}{
|
||||
\str_set:Ne \l_TwinFig_valign_str {\l_keys_choice_tl}
|
||||
},
|
||||
valign .initial:n = {m},
|
||||
% valign .default:n = {m},
|
||||
|
||||
width .dim_set:N = \l_TwinFig_width_dim,
|
||||
width .initial:e = {\c_TwinFig_width_dim},
|
||||
% width .default:e = {\c_TwinFig_width_dim},
|
||||
|
||||
space .dim_set:N = \l_TwinFig_space_dim,
|
||||
space .initial:e = {\c_TwinFig_space_dim},
|
||||
% space .default:e = {\c_TwinFig_space_dim},
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\TwinFig}{%
|
||||
% #1: Key=value options.
|
||||
O{}
|
||||
% #2: First graphic file.
|
||||
m
|
||||
% #3: First label.
|
||||
>{\TrimSpaces}m
|
||||
% #4: First caption.
|
||||
>{\TrimSpaces}m
|
||||
% #5: Second graphic file.
|
||||
m
|
||||
% #6: Second label.
|
||||
>{\TrimSpaces}m
|
||||
% #7: Second caption.
|
||||
>{\TrimSpaces}m
|
||||
}{%
|
||||
\keys_set:nn{TwinFig}{#1}%
|
||||
\begin{BigFloat}[
|
||||
type = {figure},
|
||||
overhang = \l_TwinFig_overhang_dim,
|
||||
placement:e = \l_TwinFig_placement_clist,
|
||||
offset = \l_TwinFig_offset_fp,
|
||||
]%
|
||||
%\typeout{TwinFig~valign:~"\l_TwinFig_valign_str"}
|
||||
\begin{tblr}{%
|
||||
colspec = {*{2}{Q[c,wd=\l_TwinFig_width_dim]}},%
|
||||
rows:e = {\l_TwinFig_valign_str},
|
||||
hlines = {0pt},
|
||||
%vlines,% For debugging. Comment out when done.
|
||||
hborder{1,Z} = {%
|
||||
abovespace = 0pt,%
|
||||
belowspace = 0pt,%
|
||||
},%
|
||||
vborder{1,Z} = {%
|
||||
leftspace = 0pt,%
|
||||
rightspace = 0pt,%
|
||||
},%
|
||||
vborder{2} = {%
|
||||
leftspace = \l_TwinFig_space_dim,%
|
||||
rightspace = \l_TwinFig_space_dim,%
|
||||
},%
|
||||
}%
|
||||
\vfill
|
||||
\captionsetup{type=figure}%
|
||||
\includegraphics[%
|
||||
keepaspectratio,width=\l_TwinFig_width_dim%
|
||||
]{#2}%
|
||||
\captionof{figure}{#4}%
|
||||
\label{fig:#3}
|
||||
\vfill%
|
||||
&%
|
||||
\vfill
|
||||
\captionsetup{type=figure}%
|
||||
\includegraphics[%
|
||||
keepaspectratio,width=\l_TwinFig_width_dim%
|
||||
]{#5}%
|
||||
\captionof{figure}{#7}%
|
||||
\label{fig:#6}
|
||||
\vfill%
|
||||
\\%
|
||||
\end{tblr}%
|
||||
\end{BigFloat}%
|
||||
}
|
||||
@@ -73,3 +73,8 @@
|
||||
\renewmenumacro{\menu}[>]{angularmenus}
|
||||
|
||||
\RenewDocumentCommand{\ctrlname}{}{$\wedge$}
|
||||
|
||||
% Line-breaking zero-width space
|
||||
\NewDocumentCommand{\zws}{}{\hspace{0pt}}
|
||||
% Line-breaking dot
|
||||
\NewDocumentCommand{\bdot}{}{.\zws}
|
||||
@@ -1,5 +1,7 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{PrimeTeX/packages/Graphics}[2025-07-09]
|
||||
\ProvidesExplPackage{PrimeTeX/packages/Graphics}{2025-09-03}{1.0}{
|
||||
Custom non-floating Graphics commands.
|
||||
}
|
||||
|
||||
\RequirePackage{PrimeTeX/packages/Layout}
|
||||
|
||||
@@ -7,212 +9,37 @@
|
||||
|
||||
\RequirePackage{wrapfig2}
|
||||
|
||||
\ProvideLength{\iconsize}[0.25in]
|
||||
\dim_const:Nn \c_Graphics_icon_dim {0.25in}
|
||||
|
||||
\ProvideLength{\@InlineGraphicHeight}[12pt]
|
||||
\ProvideLength{\@InlineGraphicOffset}[-2pt]
|
||||
\NewDocumentCommand{\IconSize}{}{\c_Graphics_icon_dim}
|
||||
|
||||
\keys_define:nn{InlineGraphic}{
|
||||
height .dim_set:N = \l_InlineGraphic_height_dim,
|
||||
height .initial:n = {12pt},
|
||||
% height .default:n = {12pt},
|
||||
|
||||
offset .dim_set:N = \l_InlineGraphic_offset_dim,
|
||||
offset .initial:n = {-2pt},
|
||||
% offset .default:n = {-2pt},
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\InlineGraphic}{
|
||||
O{\@InlineGraphicHeight}
|
||||
m
|
||||
O{\@InlineGraphicOffset}
|
||||
}{%
|
||||
\raisebox{#3}{\includegraphics[keepaspectratio,height=#1]{#2}}%
|
||||
}
|
||||
|
||||
% Shorthand command for \includegraphics.
|
||||
\NewDocumentCommand{\ig}{O{width=0.5in} m}{%
|
||||
\includegraphics[keepaspectratio,#1]{#2}%
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\centerfig}{O{} m >{\TrimSpaces}m m}{
|
||||
\begin{figure}[htpb]%
|
||||
\Centering%
|
||||
\includegraphics[keepaspectratio,#1]{#2}%
|
||||
\caption{#4}%
|
||||
\label{fig:#3}%
|
||||
\end{figure}%
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\bigfig}{
|
||||
% BigFloat overhang.
|
||||
O{\bigfloatoverhang}
|
||||
% Float positioning.
|
||||
O{htpb}
|
||||
% BigFloat offset ratio.
|
||||
O{\bigfloatoffsetratio}
|
||||
% Key=value options.
|
||||
O{}
|
||||
% Graphic file.
|
||||
m
|
||||
% Label.
|
||||
>{\TrimSpaces}m
|
||||
% Caption.
|
||||
m
|
||||
}{%
|
||||
\begin{BigFloat}[figure][#1][#2][#3]%
|
||||
\captionsetup{type=figure}%
|
||||
\includegraphics[keepaspectratio,width=\linewidth]{#4}%
|
||||
\Centering\captionof{figure}{#6}%\par
|
||||
\label{fig:#5}%
|
||||
\end{BigFloat}%
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\doublebigfig}{%
|
||||
% BigFloat overhang.
|
||||
O{\bigfloatoverhang}
|
||||
% BigFloat offet.
|
||||
O{\bigfloatoffsetratio}
|
||||
% First graphic filename.
|
||||
m
|
||||
% First graphic label.
|
||||
>{\TrimSpaces}m
|
||||
% First graphic caption.
|
||||
m
|
||||
% Second graphic filename.
|
||||
m
|
||||
% Second graphic label.
|
||||
>{\TrimSpaces}m
|
||||
% Second Graphic caption.
|
||||
m
|
||||
}{%
|
||||
\begin{BigFloat}[figure][#1][p][#2]%
|
||||
\captionsetup{type=figure}%
|
||||
\includegraphics[keepaspectratio,width=\textwidth]{#3}%
|
||||
\Centering\captionof{figure}{#5}%
|
||||
\label{fig:#4}
|
||||
\bigskip
|
||||
\captionsetup{type=figure}%
|
||||
\includegraphics[keepaspectratio,width=\textwidth]{#6}%
|
||||
\Centering\captionof{figure}{#8}%
|
||||
\label{fig:#7}%
|
||||
\end{BigFloat}%
|
||||
}
|
||||
|
||||
\RequirePackage{tabularray}
|
||||
|
||||
\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}{%
|
||||
% #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
|
||||
% #3: First label.
|
||||
>{\TrimSpaces}m
|
||||
% #4: First caption.
|
||||
>{\TrimSpaces}m
|
||||
% #5: Second graphic file.
|
||||
m
|
||||
% #6: Second label.
|
||||
>{\TrimSpaces}m
|
||||
% #7: Second caption.
|
||||
>{\TrimSpaces}m
|
||||
% #8: Image vertical alignment.
|
||||
%O{m}
|
||||
}{%
|
||||
\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,\l_twinfig_valign,wd=\l_twinfig_width]}},%
|
||||
hlines = {0pt},
|
||||
%vlines,% For debugging. Comment out when done.
|
||||
hborder{1,Z} = {%
|
||||
abovespace = 0pt,%
|
||||
belowspace = 0pt,%
|
||||
},%
|
||||
vborder{1,Z} = {%
|
||||
leftspace = 0pt,%
|
||||
rightspace = 0pt,%
|
||||
},%
|
||||
vborder{2} = {%
|
||||
leftspace = \l_twinfig_space,%
|
||||
rightspace = \l_twinfig_space,%
|
||||
},%
|
||||
\keys_set:nn{InlineGraphic}{#1}
|
||||
\raisebox{\l_InlineGraphic_offset_dim}{
|
||||
\includegraphics[keepaspectratio,height=\l_InlineGraphic_height_dim]{#2}
|
||||
}%
|
||||
\vfill
|
||||
\captionsetup{type=figure}%
|
||||
\includegraphics[%
|
||||
keepaspectratio,width=\l_twinfig_width%
|
||||
]{#2}%
|
||||
\captionof{figure}{#4}%
|
||||
\label{fig:#3}
|
||||
\vfill%
|
||||
&%
|
||||
\vfill
|
||||
\captionsetup{type=figure}%
|
||||
\includegraphics[%
|
||||
keepaspectratio,width=\l_twinfig_width%
|
||||
]{#5}%
|
||||
\captionof{figure}{#7}%
|
||||
\label{fig:#6}
|
||||
\vfill%
|
||||
\\%
|
||||
\end{tblr}%
|
||||
\end{BigFloat}%
|
||||
}
|
||||
|
||||
\dim_const:Nn \c_ig_width_dim {0.5in}
|
||||
|
||||
% Shorthand command for \includegraphics.
|
||||
\NewDocumentCommand{\ig}{O{width=\c_ig_width_dim} m}{%
|
||||
\includegraphics[keepaspectratio,#1]{#2}%
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\wrapfig}{
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{PrimeTeX/packages/Header}[2025-08-16]
|
||||
\ProvidesExplPackage{PrimeTeX/packages/Header}{2025-08-16}{1.0}{
|
||||
Customize header and footer layout and contents.
|
||||
}
|
||||
|
||||
\RequirePackage{PrimeTeX/packages/Layout}
|
||||
|
||||
\ProvideLength{\insideheaderoffset}[\bigfloatoverhang]
|
||||
\ProvideLength{\outsideheaderoffset}[
|
||||
\bigfloatoverhang * \real{\bigfloatoffsetratio}
|
||||
]
|
||||
\dim_new:N \g_header_insideoffset_dim
|
||||
\dim_set:Nn \g_header_insideoffset_dim {\c_BigFloat_overhang_dim}
|
||||
\dim_new:N \g_header_outsideoffset_dim
|
||||
\dim_set:Nn \g_header_outsideoffset_dim {
|
||||
\fp_to_dim:n {\c_BigFloat_overhang_dim * \c_BigFloat_offset_fp}
|
||||
}
|
||||
|
||||
\ProvideLength{\HeaderInsideOffset}[\BigFloatOverhang]
|
||||
\ProvideLength{\HeaderOutsideOffset}[\BigFloatOverhang * \real{\BigFloatOffset}]
|
||||
|
||||
% Header & Footer Options
|
||||
\RequirePackage{fancyhdr}
|
||||
@@ -38,14 +45,14 @@
|
||||
|
||||
\fancypagestyle{fancy}{
|
||||
\ifthenelse{\boolean{isElectronic}}{
|
||||
\fancyhfoffset[L]{\insideheaderoffset}
|
||||
\fancyhfoffset[R]{\outsideheaderoffset}
|
||||
\fancyhfoffset[L]{\HeaderInsideOffset}
|
||||
\fancyhfoffset[R]{\HeaderOutsideOffset}
|
||||
\fancyhead[L]{\partlabel}
|
||||
\fancyhead[R]{\chapappname{}\leftmark}
|
||||
|
||||
\fancyfoot[R]{\thepage}
|
||||
}{
|
||||
\fancyhfoffset[LE,RO]{\outsideheaderoffset}
|
||||
\fancyhfoffset[LE,RO]{\HeaderOutsideOffset}
|
||||
\fancyhead[LE]{\partlabel}
|
||||
\fancyhead[RO]{\chapappname\leftmark}
|
||||
|
||||
@@ -59,11 +66,11 @@
|
||||
\renewcommand{\footrulewidth}{0pt}
|
||||
|
||||
\ifthenelse{\boolean{isElectronic}}{
|
||||
\fancyhfoffset[L]{\insideheaderoffset}
|
||||
\fancyhfoffset[R]{\outsideheaderoffset}
|
||||
\fancyhfoffset[L]{\HeaderInsideOffset}
|
||||
\fancyhfoffset[R]{\HeaderOutsideOffset}
|
||||
\fancyfoot[R]{\thepage}
|
||||
}{
|
||||
\fancyhfoffset[LE,RO]{\outsideheaderoffset}
|
||||
\fancyhfoffset[LE,RO]{\HeaderOutsideOffset}
|
||||
\fancyfoot[LE,RO]{\thepage}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,11 +95,6 @@
|
||||
% N.B.: floatpagefraction MUST be less than topfraction !!
|
||||
\renewcommand{\dblfloatpagefraction}{0.8} % require fuller float pages
|
||||
|
||||
% Line-breaking zero-width space
|
||||
\NewDocumentCommand{\zws}{}{\hspace{0pt}}
|
||||
% Line-breaking dot
|
||||
\NewDocumentCommand{\bdot}{}{.\zws}
|
||||
|
||||
\NewDocumentEnvironment{SmartAdjustWidth}{O{\boolean{isElectronic}} m m +b}{%
|
||||
\ifthenelse{#1}{%
|
||||
\begin{adjustwidth}{#2}{#3}%
|
||||
@@ -112,43 +107,6 @@
|
||||
}%
|
||||
}{}
|
||||
|
||||
\newcommand{\bigfloatoffsetratio}{2.0}
|
||||
|
||||
% Maximum width adjustment to fit 2 16x9 screensots on one page.
|
||||
\ProvideLength{\bigfloatoverhang}[0.54in]
|
||||
\newcommand{\bigfloatplacement}{htpb}
|
||||
|
||||
\floatstyle{plain}
|
||||
\newfloat{generic}{htpb}{lgf}
|
||||
|
||||
\NewDocumentEnvironment{BigFloat}{
|
||||
% #1: Float type
|
||||
O{generic}
|
||||
% #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{\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
|
||||
}{%
|
||||
\begin{#1}[#3]% float environment
|
||||
\begin{SmartAdjustWidth}{-#2}{-#2 * \real{#4}}% adjustwidth(*)
|
||||
\begin{minipage}{\linewidth}%{#2 * (#4 + 1) + \textwidth}%
|
||||
\ifthenelse{\boolean{isDraft}}{%
|
||||
{\color{layout}\rule{\textwidth}{1pt}\zws}%
|
||||
#5%
|
||||
%{\color{layout}\rule{\textwidth}{1pt}}%
|
||||
}{%
|
||||
#5%
|
||||
}%
|
||||
\end{minipage}%
|
||||
\end{SmartAdjustWidth}%
|
||||
\end{#1}%
|
||||
}{}
|
||||
|
||||
\AtBeginDocument{
|
||||
\ifthenelse{\boolean{isElectronic}}{
|
||||
\newgeometry{
|
||||
@@ -181,11 +139,14 @@
|
||||
}
|
||||
\restoregeometry
|
||||
|
||||
\ExplSyntaxOn
|
||||
\NewDocumentEnvironment{SmallMargin}{O{0.0in} O{-0.25in}}{
|
||||
\clearpage
|
||||
\loadgeometry{smallMargin}
|
||||
\setlength{\insideheaderoffset}{#1}
|
||||
\setlength{\outsideheaderoffset}{#2}
|
||||
\setlength{\HeaderInsideOffset}{#1}
|
||||
%\dim_set:Nn \g_header_insideoffset_dim {#1}
|
||||
\setlength{\HeaderOutsideOffset}{#2}
|
||||
%\dim_set:Nn \g_header_outsideoffset_dim {#2}
|
||||
\pagestyle{fancy}
|
||||
}{
|
||||
\clearpage
|
||||
|
||||
@@ -21,11 +21,20 @@
|
||||
style verso outer = {\RaggedLeft\small\color{marginText}},
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\MarginHyperSetup}{}{
|
||||
\ifthenelse{\boolean{isElectronic}}{
|
||||
\hypersetup{allcolors = link}
|
||||
}{
|
||||
\hypersetup{allcolors = marginText}
|
||||
}
|
||||
}
|
||||
|
||||
% Put a glossary definition in a margin paragraph.
|
||||
\NewDocumentCommand{\mdef}{O{} m m}{%
|
||||
\index{\glsentryname{#2}}% Add a reference to this in the index.
|
||||
\strong{#3{#2}}% This is the text that appears on the page.
|
||||
\marginalia[#1]{%
|
||||
\MarginHyperSetup%
|
||||
\strong{\Glsentryname{#2}:} % Create the title of the margin note.
|
||||
\glsdesc*{#2}% Create the text of the margin note.
|
||||
}%
|
||||
@@ -47,6 +56,7 @@
|
||||
\NewDocumentCommand{\mnote}{O{} +m}{%
|
||||
\footnotemark%
|
||||
\marginalia[#1]{%
|
||||
\MarginHyperSetup%
|
||||
\footnotemark[\value{footnote}]#2%
|
||||
}%
|
||||
}
|
||||
@@ -68,6 +78,7 @@
|
||||
% following paragraph and is vertically aligned with it.
|
||||
\strut%
|
||||
\marginalia{%
|
||||
\MarginHyperSetup%
|
||||
\captionsetup{%
|
||||
type = figure,%
|
||||
justification = RaggedOutside,%
|
||||
|
||||
Reference in New Issue
Block a user