- Add VSCode fold regions.

- Add margin footnote macro.
- Fix margin note vertical offset.
This commit is contained in:
Silcantar
2025-07-06 20:25:49 -05:00
parent ad30cc2a41
commit 7230d1a842

View File

@@ -1,184 +1,224 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{latex-templates/PrimeManual}[2025-06-24] \ProvidesPackage{latex-templates/PrimeManual}[2025-06-24]
%
% Suppress warning about \showhyphens being changed. % Suppress warning about \showhyphens being changed.
\let\CheckCommand\providecommand \let\CheckCommand\providecommand
\RequirePackage{microtype} \RequirePackage{microtype}
\DeclareRobustCommand*{\customer}[1]{\gdef\@customer{#1}} % Custom document properties.
\DeclareRobustCommand*{\customerFull}[1]{\gdef\@customerFull{#1}} %#region
\DeclareRobustCommand*{\projectNumber}[1]{\gdef\@projectNumber{#1}} \DeclareRobustCommand*{\customer}[1]{\gdef\@customer{#1}}
\DeclareRobustCommand*{\projectDesc}[1]{\gdef\@projectDesc{#1}} \DeclareRobustCommand*{\customerFull}[1]{\gdef\@customerFull{#1}}
\DeclareRobustCommand*{\version}[1]{\gdef\@version{#1}} \DeclareRobustCommand*{\projectNumber}[1]{\gdef\@projectNumber{#1}}
\DeclareRobustCommand*{\projectDesc}[1]{\gdef\@projectDesc{#1}}
\newcommand{\sTitle}{\makeatletter{\@title}} \DeclareRobustCommand*{\version}[1]{\gdef\@version{#1}}
\newcommand{\sAuthor}{\makeatletter{\@author}} %#endregion
\newcommand{\sDate}{\makeatletter{\@date}}
\newcommand{\sCustomer}{\makeatletter{\@customer}} % Macros to insert document properties.
\newcommand{\sCustomerFull}{\makeatletter{\@customerFull}} %#region
\newcommand{\sProjectNumber}{\makeatletter{\@projectNumber}} \newcommand{\sTitle}{\makeatletter{\@title}}
\newcommand{\sProjectDesc}{\makeatletter{\@projectDesc}} \newcommand{\sAuthor}{\makeatletter{\@author}}
\newcommand{\sProjectTitle}{\makeatletter{Project \@projectNumber : \@projectDesc}} \newcommand{\sDate}{\makeatletter{\@date}}
\newcommand{\sVersion}{\makeatletter{\@version}} \newcommand{\sCustomer}{\makeatletter{\@customer}}
\newcommand{\sCustomerFull}{\makeatletter{\@customerFull}}
%\RequirePackage[mark]{gitinfo2} \newcommand{\sProjectNumber}{\makeatletter{\@projectNumber}}
\newcommand{\sProjectDesc}{\makeatletter{\@projectDesc}}
% Specify Fonts \newcommand{\sProjectTitle}{\makeatletter{Project \@projectNumber : \@projectDesc}}
%#region \newcommand{\sVersion}{\makeatletter{\@version}}
\RequirePackage{fontspec} %#endregion
% Main font: Roboto Serif
\setmainfont{RobotoSerif}[ % Specify Fonts
Path = ./fonts/RobotoSerif/, %#region
Extension = .ttf, \RequirePackage{fontspec}
UprightFont = *-Light, % Main font: Roboto Serif
BoldFont = *-SemiBold, \setmainfont{RobotoSerif}[
ItalicFont = *-LightItalic, Path = ./fonts/RobotoSerif/,
BoldItalicFont = *-SemiBoldItalic, Extension = .ttf,
] UprightFont = *-Light,
% Headings & Titles font: Roboto Slab BoldFont = *-SemiBold,
\setsansfont{RobotoSlab}[ ItalicFont = *-LightItalic,
Path = ./fonts/RobotoSlab/, BoldItalicFont = *-SemiBoldItalic,
Extension = .ttf, ]
UprightFont = *-SemiBold, % Headings & Titles font: Roboto Slab
BoldFont = *-Black, \setsansfont{RobotoSlab}[
] Path = ./fonts/RobotoSlab/,
% Monospace font: Roboto Mono Extension = .ttf,
\setmonofont{RobotoMono}[ UprightFont = *-SemiBold,
Path = ./fonts/RobotoMono/, BoldFont = *-Black,
Extension = .ttf, ]
UprightFont = *-Regular, % Monospace font: Roboto Mono
BoldFont = *-Bold, \setmonofont{RobotoMono}[
ItalicFont = *-Italic, Path = ./fonts/RobotoMono/,
BoldItalicFont = *-BoldItalic, Extension = .ttf,
] UprightFont = *-Regular,
%#endregion BoldFont = *-Bold,
ItalicFont = *-Italic,
% Page Layout BoldItalicFont = *-BoldItalic,
\RequirePackage[pass]{geometry} ]
%#endregion
% Title & Heading Options
\RequirePackage[sf,raggedright]{titlesec} % Page Layout
%#region
% Header & Footer Options \RequirePackage[pass]{geometry}
\pagestyle{plain} %#endregion
% Color import and definition % Title & Heading Options
\RequirePackage{xcolor} %#region
\definecolor{PrimeBlue}{RGB}{25,45,145} \RequirePackage[sf,raggedright]{titlesec}
%#endregion
% Use Hyperref to automatically create links in the document
\RequirePackage{hyperref} % Header & Footer Options
\hypersetup{colorlinks=true, allcolors=PrimeBlue} %#region
\pagestyle{plain}
% Graphics package for including images %#endregion
\RequirePackage{graphicx}
\RequirePackage{calc} % Color import and definition
%#region
% Define custom title page. \RequirePackage{xcolor}
\newcommand{\PrimeTitlePage}{ \definecolor{PrimeBlue}{RGB}{25,45,145}
\begin{titlepage} %#endregion
\begin{sffamily}
{\raggedright\noindent\large % Use Hyperref to automatically create links in the document
\vspace*{\stretch{1}} %#region
\RequirePackage{hyperref}
\sCustomerFull \hypersetup{colorlinks=true, allcolors=PrimeBlue}
\medbreak %#endregion
\sProjectTitle
\bigbreak % Graphics package for including images
{\Huge \sTitle} %#region
\vfill \RequirePackage{graphicx}
{\leavevmode \RequirePackage{calc}
% Move the rule graphic to 0.25 in from the left edge of the %#endregion
% paper and vertically centered on the heartbeat graphic.
\put(-\oddsidemargin-0.75in,10pt){ % Define custom title page.
\includegraphics{graphics/prime_rule.pdf} %#region
} \newcommand{\PrimeTitlePage}{
% The numbers here are just what looks good. \begin{titlepage}
\put(100pt,0pt){ \begin{sffamily}
\includegraphics{graphics/prime_heartbeat.pdf} {\raggedright\noindent\large
} \vspace*{\stretch{1}}
}
\sCustomerFull
\sAuthor \medbreak
\sProjectTitle
Revision \sVersion \bigbreak
{\Huge \sTitle}
\sDate \vfill
\vfill {\leavevmode
} % Move the rule graphic to 0.25 in from the left edge of the
\end{sffamily} % paper and vertically centered on the heartbeat graphic.
\end{titlepage} \put(-\oddsidemargin-0.75in,10pt){
} \includegraphics{graphics/prime_rule.pdf}
}
% Paragraph formatting. % The numbers here are just what looks good.
\setlength{\parindent}{0pt} \put(100pt,0pt){
\setlength{\parskip}{2ex plus 0.5ex minus 0.5ex} \includegraphics{graphics/prime_heartbeat.pdf}
}
% Table formatting. }
\renewcommand{\arraystretch}{1.5}
\RequirePackage{csvsimple} \sAuthor
\RequirePackage{longtable}
\RequirePackage{colortbl} Revision \sVersion
\RequirePackage{booktabs}
\sDate
% Glossary formatting. \vfill
\RequirePackage[nopostdot,toc,sort=standard]{glossaries} }
\end{sffamily}
% Index formatting. \end{titlepage}
\RequirePackage{makeidx} }
\RequirePackage{xstring} %#endregion
\newcommand{\idx}[1]{\StrSubstitute{#1}{!}{ }\index{#1}}
% Paragraph formatting.
% Margin Note formatting. %#region
\RequirePackage{marginnote} \setlength{\parindent}{0pt}
% -38pt seems to be just the right vertical adjustment to align margin notes \setlength{\parskip}{2ex plus 0.5ex minus 0.5ex}
% with the reference in the text. %#endregion
\renewcommand{\marginnotevadjust}{-38pt}
\renewcommand{\marginfont}{\small\color{PrimeBlue}} % Table formatting.
%#region
\newcommand{\margintitle}[1]{\paragraph{\textbf{#1}}} \renewcommand{\arraystretch}{1.5}
\newcommand{\margindef}[2][0pt]{% \RequirePackage{csvsimple}
\index{\glsentryname{#2}}% Add a reference to this in the index. \RequirePackage{longtable}
\textbf{\gls{#2}}% This is the text that appears on the page. \RequirePackage{colortbl}
\marginnote{% Create the margin note. \RequirePackage{booktabs}
\margintitle{\Glsentryname{#2}:% Create the title of the margin note.
} \glsdesc*{#2}}[#1]% Create the text of the margin note. \newcommand{\bandedrows}{\rowcolors{2}{white}{gray!10}}
} %#endregion
% Cross references % Glossary formatting.
%#region %#region
\newcommand{\sectionRef}[3][]{#1 \ref{#2:#3}: #3} \RequirePackage[nopostdot,toc,sort=standard]{glossaries}
%#endregion
\newcommand{\lblGeneral}[4][]{
\if\relax\detokenize{#1}\relax % Check if #1 is empty string. % Index formatting.
#3{#2}\label{#4:#2} %#region
\else \RequirePackage{makeidx}
#3{#2}\label{#4:#1} \RequirePackage{xstring}
\fi \newcommand{\idx}[1]{\StrSubstitute{#1}{!}{ }\index{#1}}
} %#endregion
\newcommand{\lblChapter}[2][]{
\lblGeneral[#1]{#2}{\chapter}{ch} % Margin Note formatting.
} %#region
\newcommand{\lblSection}[2][]{ \RequirePackage{marginnote}
\lblGeneral[#1]{#2}{\section}{sec} % -38pt seems to be just the right vertical adjustment to align margin notes
} % with the reference in the text.
\newcommand{\lblSubsection}[2][]{ %\renewcommand{\marginnotevadjust}{-38pt}
\lblGeneral[#1]{#2}{\subsection}{subsec} \renewcommand{\marginfont}{\small\color{PrimeBlue}}
}
\newcommand{\lblSubsubsection}[2][]{ % Title formatting for margin notes.
\lblGeneral[#1]{#2}{\subsubsection}{sssec} \newcommand{\margintitle}[1]{\paragraph{\textbf{#1}}}
}
\newcommand{\lblParagraph}[2][]{ % Put a glossary definition in a margin note.
\lblGeneral[#1]{#2}{\paragraph}{par} % Optional parameter is vertical adjustment of the note.
} \newcommand{\margindef}[2][0pt]{%
\newcommand{\lblSubparagraph}[2][]{ \index{\glsentryname{#2}}% Add a reference to this in the index.
\lblGeneral[#1]{#2}{\subparagraph}{subpar} \textbf{\gls{#2}}% This is the text that appears on the page.
} \marginnote{% Create the margin note.
\newcommand{\lblTable}[2][]{ \textsf{\textbf{
\textbf{\lblGeneral[#1]{#2}{\caption}{tbl}} \Glsentryname{#2}:% Create the title of the margin note.
} }}
\newcommand{\lblFigure}[2][]{ \glsdesc*{#2}}[#1]% Create the text of the margin note.
\textbf{\lblGeneral[#1]{#2}{\caption}{fig}} }
}
% 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]}
%#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}}
}
\newcommand{\lblFigure}[2][]{
\textbf{\lblGeneral[#1]{#2}{\caption}{fig}}
}
%#endregion %#endregion