- Fix WrapBoxout.

- Migrate from wrapfig2 to wrapstuff.
- Miscellaneous improvements.
This commit is contained in:
2025-09-10 16:32:35 -05:00
parent d0e3687583
commit d1fd2fef22
7 changed files with 244 additions and 165 deletions

View File

@@ -6,18 +6,12 @@
\RequirePackage{PrimeTeX/packages/Layout}
% 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]}
\RequirePackage{float}
\floatstyle{plain}
\newfloat{generic}{htpb}{lgf}
%\floatplacement{figure}{htpb}
%\floatplacement{table}{htpb}
% Function for converting clists generated by multichoice keys into strings.
\NewDocumentCommand{\clist_use_default:Nnnn}{
@@ -95,8 +89,7 @@
\dim_set:Nn \l_BigFloat_workoverhang_dim {
\dim_min:nn {\l_BigFloat_overhang_dim} {\l_BigFloat_maxoverhang_dim}
}
\ExpEnvOption
\begin{\l_BigFloat_type_str}[\l_BigFloat_placement_str]% float environment
\expanded{\noexpand\begin{\l_BigFloat_type_str}[\l_BigFloat_placement_str]}% float environment
\begin{SmartAdjustWidth}{
\fp_to_dim:n {
-\l_BigFloat_workoverhang_dim
@@ -116,7 +109,7 @@
}
\end{minipage}
\end{SmartAdjustWidth}
\end{\l_BigFloat_type_str}
\expanded{\noexpand\end{\l_BigFloat_type_str}}
\group_end: }{}
\clist_const:Nn \c_CenterFig_placement_clist {h, t, p, b}
@@ -141,12 +134,14 @@
\clist_use_default:Nnnn \l_CenterFig_placement_str
{\l_Float_placement_clist}
{\c_Float_placement_clist}
\ExpEnvOption
\begin{figure}[\l_CenterFig_placement_str]
\Centering
\includegraphics[keepaspectratio,#1]{#3}
\caption{#5}
\label{fig:#4}
%\ExpEnvOption
\expanded{\noexpand\begin{figure}[\l_CenterFig_placement_str]}
\begin{MyCaption}{fig:#4}{#5}
\Centering
\includegraphics[keepaspectratio,#1]{#3}
\end{MyCaption}
% \caption{#5}
% \label{fig:#4}
\end{figure}
\group_end: }
@@ -202,10 +197,12 @@
placement:e = \l_Float_placement_clist,
offset = \l_BigFloat_offset_fp,
]
\captionsetup{type=figure}
\includegraphics[keepaspectratio,width=\linewidth]{#2}
\Centering\captionof{figure}{#4}
\label{fig:#3}
%\captionsetup{type=figure}
\begin{MyCaption}{fig:#3}{#4}
\includegraphics[keepaspectratio,width=\linewidth]{#2}
\end{MyCaption}
% \Centering\captionof{figure}{#4}
% \label{fig:#3}
\end{BigFloat}
\group_end: }
@@ -242,7 +239,7 @@
\keys_set:nn{DoubleBigFig}{#1}
\begin{BigFloat}[
type = generic,
type = figure,
overhang = \l_BigFloat_overhang_dim,
placement:e = \l_Float_placement_clist,
offset = \l_BigFloat_offset_fp,
@@ -264,18 +261,13 @@
rightspace = 0pt,
},
}
%\captionsetup{type=figure}
\includegraphics[keepaspectratio,width=\textwidth]{#2}
\par
\MyCaption{fig:#3}{#4}\\
% \Centering\captionof{figure}{#4}
% \label{fig:#3}\\
%\captionsetup{type=figure}
\includegraphics[keepaspectratio,width=\textwidth]{#5}
\par
\MyCaption{fig:#6}{#7}
% \Centering\captionof{figure}{#7}
% \label{fig:#6}
\begin{MyCaption}{fig:#3}{#4}
\includegraphics[keepaspectratio,width=\linewidth]{#2}
\end{MyCaption}
\\
\begin{MyCaption}{fig:#6}{#7}
\includegraphics[keepaspectratio,width=\linewidth]{#5}
\end{MyCaption}
\end{tblr}
\end{BigFloat}
\group_end: }
@@ -326,7 +318,7 @@
\keys_set:nn{TwinFig}{#1}
\begin{BigFloat}[
type = {generic},
type = {figure},
overhang = \l_BigFloat_overhang_dim,
placement:e = \l_Float_placement_clist,
offset = \l_BigFloat_offset_fp,
@@ -349,21 +341,25 @@
},
}
\vfill
\captionsetup{type=figure}
\includegraphics[
keepaspectratio,width=\l_TwinFig_width_dim
]{#2}
\captionof{figure}{#4}
\label{fig:#3}
%\captionsetup{type=figure}
\begin{MyCaption}{fig:#3}{#4}
\includegraphics[
keepaspectratio,width=\l_TwinFig_width_dim
]{#2}
\end{MyCaption}
% \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}
% \captionsetup{type=figure}
\begin{MyCaption}{fig:#6}{#7}
\includegraphics[
keepaspectratio,width=\l_TwinFig_width_dim
]{#5}
\end{MyCaption}
% \captionof{figure}{#7}
% \label{fig:#6}
\vfill
\\
\end{tblr}