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},
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}
\tl_new:N \l_Boxout_title_tl
\keys_define:nn{Boxout}{
colspec .str_set_e:N= \l_Boxout_colspec_str,
colspec .initial:e = {\c_Boxout_colspec_str},
innerspec .tl_set_e:N= \l_Boxout_innerspec_tl,
innerspec .initial:e = {\c_Boxout_innerspec_tl},
innerspec .default:e = {\c_Boxout_innerspec_tl},
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}{
% #1: Key-value options.
O{}
@@ -45,18 +58,23 @@
+b
}{%
\keys_set:nn{Boxout}{#1}
\bool_if:nT \l_Boxout_warning_bool {%
\colorlet{boxoutBG}{warningBG}%
\colorlet{boxoutFG}{warningFG}%
}%
\label{box:#2}%
\message{colspec=\str_use:N \l_Boxout_colspec_str}
\SetTblrInner{colspec:e=\l_Boxout_colspec_str}
\begin{tblrBoxout}{}%
\IfBlankF{#3}{\Centering\sbfamily\bfseries #3\\}%
\setlength{\parskip}{\medskipamount}%
#4\\%
\end{tblrBoxout}%
\bool_if:nT \l_Boxout_warning_bool {
\colorlet{boxoutBG}{warningBG}
\colorlet{boxoutFG}{warningFG}
}
\label{box:#2}
\tl_if_empty:nTF {#3} {
\expanded{\noexpand\begin{tblrBoxout}{\l_Boxout_innerspec_tl}}
\setlength{\parskip}{\medskipamount}
#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{}{
@@ -69,8 +87,6 @@
O{}
% #2: Label, passed to Boxout argument #1.
>{\TrimSpaces}m
% #5: Tabularray colspec, passed to Boxout argument #2.
%O{X[l,h]}
% #3: Caption, passed to Boxout argument #3.
m
% #4: Body, passed to Boxout.
@@ -84,12 +100,12 @@
offset = \l_BigFloat_offset_fp,
]%
\begin{Boxout}[%
warning=\l_Boxout_warning_bool,
colspec=\l_Boxout_colspec_str,
]{#2}[\l_Boxout_colspec_str]{#3}%
#4%
\end{Boxout}%
\end{BigFloat}%
innerspec:e = \l_Boxout_innerspec_tl,
warning:e = \bool_to_str:N \l_Boxout_warning_bool,
]{#2}{#3}
#4
\end{Boxout}
\end{BigFloat}
}{}
\str_const:Nn \c_WrapBoxout_position_str {o}
@@ -100,7 +116,7 @@
WrapBoxout .inherit:n = Boxout,
}
\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}
},
position .initial:e = {\c_WrapBoxout_position_str},
@@ -126,8 +142,8 @@
\begin{wrapfigure}{\l_WrapBoxout_position_str}[\l_WrapBoxout_offset_dim]%
\begin{minipage}{\l_WrapBoxout_width_dim}%
\begin{Boxout}[
colspec = \l_Boxout_colspec_str,
warning = \l_Boxout_warning_bool,
innerspec:e = \l_Boxout_innerspec_tl,
warning:e = \bool_to_str:N \l_Boxout_warning_bool,
]{#2}{#3}%
#4%
\end{Boxout}%

View File

@@ -19,6 +19,25 @@
\floatstyle{plain}
\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.
\dim_const:Nn \c_BigFloat_overhang_dim {0.54in}
\str_const:Nn \c_BigFloat_type_str {generic}
@@ -57,10 +76,9 @@
+b
}{%
\keys_set:nn{BigFloat}{#1}%
%\str_new:N \l_BigFloat_placement_str
\str_set:Ne \l_BigFloat_placement_str {
\clist_use:Nn \c_BigFloat_placement_clist {}
}
\clist_use_default:Nnnn \l_BigFloat_placement_str
{\l_BigFloat_placement_clist}
{\c_BigFloat_placement_clist}
\ExpEnvOption%
\begin{\l_BigFloat_type_str}[\l_BigFloat_placement_str]% float environment
\begin{SmartAdjustWidth}{%
@@ -88,11 +106,11 @@
\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}{
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
}{
\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 {}
}
}
\clist_use_default:Nnnn \l_CenterFig_placement_str
{\l_CenterFig_placement_clist}
{\c_CenterFig_placement_clist}
\ExpEnvOption
\begin{figure}[\l_CenterFig_placement_str]%
\Centering%

View File

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

View File

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