- Minor restructuring of PrimeManual.sty.

- Improvements to margin note formatting.
- Add CenterFig macro.
This commit is contained in:
Silcantar
2025-07-08 22:48:32 -05:00
parent 5871ec80da
commit 69501ce6b7

View File

@@ -85,18 +85,135 @@
\hypersetup{colorlinks=true, allcolors=PrimeBlue}
%#endregion
% Cross references
%#region
%\newcommand{\sectionRef}[2]{\ref{#1:#2}: #2}
\newcommand{\lblGeneral}[4][]{
\if\relax\detokenize{#1}\relax % Check if #1 is empty string.
#3{#2}\label{#4:#2}
\else
#3{#2}\label{#4:#1}
\fi
}
\newcommand{\lblChapter}[2][]{
\lblGeneral[#1]{#2}{\chapter}{ch}
}
\newcommand{\lblSection}[2][]{
\lblGeneral[#1]{#2}{\section}{sec}
}
\newcommand{\lblSubsection}[2][]{
\lblGeneral[#1]{#2}{\subsection}{subsec}
}
\newcommand{\lblSubsubsection}[2][]{
\lblGeneral[#1]{#2}{\subsubsection}{sssec}
}
\newcommand{\lblParagraph}[2][]{
\lblGeneral[#1]{#2}{\paragraph}{par}
}
\newcommand{\lblSubparagraph}[2][]{
\lblGeneral[#1]{#2}{\subparagraph}{subpar}
}
\newcommand{\lblTable}[2][]{
\textbf{\lblGeneral[#1]{#2}{\caption}{tbl}}
}
\newcommand{\lblFigure}[2][]{
\textbf{\lblGeneral[#1]{#2}{\caption}{fig}}
}
%#endregion
% Graphics package for including images
%#region
\RequirePackage{graphicx}
\RequirePackage{calc}
\newcommand{\ig}[2][0.5in]{
\includegraphics[keepaspectratio,width=#1]{graphics/#2}
}
\newcommand{\centerfig}[3]{
\begin{figure}[ht]
\centering
\includegraphics{graphics/#1}
\caption{#3}
\label{fig:#2}
\end{figure}
}
%#endregion
% Paragraph formatting.
%#region
\setlength{\parindent}{0pt}
\setlength{\parskip}{2ex plus 0.5ex minus 0.5ex}
%#endregion
% Table formatting.
%#region
\RequirePackage{tabularray}
\RequirePackage{csvsimple-l3}
%#endregion
% Glossary formatting.
%#region
\RequirePackage[nopostdot,toc,sort=standard]{glossaries}
%#endregion
% Index formatting.
%#region
\RequirePackage{makeidx}
\RequirePackage{xstring}
\newcommand{\idx}[1]{\StrSubstitute{#1}{!}{ }\index{#1}}
%#endregion
% Margin Note formatting.
%#region
\RequirePackage{marginnote}
\colorlet{marginTextColor}{PrimeBlue}
\renewcommand{\marginfont}{\small\color{marginTextColor}}
% Put a glossary definition in a margin note.
% Optional parameter is vertical adjustment of the note.
\newcommand{\mdef}[3][0pt]{%
\index{\glsentryname{#2}}% Add a reference to this in the index.
\textbf{#3{#2}}% This is the text that appears on the page.
\marginnote{% Create the margin note.
\textsf{\textbf{%
\Glsentryname{#2}:% Create the title of the margin note.
}}%
\glsdesc*{#2}% Create the text of the margin note.
}[#1]%
}
\newcommand{\margindef}[2][0pt]{%
\mdef[#1]{#2}{\gls}%
}
\newcommand{\Margindef}[2][0pt]{%
\mdef[#1]{#2}{\Gls}%
}
% Put a footnote in a margin note.
% Optional parameter is vertical adjustment of the note.
\newcommand{\mnote}[2][0pt]{%
\footnotemark%
\marginnote{%
\footnotemark[\value{footnote}]#2%
}[#1]%
}
\RequirePackage[hypcap=true]{caption}
\newcommand{\marginfig}[4][0pt]{%
\marginnote{%
\captionsetup{%
type = figure,%
font = {color=marginTextColor},%
}%
{\centering\includegraphics{graphics/#2}\par}%
\captionof{figure}{#4}\label{fig:#3}%
}[#1]%
}
%#endregion
% Define custom title page.
%#region
\RequirePackage{calc}
\newcommand{\PrimeTitlePage}{
\begin{titlepage}
\begin{sffamily}
@@ -131,103 +248,4 @@
\end{sffamily}
\end{titlepage}
}
%#endregion
% Paragraph formatting.
%#region
\setlength{\parindent}{0pt}
\setlength{\parskip}{2ex plus 0.5ex minus 0.5ex}
%#endregion
% Table formatting.
%#region
\RequirePackage{tabularray}
\RequirePackage{csvsimple-l3}
%#endregion
% Glossary formatting.
%#region
\RequirePackage[nopostdot,toc,sort=standard]{glossaries}
%#endregion
% Index formatting.
%#region
\RequirePackage{makeidx}
\RequirePackage{xstring}
\newcommand{\idx}[1]{\StrSubstitute{#1}{!}{ }\index{#1}}
%#endregion
% Margin Note formatting.
%#region
\RequirePackage{marginnote}
\renewcommand{\marginfont}{\small\color{PrimeBlue}}
% Put a glossary definition in a margin note.
% Optional parameter is vertical adjustment of the note.
\newcommand{\margindef}[2][0pt]{%
\index{\glsentryname{#2}}% Add a reference to this in the index.
\textbf{\gls{#2}}% This is the text that appears on the page.
\marginnote{% Create the margin note.
\textsf{\textbf{
\Glsentryname{#2}:% Create the title of the margin note.
}}
\glsdesc*{#2}% Create the text of the margin note.
}[#1]%
}
% Put a footnote in a margin note.
% Optional parameter is vertical adjustment of the note.
\newcommand{\mnote}[2][0pt]{%
\footnotemark
\marginnote{
\footnotemark[\value{footnote}]#2
}[#1]
}
\RequirePackage[hypcap=true]{caption}
\newcommand{\marginfig}[3][0pt]{%
\marginnote{%
\captionsetup{type=figure}%
{\centering\includegraphics{graphics/#2}\par}%
\captionof{figure}{#3}\label{fig:#3}%
}[#1]
}
%#endregion
% Cross references
%#region
\newcommand{\sectionRef}[3][]{#1 \ref{#2:#3}: #3}
\newcommand{\lblGeneral}[4][]{
\if\relax\detokenize{#1}\relax % Check if #1 is empty string.
#3{#2}\label{#4:#2}
\else
#3{#2}\label{#4:#1}
\fi
}
\newcommand{\lblChapter}[2][]{
\lblGeneral[#1]{#2}{\chapter}{ch}
}
\newcommand{\lblSection}[2][]{
\lblGeneral[#1]{#2}{\section}{sec}
}
\newcommand{\lblSubsection}[2][]{
\lblGeneral[#1]{#2}{\subsection}{subsec}
}
\newcommand{\lblSubsubsection}[2][]{
\lblGeneral[#1]{#2}{\subsubsection}{sssec}
}
\newcommand{\lblParagraph}[2][]{
\lblGeneral[#1]{#2}{\paragraph}{par}
}
\newcommand{\lblSubparagraph}[2][]{
\lblGeneral[#1]{#2}{\subparagraph}{subpar}
}
\newcommand{\lblTable}[2][]{
\textbf{\lblGeneral[#1]{#2}{\caption}{tbl}}
\smallskip
}
\newcommand{\lblFigure}[2][]{
\textbf{\lblGeneral[#1]{#2}{\caption}{fig}}
}
%#endregion