Add indented lines override to \wrapfig.

This commit is contained in:
2025-09-05 16:30:35 -05:00
parent db078eb5df
commit 2cefebccd6
3 changed files with 89 additions and 86 deletions

View File

@@ -44,28 +44,40 @@
\includegraphics[keepaspectratio,#1]{#2}%
}
\NewDocumentCommand{\@wrapfigbody}{m m m m}{
\captionsetup{type=figure}%
\capstart%
\includegraphics[%
keepaspectratio,%
#2%
]{#1}%
\Centering\captionof{figure}{#4}%
\label{fig:#3}%
}
\NewDocumentCommand{\wrapfig}{
% alignment [l,r,i,o]
% #1: alignment [l,r,i,o]
O{O}
% horizontal_offset
% #2: horizontal_offset
O{\marparwidth}
% graphic_file
% #3: graphic_file
m
% (width|height)=lengthvalue
% #4: (width|height)=lengthvalue
O{}
% label
% #5: label
>{\TrimSpaces}m
% caption
% #6: caption
m%
% #7: indented lines override
o
}{%
\begin{wrapfigure}{#1}[#2]%
\captionsetup{type=figure}%
\capstart%
\includegraphics[%
keepaspectratio,%
#4%
]{#3}%
\Centering\captionof{figure}{#6}%
\label{fig:#5}%
\end{wrapfigure}%
\IfNoValueTF{#7}{%
\begin{wrapfigure}{#1}[#2]%
\@wrapfigbody{#3}{#4}{#5}{#6}%
\end{wrapfigure}%
}{%
\begin{wrapfigure}[#7]{#1}[#2]%
\@wrapfigbody{#3}{#4}{#5}{#6}%
\end{wrapfigure}%
}%
}