From 616c521c384e57c806536b2e58226c7bf2be27f1 Mon Sep 17 00:00:00 2001 From: Joshua Lucas Date: Tue, 30 Sep 2025 16:22:14 -0500 Subject: [PATCH] - Tweak code colors. - Debug CrossRef. --- packages/Color.sty | 14 +++++++------- packages/CrossRef.sty | 44 +++++++++++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/packages/Color.sty b/packages/Color.sty index 2feae23..2b07af3 100644 --- a/packages/Color.sty +++ b/packages/Color.sty @@ -158,9 +158,9 @@ % Code snippet syntax highlighting colors. \colorlet{codeKeywordColor}{PrimeLightBlue} - \colorlet{codeOperatorColor}{PrimeLightOrange} + \colorlet{codeOperatorColor}{PrimeLightPink} \colorlet{codeCommentColor}{PrimeLightMint} - \colorlet{codeNumberColor}{PrimeLightPink} + \colorlet{codeNumberColor}{textColor} \colorlet{codeStringColor}{PrimeLightLime} } { % Page and text colors. @@ -197,11 +197,11 @@ \colorlet{layoutColor}{PrimePaleBlue} % Code snippet syntax highlighting colors. - \colorlet{codeKeywordColor}{PrimeDarkBlue} - \colorlet{codeOperatorColor}{PrimeDarkOrange} - \colorlet{codeCommentColor}{PrimeDarkMint} - \colorlet{codeNumberColor}{PrimeDarkPink} - \colorlet{codeStringColor}{PrimeDarkLime} + \colorlet{codeKeywordColor}{PrimeBlue} + \colorlet{codeOperatorColor}{PrimePink} + \colorlet{codeCommentColor}{PrimeMint} + \colorlet{codeNumberColor}{textColor} + \colorlet{codeStringColor}{PrimeLime} } \pagecolor{pageColor} diff --git a/packages/CrossRef.sty b/packages/CrossRef.sty index 2714c60..117a6f7 100644 --- a/packages/CrossRef.sty +++ b/packages/CrossRef.sty @@ -7,14 +7,14 @@ \debug_on:n {all} \prop_const_from_keyval:Nn \c_@@_section_names_prop { - 1 = Part\nobreakspace, - 2 = Chapter\nobreakspace, - 3 = Section\nobreakspace, - 4 = Subsection\nobreakspace, - 5 = Sub-subsection\nobreakspace, - 6 = Paragraph\nobreakspace, - 7 = Subparagraph\nobreakspace, - 8 = Appendix\nobreakspace, + 1 = Part, + 2 = Chapter, + 3 = Section, + 4 = Subsection, + 5 = Sub-subsection, + 6 = Paragraph, + 7 = Subparagraph, + 8 = Appendix, } \prop_const_from_keyval:Nn \c_@@_section_levels_prop { @@ -61,7 +61,7 @@ } \NewDocumentCommand{\Subparagraph}{s t^ m >{\TrimSpaces}m}{ - \@@_heading:nnnnn {subparagaph} {#1} {#2} {#3} {#4} + \@@_heading:nnnnn {subparagraph} {#1} {#2} {#3} {#4} } \NewDocumentCommand{\Appendices}{}{ @@ -91,7 +91,6 @@ % 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 @@ -99,6 +98,7 @@ \seq_new:N \l_@@_ref_seq \str_new:N \l_@@_ref_str +\str_new:N \l_@@_section_name_str \NewDocumentCommand{\HiRef}{ % #1: Star (No star = include section name in reference, star = do not include). @@ -107,26 +107,38 @@ >{\TrimSpaces}m }{ \group_begin: + %\prop_show:N \c_@@_section_names_prop + %\str_set:Ne \l_@@_ref_str {#2} \@@_HiRef_process:Nn \l_@@_ref_str {#2} + \str_set:Nn \l_@@_section_name_str {} + % 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:eeTF { + \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} + \str_set:Ne \l_@@_section_name_str {\prop_item:Nn \c_@@_section_names_prop {8}} } { % Otherwise, look up the correct section name. - \prop_item:Nn \c_@@_section_names_prop { - \seq_count:N \l_@@_ref_seq - 1 + \str_set:Ne \l_@@_section_name_str { + \prop_item:Ne \c_@@_section_names_prop { + \int_eval:n{\seq_count:N \l_@@_ref_seq} + } } } } % Create a reference with the string we just created. - \exp_args:Ne \ref {\l_@@_ref_str} + \hyperref [\l_@@_ref_str] { + \l_@@_section_name_str\nobreakspace\ref {\l_@@_ref_str} + } + + \group_end: } \NewDocumentCommand{\HiperRef}{