Files
PrimeTeX/packages/Marginalia.sty
Silcantar 21d5f5d0ea - Move packages to subfolder.
- Add Prime Controls graphics to this repo.
- Expand readme.
2025-08-01 22:54:37 -05:00

76 lines
1.7 KiB
TeX

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Marginalia}[2025-07-09]
% Marginalia formatting.
\colorlet{marginTextColor}{PrimeBlue}
\RequirePackage{marginalia}
\marginaliasetup{
ysep = {\parskip},
ysep page bottom = {
- 1in
+ \paperheight
- \voffset
- \topmargin
- \textheight
},
style recto outer = {\raggedright\small\color{marginTextColor}},
style verso outer = {\raggedleft\small\color{marginTextColor}},
}
% Put a glossary definition in a margin paragraph.
\newcommand{\mdef}[2]{%
\index{\glsentryname{#1}}% Add a reference to this in the index.
\strong{#2{#1}}% This is the text that appears on the page.
\marginalia{%
\slab{\strong{\Glsentryname{#1}:}} % Create the title of the margin note.
\glsdesc*{#1}% Create the text of the margin note.
}%
}
\newcommand{\margindef}[1]{%
\mdef{#1}{\gls}%
}
\newcommand{\Margindef}[1]{%
\mdef{#1}{\Gls}%
}
\newcommand{\margindefpl}[1]{%
\mdef{#1}{\glspl}%
}
\newcommand{\Margindefpl}[1]{%
\mdef{#1}{\Glspl}%
}
% Put a footnote in a margin paragraph.
\newcommand{\mnote}[1]{%
\footnotemark%
\marginalia{%
\footnotemark[\value{footnote}]#1%
}%
}
\newcommand{\marginfig}[4][]{%
% Syntax:
% \marginfig[
% (width|height)=lengthvalue, or any other optional \includegraphics
% parameters
% ]{
% graphic_file_name
% }{
% label
% }{
% caption
% }
%
% This strut ensures that the margin figure is counted as part of the
% following paragraph and is vertically aligned with it.
\strut%
\marginalia{%
\captionsetup{%
type = figure,%
%justification = raggedoutside,
}%
\centering\includegraphics[keepaspectratio,#1]{#2}\par%
\captionof{figure}{#4}%
\label{fig:#3}%
}%
}