Override subfigs commands

This commit is contained in:
2024-07-12 10:05:37 +02:00
parent 29523ed1f3
commit 913a35ef9d
11 changed files with 112 additions and 75 deletions

View File

@@ -28,3 +28,46 @@
\newcommand{\partref}[1]{Part~\ref{#1}}
\renewcommand{\secref}[2][\labelprefix]{Section~\ref{#1:sec:#2}}
\renewcommand{\tabref}[2][\labelprefix]{Table~\ref{#1:tab:#2}}
% Images
% example:
% \begin{subfigs}{label}{Fig title}[Subfig titles]
% \subfig{subfig1}%
% \subfig[1][htbp]{subfig2}[caption]%
% \end{subfigs}
% reference later with: \figref{label}
\RenewDocumentEnvironment{subfigs}{O{htbp} m m o}{%
\begin{figure}[#1]%
\centering%
}{%
\caption[#3]{%
#3%
\IfValueTF{#4}{ % voluntary space before the subfig titles
\begin{enumerate*}[label=\textbf{(\alph*)}]%
#4%
\end{enumerate*}%
}%
}%
\label{fig:#2}%
\end{figure}%
}
\NewDocumentCommand{\subfigsheight}{m}{%
\setkeys{Gin}{height=#1}%
}
\RenewDocumentCommand{\subfig}{o O{b} m O{}}{%
\hfill%
\subfloat[#4\label{fig:#3}]{%
\IfValueTF{#1}{%
\includegraphics[width=#1\linewidth, valign=#2, keepaspectratio]{#3}%
}{%
\includegraphics[valign=#2, keepaspectratio]{#3}%
}%
}%
\hfill%
}
\captionsetup{%
labelfont={sf,bf,up}, % sans-serif, bold, upright
}