- Make all packages Expl3.

- Replace ifthen dependency with wrappers for Latex3 conditionals.
- Debug CrossRef and WrapBoxout.
This commit is contained in:
2025-09-18 16:51:12 -05:00
parent 72ab67463b
commit e2a0277635
21 changed files with 278 additions and 183 deletions

View File

@@ -4,77 +4,87 @@
published by Prime Controls. published by Prime Controls.
} }
\RequirePackage{ifthen}
% Option 'electronic': single side printing. % Option 'electronic': single side printing.
\newboolean{isElectronic} \bool_new:N \g_electronic_bool
\setboolean{isElectronic}{false} \bool_gset_false:N \g_electronic_bool
\DeclareOption{electronic}{ \DeclareOption{electronic}{
\setboolean{isElectronic}{true} \bool_gset_true:N \g_electronic_bool
} }
\NewExpandableDocumentCommand{\IsElectronic}{}{\g_electronic_bool}
% Option 'admin': turn on admin manual sections. % Option 'admin': turn on admin manual sections.
\newboolean{isAdminManual} \bool_new:N \g_admin_bool
\setboolean{isAdminManual}{false} \bool_gset_false:N \g_admin_bool
\DeclareOption{admin}{ \DeclareOption{admin}{
\setboolean{isAdminManual}{true} \bool_gset_true:N \g_admin_bool
} }
\NewExpandableDocumentCommand{\IsAdminManual}{}{\g_admin_bool}
% Option 'darkmode': render as light text on dark background. % Option 'darkmode': render as light text on dark background.
\newboolean{isDarkMode} \bool_new:N \g_dark_mode_bool
\setboolean{isDarkMode}{false} \bool_gset_false:N \g_dark_mode_bool
\DeclareOption{darkmode}{ \DeclareOption{darkmode}{
\setboolean{isDarkMode}{true} \bool_gset_true:N \g_dark_mode_bool
} }
\NewExpandableDocumentCommand{\IsDarkMode}{}{\g_dark_mode_bool}
% Option 'draft': same as base book class, but with bigger overfull boxes. % Option 'draft': same as base book class, but with bigger overfull boxes.
\newboolean{isDraft} \bool_new:N \g_draft_bool
\setboolean{isDraft}{false} \bool_gset_false:N \g_draft_bool
\DeclareOption{draft}{ \DeclareOption{draft}{
\setboolean{isDraft}{true} \bool_gset_true:N \g_draft_bool
\overfullrule = 1in \overfullrule = 1in
} }
% Option 'admin': turn on admin manual sections. \NewExpandableDocumentCommand{\IsDraft}{}{\g_draft_bool}
\newboolean{doRomanNumerals}
\setboolean{doRomanNumerals}{false} % Option 'roman': render Part numbers as Roman numerals.
\bool_new:N \g_roman_bool
\bool_gset_false:N \g_roman_bool
\DeclareOption{roman}{ \DeclareOption{roman}{
\setboolean{doRomanNumerals}{true} \bool_gset_true:N \g_roman_bool
} }
\NewExpandableDocumentCommand{\DoRomanNumerals}{}{\g_roman_bool}
% Option 'labels': show Part and Chapter labels in the header.
\bool_new:N \g_label_bool
\bool_gset_false:N \g_label_bool
\DeclareOption{labels}{
\bool_gset_true:N \g_label_bool
}
\NewExpandableDocumentCommand{\ShowLabels}{}{\g_label_bool}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions\relax \ProcessOptions\relax
\ifthenelse{\boolean{isElectronic}}{ \bool_if:NTF \g_electronic_bool {
\ifthenelse{\boolean{isDraft}}{ \bool_if:NTF \g_draft_bool {
\LoadClass[draft,oneside]{book} \LoadClass[draft,oneside]{book}
}{ } {
\LoadClass[oneside]{book} \LoadClass[oneside]{book}
} }
}{ } {
\ifthenelse{\boolean{isDraft}}{ \bool_if:NTF \g_draft_bool {
\LoadClass[draft]{book} \LoadClass[draft]{book}
}{ } {
\LoadClass{book} \LoadClass{book}
} }
} }
\input{PrimeTeX/commonincludes.def} \input{PrimeTeX/commonincludes.def}
\NewDocumentCommand{\IfAdminManual}{+m +m}{
\ifthenelse{\boolean{isAdminManual}}{#1}{#2}
}
\NewDocumentCommand{\IfElectronic}{+m +m}{
\ifthenelse{\boolean{isElectronic}}{#1}{#2}
}
\NewDocumentCommand{\rem}{+m}{} \NewDocumentCommand{\rem}{+m}{}
\str_new:N \l_IncludeOnly_chapters_str \str_new:N \l_IncludeOnly_chapters_str

View File

@@ -3,11 +3,11 @@
\RequirePackage{ifthen} \RequirePackage{ifthen}
\newboolean{isDarkMode} \bool_new:N \isDarkMode
\setboolean{isDarkMode}{false} \bool_set_false:N \isDarkMode
\DeclareOption{darkmode}{ \DeclareOption{darkmode}{
\setboolean{isDarkMode}{true} \bool_set_true:N \isDarkMode
} }
\DeclareOption{showoverfull}{ \DeclareOption{showoverfull}{

View File

@@ -35,7 +35,7 @@
\RequirePackage{hyperref} \RequirePackage{hyperref}
\RequirePackage{ifthen} %\RequirePackage{ifthen}
\RequirePackage{lua-widow-control} \RequirePackage{lua-widow-control}
@@ -68,6 +68,8 @@
\RequirePackage{PrimeTeX/packages/Boxout} \RequirePackage{PrimeTeX/packages/Boxout}
\RequirePackage{PrimeTeX/packages/Branch}
\RequirePackage{PrimeTeX/packages/Caption} \RequirePackage{PrimeTeX/packages/Caption}
\RequirePackage{PrimeTeX/packages/Color} \RequirePackage{PrimeTeX/packages/Color}

View File

@@ -53,12 +53,14 @@
\color{textColor} \color{textColor}
\label{box:#2} \label{box:#2}
\tl_if_empty:nTF {#3} { \tl_if_empty:nTF {#3} {
% No header
\expanded{\noexpand\begin{tblrBoxout}{\l_Boxout_innerspec_tl}} \expanded{\noexpand\begin{tblrBoxout}{\l_Boxout_innerspec_tl}}
\setlength{\parskip}{\medskipamount} \setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt} \setlength{\parindent}{0pt}
\__Boxout_format:\ignorespaces#4\\ \__Boxout_format:\ignorespaces#4\\
\end{tblrBoxout} \end{tblrBoxout}
}{ }{
% Yes header
\expanded{\noexpand\begin{tblrBoxout}{\l_Boxout_innerspec_tl}} \expanded{\noexpand\begin{tblrBoxout}{\l_Boxout_innerspec_tl}}
\SetCell{halign=c, font={\sbfamily\bfseries}}{#3}\\ \SetCell{halign=c, font={\sbfamily\bfseries}}{#3}\\
\setlength{\parskip}{\medskipamount} \setlength{\parskip}{\medskipamount}
@@ -167,9 +169,9 @@
\keys_set:nn{WrapBoxout}{#1} \keys_set:nn{WrapBoxout}{#1}
\__WrapFig_process_options: \__WrapFig_process_options:
\dim_compare:nNnTF {\l_WrapBoxout_width_dim} > {\l_WrapBoxout_justifywidth_dim} { \dim_compare:nNnTF {\l_WrapBoxout_width_dim} > {\l_WrapBoxout_justifywidth_dim} {
\cs_set:Npn \__WrapBoxout_format: {\justifying} \cs_set:Nn \__WrapBoxout_format: {\justifying}
} { } {
\cs_set:Npn \__WrapBoxout_format: {\l_WrapFig_format_tl} \cs_set:Nn \__WrapBoxout_format: {\l_WrapFig_format_tl}
} }
% \message{ % \message{
% WrapBoxout:~ % WrapBoxout:~
@@ -181,14 +183,15 @@
hoffset = {\dim_use:N \l_WrapFig_hoffset_dim}, hoffset = {\dim_use:N \l_WrapFig_hoffset_dim},
\l_WrapFig_passed_keys_str, \l_WrapFig_passed_keys_str,
]} ]}
%\begin{minipage}{\l_WrapBoxout_width_dim}
\begin{Boxout}[ \begin{Boxout}[
innerspec:e = {\l_Boxout_innerspec_tl,columns={\dim_use:N \l_WrapBoxout_width_dim}}, innerspec:e = {
warning:e = \bool_to_str:N \l_Boxout_warning_bool, \l_Boxout_innerspec_tl,
format = {\__WrapBoxout_format:} columns={\dim_use:N \l_WrapBoxout_width_dim}
},
warning:e = {\bool_to_str:N \l_Boxout_warning_bool},
format = \__WrapBoxout_format:,
]{#2}[#3] ]{#2}[#3]
#4 #4
\end{Boxout} \end{Boxout}
%\end{minipage}
\end{wrapstuff} \end{wrapstuff}
\group_end: }{} \group_end: }{}

20
packages/Branch.sty Normal file
View File

@@ -0,0 +1,20 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesExplPackage{PrimeTeX/packages/Branch}{2025-09-18}{1.0}{
LaTeX2e-syntax wrappers for LaTeX3 branch commands.
}
\NewDocumentCommand{\If}{m +m +O{}}{
\bool_if:nTF {#1} {#2} {#3}
}
\NewDocumentCommand{\Compare}{o m o}{
\bool_if:nTF {\tl_if_novalue_p:n {#1} || \tl_if_novalue_p:n {#3}} {
\dim_compare_p:n {#2}
} {
\dim_compare_p:nNn {#1} #2 {#3}
}
}
\NewDocumentCommand{\Switch}{m +m +O{} +O{}}{
\int_case:nnTF {#1} {#2} {#3} {#4}
}

View File

@@ -4,9 +4,9 @@
} }
\NewDocumentCommand{\RaggedOutside}{}{ \NewDocumentCommand{\RaggedOutside}{}{
\ifthenelse{\boolean{isElectronic}}{% \bool_if:NTF \g_electronic_bool {
\RaggedRight% \RaggedRight%
}{% } {%
\checkoddpage% \checkoddpage%
\ifoddpage% \ifoddpage%
\RaggedRight% \RaggedRight%

View File

@@ -1,5 +1,7 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Color}[2025-07-09] \ProvidesExplPackage{PrimeTeX/packages/Color}{2025-09-18}{1.0}{
Color definitions.
}
% Split Complementary Color Scheme % Split Complementary Color Scheme
% Primary Color: Blue % Primary Color: Blue
@@ -120,7 +122,7 @@
Orange, fbefe9 % #fbefe9 Orange, fbefe9 % #fbefe9
} }
\ifthenelse{\boolean{isDarkMode}\AND\boolean{isElectronic}}{ \bool_if:nTF {\g_dark_mode_bool && \g_electronic_bool} {
% Page and text colors. % Page and text colors.
\colorlet{pageColor}{PrimeDarkGray} \colorlet{pageColor}{PrimeDarkGray}
\colorlet{textColor}{PrimePastelGray} \colorlet{textColor}{PrimePastelGray}
@@ -144,7 +146,7 @@
% Layout preview frame color. % Layout preview frame color.
\colorlet{layoutColor}{PrimeGray} \colorlet{layoutColor}{PrimeGray}
}{ } {
% Page and text colors. % Page and text colors.
\colorlet{pageColor}{white} \colorlet{pageColor}{white}
\colorlet{textColor}{black} \colorlet{textColor}{black}

View File

@@ -2,19 +2,22 @@
\ProvidesExplPackage{PrimeTeX/packages/CrossRef}{2025-09-16}{1.0}{ \ProvidesExplPackage{PrimeTeX/packages/CrossRef}{2025-09-16}{1.0}{
Custom label and reference commands. Custom label and reference commands.
} }
%<@@=CrossRef>
\prop_const_from_keyval:Nn \c_section_names_prop { \debug_on:n {all}
0 = Part\nobreakspace,
1 = Chapter\nobreakspace, \prop_const_from_keyval:Nn \c_@@_section_names_prop {
2 = Section\nobreakspace, 1 = Part\nobreakspace,
3 = Subsection\nobreakspace, 2 = Chapter\nobreakspace,
4 = Sub-subsection\nobreakspace, 3 = Section\nobreakspace,
5 = Paragraph\nobreakspace, 4 = Subsection\nobreakspace,
6 = Subparagraph\nobreakspace, 5 = Sub-subsection\nobreakspace,
9 = Appendix\nobreakspace, 6 = Paragraph\nobreakspace,
7 = Subparagraph\nobreakspace,
8 = Appendix\nobreakspace,
} }
\prop_const_from_keyval:Nn \c_section_levels_prop { \prop_const_from_keyval:Nn \c_@@_section_levels_prop {
part = 0, part = 0,
chapter = 1, chapter = 1,
section = 2, section = 2,
@@ -24,162 +27,196 @@
subparagraph = 6, subparagraph = 6,
} }
\str_const:Nn \c_label_delimiter_str {/} \str_const:Nn \c_@@_label_delimiter_str {/}
\str_const:Nn \c_label_parent_str {.} \str_const:Nn \c_@@_label_parent_str {.}
\str_const:Nn \c_label_wildcard_str {~} \str_const:Nn \c_@@_label_wildcard_str {~}
\str_const:Nn \c_appendices_label_str {appendices} \str_const:Nn \c_@@_appendices_label_str {appendices}
\seq_new:N \g_label_seq \seq_new:N \g_@@_label_seq
\seq_gclear:N \g_@@_label_seq
\NewDocumentCommand{\Part}{s t^ m >{\TrimSpaces}m}{ \NewDocumentCommand{\Part}{s t^ m >{\TrimSpaces}m}{
\_heading:nnnnn {part} {#1} {#2} {#3} {#4} \@@_heading:nnnnn {part} {#1} {#2} {#3} {#4}
\RenewDocumentCommand{\parttitle}{}{#2} \RenewDocumentCommand{\parttitle}{}{#3}
} }
\NewDocumentCommand{\Chapter}{s t^ m >{\TrimSpaces}m}{ \NewDocumentCommand{\Chapter}{s t^ m >{\TrimSpaces}m}{
\_heading:nnnnn {chapter} {#1} {#2} {#3} {#4} \@@_heading:nnnnn {chapter} {#1} {#2} {#3} {#4}
} }
\NewDocumentCommand{\Section}{s t^ m >{\TrimSpaces}m}{ \NewDocumentCommand{\Section}{s t^ m >{\TrimSpaces}m}{
\_heading:nnnnn {section} {#1} {#2} {#3} {#4} \@@_heading:nnnnn {section} {#1} {#2} {#3} {#4}
} }
\NewDocumentCommand{\Subsection}{s t^ m >{\TrimSpaces}m}{ \NewDocumentCommand{\Subsection}{s t^ m >{\TrimSpaces}m}{
\_heading:nnnnn {subsection} {#1} {#2} {#3} {#4} \@@_heading:nnnnn {subsection} {#1} {#2} {#3} {#4}
} }
\NewDocumentCommand{\Subsubsection}{s t^ m >{\TrimSpaces}m}{ \NewDocumentCommand{\Subsubsection}{s t^ m >{\TrimSpaces}m}{
\_heading:nnnnn {subsubsection} {#1} {#2} {#3} {#4} \@@_heading:nnnnn {subsubsection} {#1} {#2} {#3} {#4}
} }
\NewDocumentCommand{\Paragraph}{s t^ m >{\TrimSpaces}m}{ \NewDocumentCommand{\Paragraph}{s t^ m >{\TrimSpaces}m}{
\_heading:nnnnn {paragraph} {#1} {#2} {#3} {#4} \@@_heading:nnnnn {paragraph} {#1} {#2} {#3} {#4}
} }
\NewDocumentCommand{\Subparagraph}{s t^ m >{\TrimSpaces}m}{ \NewDocumentCommand{\Subparagraph}{s t^ m >{\TrimSpaces}m}{
\_heading:nnnnn {subparagaph} {#1} {#2} {#3} {#4} \@@_heading:nnnnn {subparagaph} {#1} {#2} {#3} {#4}
} }
\NewDocumentCommand{\Appendices}{}{ \NewDocumentCommand{\Appendices}{}{
\_heading:nnnnn {part} {\c_true_bool} {\c_false_bool} {Appendices} {\c_appendices_label_str} \@@_heading:nnnnn {part} {\c_true_bool} {\c_false_bool} {Appendices} {\c_@@_appendices_label_str}
} }
\NewDocumentCommand{\GetCurrentLabel}{}{ \NewDocumentCommand{\GetCurrentLabel}{}{
\seq_use:Nn \g_label_seq {\c_label_delimiter_str} \seq_use:Nn \g_@@_label_seq {\c_@@_label_delimiter_str}
} }
\NewDocumentCommand{\SetCurrentLabel}{ \NewDocumentCommand{\SetCurrentLabel}{
% #1: Delimiter % #1: Delimiter
O{\c_label_delimiter_str} O{\c_@@_label_delimiter_str}
% #2: Label string. % #2: Label string.
>{\TrimSpaces}m >{\TrimSpaces}m
}{ }{
\seq_set_split:Nnn \g_label_seq {#1} {#2} \seq_set_split:Nnn \g_@@_label_seq {#1} {#2}
} }
\RenewDocumentCommand{\Ref}{ \RenewDocumentCommand{\Ref}{
% #1: Star (No star = include section name in reference, star = do not include). % #1: Star (No star = include section name in reference, star = do not include).
s s
% #2: Label string delimiter (defaults to "/"). % #2: Label string delimiter (defaults to "/").
O{\c_label_delimiter_str} O{\c_@@_label_delimiter_str}
% #3: Label Reference % #3: Label Reference
>{\TrimSpaces}m >{\TrimSpaces}m
% #4: Parent label symbol (defaults to "."). % #4: Parent label symbol (defaults to ".").
O{\c_label_parent_str} O{\c_@@_label_parent_str}
% #5: Label wildcard symbol (defaults to "~"). % #5: Label wildcard symbol (defaults to "~").
O{\c_label_wildcard_str} O{\c_@@_label_wildcard_str}
}{ \group_begin: }{ \group_begin:
% Put the parameters in string variables so we can work with them. % Put the parameters in string variables so we can work with them.
\str_const:Nn \c_label_delimiter_str {#2} \str_const:Nn \c_@@_label_delimiter_str {#2}
\str_const:Nn \c_label_parent_str {#4} \str_const:Nn \c_@@_label_parent_str {#4}
\str_const:Nn \c_label_wildcard_str {#5} \str_const:Nn \c_@@_label_wildcard_str {#5}
\str_const:Ne \c_regex_str { \str_const:Ne \c_@@_regex_str {
/|([\c_label_parent_str\c_label_wildcard_str]) % MATCH delimiter, parent, and wildcard symbols, but CAPTURE only
% parents and wildcards, NOT delimiters.
/|(\c_@@_label_parent_str|\c_@@_label_wildcard_str)
} }
\seq_new:N \l_label_seq \seq_new:N \l_@@_label_seq
\seq_new:N \l_ref_seq \seq_new:N \l_@@_ref_seq
\str_new:N \l_ref_str \str_new:N \l_@@_ref_str
\str_set:Nn \l_ref_str {#3} \str_set:Nn \l_@@_ref_str {#3}
% Split the string on the delimiters. % Split the string on the delimiters.
\seq_set_regex_split:NNn \l_ref_seq \c_regex_str {\l_ref_str} \seq_set_regex_split:NNn \l_@@_ref_seq \c_@@_regex_str {\l_@@_ref_str}
% Copy the current label sequence to a local variable. % Copy the current label sequence to a local variable.
\seq_set_eq:NN \l_label_seq \g_label_seq \seq_set_eq:NN \l_@@_label_seq \g_@@_label_seq
% Iterate through the reference sequence, removing one element from the % Iterate through the reference sequence, removing one element from the
% end of the temporary label sequence for each parent symbol. % end of the temporary label sequence for each parent symbol.
\seq_map_indexed_function:NN \l_ref_seq \_seq_map:nn \seq_map_indexed_function:NN \l_@@_ref_seq \_seq_map:nn
% If the first character in the label string is a delimiter, it is an % % Add the shortened temporary label sequence to the beginning of the
% absolute reference and we don't have to do anything to it. % % reference sequence.
% Otherwise, we have to convert it from a relative reference to an absolute. \seq_concat:NNN \l_@@_ref_seq \l_@@_label_seq \l_@@_ref_seq
\str_if_eq:nnTF {\str_head:N \l_ref_str} {\c_label_delimiter_str} {
} { % % Join the reference sequence back into a delimited string.
% Add a delimiter before each parent symbol so we can split the string. \str_set:Nn \l_@@_ref_str {\seq_use:Nn \l_@@_ref_seq {#1}}
\str_replace_all:Nnn \l_ref_str {\c_label_parent_str} {
\c_label_delimiter_str\c_label_parent_str \str_if_eq:nnF {\str_head:N \l_@@_ref_str} {\c_@@_label_delimiter_str} {
} \str_put_left:Nn \l_@@_ref_str {\c_@@_label_delimiter_str}
% Remove empty items from the sequence.
\seq_remove_all:Nn \l_ref_seq {}
% Add the shortened temporary label sequence to the beginning of the
% reference sequence.
\seq_concat:NNN \l_ref_seq \l_label_seq \l_ref_seq
% Join the reference sequence back into a delimited string.
\str_set:Nn \l_ref_str {\seq_use:Nn \l_ref_seq {#1}}
\str_put_left:Nn \l_ref_str {\c_label_delimiter_str}
} }
% Output the section name only if no star is passed. % Output the section name only if no star is passed.
\bool_if:nF {#1} { \bool_if:nF {#1} {
\str_if_eq:nnTF {\seq_item:Nn \l_ref_seq {1}} {\c_appendices_label_str} { \str_if_eq:nnTF {\seq_item:Nn \l_@@_ref_seq {1}} {\c_@@_appendices_label_str} {
% If the part label is "appendices", the section name is "Appendix". % If the part label is "appendices", the section name is "Appendix".
\prop_item:Nn \c_section_names_prop {9} \prop_item:Nn \c_@@_section_names_prop {9}
}{ }{
% Otherwise, look up the correct section name. % Otherwise, look up the correct section name.
\prop_item:Nn \c_section_names_prop {\seq_count:N \l_ref_seq - 1} \prop_item:Nn \c_@@_section_names_prop {\seq_count:N \l_@@_ref_seq - 1}
} }
} }
% Create a reference with the string we just created. % Create a reference with the string we just created.
\ref{\l_ref_str} \ref{\l_@@_ref_str}
\cs_new:Nn \_seq_map:nn { \cs_new:Nn \_seq_map:nn {
\str_case:nn {#2} { \str_case:nn {#2} {
{\c_label_parent_str} {\seq_pop_right:NN \l_label_seq \l_tmpa_tl} {\c_@@_label_parent_str} {
{\c_label_wildcard_str} { \seq_pop_right:NN \l_@@_label_seq \l_@@_tmpa_tl
\seq_item:Nn \l_label_temp_str {#1}} \seq_pop_left:NN \l_@@_ref_seq \l_@@_tmpa_tl
}
{\c_@@_label_wildcard_str} {
\seq_pop_left:NN \l_@@_label_seq \l_@@_tmpa_tl
\l_@@_tmpa_tl
}
} }
} }
\group_end: } \group_end: }
\int_new:N \l_level_index_int \int_new:N \l_@@_current_level_int
\int_new:N \l_section_level_int \int_new:N \l_@@_pop_count_int
\int_new:N \l_@@_pop_index_int
\cs_new:Nn \_heading:nnnnn { \seq_new:N \l_@@_label_seq
\str_new:N \l_@@_label_str
\cs_new:Nn \@@_heading:nnnnn { \group_begin:
% #1: Section name: part, chapter, section, etc. % #1: Section name: part, chapter, section, etc.
% #2: Star (passed to default sectioning command) % #2: Star (passed to default sectioning command)
% #3: ^ token: suppresses sectioning command. % #3: ^ token: suppresses sectioning command.
% #4: Section title % #4: Section title
% #5: Label % #5: Label
\prop_get:NnN \c_section_levels_prop {#1} \l_section_level_int \debug_on:n {all}
% Get the numeric level of the section command.
\prop_get:NnN \c_@@_section_levels_prop {#1} \l_@@_current_level_int
% \message{^^J@@_heading:~#5~\seq_use:Ne \g_@@_label_seq {\c_@@_label_delimiter_str}}
\seq_set_eq:NN \l_@@_label_seq \g_@@_label_seq
\int_set:Nn \l_@@_pop_count_int {
\seq_count:N \l_@@_label_seq - \l_@@_current_level_int
}
\int_while_do:nNnn {\l_@@_pop_index_int} < {\l_@@_pop_count_int} {
\seq_if_empty:NF \l_@@_label_seq {
\seq_pop_right:NN \l_@@_label_seq \l_tmpa_tl
}
\int_incr:N \l_@@_pop_index_int
}
% Add the new label to the end of the modified label sequence.
\seq_put_right:Ne \l_@@_label_seq {#5}
\seq_gset_eq:NN \g_@@_label_seq \l_@@_label_seq
% Join the label sequence into a string.
\str_set:Ne \l_@@_label_str {
\seq_use:Ne \l_@@_label_seq {\c_@@_label_delimiter_str}
}
% Add a delimiter to the beginning of the label string to indicate this is
% an absolute reference.
\str_put_left:Ne \l_@@_label_str {\c_@@_label_delimiter_str}
% If the caret argument is NOT present, output the heading.
\bool_if:nF {#3} { \bool_if:nF {#3} {
% Pass along the star argument if it is present.
\bool_if:nTF {#2} { \bool_if:nTF {#2} {
\use:c {#1} * {#4} \use:c {#1} * {#4}
} { } {
\use:c {#1} {#4} \use:c {#1} {#4}
} }
} }
\int_set:Nn \l_level_index_int {\seq_count:N \g_label_seq} % Output the label.
\int_do_while:nNnn {\l_level_index_int} > {\l_section_level_int} { \exp_args:Ne \label {\l_@@_label_str}
\seq_pop_right:NN \g_label_seq \l_tmpa_tl \group_end: }
\int_decr:N \l_level_index_int
} \debug_off:n {all}
\seq_put_right:Nn \g_label_seq {#5}
\str_set:Nn \l_label_str {\seq_use:Nn \g_label_seq \c_label_delimiter_str}
\str_put_left:Nn \l_label_str {\c_label_delimiter_str}
\exp_args:Ne \label {\l_label_str}
}

View File

@@ -1,5 +1,7 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/DocProperties}[2025-07-09] \ProvidesExplPackage{PrimeTeX/packages/DocProperties}{2025-07-09}{1.0}{
Commands for document and PDF properties.
}
\DTMnewdatestyle{longdate}{% \DTMnewdatestyle{longdate}{%
\renewcommand{\DTMdisplaydate}[4]{\number##3\ \DTMenglishmonthname{##2}\ \number##1}% \renewcommand{\DTMdisplaydate}[4]{\number##3\ \DTMenglishmonthname{##2}\ \number##1}%

View File

@@ -96,10 +96,10 @@
} }
} }
\begin{minipage}{\linewidth} \begin{minipage}{\linewidth}
\ifthenelse{\boolean{isDraft}}{ \bool_if:NTF \g_draft_bool {
{\color{layoutColor}\rule{\textwidth}{1pt}\zws} {\color{layoutColor}\rule{\textwidth}{1pt}\zws}
#2 #2
}{ } {
#2 #2
} }
\end{minipage} \end{minipage}

View File

@@ -1,5 +1,7 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Fonts}[2025-06-24] \ProvidesExplPackage{PrimeTeX/packages/Fonts}{2025-09-18}{1.0}{
Font definitions.
}
\NewDocumentCommand{\fontpath}{}{PrimeTeX/fonts} \NewDocumentCommand{\fontpath}{}{PrimeTeX/fonts}

View File

@@ -112,18 +112,18 @@
\cs_new:Nn \__WrapFig_process_options: { \cs_new:Nn \__WrapFig_process_options: {
\str_case:en \l_WrapFig_margin_str { \str_case:en \l_WrapFig_margin_str {
{inside} { {inside} {
\dim_set:Nn \l_WrapFig_hoffset_dim {\c_WrapFig_im_hoffset_dim} \dim_set_eq:NN \l_WrapFig_hoffset_dim \c_WrapFig_im_hoffset_dim
\str_set:Nn \l_WrapFig_placement_str {i} \str_set:Nn \l_WrapFig_placement_str {i}
} }
{outside} { {outside} {
\dim_set:Nn \l_WrapFig_hoffset_dim {\c_WrapFig_om_hoffset_dim} \dim_set_eq:NN \l_WrapFig_hoffset_dim \c_WrapFig_om_hoffset_dim
\str_set:Nn \l_WrapFig_placement_str {o} \str_set:Nn \l_WrapFig_placement_str {o}
} }
} }
\ifthenelse{\boolean{isElectronic}}{ \bool_if:NTF \g_electronic_bool {
\str_replace_all:Nnn \l_WrapFig_placement_str {i} {l} \str_replace_all:Nnn \l_WrapFig_placement_str {i} {l}
\str_replace_all:Nnn \l_WrapFig_placement_str {o} {r} \str_replace_all:Nnn \l_WrapFig_placement_str {o} {r}
}{ } {
\checkoddpage \checkoddpage
\ifoddpage \ifoddpage
\str_replace_all:Nnn \l_WrapFig_placement_str {i} {l} \str_replace_all:Nnn \l_WrapFig_placement_str {i} {l}

View File

@@ -19,7 +19,7 @@
\NewDocumentCommand{\FrontMatter}{}{ \NewDocumentCommand{\FrontMatter}{}{
\pagestyle{plain} \pagestyle{plain}
\ifthenelse{\boolean{isElectronic}}{ \bool_if:NTF \g_electronic_bool {
\pagenumbering{arabic} \pagenumbering{arabic}
}{ }{
\pagenumbering{roman} \pagenumbering{roman}
@@ -48,17 +48,17 @@
\renewcommand{\chaptermark}[1]{\markboth{#1}{}} \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancypagestyle{fancy}{ \fancypagestyle{fancy}{
\ifthenelse{\boolean{isElectronic}}{ \bool_if:NTF \g_electronic_bool {
\fancyhfoffset[L]{\HeaderInsideOffset} \fancyhfoffset[L]{\HeaderInsideOffset}
\fancyhfoffset[R]{\HeaderOutsideOffset} \fancyhfoffset[R]{\HeaderOutsideOffset}
\fancyhead[L]{\partlabel} \fancyhead[L]{\partlabel}
\fancyhead[R]{\chapappname{}\leftmark} \fancyhead[R]{\bool_if:NT \g_label_bool {\chapappname} \leftmark}
\fancyfoot[R]{\thepage} \fancyfoot[R]{\thepage}
}{ }{
\fancyhfoffset[LE,RO]{\HeaderOutsideOffset} \fancyhfoffset[LE,RO]{\HeaderOutsideOffset}
\fancyhead[LE]{\partlabel} \fancyhead[LE]{\partlabel}
\fancyhead[RO]{\chapappname\leftmark} \fancyhead[RO]{\bool_if:NT \g_label_bool {\chapappname} \leftmark}
\fancyfoot[LE,RO]{\thepage} \fancyfoot[LE,RO]{\thepage}
} }
@@ -69,7 +69,7 @@
\renewcommand{\headrulewidth}{0pt} % remove lines as well \renewcommand{\headrulewidth}{0pt} % remove lines as well
\renewcommand{\footrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}
\ifthenelse{\boolean{isElectronic}}{ \bool_if:NTF \g_electronic_bool {
\fancyhfoffset[L]{\HeaderInsideOffset} \fancyhfoffset[L]{\HeaderInsideOffset}
\fancyhfoffset[R]{\HeaderOutsideOffset} \fancyhfoffset[R]{\HeaderOutsideOffset}
\fancyfoot[R]{\thepage} \fancyfoot[R]{\thepage}

View File

@@ -1,5 +1,7 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Hyphenation}[2025-07-11] \ProvidesExplPackage{PrimeTeX/packages/Hyphenation}{2025-07-11}{1.0}{
Hyphenation definitions.
}
\hyphenation{ \hyphenation{
over-view over-view

View File

@@ -6,5 +6,6 @@
\NewDocumentCommand{\idx}{m}{ \NewDocumentCommand{\idx}{m}{
\str_set:Nn \l_tmpa_str {#1} \str_set:Nn \l_tmpa_str {#1}
\str_replace_all:Nnn \l_tmpa_str {!} {~} \str_replace_all:Nnn \l_tmpa_str {!} {~}
\l_tmpa_str
\index{\l_tmpa_str} \index{\l_tmpa_str}
} }

View File

@@ -1,5 +1,5 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Layout}%{2025-09-03}{1.0}{Layout.} \ProvidesExplPackage{PrimeTeX/packages/Layout}{2025-09-03}{1.0}{Layout.}
% Suppress warning about \showhyphens being changed. % Suppress warning about \showhyphens being changed.
\let\CheckCommand\providecommand \let\CheckCommand\providecommand
@@ -21,7 +21,7 @@
% Suppress "Underfull \hbox" infos. % Suppress "Underfull \hbox" infos.
\hbadness=10000 \hbadness=10000
\ifthenelse{\boolean{isDraft}}{ \bool_if:NTF \g_draft_bool{
\geometry{showframe} \geometry{showframe}
\hfuzz = 0.5pt \hfuzz = 0.5pt
\vfuzz = 0.0pt \vfuzz = 0.0pt
@@ -44,7 +44,7 @@
footskip = 0.5in, % 36pt, footskip = 0.5in, % 36pt,
} }
\ifthenelse{\boolean{isElectronic}}{ \bool_if:NTF \g_electronic_bool {
% \geometry{} % \geometry{}
}{ }{
\geometry{twoside} \geometry{twoside}
@@ -65,7 +65,7 @@
\ProvideLength{\marparwidth}[\marginparsep + \marginparwidth] \ProvideLength{\marparwidth}[\marginparsep + \marginparwidth]
\ProvideLength{\contentwidth}[\textwidth + \marparwidth] \ProvideLength{\contentwidth}[\textwidth + \marparwidth]
\ifthenelse{\boolean{isDraft}}{ \bool_if:NTF \g_draft_bool{
\lwcsetup{showcolours=true,} \lwcsetup{showcolours=true,}
}{} }{}
@@ -89,24 +89,26 @@
\renewcommand{\dblfloatpagefraction}{0.8} % require fuller float pages \renewcommand{\dblfloatpagefraction}{0.8} % require fuller float pages
\NewDocumentEnvironment{SmartAdjustWidth}{ \NewDocumentEnvironment{SmartAdjustWidth}{
O{\boolean{isElectronic}} O{\IsElectronic}
m m
m m
+b +b
}{% }{
\ifthenelse{#1}{% \bool_if:nTF {#1} {
\begin{adjustwidth}{#2}{#3}% \begin{adjustwidth}{#2}{#3}
#4% #4
\end{adjustwidth}% \end{adjustwidth}
}{% }{
\begin{adjustwidth*}{#2}{#3}% \begin{adjustwidth*}{#2}{#3}
#4% #4
\end{adjustwidth*}% \end{adjustwidth*}
}% }
}{} }{}
\ExplSyntaxOff
\AtBeginDocument{ \AtBeginDocument{
\ifthenelse{\boolean{isElectronic}}{ \If{\IsElectronic}{
\newgeometry{ \newgeometry{
inner = 0.75in, inner = 0.75in,
top = 66pt, % 11/12in top = 66pt, % 11/12in
@@ -119,7 +121,7 @@
marginratio = 2:3, marginratio = 2:3,
} }
\savegeometry{tinyMargin} \savegeometry{tinyMargin}
}{ }[
\newgeometry{ \newgeometry{
twoside = true, twoside = true,
inner = 0.75in, inner = 0.75in,
@@ -134,7 +136,7 @@
marginratio = 2:3, marginratio = 2:3,
} }
\savegeometry{tinyMargin} \savegeometry{tinyMargin}
} ]
\restoregeometry \restoregeometry
\NewDocumentEnvironment{SmallMargin}{O{0.0in} O{-0.25in}}{ \NewDocumentEnvironment{SmallMargin}{O{0.0in} O{-0.25in}}{

View File

@@ -14,7 +14,7 @@
bookmarksopenlevel = 2, bookmarksopenlevel = 2,
} }
\ifthenelse{\boolean{isElectronic}}{ \bool_if:NTF \g_electronic_bool {
\hypersetup{ \hypersetup{
allcolors = linkColor, allcolors = linkColor,
} }

View File

@@ -22,7 +22,7 @@
} }
\NewDocumentCommand{\MarginHyperSetup}{}{ \NewDocumentCommand{\MarginHyperSetup}{}{
\ifthenelse{\boolean{isElectronic}}{ \bool_if:NTF \g_electronic_bool {
\hypersetup{allcolors = linkColor} \hypersetup{allcolors = linkColor}
}{ }{
\hypersetup{allcolors = marginTextColor} \hypersetup{allcolors = marginTextColor}

View File

@@ -1,5 +1,7 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Tables}[2025-07-09] \ProvidesExplPackage{PrimeTeX/packages/Tables}{2025-07-09}{1.0}{
Tabularray configuration.
}
\RenewDocumentCommand\TblrAlignBoth{}{\justifying} \RenewDocumentCommand\TblrAlignBoth{}{\justifying}
\RenewDocumentCommand\TblrAlignLeft{}{\RaggedRight} \RenewDocumentCommand\TblrAlignLeft{}{\RaggedRight}

View File

@@ -1,20 +1,28 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/TitlePage}[2025-07-09] \ProvidesExplPackage{PrimeTeX/packages/TitlePage}{2025-07-09}{1.0}{
Definition for title page.
}
% Define custom title page. % Define custom title page.
\NewDocumentCommand{\PrimeTitlePage}{O{}}{ \NewDocumentCommand{\PrimeTitlePage}{O{}}{
\thispagestyle{empty} \thispagestyle{empty}
\pdfbookmark{Title Page}{title-page} \pdfbookmark{Title Page}{title-page}
\begin{sbfamily} \begin{sbfamily}
{\noindent\large\raggedright {\noindent\large\raggedright % Not RaggedRight because we don't want hyphens.
\vspace*{\stretch{1}} \vspace*{\stretch{1}}
\CustomerFull \CustomerFull
\medbreak \medbreak
\ProjectTitle \ProjectTitle
\bigbreak \bigbreak
{\Huge\Title} {\Huge\Title}
\vfill \vfill
{\leavevmode {\leavevmode
% Move the rule graphic to 0.25 in from the left edge of the % Move the rule graphic to 0.25 in from the left edge of the
% paper and vertically centered on the heartbeat graphic. % paper and vertically centered on the heartbeat graphic.
@@ -27,9 +35,9 @@
} }
} }
\AuthorCompany \AuthorCompany\par
Revision \Version Revision~\Version\par
\LongDate \LongDate

View File

@@ -1,9 +1,11 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{PrimeTeX/packages/Titles}[2025-07-16] \ProvidesExplPackage{PrimeTeX/packages/Titles}{2025-07-16}{1.0}{
Title formatting definitions.
}
\ifthenelse{\NOT\boolean{doRomanNumerals}}{ \bool_if:NF \g_roman_bool {
\renewcommand{\thepart}{\arabic{part}} \renewcommand{\thepart}{\arabic{part}}
}{} }
\titleformat{\part}[display]{ \titleformat{\part}[display]{
\normalfont\sbfamily\huge \normalfont\sbfamily\huge