diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/knowledge/knowledge.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/knowledge/knowledge.sty | 66 |
1 files changed, 51 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/latex/knowledge/knowledge.sty b/Master/texmf-dist/tex/latex/knowledge/knowledge.sty index b4990b54358..5bdb9ba13bc 100644 --- a/Master/texmf-dist/tex/latex/knowledge/knowledge.sty +++ b/Master/texmf-dist/tex/latex/knowledge/knowledge.sty @@ -23,11 +23,12 @@ %% LaTeX version 1999/12/01 or later. %% \usepackage{expl3} -\ProvidesExplPackage{knowledge}{2017/10/10}{v1.06}{} +\ProvidesExplPackage{knowledge}{2017/10/10}{v1.07}{} %%%%%%%%%% \RequirePackage{l3keys2e} \RequirePackage{etoolbox} \RequirePackage{xparse} +\RequirePackage{etoolbox} \bool_if_exist:NTF\knowledge_package_loaded_bool {\endinput} {\bool_new:N\knowledge_package_loaded_bool @@ -192,7 +193,10 @@ \tl_gput_right:Nn\kaux_command_list_tl{#1} } \NewDocumentCommand\KAuxCommand{mmm} - {\ProvideDocumentCommand#1{#2}{}} + { \cs_if_exist:NTF #1 + {} + {\ProvideDocumentCommand#1{#2}} + } \NewDocumentCommand\ActivateKAuxPhase{m}{ \tl_map_inline:Nn\kaux_command_list_tl {\kaux_activate_command_phase:Nn##1{#1}} @@ -818,7 +822,7 @@ \msg_new:nnn{knowledge}{recap~autoref~not~introduced} {Some~knowledge~is~used~but~not~introduced.~See~the~'.diagnose'~file~for~more~information.} \tl_clear_new:N\knowledge_configuration_pending_tl -\NewDocumentCommand\knowledgeconfigure{m}{ +\newrobustcmd\knowledgeconfigure[1]{ \keys_set:nn{ knowledge~configuration~options }{#1} } \NewDocumentCommand\KnowledgeConfigureBooleanOption{om} @@ -857,7 +861,7 @@ { #1 .code:n = {\tl_put_right:Nn\knowledge_configuration_pending_tl{,#2={##1}} }} } } -\NewDocumentCommand\KnowledgePackageTrigger{mm} +\newrobustcmd\KnowledgePackageTrigger[2] { \keys_define:nn{ knowledge~package~options }{ #1 .code:n = {#2} } \keys_define:nn{ knowledge~configuration~options }{ #1 .code:n = {\knowledge_error:n @@ -945,11 +949,14 @@ \bool_set_false:c{knowledge_#1_syntax_bool}}, #1 .default:n = {active} }} -\cs_new:Nn\knowledge_option_aci_autoload:nn{ +\cs_new:Nn\knowledge_option_aci_autoload:nnn{ \bool_if:cTF{knowledge_#1_active_bool} {\package_if_loaded:nTF{#1}{} - {\RequirePackage[#2]{#1}}}{} + {\RequirePackage[#2]{#1}{#3}}} + {} } +\cs_new:Nn\knowledge_option_aci_autoload:nn + {\knowledge_option_aci_autoload:nnn{#1}{#2}{}} \knowledge_option_bool_new:n{scope} \knowledge_option_aci_define:n{hyperref} \knowledge_option_aci_define:n{xcolor} @@ -998,7 +1005,7 @@ \keys_set:nV{ knowledge~package~modes }{ composition }} } \keys_set:nV{ knowledge~package~modes }\knowledge_option_mode_tl -\knowledge_option_aci_autoload:nn{ hyperref }{} +\knowledge_option_aci_autoload:nnn{ hyperref }{}{\hypersetup{hidelinks}} \knowledge_option_aci_autoload:nn{ xcolor }{} \knowledge_option_aci_autoload:nn{ makeidx }{} \tl_const:Nn\scope_tl{SC@PE} @@ -1079,7 +1086,7 @@ \cs_new:Npn\scope_area_if_in_scope:nTF#1 {\int_compare:nNnTF {\use:c{\scope_tl.area[#1].nesting_int}}>0} -\NewDocumentCommand\ScopeConfigure{mm} +\newrobustcmd\ScopeConfigure[2] {\scope_area_set:nn{#1}{#2}} \cs_new:Nn\scope_area_set:nn {\clist_map_inline:nn{#1} @@ -1591,7 +1598,20 @@ % \msg_warning:nn{knowledge}{recap~autoref~not~introduced} } - % + \int_compare:nNnT\kl_digest_autorefunused_int>0{ + \knowledge_diagnose:n{***********************************} + \knowledge_diagnose:n{*~Autoref~introduced~but~not~used~*} + \knowledge_diagnose:n{***********************************} + \knowledge_diagnose:n{} + % + \knowledge_diagnose_reset_line: + \KAuxProcess{autoref-introduced-not-used} + % + \knowledge_diagnose:n{} + \knowledge_diagnose:n{} + % + } + % \iffalse \knowledge_diagnose:n{***********************} \knowledge_diagnose:n{*~Exported~knowledges~*} @@ -1757,7 +1777,7 @@ Takes~the~{namespace}{instance}{knowledge}{directives}.} \DeclareKAuxPhaseCommand\KAuxKnowledge{init} {\knowledge_set_now:nnnn{#1}{#2}{#3}{#4}} -\NewKAuxCommand\KAuxExport{mmmm} +\newrobustcmd\KAuxExport[4] {Package~knowledge:~undefined~so~far.} \cs_new:Nn\knowledge_new_now:nnnn {\knowledge_sets_to:nnn{#1}{#2}{#3} @@ -2045,6 +2065,7 @@ {{#1}{#2}{\exp_not:n{#3}}} \exp_args:NNc\tl_set:Nn\knowledge_kl_resourcetoken_tl {\knowledge_id:nnn{#1}{#2}{#3}} + \expandafter\ktuple_countuse_gincr:N\knowledge_kl_resourcetoken_tl % \tl_clear:N\knowledge_kl_link_tl \tl_clear:N\knowledge_kl_linkscope_tl @@ -2439,10 +2460,14 @@ \knowledge_at:N\ktuple_countuse_get_int:NN\kl_countuse_int \knowledge_at:N\ktuple_countintro_get_int:NN\kl_countintro_int \int_compare:nNnT\kl_countintro_int=1 - {\int_gincr:N\kl_digest_autorefused_int} - \int_compare:nNnT\kl_countintro_int=0 - {\int_compare:nNnTF\kl_countuse_int=0 + { + \int_compare:nNnTF\kl_countuse_int=1 {\int_gincr:N\kl_digest_autorefunused_int} + {\int_gincr:N\kl_digest_autorefused_int} + } + \int_compare:nNnT\kl_countintro_int=0 + {\int_compare:nNnF\kl_countuse_int=0 + %{\int_gincr:N\kl_digest_autorefunused_int} {\int_gincr:N\kl_digest_autorefnointro_int}} \int_compare:nNnT\kl_countintro_int>1 {\int_gincr:N\kl_digest_autoreftwiceintro_int} @@ -2458,6 +2483,17 @@ {\knowledge_diagnose_line: \knowledge_diagnose:n{\nointro{#1}{#2}{#3}}}} \group_end:} +\DeclareKAuxPhaseCommand\KAuxAutoref{autoref-introduced-not-used} + {\group_begin: + \knowledge_sets_to:nnn{#1}{#2}{#3} + \knowledge_at:N\ktuple_countuse_get_int:NN\kl_countuse_int + \knowledge_at:N\ktuple_countintro_get_int:NN\kl_countintro_int + \int_compare:nNnT\kl_countuse_int=1 + {\int_compare:nNnT\kl_countintro_int=1 + {\knowledge_diagnose_line: + \knowledge_diagnose:x{\kaux_current_location:\space + \exp_not:n{{#3}{#1}{#2}}}}} + \group_end:} \DeclareKAuxPhaseCommand\KAuxAutorefTarget{autoref-introduced-twice} {\group_begin: \knowledge_sets_to:nnn{#1}{#2}{#3} @@ -2465,7 +2501,8 @@ \knowledge_at:N\ktuple_countintro_get_int:NN\kl_countintro_int \int_compare:nNnT\kl_countintro_int>1 {\knowledge_diagnose_line: - \knowledge_diagnose:x{\kaux_current_location:\space\exp_not:n{knowledge={#3},namespace=#1,scope=#2}}} + \knowledge_diagnose:x{\kaux_current_location:\space + \exp_not:n{{#3}{#1}{#2}}}} \group_end:} \NewKAuxCommand\KAuxUseKnowledge{mmm} {Package~knowledge:~Identifies~the~use~of~some~knowledge.~ @@ -2797,7 +2834,6 @@ \knowledge_directives_require_aci_package:nn {url,ref,autoref}{hyperref} \bool_if:NT\knowledge_hyperref_active_bool{ - \hypersetup{hidelinks} \DeclareExpandableDocumentCommand\knowledge_fake_klTKS{mmm}{#1} \pdfstringdefDisableCommands{% \let\klTKS\knowledge_fake_klTKS |