This commit is contained in:
2025-09-04 17:12:01 -05:00
parent 6130aab230
commit db078eb5df
4 changed files with 74 additions and 42 deletions

View File

@@ -23,17 +23,30 @@
vlines = {0pt,boxoutBG}, vlines = {0pt,boxoutBG},
vline{1,Z} = {\boxoutrule,boxoutFG}, vline{1,Z} = {\boxoutrule,boxoutFG},
} }
% \SetTblrOuter[tblrBoxout]{
% expand+ = \l_Boxout_body_tl,
% }
\str_const:Nn \c_Boxout_colspec_str {{X[l,h]}} \tl_const:Nn \c_Boxout_innerspec_tl {colspec={X[l,h]}}
\bool_const:Nn \c_Boxout_warning_bool {\c_false_bool} \bool_const:Nn \c_Boxout_warning_bool {\c_false_bool}
\tl_new:N \l_Boxout_title_tl
\keys_define:nn{Boxout}{ \keys_define:nn{Boxout}{
colspec .str_set_e:N= \l_Boxout_colspec_str, innerspec .tl_set_e:N= \l_Boxout_innerspec_tl,
colspec .initial:e = {\c_Boxout_colspec_str}, innerspec .initial:e = {\c_Boxout_innerspec_tl},
innerspec .default:e = {\c_Boxout_innerspec_tl},
warning .bool_set:N = \l_Boxout_warning_bool, warning .bool_set:N = \l_Boxout_warning_bool,
warning .initial:e = {false},
warning .default:e = {true},
} }
% \NewExpandableDocumentCommand{\__Boxout_body:Nnn}{m +m +m}{
% %\message{boxout~body~start}
% }
\NewDocumentEnvironment{Boxout}{ \NewDocumentEnvironment{Boxout}{
% #1: Key-value options. % #1: Key-value options.
O{} O{}
@@ -45,18 +58,23 @@
+b +b
}{% }{%
\keys_set:nn{Boxout}{#1} \keys_set:nn{Boxout}{#1}
\bool_if:nT \l_Boxout_warning_bool {% \bool_if:nT \l_Boxout_warning_bool {
\colorlet{boxoutBG}{warningBG}% \colorlet{boxoutBG}{warningBG}
\colorlet{boxoutFG}{warningFG}% \colorlet{boxoutFG}{warningFG}
}% }
\label{box:#2}% \label{box:#2}
\message{colspec=\str_use:N \l_Boxout_colspec_str} \tl_if_empty:nTF {#3} {
\SetTblrInner{colspec:e=\l_Boxout_colspec_str} \expanded{\noexpand\begin{tblrBoxout}{\l_Boxout_innerspec_tl}}
\begin{tblrBoxout}{}% \setlength{\parskip}{\medskipamount}
\IfBlankF{#3}{\Centering\sbfamily\bfseries #3\\}% #4\\
\setlength{\parskip}{\medskipamount}% \end{tblrBoxout}
#4\\% }{
\end{tblrBoxout}% \expanded{\noexpand\begin{tblrBoxout}{\l_Boxout_innerspec_tl}}
\SetCell{halign=c, font={\sbfamily\bfseries}}{#3}\\
\setlength{\parskip}{\medskipamount}
#4\\
\end{tblrBoxout}
}
}{} }{}
\keys_define:nn{}{ \keys_define:nn{}{
@@ -69,8 +87,6 @@
O{} O{}
% #2: Label, passed to Boxout argument #1. % #2: Label, passed to Boxout argument #1.
>{\TrimSpaces}m >{\TrimSpaces}m
% #5: Tabularray colspec, passed to Boxout argument #2.
%O{X[l,h]}
% #3: Caption, passed to Boxout argument #3. % #3: Caption, passed to Boxout argument #3.
m m
% #4: Body, passed to Boxout. % #4: Body, passed to Boxout.
@@ -84,12 +100,12 @@
offset = \l_BigFloat_offset_fp, offset = \l_BigFloat_offset_fp,
]% ]%
\begin{Boxout}[% \begin{Boxout}[%
warning=\l_Boxout_warning_bool, innerspec:e = \l_Boxout_innerspec_tl,
colspec=\l_Boxout_colspec_str, warning:e = \bool_to_str:N \l_Boxout_warning_bool,
]{#2}[\l_Boxout_colspec_str]{#3}% ]{#2}{#3}
#4% #4
\end{Boxout}% \end{Boxout}
\end{BigFloat}% \end{BigFloat}
}{} }{}
\str_const:Nn \c_WrapBoxout_position_str {o} \str_const:Nn \c_WrapBoxout_position_str {o}
@@ -100,7 +116,7 @@
WrapBoxout .inherit:n = Boxout, WrapBoxout .inherit:n = Boxout,
} }
\keys_define:nn{WrapBoxout}{ \keys_define:nn{WrapBoxout}{
position .choices:nn = {l,r,i,o}{ position .choices:nn = {L,l,R,r,I,i,O,o}{
\str_set:Nn \l_WrapBoxout_position_str {\l_keys_choice_tl} \str_set:Nn \l_WrapBoxout_position_str {\l_keys_choice_tl}
}, },
position .initial:e = {\c_WrapBoxout_position_str}, position .initial:e = {\c_WrapBoxout_position_str},
@@ -126,8 +142,8 @@
\begin{wrapfigure}{\l_WrapBoxout_position_str}[\l_WrapBoxout_offset_dim]% \begin{wrapfigure}{\l_WrapBoxout_position_str}[\l_WrapBoxout_offset_dim]%
\begin{minipage}{\l_WrapBoxout_width_dim}% \begin{minipage}{\l_WrapBoxout_width_dim}%
\begin{Boxout}[ \begin{Boxout}[
colspec = \l_Boxout_colspec_str, innerspec:e = \l_Boxout_innerspec_tl,
warning = \l_Boxout_warning_bool, warning:e = \bool_to_str:N \l_Boxout_warning_bool,
]{#2}{#3}% ]{#2}{#3}%
#4% #4%
\end{Boxout}% \end{Boxout}%

View File

@@ -19,6 +19,25 @@
\floatstyle{plain} \floatstyle{plain}
\newfloat{generic}{htpb}{lgf} \newfloat{generic}{htpb}{lgf}
% Function for converting clists generated by multichoice keys into strings.
\NewDocumentCommand{\clist_use_default:Nnnn}{
% #1: Output string variable.
m
% #2: Input clist.
m
% #3: Default clist to use if #2 is empty.
m
% #4: Separator for \clist_use:Nn.
O{}
}{
\clist_if_empty:NT #2 {
\clist_set:Ne #2 {#3}
}
\str_set:Ne #1 {
\clist_use:Nn #2 {#4}
}
}
% Maximum width adjustment to fit 2 16x9 screensots on one page. % Maximum width adjustment to fit 2 16x9 screensots on one page.
\dim_const:Nn \c_BigFloat_overhang_dim {0.54in} \dim_const:Nn \c_BigFloat_overhang_dim {0.54in}
\str_const:Nn \c_BigFloat_type_str {generic} \str_const:Nn \c_BigFloat_type_str {generic}
@@ -57,10 +76,9 @@
+b +b
}{% }{%
\keys_set:nn{BigFloat}{#1}% \keys_set:nn{BigFloat}{#1}%
%\str_new:N \l_BigFloat_placement_str \clist_use_default:Nnnn \l_BigFloat_placement_str
\str_set:Ne \l_BigFloat_placement_str { {\l_BigFloat_placement_clist}
\clist_use:Nn \c_BigFloat_placement_clist {} {\c_BigFloat_placement_clist}
}
\ExpEnvOption% \ExpEnvOption%
\begin{\l_BigFloat_type_str}[\l_BigFloat_placement_str]% float environment \begin{\l_BigFloat_type_str}[\l_BigFloat_placement_str]% float environment
\begin{SmartAdjustWidth}{% \begin{SmartAdjustWidth}{%
@@ -88,11 +106,11 @@
\clist_const:Nn \c_CenterFig_placement_clist {h, t, p, b} \clist_const:Nn \c_CenterFig_placement_clist {h, t, p, b}
\str_new:N \l_CenterFig_placement_str \clist_new:N \l_CenterFig_placement_clist
\keys_define:nn{CenterFig}{ \keys_define:nn{CenterFig}{
placement .multichoices:nn= {b,H,h,p,t}{ placement .multichoices:nn= {b,H,h,p,t}{
\str_put_right:Ne \l_CenterFig_placement_str {\l_keys_choice_tl} \clist_put_right:Nn \l_CenterFig_placement_clist {\l_keys_choice_tl}
}, },
} }
@@ -109,11 +127,9 @@
m m
}{ }{
\keys_set:nn{CenterFig}{#2}% \keys_set:nn{CenterFig}{#2}%
\str_if_empty:NT \l_CenterFig_placement_str { \clist_use_default:Nnnn \l_CenterFig_placement_str
\str_set:Ne \l_CenterFig_placement_str { {\l_CenterFig_placement_clist}
\clist_use:Nn \c_CenterFig_placement_clist {} {\c_CenterFig_placement_clist}
}
}
\ExpEnvOption \ExpEnvOption
\begin{figure}[\l_CenterFig_placement_str]% \begin{figure}[\l_CenterFig_placement_str]%
\Centering% \Centering%

View File

@@ -25,12 +25,12 @@
\renewcommand{\headrulewidth}{0pt} \renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}
\NewDocumentCommand{\chapappname}{}{Chapter \thechapter{}: } \NewDocumentCommand{\chapappname}{}{Chapter~\thechapter{}:~}
\NewDocumentCommand{\partlabel}{}{\partname{} \thepart{}: \parttitle} \NewDocumentCommand{\partlabel}{}{\partname{}~\thepart{}:~\parttitle}
\NewDocumentCommand{\Appendix}{}{ \NewDocumentCommand{\Appendix}{}{
\appendix \appendix
\RenewDocumentCommand{\chapappname}{}{Appendix \thechapter{}: } \RenewDocumentCommand{\chapappname}{}{Appendix~\thechapter{}:~}
\RenewDocumentCommand{\partlabel}{}{} \RenewDocumentCommand{\partlabel}{}{}
} }

View File

@@ -62,7 +62,7 @@
\ProvideLength{\contentwidth}[\textwidth + \marparwidth] \ProvideLength{\contentwidth}[\textwidth + \marparwidth]
\RequirePackage[ \RequirePackage[
debug, %debug,
balanced, balanced,
emergencystretch = 3em, emergencystretch = 3em,
max-cost = 25000, max-cost = 25000,