- Add Ragged2e dependency for better alignment options. - Refine marginalia, widow control.
49 lines
1.7 KiB
TeX
49 lines
1.7 KiB
TeX
\NeedsTeXFormat{LaTeX2e}
|
|
\ProvidesPackage{PrimeTeX/packages/CrossRef}[2025-07-09]
|
|
|
|
% Cross references
|
|
\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}}
|
|
|
|
\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
|
|
}
|
|
\NewDocumentCommand{\lblPart}{O{} m}{
|
|
\lblGeneral[#1]{#2}{\part}{pt}
|
|
}
|
|
\NewDocumentCommand{\lblChapter}{O{} m}{
|
|
\lblGeneral[#1]{#2}{\chapter}{ch}
|
|
}
|
|
\NewDocumentCommand{\lblSection}{O{} m}{
|
|
\lblGeneral[#1]{#2}{\section}{sec}
|
|
}
|
|
\NewDocumentCommand{\lblSubsection}{O{} m}{
|
|
\lblGeneral[#1]{#2}{\subsection}{subsec}
|
|
}
|
|
\NewDocumentCommand{\lblSubsubsection}{O{} m}{
|
|
\lblGeneral[#1]{#2}{\subsubsection}{sssec}
|
|
}
|
|
\NewDocumentCommand{\lblParagraph}{O{} m}{
|
|
\lblGeneral[#1]{#2}{\paragraph}{par}
|
|
}
|
|
\NewDocumentCommand{\lblSubparagraph}{O{} m}{
|
|
\lblGeneral[#1]{#2}{\subparagraph}{subpar}
|
|
}
|
|
\NewDocumentCommand{\lblTable}{O{} m}{
|
|
\lblGeneral[#1]{#2}{\caption}{tbl}
|
|
}
|
|
\NewDocumentCommand{\lblFigure}{O{} m}{
|
|
\lblGeneral[#1]{#2}{\caption}{fig}
|
|
} |