- Add full-width float macros.

- Add reference macros.
- Add versions of marginfig and centerfig that allow custom widths.
This commit is contained in:
2025-07-09 17:26:06 -05:00
parent 69501ce6b7
commit 40b8836e51

View File

@@ -61,6 +61,32 @@
% Page Layout % Page Layout
%#region %#region
\RequirePackage[pass]{geometry} \RequirePackage[pass]{geometry}
\RequirePackage{calc}
\RequirePackage{ifoddpage}
\newlength{\contentwidth}
\setlength{\contentwidth}{\textwidth+\marginparsep+\marginparwidth}
\newlength{\bfFigureWidth}
\newlength{\bfMarginOffset}
\newcommand{\bigfloat}[2][1in]{%
\setlength{\bfFigureWidth}{#1*-2+\paperwidth}%
\checkoddpage%
\ifoddpage%
\setlength{\bfMarginOffset}{-1in+#1-\oddsidemargin}%
\else%
\setlength{\bfMarginOffset}{-1in+#1-\evensidemargin}%
\fi%
\begin{figure}[ht]%
{\leavevmode%
\put(\bfMarginOffset,0in){%
\begin{minipage}{\bfFigureWidth}%
#2%
\end{minipage}%
}%
}%
\end{figure}%
}
%#endregion %#endregion
% Title & Heading Options % Title & Heading Options
@@ -79,15 +105,18 @@
\definecolor{PrimeBlue}{RGB}{25,45,145} \definecolor{PrimeBlue}{RGB}{25,45,145}
%#endregion %#endregion
% Use Hyperref to automatically create links in the document
%#region
\RequirePackage{hyperref}
\hypersetup{colorlinks=true, allcolors=PrimeBlue}
%#endregion
% Cross references % Cross references
%#region %#region
%\newcommand{\sectionRef}[2]{\ref{#1:#2}: #2} %\newcommand{\sectionRef}[2]{\ref{#1:#2}: #2}
\newcommand{\refChapter}[1]{Chapter \ref{ch:#1}}
\newcommand{\refAppendix}[1]{Appendix \ref{ch:#1}}
\newcommand{\refSection}[1]{Section \ref{sec:#1}}
\newcommand{\refSubsection}[1]{Subsection \ref{subsec:#1}}
\newcommand{\refSubsubsection}[1]{Sub-subsection \ref{sssec:#1}}
\newcommand{\refParagraph}[1]{Paragraph \ref{par:#1}}
\newcommand{\refSubparagraph}[1]{Subparagraph \ref{subpar:#1}}
\newcommand{\refTable}[1]{Table \ref{tbl:#1}}
\newcommand{\refFigure}[1]{Figure \ref{fig:#1}}
\newcommand{\lblGeneral}[4][]{ \newcommand{\lblGeneral}[4][]{
\if\relax\detokenize{#1}\relax % Check if #1 is empty string. \if\relax\detokenize{#1}\relax % Check if #1 is empty string.
@@ -125,18 +154,30 @@
% Graphics package for including images % Graphics package for including images
%#region %#region
\RequirePackage{graphicx} \RequirePackage{graphicx}
\RequirePackage[hypcap=true]{caption}
\newcommand{\ig}[2][0.5in]{ \newcommand{\ig}[2][0.5in]{
\includegraphics[keepaspectratio,width=#1]{graphics/#2} \includegraphics[keepaspectratio,width=#1]{#2}
} }
\newcommand{\centerfig}[3]{ \newcommand{\cfig}[4]{%
\begin{figure}[ht] \begin{figure}[ht]%
\centering \centering%
\includegraphics{graphics/#1} #4{#1}%
\caption{#3} \caption{#3}%
\label{fig:#2} \label{fig:#2}%
\end{figure} \end{figure}%
}
\newcommand{\centerfig}[3]{\cfig{#1}{#2}{#3}{\includegraphics}}
\newcommand{\centerfigw}[4][\textwidth]{\cfig{#2}{#3}{#4}{\includegraphics[keepaspectratio,width=#1]}}
\newcommand{\bigfig}[4][1in]{%
\bigfloat[#1]{%
\captionsetup{type=figure}%
\includegraphics[keepaspectratio,width=\bfFigureWidth]{#2}%
\captionof{figure}{#4}%
\label{fig:#3}%
}%
} }
%#endregion %#endregion
@@ -154,7 +195,7 @@
% Glossary formatting. % Glossary formatting.
%#region %#region
\RequirePackage[nopostdot,toc,sort=standard]{glossaries} \RequirePackage[xindy,nopostdot,toc,sort=standard]{glossaries}
%#endregion %#endregion
% Index formatting. % Index formatting.
@@ -198,23 +239,37 @@
}[#1]% }[#1]%
} }
\RequirePackage[hypcap=true]{caption} \newcommand{\mfig}[5][0pt]{%
\newcommand{\marginfig}[4][0pt]{% % This strut ensures that the margin figure is counted as part of the
% following paragraph and is vertically aligned with it.
\strut%
\marginnote{% \marginnote{%
\captionsetup{% \captionsetup{%
type = figure,% type = figure,%
font = {color=marginTextColor},% font = {color=marginTextColor},%
}% }%
{\centering\includegraphics{graphics/#2}\par}% {\centering#5{#2}\par}%
\captionof{figure}{#4}\label{fig:#3}% \captionof{figure}{#4}%
\label{fig:#3}%
}[#1]% }[#1]%
} }
\newcommand{\marginfig}[4][0pt]{%
\mfig[#1]{#2}{#3}{#4}{\includegraphics}%
}
\newcommand{\marginfigw}[5][0pt]{%
\mfig[#1]{#2}{#3}{#4}{\includegraphics[keepaspectratio,width=#5]}%
}
%#endregion
% Use Hyperref to automatically create links in the document
%#region
\RequirePackage{hyperref}
\hypersetup{colorlinks=true, allcolors=PrimeBlue}
%#endregion %#endregion
% Define custom title page. % Define custom title page.
%#region %#region
\RequirePackage{calc} \newcommand{\PrimeTitlePage}[1]{
\newcommand{\PrimeTitlePage}{
\begin{titlepage} \begin{titlepage}
\begin{sffamily} \begin{sffamily}
{\raggedright\noindent\large {\raggedright\noindent\large
@@ -230,11 +285,11 @@
% Move the rule graphic to 0.25 in from the left edge of the % Move the rule graphic to 0.25 in from the left edge of the
% paper and vertically centered on the heartbeat graphic. % paper and vertically centered on the heartbeat graphic.
\put(-\oddsidemargin-0.75in,10pt){ \put(-\oddsidemargin-0.75in,10pt){
\includegraphics{graphics/title/prime_rule.pdf} \includegraphics{#1/prime_rule.pdf}
} }
% The numbers here are just what looks good. % The numbers here are just what looks good.
\put(100pt,0pt){ \put(100pt,0pt){
\includegraphics{graphics/title/prime_heartbeat.pdf} \includegraphics{#1/prime_heartbeat.pdf}
} }
} }