diff --git a/Manual.cls b/Manual.cls index a93b79a..5612222 100644 --- a/Manual.cls +++ b/Manual.cls @@ -4,14 +4,13 @@ published by Prime Controls. } -% Option 'electronic': single side printing. +% Option 'electronic': single side printing, among other things. \bool_new:N \g_electronic_bool \bool_gset_false:N \g_electronic_bool \DeclareOption{electronic}{ \bool_gset_true:N \g_electronic_bool } - \NewExpandableDocumentCommand{\IsElectronic}{}{\g_electronic_bool} % Option 'admin': turn on admin manual sections. @@ -21,17 +20,16 @@ \DeclareOption{admin}{ \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. Only applies if +% electronic mode is also on. \bool_new:N \g_dark_mode_bool \bool_gset_false:N \g_dark_mode_bool \DeclareOption{darkmode}{ - \bool_gset_true:N \g_dark_mode_bool + \bool_gset:Nn \g_dark_mode_bool {\g_electronic_bool} } - \NewExpandableDocumentCommand{\IsDarkMode}{}{\g_dark_mode_bool} % Option 'draft': same as base book class, but with bigger overfull boxes. @@ -42,17 +40,16 @@ \bool_gset_true:N \g_draft_bool \overfullrule = 1in } - \NewExpandableDocumentCommand{\IsDraft}{}{\g_draft_bool} -% Option 'roman': render Part numbers as Roman numerals. +% Option 'roman': render Part numbers and print-format front matter page numbers +% as Roman numerals. \bool_new:N \g_roman_bool \bool_gset_false:N \g_roman_bool \DeclareOption{roman}{ \bool_gset_true:N \g_roman_bool } - \NewExpandableDocumentCommand{\DoRomanNumerals}{}{\g_roman_bool} % Option 'labels': show Part and Chapter labels in the header. @@ -62,7 +59,6 @@ \DeclareOption{labels}{ \bool_gset_true:N \g_label_bool } - \NewExpandableDocumentCommand{\ShowLabels}{}{\g_label_bool} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}} diff --git a/commonincludes.def b/commonincludes.def index 062db0e..2d8877d 100644 --- a/commonincludes.def +++ b/commonincludes.def @@ -35,8 +35,6 @@ \RequirePackage{hyperref} -%\RequirePackage{ifthen} - \RequirePackage{lua-widow-control} % Index formatting. diff --git a/graphics/Prime-Controls-dark.pdf b/graphics/Prime-Controls-dark.pdf new file mode 100644 index 0000000..870db8e Binary files /dev/null and b/graphics/Prime-Controls-dark.pdf differ diff --git a/graphics/Prime-Controls-nofont-dark.svg b/graphics/Prime-Controls-nofont-dark.svg new file mode 100644 index 0000000..f8ac51b --- /dev/null +++ b/graphics/Prime-Controls-nofont-dark.svg @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/graphics/prime-heartbeat-dark.pdf b/graphics/prime-heartbeat-dark.pdf new file mode 100644 index 0000000..100a1a2 Binary files /dev/null and b/graphics/prime-heartbeat-dark.pdf differ diff --git a/graphics/prime-heartbeat-dark.svg b/graphics/prime-heartbeat-dark.svg new file mode 100644 index 0000000..a252771 --- /dev/null +++ b/graphics/prime-heartbeat-dark.svg @@ -0,0 +1,83 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/graphics/prime-rule-dark.pdf b/graphics/prime-rule-dark.pdf new file mode 100644 index 0000000..991c69b Binary files /dev/null and b/graphics/prime-rule-dark.pdf differ diff --git a/graphics/prime-rule-dark.svg b/graphics/prime-rule-dark.svg new file mode 100644 index 0000000..ed995bf --- /dev/null +++ b/graphics/prime-rule-dark.svg @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/packages/CrossRef.sty b/packages/CrossRef.sty index 86cdd39..2714c60 100644 --- a/packages/CrossRef.sty +++ b/packages/CrossRef.sty @@ -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 diff --git a/packages/DocProperties.sty b/packages/DocProperties.sty index 094c2e7..7bfccd0 100644 --- a/packages/DocProperties.sty +++ b/packages/DocProperties.sty @@ -44,8 +44,8 @@ } } -\NewExpandableDocumentCommand{\ProjectTitle}{}{% - Project \@CustomerProjectNumber{}: \@ProjectDescription% +\NewExpandableDocumentCommand{\ProjectTitle}{}{ + Project~\@CustomerProjectNumber{}:~\@ProjectDescription } % Custom document properties. diff --git a/packages/Header.sty b/packages/Header.sty index a4b1d17..fd814ee 100644 --- a/packages/Header.sty +++ b/packages/Header.sty @@ -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}{}{ diff --git a/packages/TitlePage.sty b/packages/TitlePage.sty index ea487ab..7e0be6f 100644 --- a/packages/TitlePage.sty +++ b/packages/TitlePage.sty @@ -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 diff --git a/packages/Titles.sty b/packages/Titles.sty index 3995a99..1ea0324 100644 --- a/packages/Titles.sty +++ b/packages/Titles.sty @@ -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}