diff options
Diffstat (limited to 'macros/latex/contrib/knowledge/knowledge-code.dtx')
-rw-r--r-- | macros/latex/contrib/knowledge/knowledge-code.dtx | 79 |
1 files changed, 61 insertions, 18 deletions
diff --git a/macros/latex/contrib/knowledge/knowledge-code.dtx b/macros/latex/contrib/knowledge/knowledge-code.dtx index 0f66f049d1..2f6a4f0a12 100644 --- a/macros/latex/contrib/knowledge/knowledge-code.dtx +++ b/macros/latex/contrib/knowledge/knowledge-code.dtx @@ -23,7 +23,7 @@ % % \iffalse %<head>\usepackage{expl3} -%<head>\ProvidesExplPackage{knowledge}{2022/01/12}{1.27}{} +%<head>\ProvidesExplPackage{knowledge}{2022/02/12}{1.28}{} %<*driver> \def\knowledgecode{active} \input{knowledge.tex} @@ -60,6 +60,7 @@ % \changes{1.25}{2021/03/31}{bug correction} % % \changes{1.26}{2021/12/20}{enhanced math+other functionalities+extra options} % % \changes{1.27}{2022/01/12}{doc changes} % +% \changes{1.28}{2022/02/12}{imakeidx support} % % \GetFileInfo{knowledge.sty} % % \DoNotIndex{} % @@ -79,8 +80,8 @@ This directory contains the package name: knowledge license: LaTeX Project Public License version 1.2 or above - version: v1.27 - date: 2022/01/12 + version: v1.28 + date: 2022/02/12 author: Thomas Colcombet mail: thomas.colcombet@irif.fr web: https://ctan.org/pkg/knowledge @@ -620,9 +621,16 @@ This directory contains the package % % \subsubsection{External package options} % -%\csintro{\knowledge_xcolor_active_bool}, \csintro{\knowledge_xcolor_syntax_bool}, -%\csintro{\knowledge_hyperref_active_bool}, \csintro{\knowledge_hyperref_syntax_bool}, -%\csintro{\knowledge_makeidx_active_bool}, \csintro{\knowledge_makeidx_syntax_bool} +%\csintro{\knowledge_xcolor_active_bool}, +% \csintro{\knowledge_xcolor_syntax_bool}, +%\csintro{\knowledge_hyperref_active_bool}, +%\csintro{\knowledge_hyperref_syntax_bool}, +%\csintro{\knowledge_makeidx_active_bool}, +%\csintro{\knowledge_makeidx_syntax_bool}, +%\csintro{\knowledge_imakeidx_active_bool}, +%\csintro{\knowledge_imakeidx_syntax_bool}. +% +% % % First, one tests the package available. % \csintro{\package_if_loaded:nTF} tests if a package is loaded. @@ -645,6 +653,7 @@ This directory contains the package \knowledge_option_aci_test_loaded:n{hyperref} \knowledge_option_aci_test_loaded:n{xcolor} \knowledge_option_aci_test_loaded:n{makeidx} +\knowledge_option_aci_test_loaded:n{imakeidx} \knowledge_option_aci_test_loaded:n{cleveref} % \end{macrocode} %\begin{quote}\tt @@ -690,6 +699,7 @@ This directory contains the package \knowledge_option_aci_define:n{hyperref} \knowledge_option_aci_define:n{xcolor} \knowledge_option_aci_define:n{makeidx} +\knowledge_option_aci_define:n{imakeidx} \knowledge_option_aci_define:n{cleveref} % \end{macrocode} % @@ -762,6 +772,7 @@ This directory contains the package \knowledge_option_aci_autoload:nnn{ hyperref }{}{} \knowledge_option_aci_autoload:nn{ xcolor }{} \knowledge_option_aci_autoload:nn{ makeidx }{} +\knowledge_option_aci_autoload:nn{ imakeidx }{} \knowledge_option_aci_autoload:nn{ cleveref }{} % \end{macrocode} % @@ -3988,7 +3999,7 @@ This directory contains the package % \end{macrocode} % % -% \subsubsection{The \kl{makeidx option}} +% \subsubsection{The \kl{makeidx option} and \kl{imakeidx} options} % % \begin{macrocode} %\bool_if:NT\knowledge_makeidx_active_bool{ @@ -4008,18 +4019,36 @@ This directory contains the package % }}}} %} % \end{macrocode} +% Since "imakeidx@@package" extends the syntax of "makeidx@@package", +% internally, activating the package or the syntax for "imakeidx@@package" +% does the same thing for "makeidx@@package". +% \begin{macrocode} +\bool_if:NT\knowledge_imakeidx_active_bool{\bool_set_true:N\knowledge_makeidx_active_bool} +\bool_if:NT\knowledge_imakeidx_syntax_bool{\bool_set_true:N\knowledge_makeidx_syntax_bool} +% \end{macrocode} +% The index option has to variant, depending on whether the name of the index is used or not. % \begin{macrocode} +\cs_new:Npn \knowledge_index:nn #1 #2{ + \tl_if_empty:nTF {#1} + {\index{#2}} + {\index[{#1}]{#2}} + } + +\cs_generate_variant:Nn \knowledge_index:nn {xx} + \cs_new:Nn\knowledge_kl_compute_code_makeidx:{ \bool_if:NF\knowledge_kl_noindex_bool{ \tl_if_exist_ne:NTF\knowledge_kl_index_tl - {\exp_args:Nx\index - {\tl_if_exist_ne:NTF\knowledge_kl_index_parent_key_tl - {\exp_not:V\knowledge_kl_index_parent_key_tl!}{} - \tl_if_exist_ne:NTF\knowledge_kl_index_key_tl - {\exp_not:V\knowledge_kl_index_key_tl@}{} + {\knowledge_index:xx + {\tl_if_exist_ne:NTF \knowledge_kl_index_name_tl + {\exp_not:V \knowledge_kl_index_name_tl}{}} + {\tl_if_exist_ne:NTF\knowledge_kl_index_parent_key_tl + {\exp_not:V\knowledge_kl_index_parent_key_tl!}{} + \tl_if_exist_ne:NTF\knowledge_kl_index_key_tl + {\exp_not:V\knowledge_kl_index_key_tl@}{} \expandafter\tl_to_str:n\expandafter{\knowledge_kl_index_tl} \tl_if_exist_ne:NTF\knowledge_kl_index_number_style_tl - {|\exp_not:V\knowledge_kl_index_number_style_tl}{} + {|\exp_not:V\knowledge_kl_index_number_style_tl}{} }}{} } } @@ -4034,12 +4063,26 @@ This directory contains the package {\knowledge_delay_directive:n{index={#1}}}}, index .default:n = {} } - -\NewKnowledgeParamTl*[\knowledge_kl_index_number_style_tl]{index~style} -\NewKnowledgeParamTl*[\knowledge_kl_index_parent_key_tl]{index~parent~key} -\NewKnowledgeParamTl*[\knowledge_kl_index_key_tl]{index~key} -\NewKnowledgeParamBool*{no~index}\knowledge_kl_noindex_bool + +\bool_if:NT\knowledge_makeidx_syntax_bool +{ \NewKnowledgeParamTl*[\knowledge_kl_index_number_style_tl]{index~style} + \NewKnowledgeParamTl*[\knowledge_kl_index_parent_key_tl]{index~parent~key} + \NewKnowledgeParamTl*[\knowledge_kl_index_key_tl]{index~key} + \NewKnowledgeParamBool*{no~index}\knowledge_kl_noindex_bool +} +\bool_if:NT\knowledge_imakeidx_syntax_bool { + \NewKnowledgeParamTl*[\knowledge_kl_index_name_tl]{index~name} +} % \end{macrocode} +% Activating error message is packages not loaded. +% \begin{macrocode} +\knowledge_directives_require_aci_package:nn + {index,index~key,index~parent~key,index~style}{makeidx} +\knowledge_directives_require_aci_package:nn + {index~name}{imakeidx} +% \end{macrocode} +% +% % % \subsubsection{The \kl{cleveref option}} % |