- Debug CrossRef.

- Miscellaneous improvements.
This commit is contained in:
2025-09-19 16:20:17 -05:00
parent 1093a0a909
commit 277f021589
13 changed files with 476 additions and 39 deletions

View File

@@ -29,7 +29,7 @@
\str_const:Nn \c_@@_label_delimiter_str {/}
\str_const:Nn \c_@@_label_parent_str {.}
\str_const:Nn \c_@@_label_wildcard_str {*}
\str_const:Nn \c_@@_label_placeholder_str {*}
\str_const:Nn \c_@@_appendices_label_str {appendices}
\seq_new:N \g_@@_label_seq
@@ -65,7 +65,9 @@
}
\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}{}{
@@ -81,10 +83,17 @@
\seq_set_split:Nnn \g_@@_label_seq {#1} {#2}
}
% MATCH delimiter, parent, and wildcard symbols, but CAPTURE only
% parents and wildcards, NOT delimiters.
\regex_const:Nn \c_@@_ref_regex {\/|(\.|\*)} %{\\\c_@@_label_delimiter_str|(\\\c_@@_label_parent_str|\\\c_@@_label_wildcard_str)}
%\regex_show:N \c_@@_ref_regex
\str_new:N \l_@@_esc_parent_str
\exp_args:Nnne \str_concat:NNN \l_@@_esc_parent_str \c_backslash_str \c_@@_label_parent_str
\str_new:N \l_@@_esc_placeholder_str
\exp_args:Nnne \str_concat:NNN \l_@@_esc_placeholder_str \c_backslash_str \c_@@_label_placeholder_str
% MATCH delimiter, parent, and placeholder symbols, but CAPTURE only
% parents and placeholders, NOT delimiters.
%\regex_const:Nn \c_@@_ref_regex {\/|(\.|\*)}
\exp_args:Nne \regex_const:Nn \c_@@_ref_regex {\c_@@_label_delimiter_str|(\l_@@_esc_parent_str|\l_@@_esc_placeholder_str)}
\regex_log:N \c_@@_ref_regex
\seq_new:N \l_@@_label_seq
\seq_new:N \l_@@_ref_seq
@@ -104,12 +113,16 @@
% Output the section name only if no star is passed.
\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".
\prop_item:Nn \c_@@_section_names_prop {9}
}{
} {
% 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.
@@ -135,9 +148,11 @@
% Split the string on the delimiters.
\exp_args:NNNe \seq_set_regex_split:NNn \l_@@_ref_seq \c_@@_ref_regex {#2}
% The regex split creates a lot of empty items, so remove them.
\seq_remove_all:Nn \l_@@_ref_seq {}
\str_log:N \l_@@_ref_str
% Log the input and output of the split process for debugging.
\str_log:n {#2}
\seq_log:N \l_@@_ref_seq
% Copy the current label sequence to a local variable.
@@ -149,22 +164,32 @@
% end of the temporary label sequence for each parent symbol.
\seq_map_indexed_function:NN \l_@@_ref_seq \@@_seq_map:nn
% Add the shortened temporary label sequence to the beginning of the
% reference sequence.
\str_if_eq:eeT {\str_head:N \l_@@_ref_str} {\c_@@_label_parent_str} {
\str_set:Ne \l_@@_ref_head_str {\str_head:n {#2}}
\str_log:N \l_@@_ref_head_str
% If the reference is relative (i.e. does not start with / or *), add the
% shortened temporary label sequence to the beginning of the reference
% sequence.
\exp_args:Ne \bool_if:nF {
\str_if_eq_p:NN \l_@@_ref_head_str \c_@@_label_delimiter_str
|| \str_if_eq_p:NN \l_@@_ref_head_str \c_@@_label_placeholder_str
} {
\seq_concat:NNN \l_@@_ref_seq \l_@@_label_seq \l_@@_ref_seq
}
\seq_log:N \l_@@_ref_seq
% Join the reference sequence back into a delimited string.
\str_set:Ne \l_@@_ref_str {\seq_use:Ne \l_@@_ref_seq {\c_@@_label_delimiter_str}}
\str_set:Ne \l_@@_ref_str {
\seq_use:Ne \l_@@_ref_seq {\c_@@_label_delimiter_str}
}
\str_if_eq:eeF {\str_head:N \l_@@_ref_str} {\c_@@_label_delimiter_str} {
\str_put_left:Ne \l_@@_ref_str {\c_@@_label_delimiter_str}
}
\str_set_eq:NN #1 \l_@@_ref_str
\str_set_eq:NN #1 \l_@@_ref_str
}
\tl_new:N \l_@@_trash_tl
@@ -175,7 +200,7 @@
\seq_pop_right:NN \l_@@_label_seq \l_@@_trash_tl
\seq_pop_left:NN \l_@@_ref_seq \l_@@_trash_tl
}
{\c_@@_label_wildcard_str} {
{\c_@@_label_placeholder_str} {
%\message{wildcard~map}
\seq_pop_left:NN \l_@@_label_seq \l_tmpa_tl
% \seq_pop_left:NN \l_@@_ref_seq \l_@@_trash_tl

View File

@@ -44,8 +44,8 @@
}
}
\NewExpandableDocumentCommand{\ProjectTitle}{}{%
Project \@CustomerProjectNumber{}: \@ProjectDescription%
\NewExpandableDocumentCommand{\ProjectTitle}{}{
Project~\@CustomerProjectNumber{}:~\@ProjectDescription
}
% Custom document properties.

View File

@@ -15,11 +15,11 @@
\renewcommand{\footrulewidth}{0pt}
\NewDocumentCommand{\chapappname}{}{Chapter~\thechapter{}:~}
\NewDocumentCommand{\partlabel}{}{\partname{}~\thepart{}:~\parttitle}
\NewDocumentCommand{\partlabel}{}{\bool_if:NT \g_label_bool {\partname{}~\thepart{}:~}\parttitle}
\NewDocumentCommand{\FrontMatter}{}{
\pagestyle{plain}
\bool_if:NTF \g_electronic_bool {
\bool_if:nTF {\g_electronic_bool || !\g_roman_bool} {
\pagenumbering{arabic}
}{
\pagenumbering{roman}
@@ -28,7 +28,9 @@
\NewDocumentCommand{\MainMatter}{}{
\pagestyle{fancy}
\pagenumbering{arabic}
\bool_if:NF \g_electronic_bool {
\pagenumbering{arabic}
}
}
\NewDocumentCommand{\Appendix}{}{

View File

@@ -3,12 +3,21 @@
Definition for title page.
}
\fp_const:Nn \c_@@_scale_fp {1}
\str_const:Ne \c_@@_dark_str {\bool_if:NT \g_dark_mode_bool {-dark}}
\NewDocumentCommand{\PrimeLogo}{O{width=2in} O{}}{
\includegraphics[keepaspectratio,#1]{#2Prime-Controls\c_@@_dark_str.pdf}
}
% Define custom title page.
\NewDocumentCommand{\PrimeTitlePage}{O{}}{
\thispagestyle{empty}
\pdfbookmark{Title Page}{title-page}
\pdfbookmark{Title~Page}{title-page}
\begin{sbfamily}
{\noindent\large\raggedright % Not RaggedRight because we don't want hyphens.
{\large\raggedright % Not RaggedRight because we don't want hyphens.
\vspace*{\stretch{1}}
\CustomerFull
@@ -27,14 +36,17 @@
% Move the rule graphic to 0.25 in from the left edge of the
% paper and vertically centered on the heartbeat graphic.
\put(-\oddsidemargin-0.75in,10pt){
\includegraphics{#1prime-rule.pdf}
\includegraphics{#1prime-rule\c_@@_dark_str.pdf}
}
% The numbers here are just what looks good.
\put(100pt,0pt){
\includegraphics{#1prime-heartbeat.pdf}
\includegraphics{#1prime-heartbeat\c_@@_dark_str.pdf}
}
}
\bigbreak
\AuthorCompany\par
Revision~\Version\par

View File

@@ -10,13 +10,13 @@
\titleformat{\part}[display]{
\normalfont\sbfamily\huge
}{
\partname{} \thepart
\partname{}~\thepart
}{20pt}{\Huge\raggedright}
\titleformat{\chapter}[display]{
\normalfont\sbfamily\huge\raggedright
}{
\chaptertitlename{} \thechapter
\chaptertitlename{}~\thechapter
}{20pt}{\Huge}
\titlespacing{\chapter}{0pt}{48pt plus 12pt minus 12pt}{24pt plus 6pt minus 6pt}