- Replace all \newcommands with \NewDocumentCommand.

- Add Ragged2e dependency for better alignment options.
- Refine marginalia, widow control.
This commit is contained in:
Silcantar
2025-08-18 22:00:52 -05:00
parent 89340afd62
commit 0c84476fc5
12 changed files with 115 additions and 110 deletions

View File

@@ -2,48 +2,48 @@
\ProvidesPackage{PrimeTeX/packages/CrossRef}[2025-07-09]
% Cross references
\newcommand{\refPart}[2][Part~]{#1\ref{pt:#2}}
\newcommand{\refChapter}[2][Chapter~]{#1\ref{ch:#2}}
\newcommand{\refAppendix}[2][Appendix~]{#1\ref{ch:#2}}
\newcommand{\refSection}[2][Section~]{#1\ref{sec:#2}}
\newcommand{\refSubsection}[2][Subsection~]{#1\ref{subsec:#2}}
\newcommand{\refSubsubsection}[2][Sub-subsection~]{#1\ref{sssec:#2}}
\newcommand{\refParagraph}[2][Paragraph]{#1\ref{par:#2}}
\newcommand{\refSubparagraph}[2][Subparagraph~]{#1\ref{subpar:#2}}
\newcommand{\refTable}[2][Table~]{#1\ref{tbl:#2}}
\newcommand{\refFigure}[2][Figure~]{#1\ref{fig:#2}}
\NewDocumentCommand{\refPart}{O{Part~} m}{#1\ref{pt:#2}}
\NewDocumentCommand{\refChapter}{O{Chapter~} m}{#1\ref{ch:#2}}
\NewDocumentCommand{\refAppendix}{O{Appendix~} m}{#1\ref{ch:#2}}
\NewDocumentCommand{\refSection}{O{Section~} m}{#1\ref{sec:#2}}
\NewDocumentCommand{\refSubsection}{O{Subsection~} m}{#1\ref{subsec:#2}}
\NewDocumentCommand{\refSubsubsection}{O{Sub-subsection~} m}{#1\ref{sssec:#2}}
\NewDocumentCommand{\refParagraph}{O{Paragraph} m}{#1\ref{par:#2}}
\NewDocumentCommand{\refSubparagraph}{O{Subparagraph~} m}{#1\ref{subpar:#2}}
\NewDocumentCommand{\refTable}{O{Table~} m}{#1\ref{tbl:#2}}
\NewDocumentCommand{\refFigure}{O{Figure~} m}{#1\ref{fig:#2}}
\newcommand{\lblGeneral}[4][]{
\NewDocumentCommand{\lblGeneral}{>{\TrimSpaces}O{} >{\TrimSpaces}m m >{\TrimSpaces}m}{
\if\relax\detokenize{#1}\relax % Check if #1 is empty string.
#3{#2}\label{#4:#2}
\else
#3{#2}\label{#4:#1}
\fi
}
\newcommand{\lblPart}[2][]{
\NewDocumentCommand{\lblPart}{O{} m}{
\lblGeneral[#1]{#2}{\part}{pt}
}
\newcommand{\lblChapter}[2][]{
\NewDocumentCommand{\lblChapter}{O{} m}{
\lblGeneral[#1]{#2}{\chapter}{ch}
}
\newcommand{\lblSection}[2][]{
\NewDocumentCommand{\lblSection}{O{} m}{
\lblGeneral[#1]{#2}{\section}{sec}
}
\newcommand{\lblSubsection}[2][]{
\NewDocumentCommand{\lblSubsection}{O{} m}{
\lblGeneral[#1]{#2}{\subsection}{subsec}
}
\newcommand{\lblSubsubsection}[2][]{
\NewDocumentCommand{\lblSubsubsection}{O{} m}{
\lblGeneral[#1]{#2}{\subsubsection}{sssec}
}
\newcommand{\lblParagraph}[2][]{
\NewDocumentCommand{\lblParagraph}{O{} m}{
\lblGeneral[#1]{#2}{\paragraph}{par}
}
\newcommand{\lblSubparagraph}[2][]{
\NewDocumentCommand{\lblSubparagraph}{O{} m}{
\lblGeneral[#1]{#2}{\subparagraph}{subpar}
}
\newcommand{\lblTable}[2][]{
\NewDocumentCommand{\lblTable}{O{} m}{
\lblGeneral[#1]{#2}{\caption}{tbl}
}
\newcommand{\lblFigure}[2][]{
\NewDocumentCommand{\lblFigure}{O{} m}{
\lblGeneral[#1]{#2}{\caption}{fig}
}