- Replace MarginNote package with Marginalia.

- Miscellaneous cleanup.
This commit is contained in:
2025-08-01 17:27:40 -05:00
parent 9ee80bbd77
commit 0eaf395e0e
6 changed files with 116 additions and 85 deletions

View File

@@ -48,5 +48,6 @@
\newcommand{\sans}[1]{\textsf{#1}}
\newcommand{\mono}[1]{\texttt{#1}}
\newcommand{\slab}[1]{{\sbfamily{}#1}}
\newcommand{\code}[1]{\mono{\small{}#1}}
\newcommand{\objref}[1]{{\sans{\strong{#1}}}}

View File

@@ -17,6 +17,19 @@
},
}
% Define a justification style that is ragged on the side toward the outside of
% the page. I. e.
\RequirePackage{changepage}
%\RequirePackage{ifthen}
\DeclareCaptionJustification{raggedoutside}{
\checkoddpage
\ifoddpage
\raggedright
\else
\raggedleft
\fi
}
\RequirePackage{calc}
\RequirePackage{wrapfig2}
@@ -63,6 +76,21 @@
}
\newcommand{\wrapfig}[6][0in]{%
% Syntax:
% \wrapfig[
% horizontal_offset
% ]{
% graphic_file
% }{
% alignment [l,r,i,o]
% }{
% (width|height)=lengthvalue
% }{
% label
% }{
% caption
% }
%
\begin{wrapfigure}{#3}[#1]%
\captionsetup{type=figure}%
\capstart%

View File

@@ -22,9 +22,6 @@
\RequirePackage{calc}
\RequirePackage[strict]{changepage}
% \RequirePackage{caption}
% \RequirePackage{graphicx}
% \RequirePackage{PrimeTeX/Tables}
\newlength{\contentwidth}
\setlength{\contentwidth}{\textwidth + \marginparsep + \marginparwidth}
@@ -36,6 +33,7 @@
\setlength{\parindent}{0pt}
\setlength{\parskip}{2ex plus 0.5ex minus 0.5ex}
% Float Page Configuration
\renewcommand{\topfraction}{0.9} % max fraction of floats at top
\renewcommand{\bottomfraction}{0.8} % max fraction of floats at bottom
% Parameters for TEXT pages (not float pages):
@@ -50,6 +48,11 @@
% N.B.: floatpagefraction MUST be less than topfraction !!
\renewcommand{\dblfloatpagefraction}{0.7} % require fuller float pages
% Line-breaking zero-width space
\newcommand{\zws}{\hspace{0pt}}
% Line-breaking dot
\newcommand{\bdot}{.\hspace{0pt}}
\newlength{\bigfloatoffset}
\setlength{\bigfloatoffset}{0.25in}
@@ -73,7 +76,7 @@
\newcommand{\boxout}[4][\bigfloatoverhang]{%
\bigfloat[#1]{figure}{#2}{%
\fcolorbox{PrimeBlue}{PrimePaleBlue}{%
\begin{minipage}{\textwidth}%
\begin{minipage}{\boxoutpadding*-2 + \textwidth}%
\vspace{\boxoutpadding}%
{\centering%
\begin{minipage}{\boxoutpadding*-2 + \textwidth}%

View File

@@ -44,7 +44,7 @@
\RequirePackage{PrimeTeX/Links}
\RequirePackage{PrimeTeX/MarginNotes}
\RequirePackage{PrimeTeX/Marginalia}
\RequirePackage{PrimeTeX/Tables}

View File

@@ -1,77 +0,0 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/MarginNotes}[2025-07-09]
% Margin Note formatting.
\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.
{\sbfamily\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{changepage}
\RequirePackage{ifthen}
\newcommand{\marginfig}[5][0pt]{%
% Syntax:
% \marginfig[
% vertical_offset
% ]{
% graphic_file_name
% }{
% (width|height)=lengthvalue
% }{
% label
% }{
% caption
% }
%
% This strut ensures that the margin figure is counted as part of the
% following paragraph and is vertically aligned with it.
\strut%
\marginnote{%
\checkoddpage%
\ifthenelse{\boolean{oddpage}}{%
\captionsetup{%
type = figure,%
font = {small,color=marginTextColor},%
justification = centering,%raggedright,%
}%
}{%
\captionsetup{%
type = figure,%
font = {small,color=marginTextColor},%
justification = centering,%raggedleft,%
}%
}%
{\centering\includegraphics[keepaspectratio,#3]{#2}\par}%
\captionof{figure}{#5}%
\label{fig:#4}%
}[#1]%
}
%#endregion

76
Marginalia.sty Normal file
View File

@@ -0,0 +1,76 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/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}%
}%
}