- Debugging.

- Move all \RequirePackages to commonincludes.def.
This commit is contained in:
2025-09-12 16:15:29 -05:00
parent 0e68ac723d
commit 029916b8d6
19 changed files with 209 additions and 243 deletions

View File

@@ -1,13 +1,13 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Marginalia}[2025-07-09]
\ProvidesExplPackage{PrimeTeX/packages/Marginalia}{2025-09-12}{1.0}{
Marginalia commands.
}
% Allow hyphenation in narrow margin paragraphs.
\RequirePackage{ragged2e}
\RequirePackage{marginalia}
\marginaliasetup{
width = {\marginparwidth},
xsep = {\marginparsep},
ysep = {\parskip},
ysep page bottom = {
ysep~page~bottom = {
- 1in % Top gutter
+ \paperheight
- \voffset
@@ -17,8 +17,8 @@
- \textheight
},
yshift = {7pt}, % Just a magic number that lines up margin notes with their reference.
style recto outer = {\RaggedRight\small\color{marginText}},
style verso outer = {\RaggedLeft\small\color{marginText}},
style~recto~outer = {\RaggedRight\small\color{marginText}},
style~verso~outer = {\RaggedLeft\small\color{marginText}},
}
\NewDocumentCommand{\MarginHyperSetup}{}{
@@ -30,30 +30,30 @@
}
% Put a glossary definition in a margin paragraph.
\NewDocumentCommand{\mdef}{O{} m m}{%
\NewDocumentCommand{\@MarginDef}{O{} m m}{%
\index{\glsentryname{#2}}% Add a reference to this in the index.
\strong{#3{#2}}% This is the text that appears on the page.
\marginalia[#1]{%
\MarginHyperSetup%
\strong{\Glsentryname{#2}:} % Create the title of the margin note.
\glsdesc*{#2}% Create the text of the margin note.
\strong{\Glsentryname{#2}:}% Create the title of the margin note.
\enspace\glsdesc*{#2}% Create the text of the margin note.
}%
}
\NewDocumentCommand{\margindef}{O{} m}{%
\mdef[#1]{#2}{\gls}%
\NewDocumentCommand{\MarginDef}{O{} m}{%
\@MarginDef[#1]{#2}{\gls}%
}
\NewDocumentCommand{\Margindef}{O{} m}{%
\mdef[#1]{#2}{\Gls}%
\NewDocumentCommand{\MarginDefCap}{O{} m}{%
\@MarginDef[#1]{#2}{\Gls}%
}
\NewDocumentCommand{\margindefpl}{O{} m}{%
\mdef[#1]{#2}{\glspl}%
\NewDocumentCommand{\MarginDefPl}{O{} m}{%
\@MarginDef[#1]{#2}{\glspl}%
}
\NewDocumentCommand{\Margindefpl}{O{} m}{%
\mdef[#1]{#2}{\Glspl}%
\NewDocumentCommand{\MarginDefCapPl}{O{} m}{%
\@MarginDef[#1]{#2}{\Glspl}%
}
% Put a footnote in a margin paragraph.
\NewDocumentCommand{\mnote}{O{} +m}{%
\NewDocumentCommand{\MarginNote}{O{} +m}{%
\footnotemark%
\marginalia[#1]{%
\MarginHyperSetup%
@@ -61,7 +61,7 @@
}%
}
\NewDocumentCommand{\marginfig}{
\NewDocumentCommand{\MarginFig}{
% #1: Options passed to \includegraphics.
O{}
% #2: Graphic file name.
@@ -69,16 +69,18 @@
% #3: Label.
>{\TrimSpaces}m
+m
}{%
}{
% This strut ensures that the margin figure is counted as part of the
% following paragraph and is vertically aligned with it.
\strut%
\marginalia{%
\MarginHyperSetup%
\begin{MyCaption}[
format={\RaggedOutside\small\color{caption}}
]{fig:#3}{#4}
\Centering\includegraphics[keepaspectratio,#1]{#2}%
\end{MyCaption}
}%
%\strut {\setlength{\parskip}{0pt} \par} \strut
\mbox{
\marginalia{
\MarginHyperSetup
\begin{MyCaption}[
format={\RaggedOutside\small\color{caption}}
]{fig:#3}{#4}
\Centering\includegraphics[keepaspectratio,#1]{#2}
\end{MyCaption}
}
}
}