From 0eaf395e0e1a089b712bf3959d718a5bb300b5b7 Mon Sep 17 00:00:00 2001 From: Joshua Lucas Date: Fri, 1 Aug 2025 17:27:40 -0500 Subject: [PATCH] - Replace MarginNote package with Marginalia. - Miscellaneous cleanup. --- Fonts.sty | 1 + Graphics.sty | 28 ++++++++++++++++++ Layout.sty | 17 ++++++----- Manual.cls | 2 +- MarginNotes.sty | 77 ------------------------------------------------- Marginalia.sty | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 116 insertions(+), 85 deletions(-) delete mode 100644 MarginNotes.sty create mode 100644 Marginalia.sty diff --git a/Fonts.sty b/Fonts.sty index a3e45c9..961d78d 100644 --- a/Fonts.sty +++ b/Fonts.sty @@ -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}}}} \ No newline at end of file diff --git a/Graphics.sty b/Graphics.sty index 1dd4c4b..5242550 100644 --- a/Graphics.sty +++ b/Graphics.sty @@ -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% diff --git a/Layout.sty b/Layout.sty index dddc2ff..43f4d9f 100644 --- a/Layout.sty +++ b/Layout.sty @@ -22,20 +22,18 @@ \RequirePackage{calc} \RequirePackage[strict]{changepage} -% \RequirePackage{caption} -% \RequirePackage{graphicx} -% \RequirePackage{PrimeTeX/Tables} \newlength{\contentwidth} \setlength{\contentwidth}{\textwidth + \marginparsep + \marginparwidth} % Header & Footer Options - \pagestyle{plain} +\pagestyle{plain} % Paragraph formatting. - \setlength{\parindent}{0pt} - \setlength{\parskip}{2ex plus 0.5ex minus 0.5ex} +\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}% diff --git a/Manual.cls b/Manual.cls index 29fd5e9..44474e7 100644 --- a/Manual.cls +++ b/Manual.cls @@ -44,7 +44,7 @@ \RequirePackage{PrimeTeX/Links} -\RequirePackage{PrimeTeX/MarginNotes} +\RequirePackage{PrimeTeX/Marginalia} \RequirePackage{PrimeTeX/Tables} diff --git a/MarginNotes.sty b/MarginNotes.sty deleted file mode 100644 index ed824c7..0000000 --- a/MarginNotes.sty +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Marginalia.sty b/Marginalia.sty new file mode 100644 index 0000000..2a2967a --- /dev/null +++ b/Marginalia.sty @@ -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}% + }% +} \ No newline at end of file