- Add VSCode fold regions.
- Change serif bold fonts from bold to semibold. - Change sans fonts from regular and bold to semibold and black. - Add margin footnote command and fix margin note placement. - Add macro for references and change label macro names from ref* to lbl*. - Add table label macro.
This commit is contained in:
101
PrimeManual.sty
101
PrimeManual.sty
@@ -1,17 +1,22 @@
|
|||||||
\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}
|
||||||
|
|
||||||
|
% Custom document properties.
|
||||||
|
%#region
|
||||||
\DeclareRobustCommand*{\customer}[1]{\gdef\@customer{#1}}
|
\DeclareRobustCommand*{\customer}[1]{\gdef\@customer{#1}}
|
||||||
\DeclareRobustCommand*{\customerFull}[1]{\gdef\@customerFull{#1}}
|
\DeclareRobustCommand*{\customerFull}[1]{\gdef\@customerFull{#1}}
|
||||||
\DeclareRobustCommand*{\projectNumber}[1]{\gdef\@projectNumber{#1}}
|
\DeclareRobustCommand*{\projectNumber}[1]{\gdef\@projectNumber{#1}}
|
||||||
\DeclareRobustCommand*{\projectDesc}[1]{\gdef\@projectDesc{#1}}
|
\DeclareRobustCommand*{\projectDesc}[1]{\gdef\@projectDesc{#1}}
|
||||||
\DeclareRobustCommand*{\version}[1]{\gdef\@version{#1}}
|
\DeclareRobustCommand*{\version}[1]{\gdef\@version{#1}}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
|
% Macros to insert document properties.
|
||||||
|
%#region
|
||||||
\newcommand{\sTitle}{\makeatletter{\@title}}
|
\newcommand{\sTitle}{\makeatletter{\@title}}
|
||||||
\newcommand{\sAuthor}{\makeatletter{\@author}}
|
\newcommand{\sAuthor}{\makeatletter{\@author}}
|
||||||
\newcommand{\sDate}{\makeatletter{\@date}}
|
\newcommand{\sDate}{\makeatletter{\@date}}
|
||||||
@@ -21,26 +26,26 @@
|
|||||||
\newcommand{\sProjectDesc}{\makeatletter{\@projectDesc}}
|
\newcommand{\sProjectDesc}{\makeatletter{\@projectDesc}}
|
||||||
\newcommand{\sProjectTitle}{\makeatletter{Project \@projectNumber : \@projectDesc}}
|
\newcommand{\sProjectTitle}{\makeatletter{Project \@projectNumber : \@projectDesc}}
|
||||||
\newcommand{\sVersion}{\makeatletter{\@version}}
|
\newcommand{\sVersion}{\makeatletter{\@version}}
|
||||||
|
%#endregion
|
||||||
%\RequirePackage[mark]{gitinfo2}
|
|
||||||
|
|
||||||
% Specify Fonts
|
% Specify Fonts
|
||||||
|
%#region
|
||||||
\RequirePackage{fontspec}
|
\RequirePackage{fontspec}
|
||||||
% Main font: Roboto Serif
|
% Main font: Roboto Serif
|
||||||
\setmainfont{RobotoSerif}[
|
\setmainfont{RobotoSerif}[
|
||||||
Path = ./fonts/RobotoSerif/,
|
Path = ./fonts/RobotoSerif/,
|
||||||
Extension = .ttf,
|
Extension = .ttf,
|
||||||
UprightFont = *-Regular,
|
UprightFont = *-Light,
|
||||||
BoldFont = *-Bold,
|
BoldFont = *-SemiBold,
|
||||||
ItalicFont = *-Italic,
|
ItalicFont = *-Italic,
|
||||||
BoldItalicFont = *-BoldItalic,
|
BoldItalicFont = *-SemiBoldItalic,
|
||||||
]
|
]
|
||||||
% Headings & Titles font: Roboto Slab
|
% Headings & Titles font: Roboto Slab
|
||||||
\setsansfont{RobotoSlab}[
|
\setsansfont{RobotoSlab}[
|
||||||
Path = ./fonts/RobotoSlab/,
|
Path = ./fonts/RobotoSlab/,
|
||||||
Extension = .ttf,
|
Extension = .ttf,
|
||||||
UprightFont = *-Regular,
|
UprightFont = *-SemiBold,
|
||||||
BoldFont = *-Bold,
|
BoldFont = *-Black,
|
||||||
]
|
]
|
||||||
% Monospace font: Roboto Mono
|
% Monospace font: Roboto Mono
|
||||||
\setmonofont{RobotoMono}[
|
\setmonofont{RobotoMono}[
|
||||||
@@ -51,29 +56,43 @@
|
|||||||
ItalicFont = *-Italic,
|
ItalicFont = *-Italic,
|
||||||
BoldItalicFont = *-BoldItalic,
|
BoldItalicFont = *-BoldItalic,
|
||||||
]
|
]
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Page Layout
|
% Page Layout
|
||||||
|
%#region
|
||||||
\RequirePackage[pass]{geometry}
|
\RequirePackage[pass]{geometry}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Title & Heading Options
|
% Title & Heading Options
|
||||||
|
%#region
|
||||||
\RequirePackage[sf,raggedright]{titlesec}
|
\RequirePackage[sf,raggedright]{titlesec}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Header & Footer Options
|
% Header & Footer Options
|
||||||
|
%#region
|
||||||
\pagestyle{plain}
|
\pagestyle{plain}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Color import and definition
|
% Color import and definition
|
||||||
|
%#region
|
||||||
\RequirePackage{xcolor}
|
\RequirePackage{xcolor}
|
||||||
\definecolor{PrimeBlue}{RGB}{25,45,145}
|
\definecolor{PrimeBlue}{RGB}{25,45,145}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Use Hyperref to automatically create links in the document
|
% Use Hyperref to automatically create links in the document
|
||||||
|
%#region
|
||||||
\RequirePackage{hyperref}
|
\RequirePackage{hyperref}
|
||||||
\hypersetup{colorlinks=true, allcolors=PrimeBlue}
|
\hypersetup{colorlinks=true, allcolors=PrimeBlue}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Graphics package for including images
|
% Graphics package for including images
|
||||||
|
%#region
|
||||||
\RequirePackage{graphicx}
|
\RequirePackage{graphicx}
|
||||||
\RequirePackage{calc}
|
\RequirePackage{calc}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Define custom title page.
|
% Define custom title page.
|
||||||
|
%#region
|
||||||
\newcommand{\PrimeTitlePage}{
|
\newcommand{\PrimeTitlePage}{
|
||||||
\begin{titlepage}
|
\begin{titlepage}
|
||||||
\begin{sffamily}
|
\begin{sffamily}
|
||||||
@@ -108,65 +127,95 @@
|
|||||||
\end{sffamily}
|
\end{sffamily}
|
||||||
\end{titlepage}
|
\end{titlepage}
|
||||||
}
|
}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Paragraph formatting.
|
% Paragraph formatting.
|
||||||
|
%#region
|
||||||
\setlength{\parindent}{0pt}
|
\setlength{\parindent}{0pt}
|
||||||
\setlength{\parskip}{2ex plus 0.5ex minus 0.5ex}
|
\setlength{\parskip}{2ex plus 0.5ex minus 0.5ex}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Table formatting.
|
% Table formatting.
|
||||||
|
%#region
|
||||||
\renewcommand{\arraystretch}{1.5}
|
\renewcommand{\arraystretch}{1.5}
|
||||||
\RequirePackage{csvsimple}
|
\RequirePackage{csvsimple}
|
||||||
\RequirePackage{longtable}
|
\RequirePackage{longtable}
|
||||||
\RequirePackage{colortbl}
|
\RequirePackage{colortbl}
|
||||||
\RequirePackage{booktabs}
|
\RequirePackage{booktabs}
|
||||||
|
|
||||||
|
\newcommand{\bandedrows}{\rowcolors{2}{white}{gray!10}}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Glossary formatting.
|
% Glossary formatting.
|
||||||
|
%#region
|
||||||
\RequirePackage[nopostdot,toc,sort=standard]{glossaries}
|
\RequirePackage[nopostdot,toc,sort=standard]{glossaries}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Index formatting.
|
% Index formatting.
|
||||||
|
%#region
|
||||||
\RequirePackage{makeidx}
|
\RequirePackage{makeidx}
|
||||||
\RequirePackage{xstring}
|
\RequirePackage{xstring}
|
||||||
\newcommand{\idx}[1]{\StrSubstitute{#1}{!}{ }\index{#1}}
|
\newcommand{\idx}[1]{\StrSubstitute{#1}{!}{ }\index{#1}}
|
||||||
|
%#endregion
|
||||||
|
|
||||||
% Margin Note formatting.
|
% Margin Note formatting.
|
||||||
|
%#region
|
||||||
\RequirePackage{marginnote}
|
\RequirePackage{marginnote}
|
||||||
% -38pt seems to be just the right vertical adjustment to align margin notes
|
% -38pt seems to be just the right vertical adjustment to align margin notes
|
||||||
% with the reference in the text.
|
% with the reference in the text.
|
||||||
\renewcommand{\marginnotevadjust}{-38pt}
|
%\renewcommand{\marginnotevadjust}{-38pt}
|
||||||
\renewcommand{\marginfont}{\small\color{PrimeBlue}}
|
\renewcommand{\marginfont}{\small\color{PrimeBlue}}
|
||||||
|
|
||||||
|
% Title formatting for margin notes.
|
||||||
\newcommand{\margintitle}[1]{\paragraph{\textbf{#1}}}
|
\newcommand{\margintitle}[1]{\paragraph{\textbf{#1}}}
|
||||||
|
|
||||||
|
% Put a glossary definition in a margin note.
|
||||||
|
% Optional parameter is vertical adjustment of the note.
|
||||||
\newcommand{\margindef}[2][0pt]{%
|
\newcommand{\margindef}[2][0pt]{%
|
||||||
\index{\glsentryname{#2}}% Add a reference to this in the index.
|
\index{\glsentryname{#2}}% Add a reference to this in the index.
|
||||||
\textbf{\gls{#2}}% This is the text that appears on the page.
|
\textbf{\gls{#2}}% This is the text that appears on the page.
|
||||||
\marginnote{% Create the margin note.
|
\marginnote{% Create the margin note.
|
||||||
\margintitle{\Glsentryname{#2}:% Create the title of the margin note.
|
\textsf{\textbf{
|
||||||
} \glsdesc*{#2}}[#1]% Create the text of the margin note.
|
\Glsentryname{#2}:% Create the title of the margin note.
|
||||||
|
}}
|
||||||
|
\glsdesc*{#2}}[#1]% Create the text of the margin note.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
% 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
|
% Cross references
|
||||||
\newcommand{\refGeneral}[3][]{
|
%#region
|
||||||
|
\newcommand{\sectionRef}[3][]{#1 \ref{#2:#3}: #3}
|
||||||
|
|
||||||
|
\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.
|
||||||
#3{#2}\label{ch:#2}
|
#3{#2}\label{#4:#2}
|
||||||
\else
|
\else
|
||||||
#3{#2}\label{ch:#1}
|
#3{#2}\label{#4:#1}
|
||||||
\fi
|
\fi
|
||||||
}
|
}
|
||||||
\newcommand{\refChapter}[2][]{
|
\newcommand{\lblChapter}[2][]{
|
||||||
\refGeneral[#1]{#2}{\chapter}
|
\lblGeneral[#1]{#2}{\chapter}{ch}
|
||||||
}
|
}
|
||||||
\newcommand{\refSection}[2][]{
|
\newcommand{\lblSection}[2][]{
|
||||||
\refGeneral[#1]{#2}{\section}
|
\lblGeneral[#1]{#2}{\section}{sec}
|
||||||
}
|
}
|
||||||
\newcommand{\refSubsection}[2][]{
|
\newcommand{\lblSubsection}[2][]{
|
||||||
\refGeneral[#1]{#2}{\subsection}
|
\lblGeneral[#1]{#2}{\subsection}{subsec}
|
||||||
}
|
}
|
||||||
\newcommand{\refSubsubsection}[2][]{
|
\newcommand{\lblSubsubsection}[2][]{
|
||||||
\refGeneral[#1]{#2}{\subsubsection}
|
\lblGeneral[#1]{#2}{\subsubsection}{sssec}
|
||||||
}
|
}
|
||||||
\newcommand{\refParagraph}[2][]{
|
\newcommand{\lblParagraph}[2][]{
|
||||||
\refGeneral[#1]{#2}{\paragraph}
|
\lblGeneral[#1]{#2}{\paragraph}{par}
|
||||||
}
|
}
|
||||||
\newcommand{\refSubparagraph}[2][]{
|
\newcommand{\lblSubparagraph}[2][]{
|
||||||
\refGeneral[#1]{#2}{\subparagraph}
|
\lblGeneral[#1]{#2}{\subparagraph}{subpar}
|
||||||
}
|
}
|
||||||
|
\newcommand{\lblTable}[2][]{
|
||||||
|
\textbf{\lblGeneral[#1]{#2}{\caption}{tbl}}
|
||||||
|
}
|
||||||
|
%#endregion
|
||||||
Reference in New Issue
Block a user