- Fix WrapBoxout.
- Migrate from wrapfig2 to wrapstuff. - Miscellaneous improvements.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
\RequirePackage{calc}
|
||||
|
||||
\RequirePackage{wrapfig2}
|
||||
\RequirePackage{wrapstuff}
|
||||
|
||||
\dim_const:Nn \c_Graphics_icon_dim {0.25in}
|
||||
|
||||
@@ -44,40 +44,41 @@
|
||||
\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}%
|
||||
\str_const:Nn \c_WrapFig_placement_str {o}
|
||||
\dim_const:Nn \c_WrapFig_hoffset_dim {\marparwidth}
|
||||
|
||||
\keys_define:nn {WrapFig} {
|
||||
placement .choices:nn = {l,r,c,i,o}{
|
||||
\str_set:Ne \l_WrapFig_placement_str {\l_keys_choice_tl}
|
||||
},
|
||||
placement .initial:e = {\c_WrapFig_placement_str},
|
||||
|
||||
hoffset .dim_set:N = \l_WrapFig_hoffset_dim,
|
||||
hoffset .initial:e = {\c_WrapFig_hoffset_dim},
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\wrapfig}{
|
||||
% #1: alignment [l,r,i,o]
|
||||
O{O}
|
||||
% #2: horizontal_offset
|
||||
O{\marparwidth}
|
||||
% #3: graphic_file
|
||||
m
|
||||
% #4: (width|height)=lengthvalue
|
||||
\NewDocumentCommand{\WrapFig}{
|
||||
% #1: Key-value options
|
||||
O{}
|
||||
% #5: label
|
||||
% #2: graphic_file
|
||||
m
|
||||
% #3: Options passed to \includegraphics
|
||||
O{}
|
||||
% #4: label
|
||||
>{\TrimSpaces}m
|
||||
% #6: caption
|
||||
m%
|
||||
% #7: indented lines override
|
||||
o
|
||||
}{%
|
||||
\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}%
|
||||
}%
|
||||
}
|
||||
% #5: caption
|
||||
m
|
||||
}{ \group_begin:
|
||||
\keys_set:nn {WrapFig} {#1}
|
||||
\expanded{\noexpand\begin{wrapstuff}[
|
||||
\l_WrapFig_placement_str,
|
||||
hoffset = \l_WrapFig_hoffset_dim,
|
||||
]}
|
||||
\begin{MyCaption}{fig:#4}{#5}
|
||||
\includegraphics[%
|
||||
keepaspectratio,%
|
||||
#3%
|
||||
]{#2}%
|
||||
\end{MyCaption}
|
||||
\end{wrapstuff}
|
||||
\group_end: }
|
||||
Reference in New Issue
Block a user