141 lines
2.9 KiB
TeX
141 lines
2.9 KiB
TeX
\NeedsTeXFormat{LaTeX2e}
|
|
\ProvidesPackage{PrimeTeX/packages/Graphics}[2025-07-09]
|
|
|
|
\RequirePackage{PrimeTeX/packages/Layout}
|
|
|
|
\RequirePackage{calc}
|
|
|
|
\RequirePackage{wrapfig2}
|
|
|
|
\providelength{\iconsize}[0.25in]
|
|
\providelength{\igh}[10pt] % igh = Inline Graphics Height.
|
|
|
|
% Shorthand command for \includegraphics.
|
|
\NewDocumentCommand{\ig}{O{width=0.5in} m}{%
|
|
\includegraphics[keepaspectratio,#1]{#2}%
|
|
}
|
|
|
|
\NewDocumentCommand{\centerfig}{O{} m >{\TrimSpaces}m m}{
|
|
\begin{figure}[htpb]%
|
|
\Centering%
|
|
\includegraphics[keepaspectratio,#1]{#2}%
|
|
\caption{#4}%
|
|
\label{fig:#3}%
|
|
\end{figure}%
|
|
}
|
|
|
|
\NewDocumentCommand{\bigfig}{O{\bigfloatoverhang} m >{\TrimSpaces}m m}{%
|
|
\BigFloat[#1]{figure}{%
|
|
\captionsetup{type=figure}%
|
|
\includegraphics[keepaspectratio,width=\linewidth]{#2}%
|
|
\Centering\captionof{figure}{#4}%\par
|
|
\label{fig:#3}%
|
|
}%
|
|
}
|
|
|
|
\NewDocumentCommand{\doublebigfig}{%
|
|
% BigFloat overhang.
|
|
O{\bigfloatoverhang}
|
|
% BigFloat offet.
|
|
O{\bigfloatoffsetratio}
|
|
% First graphic filename.
|
|
m
|
|
% First graphic label.
|
|
>{\TrimSpaces}m
|
|
% First graphic caption.
|
|
m
|
|
% Second graphic filename.
|
|
m
|
|
% Second graphic label.
|
|
>{\TrimSpaces}m
|
|
% Second Graphic caption.
|
|
m
|
|
}{%
|
|
\BigFloat[#1][p][#2]{figure}{%
|
|
\captionsetup{type=figure}%
|
|
\includegraphics[keepaspectratio,width=\textwidth]{#3}%
|
|
\Centering\captionof{figure}{#5}\par%
|
|
\label{fig:#4}
|
|
\bigskip
|
|
\captionsetup{type=figure}%
|
|
\includegraphics[keepaspectratio,width=\textwidth]{#6}%
|
|
\Centering\captionof{figure}{#8}\par%
|
|
\label{fig:#7}%
|
|
}%
|
|
}
|
|
|
|
\RequirePackage{tabularray}
|
|
|
|
\providelength{\twinfigspace}[3pt]
|
|
\providelength{\twinfigwidth}[
|
|
\textwidth / 2 + \bigfloatoverhang - \twinfigspace
|
|
]
|
|
|
|
\NewDocumentCommand{\twinfig}{%
|
|
O{\bigfloatoverhang} m >{\TrimSpaces}m m m >{\TrimSpaces}m m%
|
|
}{%
|
|
\BigFloat[#1]{table}{%
|
|
\begin{tblr}{%
|
|
colspec = {*{2}{Q[c,m,wd=\twinfigwidth]}},%
|
|
hlines = {0pt},
|
|
%vlines,% For debugging. Comment out when done.
|
|
hborder{1,Z} = {%
|
|
abovespace = 0pt,%
|
|
belowspace = 0pt,%
|
|
},%
|
|
vborder{1,Z} = {%
|
|
leftspace = 0pt,%
|
|
rightspace = 0pt,%
|
|
},%
|
|
vborder{2} = {%
|
|
leftspace = \twinfigspace,%
|
|
rightspace = \twinfigspace,%
|
|
},%
|
|
}%
|
|
\vfill
|
|
\captionsetup{type=figure}%
|
|
\includegraphics[%
|
|
keepaspectratio,width=\twinfigwidth%
|
|
]{#2}%
|
|
\captionof{figure}{#4}%
|
|
\label{fig:#3}
|
|
\vfill%
|
|
&%
|
|
\vfill
|
|
\captionsetup{type=figure}%
|
|
\includegraphics[%
|
|
keepaspectratio,width=\twinfigwidth%
|
|
]{#5}%
|
|
\captionof{figure}{#7}%
|
|
\label{fig:#6}
|
|
\vfill%
|
|
\\%
|
|
\end{tblr}%
|
|
}%
|
|
}
|
|
|
|
\NewDocumentCommand{\wrapfig}{
|
|
% alignment [l,r,i,o]
|
|
O{O}
|
|
% horizontal_offset
|
|
O{\marparwidth}
|
|
% graphic_file
|
|
m
|
|
% (width|height)=lengthvalue
|
|
O{}
|
|
% label
|
|
>{\TrimSpaces}m
|
|
% caption
|
|
m%
|
|
}{%
|
|
\begin{wrapfigure}{#1}[#2]%
|
|
\captionsetup{type=figure}%
|
|
\capstart%
|
|
\includegraphics[%
|
|
keepaspectratio,%
|
|
#4%
|
|
]{#3}%
|
|
\Centering\captionof{figure}{#6}%
|
|
\label{fig:#5}%
|
|
\end{wrapfigure}%
|
|
} |