diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/knowledge/README.md | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/knowledge/knowledge.pdf | bin | 671069 -> 673977 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/knowledge/knowledge.tex | 61 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx | 79 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/knowledge/knowledge-utils.dtx | 65 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/knowledge/knowledge.ins | 1 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/knowledge/knowledge.sty | 119 |
7 files changed, 195 insertions, 134 deletions
diff --git a/Master/texmf-dist/doc/latex/knowledge/README.md b/Master/texmf-dist/doc/latex/knowledge/README.md index 15a7661ddd4..e78dd4ff02d 100644 --- a/Master/texmf-dist/doc/latex/knowledge/README.md +++ b/Master/texmf-dist/doc/latex/knowledge/README.md @@ -3,8 +3,8 @@ This directory contains the package name: knowledge license: LaTeX Project Public License version 1.2 or above - version: v1.08 - date: 2017/10/17 + version: v1.10 + date: 2018/02/17 author: Thomas Colcombet mail: thomas.colcombet@irif.fr web: https://www.irif.fr/~colcombe/knowledge_en.html diff --git a/Master/texmf-dist/doc/latex/knowledge/knowledge.pdf b/Master/texmf-dist/doc/latex/knowledge/knowledge.pdf Binary files differindex 62a60f9e886..d3b3246c9fc 100644 --- a/Master/texmf-dist/doc/latex/knowledge/knowledge.pdf +++ b/Master/texmf-dist/doc/latex/knowledge/knowledge.pdf diff --git a/Master/texmf-dist/doc/latex/knowledge/knowledge.tex b/Master/texmf-dist/doc/latex/knowledge/knowledge.tex index 6c57864cf3c..d104052f6bc 100644 --- a/Master/texmf-dist/doc/latex/knowledge/knowledge.tex +++ b/Master/texmf-dist/doc/latex/knowledge/knowledge.tex @@ -29,7 +29,8 @@ \CodelineIndex \RecordChanges - +\let\oldbibitem\bibitem +\renewrobustcmd\bibitem\oldbibitem @@ -114,7 +115,7 @@ default style={autoref link,cs}, unknown style=cs unknown, unknown style cont=cs unknown, - unknown warning=f alse, + unknown warning=false, unknown diagnose=true, suggestion=cs, PDF string={\detokenize{#1}}} @@ -176,7 +177,7 @@ \knowledge {experimental}{doc notion,color=gray} -\ExplSyntaxOn +%\ExplSyntaxOn \NewDocumentCommand\robustdisplaycs{m} {\expandafter\robustdisplay\csname#1\endcsname} @@ -191,16 +192,13 @@ \knowledge{AucTex}{typewriter} \knowledge{Emacs}[emacs|EMACS]{typewriter} -\makeatletter -\let\arobas @ -\makeatother - +\ExplSyntaxOff \knowledgestyle{tt}{typewriter,up,md,color=NavyBlue} \knowledgestyle{tt intro}{typewriter,up,md,color=blue} \knowledgedirective{kcommand}{style=tt,intro style=tt intro,autoref} - -\knowledgedirective{kquotation}{style=tt,intro style=tt intro,autoref} -\knowledge{"..."}{kquotation,text=\kl"$\cdots$\kl{"}} +\knowledgedirective{kquotation}{style=tt, intro style=tt intro,autoref} +\ExplSyntaxOn +\knowledge{"..."}{kquotation,text=\kl{"}$\cdots$\kl{"}} \knowledge{""...""}{kquotation,text=\kl{""}$\cdots$\kl{""}} \knowledge{"...@..."}{kquotation,text=\kl{"}$\cdots\arobas\cdots$\kl{"}} \knowledge{""...@...""}{kquotation,text=\kl{""}$\cdots\arobas\cdots$\kl{""}} @@ -208,9 +206,15 @@ \knowledge{""...@@...""}{kquotation,text=\kl{""}$\cdots\arobas\cdots\arobas\cdots$\kl{""}} \knowledge{"...@...@..."}{kquotation,text=\kl{"}$\cdots\arobas\cdots\arobas\cdots$\kl{"}} \knowledge{""...@...@...""}{kquotation,text=\kl{""}$\cdots\arobas\cdots\arobas\cdots$\kl{""}} -\knowledge{@}{kcommand,text=\arobas} +\ExplSyntaxOn + +\makeatletter +\let\arobas @ +\makeatother +\knowledge{@}{kcommand,text=\arobas} + \knowledge{tex}{text=\TeX} @@ -283,6 +287,7 @@ \knowledge{protect link}{directive} +\knowledge{strict}{directive} \knowledge{emphasize}{directive} \knowledge{underline}{directive} \knowledge{up}{directive} @@ -293,6 +298,7 @@ \knowledge{ensuretext}{directive} \knowledge{ensuremath}{directive} \knowledge{italic}[italic=]{directive} +\knowledge{smallcaps}[smallcaps=]{directive} \knowledge{lowercase}{directive} \knowledge{uppercase}{directive} \knowledge{mathord}{directive} @@ -592,21 +598,15 @@ This is still in beta version but close to a first definitive release. A lot of \label{section:todo} This is essentially a list for personal referencing of what has to be done. \begin{asparaitem} -\item make quoatation work properly in the titles of section..., +\item deactivate quotation by default in the preamble in particular for avoiding clashes with commands such as \cs\DeclareMathDelimiter. +\item make knowledge compatible with beamer (request of Patrick Aiyao He), probably use hypertarget and hyperlink instead of hyperlabel and hyperref. Seems complicated because I do not know how to know if some material is going to be displayed, and this is necessary for a complete working solution. +\item make quotation work properly in the titles of section..., \item allow to protect quotation in commands, and not only environments (for instance xymatrix) \item remove the warnings about redefining commands -\item give detail on where appear the multiple introduction of the same knowledge \item proper mathematics handling. Write a new \csintro{\NewDocumentCommand}-like macro \item detect using some trick that the previous compilation failed, and deactivate the Kaux file in this case (for the moment, removing the aux file deactivates the kaux file. This is convenient but not sufficient.) \item proper code for \cs{\nointro}. -\item Solve the problem of \cs{\kl} (and similar commands) being unknown when creating the pdf index. -\item improve the diagnose file - \begin{asparaenum} - \item more information on the origin of errors (file/line) - \item help possible in it - \item short or long version of diagnose upon request - \end{asparaenum} \item improving the \cs{\AP} and \cs{\itemAP} commands. For the moment \cs{\AP} silently fails inside the optional argument of \cs{\item}, and probably elsewhere too. See how this can be improved. \item solve the \kl(package){amsmath} problem that \cs{\label} is deactivated in unnumbered environment, while knowledge would nevertheless like to point to the place... @@ -685,6 +685,9 @@ This is essentially a list for personal referencing of what has to be done. \item[2017-10-10] Version 1.06 on "CTAN". \item[2017-10-15] Diagnose extended (suggested by Fabian Reiter). Minor corrections. Version 1.07 on "CTAN". \item[2017-10-17] Added "cyclic color" and "cyclic colors=@@option". Reorganization of the structure of the code for producing a better "CTAN" archive. Version 1.08 on "CTAN". +\item[2018-01-31] Added the "strict" configuration option. +\item[2018-02-05] Added the "smallcaps" formatting directive. +\item[2018-02-17] Corrected incompatibility with latest version of "expl3@@package". \end{compactdesc} \normalsize %\restoregeometry @@ -1141,6 +1144,7 @@ be used in the optional parameter of \cs{\usepackage} when loading the "knowledg This is typically useful around, e.g. the table of contents. \itemAP[\kl(option){quotation}] activates the "quotation notation", which allows to use \kl{"..."}, \kl{"...@..."} and \kl{"...@...@..."} instead of \cs{\kl} commands and \kl{""...""}, \kl{""...@...""} and \kl{""...@...@...""} instead of the \cs{\intro} command. +\itemAP[""strict""] is a Boolean option which, when activated turns some warnings (for instance when a knowledge is redefined) into errors. \itemAP[\kl{visible anchor points}] is an option that makes visible or invisible the \kl{anchor points} of the \cs{\AP} and \cs{\itemAP} commands. \end{description} @@ -1234,6 +1238,7 @@ The general boolean \kl[\knowledge directives]{directives} are the following: \itemAP[\intro{emphasize}] forces the text to be emphasized using `\cs{\emph}', \itemAP[\intro{italic}/\intro{up}] forces/unforces italic (be it in math or text mode), \itemAP[\intro{boldface}/\intro{md}] forces/unforces boldface (be it in math or text mode), +\itemAP[\intro{smallcaps}] forces small capitals, \itemAP[\intro{underline}] forces the text to be emphasized using `\cs{\underline}', \itemAP[\intro{fbox}] puts a box around the text, \itemAP[\intro{typewriter}] puts in typewriter font (be it in math or text mode), @@ -1254,7 +1259,8 @@ yield the corresponding standard \TeX{} spacing features in math mode, \itemAP[\intro{lowercase}] puts the content in lowercase, \itemAP[\intro{uppercase}] puts the content in uppercase, \itemAP[""detokenize""] detokenizes the content, i.e., instead of executing it provides a string that displays it (this is useful for commands), -\itemAP[""remove space""] +\itemAP[""remove space""] removes the spaces from the text +\itemAP[""invisible""] prevents the rendering of the knowledge. \end{description} @@ -1499,7 +1505,7 @@ These command define/modify a/the macro \cs{\variant} that uses the same syntax \itemAP[""unknown diagnose=@@variant""true/false] activates or deactivates the corresponding messages in the "diagnose file". True by default. \itemAP[""suggestion=@@variant""\{directives\}] configures the "directives" to be suggested in the "diagnose file" when the "knowledge" is unknown. -\itemAP[""PDF string=@@variant""\{code\}] gives a substitute text for "hyperref@@package" to use for producing the bookmarks. This code has to be expandable. The code may use three parameters; $\sharp1$ is the main text of the command, $\sharp 2$ is the optional parameter, and $\sharp 3$ is the scope. The macro \cs{\IfNoValueTF} of the package "xparse@@package" can be used to test if the second and third arguments are present. By default, the code is \texttt{\{$\sharp1$\}}. Note that the star syntax cannot be used in this context. It the expected result cannot be achieved usinf this directive, the less convenient macro \cs{\texorpdfstring} of the "hyperref@@package" should be used. +\itemAP[""PDF string=@@variant""\{code\}] gives a substitute text for "hyperref@@package" to use for producing the bookmarks. This code has to be expandable. The code may use three parameters; $\sharp1$ is the main text of the command, $\sharp 2$ is the optional parameter, and $\sharp 3$ is the scope. The macro \cs{\IfNoValueTF} of the package "xparse@@package" can be used to test if the second and third arguments are present. By default, the code is \texttt{\{$\sharp1$\}}. Note that the star syntax cannot be used in this context. It the expected result cannot be achieved using this directive, the less convenient macro \cs{\texorpdfstring} of the "hyperref@@package" package should be used. \end{compactdesc} \smallskip @@ -2290,6 +2296,15 @@ A workaround is to use the \texttt{breaklinks} option of \kl(package){hyperref} \kl{[...]}\par\noindent \end{code} +\subsection{Problems with scope} + +\subsubsection{Problems in combination with \cs{\bibitem}} + +The "scope option" of the package triggers some analysis of the code, and restrains the structure of the code (in particular, this is because "scopes" have to be nested, and thus some not so well nested part of "LaTeX" yields error). In particular, the "scope option" does not allow to have a \cs{\section} command inside a list. However, this is what does \cs{\bibitem}. + +Here is a hack to treat this situation: + + \subsection{Editor} \newenvironment{pquote}{\begin{quote}}{\end{quote}} @@ -2382,6 +2397,7 @@ If other kind of problems occur, report them to \texttt{thomas.colcombet@irif.fr \item[\kl{protect link}] Disables the hyperlinks inside the link. \item[\kl{ref=}] Links to a label inside the document. \item[\kl{scope=}] Choose the \kl{scope} of the definition. +\item[\kl{smallcaps}] Forces the use of small capitals. \item[\kl{style=}] Links to a style. \item[\kl{synonym}] Is a synonym of the lastly defined \kl{knowledge}. \item[\kl{text=}] Changes the output text. @@ -2409,6 +2425,7 @@ If other kind of problems occur, report them to \texttt{thomas.colcombet@irif.fr \item["paper"] switches to "paper mode", \item[\kl{protect link co} and \kl{unprotect link co}] starts and ends respectively a zone in which the "knowledge@@package" package does not create hyperlinks. \item[\kl{protect quotation=}\textmd{\{environment list\}}] declares a list of environment in which the "quotation notation" should be deactivated +\item["strict"] is a Boolean which, when true, makes the compilation more restrictive by turning some of the warnings into errors (in particular in case of redefinition of knowledges). \item[\kl{visible anchor points=}\textmd{\{true,false\}}] makes the \kl{anchor points} either visible or invisible \end{compactdesc} \newpage diff --git a/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx b/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx index 209ecb410c6..b05e9b8cdf8 100644 --- a/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx +++ b/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx @@ -6,7 +6,7 @@ % % meta-comment % -% Copyright (C) 2017 by Thomas Colcombet +% Copyright (C) 2017-2018 by Thomas Colcombet % ----------------------------------- % % This file may be distributed and/or modified under the @@ -23,7 +23,7 @@ % % \iffalse %<head>\usepackage{expl3} -%<head>\ProvidesExplPackage{knowledge}{2017/10/18}{1.07}{} +%<head>\ProvidesExplPackage{knowledge}{2018/02/17}{1.10}{} %<*driver> \def\knowledgecode{active} \input{knowledge.tex} @@ -41,6 +41,8 @@ % \changes{1.06}{2017/10/10}{bug correction} % % \changes{1.07}{2017/10/15}{minor improvements} % % \changes{1.08}{2017/10/17}{minor changes and reorganization of the files} % +% \changes{1.09}{2017/10/31}{minor changes} % +% \changes{1.10}{2018/17/02}{bug fixes} % % \GetFileInfo{knowledge.sty} % % \DoNotIndex{} % @@ -60,8 +62,8 @@ This directory contains the package name: knowledge license: LaTeX Project Public License version 1.2 or above - version: v1.08 - date: 2017/10/17 + version: v1.10 + date: 2018/02/17 author: Thomas Colcombet mail: thomas.colcombet@irif.fr web: https://www.irif.fr/~colcombe/knowledge_en.html @@ -169,6 +171,11 @@ Content of the file knowledge-sources.zip: \cs_new:Nn\knowledge_error:n {\msg_error:nnn{knowledge}{knowledge~error}{#1}} % \end{macrocode} +% The command \csintro{\knowledge_werror:Nn} takes a boolean as argument, and behaves like \cs{\knowledge_error:n} if it is true, and \cs{\knowledge_warning:n} otherwise. +% \begin{macrocode} +\cs_new:Npn\knowledge_werror:Nn#1 + {\bool_if:NTF#1\knowledge_error:n\knowledge_warning:n} +% \end{macrocode} % \begin{macrocode} \msg_new:nnnn{knowledge}{knowledge~info}{#1}{#2} \msg_new:nnnn{knowledge}{knowledge~warning}{#1}{#2} @@ -262,7 +269,7 @@ Content of the file knowledge-sources.zip: % At the same time, it sets at package loading these options to be `posponed' (these will be executed) % when the package loading is completed. % \begin{macrocode} -\newrobustcmd\knowledgeconfigure[1]{ +\newrobustcmd\knowledgeconfigure[1]{ \keys_set:nn{ knowledge~configuration~options }{#1} } % \end{macrocode} @@ -389,6 +396,11 @@ Content of the file knowledge-sources.zip: % Code for a single feature. It takes the name of the trigger followed by the code. % % \begin{macrocode} +\bool_new:N\knowledge_warningstrict_bool +\bool_set_false:N\knowledge_warningstrict_bool +\KnowledgeConfigureBooleanOption[\knowledge_warningstrict_bool]{strict} +% \end{macrocode} +% \begin{macrocode} \bool_new:N\knowledge_configuration_quotation_bool \KnowledgeConfigureBooleanOptionTF[\knowledge_configuration_quotation_bool]{quotation}{\klactivatequotation}{\kldeactivatequotation} \KnowledgeConfigureTrigger{protect~quotation}{\kl_protect_environment_quotation:n{#1}} @@ -1777,10 +1789,10 @@ Content of the file knowledge-sources.zip: % \begin{macrocode} \keys_define:nn { knowledge~directives } { namespace .code:n = { \tl_set:Nn\knowledge_knowledge_namespace_tl{#1} }, - force .choice:, - force / false .code:n = {\bool_set_false:N\knowledge_knowledge_force_bool}, - force / true .code:n = {\bool_set_true:N\knowledge_knowledge_force_bool}, - force .default:n = false, + append .choice:, + append / false .code:n = {\bool_set_false:N\knowledge_knowledge_append_bool}, + append / true .code:n = {\bool_set_true:N\knowledge_knowledge_append_bool}, + append .default:n = false, clear .choice:, clear / false .code:n = {\bool_set_false:N\knowledge_knowledge_clear_bool}, clear / true .code:n = {\bool_set_true:N\knowledge_knowledge_clear_bool}, @@ -1827,7 +1839,11 @@ Content of the file knowledge-sources.zip: \knowledge_at:N\ktuple_if_exist:NTF {\bool_if:NTF\knowledge_knowledgestyle_bool {\knowledge_at:N\ktuple_gclear:N} - {\knowledge_warning:n{knowledge~'#3'~(namespace=#1,~scope=#2)~is~redefined.}}} + {\bool_if:NF\knowledge_knowledge_append_bool + {\bool_if:NF\knowledge_knowledge_clear_bool + \knowledge_werror:Nn\knowledge_warningstrict_bool + {knowledge~'#3'~(namespace=#1,~scope=#2)~is~redefined.}}} + } {\knowledge_at:N\ktuple_new:N} \keys_set:nn { knowledgenow~directives } { #4 } } @@ -1855,27 +1871,37 @@ Content of the file knowledge-sources.zip: % The command \csintro{\__knowledge_knowledge} is the center of the \cs{\knowledge} % command. It parses its arguments (in particular separating the synonyms using the "xparse@@package"), and executes \cs{\knowledge_knowledge_process:nn} % \begin{macrocode} -\NewDocumentCommand\__knowledge_knowledge{m >{\SplitList{|}}o m } +\NewDocumentCommand\__knowledge_knowledge{t! t+ m >{\SplitList{|}}o m } { \kl_hide_begin: \group_begin: + % + \IfBooleanTF{#1}{% + \bool_set_false:N\knowledge_knowledge_append_bool + \bool_set_true:N\knowledge_knowledge_clear_bool + }% + \IfBooleanTF{#2}{% + \bool_set_true:N\knowledge_knowledge_append_bool + \bool_set_false:N\knowledge_knowledge_clear_bool + }% + % \tl_set_eq:NN\knowledge_namespace_tl \knowledge_default_namespace_tl % \bool_gset_false:N\knowledge_knowledge_is_synonym_bool % \use:x{ - \exp_not:n{\knowledge_knowledge_process:nn{#1}} - {\exp_not:V\knowledge_knowledgedefault_tl,\exp_not:n{#3}}} + \exp_not:n{\knowledge_knowledge_process:nn{#3}} + {\exp_not:V\knowledge_knowledgedefault_tl,\exp_not:n{#5}}} % \bool_if:NF\knowledge_knowledge_is_synonym_bool - {\tl_gset:Nn\knowledge_knowledge_synonym_tl{#1} + {\tl_gset:Nn\knowledge_knowledge_synonym_tl{#3} \tl_gset_eq:NN\knowledge_knowledge_synonyminstance_tl \knowledge_knowledge_instance_tl} % - \IfNoValueTF{#2}{}{ + \IfNoValueTF{#4}{}{ \cs_set:Nn\l_tmpa_cs:n {\exp_args:Nnx\knowledge_knowledge_process:nn{##1}{synonym}} - \ProcessList{#2}\l_tmpa_cs:n + \ProcessList{#4}\l_tmpa_cs:n } % \group_end: @@ -1918,10 +1944,10 @@ Content of the file knowledge-sources.zip: \bool_new:N\knowledge_knowledge_alsonow_bool \bool_new:N\knowledge_knowledge_is_synonym_bool \bool_new:N\knowledge_knowledge_autoref_bool +\bool_new:N\knowledge_knowledge_clear_bool +\bool_new:N\knowledge_knowledge_append_bool \tl_clear_new:N\knowledge_knowledge_synonym_tl \tl_clear_new:N\knowledge_knowledge_synonyminstance_tl -\tl_clear_new:N\knowledge_knowledge_clear_bool -\tl_clear_new:N\knowledge_knowledge_force_bool \tl_clear_new:N\knowledge_knowledge_export_bool \tl_clear_new:N\knowledge_knowledge_key_tl \tl_clear_new:N\knowledge_knowledge_namespace_tl @@ -1932,9 +1958,7 @@ Content of the file knowledge-sources.zip: % is the heart of \cs{\knowledge} command. % \begin{macrocode} \cs_new:Nn\knowledge_knowledge_process:nn -{ \bool_set_false:N\knowledge_knowledge_clear_bool - \bool_set_false:N\knowledge_knowledge_force_bool - \bool_set_false:N\knowledge_knowledge_export_bool +{ \bool_set_false:N\knowledge_knowledge_export_bool \bool_set_false:N\knowledge_knowledge_autoref_bool \bool_set_false:N\knowledge_knowledge_now_bool \bool_set_false:N\knowledge_knowledge_alsonow_bool @@ -1952,6 +1976,11 @@ Content of the file knowledge-sources.zip: {\bool_set_true:N\knowledge_knowledge_now_bool} {} % + \bool_if:NT\knowledge_knowledge_clear_bool + {\tl_put_left:Nn\knowledge_knowledge_directives_tl{clear,}} + \bool_if:NT\knowledge_knowledge_append_bool + {\tl_put_left:Nn\knowledge_knowledge_directives_tl{force,}} + % \bool_if:nTF{\knowledge_knowledge_now_bool} {\use:x{ \exp_not:N\knowledge_new_now:nnnn @@ -2680,7 +2709,7 @@ Content of the file knowledge-sources.zip: \NewKnowledgeParamBool*{autoref~link}\kl_autoreflink_bool \NewKnowledgeParamBool*{invisible}\kl_invisible_bool \NewKnowledgeParamBool*{italic}\kl_italic_bool -\NewKnowledgeParamBool*{sc}\kl_sc_bool +\NewKnowledgeParamBool*{smallcaps}\kl_smallcaps_bool \NewKnowledgeParamBool*{md}\kl_md_bool \NewKnowledgeParamBool*{up}\kl_up_bool \NewKnowledgeParamBool*{boldface}\kl_boldface_bool @@ -2873,7 +2902,7 @@ Content of the file knowledge-sources.zip: \knowledge_kl_display_generic_cond:Nn\kl_boldface_bool\kl_bf:n \knowledge_kl_display_generic_cond:Nn\kl_up_bool\kl_up:n \knowledge_kl_display_generic_cond:Nn\kl_italic_bool\kl_it:n - \knowledge_kl_display_generic_cond:Nn\kl_sc_bool\kl_sc:n + \knowledge_kl_display_generic_cond:Nn\kl_smallcaps_bool\kl_smallcaps:n \knowledge_kl_display_generic_cond:Nn\kl_typewriter_bool\kl_tt:n % if math \knowledge_kl_display_generic_cond:Nn\kl_mathop_bool\mathop @@ -2956,6 +2985,8 @@ Content of the file knowledge-sources.zip: \cs_new:Npn\kl_md:n{\mode_if_math:TF\mathmd\textmd} \cs_new:Npn\kl_sc:n{\mode_if_math:TF\mathsc\textsc} \cs_new:Npn\kl_it:n{\mode_if_math:TF\mathit\textit} +\cs_new:Npn\mathscerror#1{\knowledge_error:n{`smallcaps'~only~allowed~in~math~mode.}} +\cs_new:Npn\kl_smallcaps:n{\mode_if_math:TF\mathscerror\textsc} \cs_new:Npn\kl_tt:n{\mode_if_math:TF\mathtt\texttt} \cs_new:Npn\kl_bf:n{\mode_if_math:TF\mathbf\textbf} \cs_new:Npn\kl_underline:n{\mode_if_math:TF\use:n\underline} @@ -3452,7 +3483,7 @@ Content of the file knowledge-sources.zip: default style={intro,autoref target}, unknown style= intro unknown, unknown style cont= intro unknown cont, - style directive=intro style + style directive= intro style } \knowledgenewvariant\phantomintro{ namespace=default, diff --git a/Master/texmf-dist/source/latex/knowledge/knowledge-utils.dtx b/Master/texmf-dist/source/latex/knowledge/knowledge-utils.dtx index eb50a561027..961ebf925b6 100644 --- a/Master/texmf-dist/source/latex/knowledge/knowledge-utils.dtx +++ b/Master/texmf-dist/source/latex/knowledge/knowledge-utils.dtx @@ -215,7 +215,7 @@ % \begin{macrocode} \cs_new:Nn\if_true:TF{#1} \cs_new:Nn\if_false:TF{#2} -\cs_generate_variant:Nn\int_compare:nNnTF{cNnTF} +%\cs_generate_variant:Nn\int_compare:nNnTF{cNnTF} \cs_generate_variant:Nn\use:nn{nx} % \end{macrocode} % The command |\cs_apply_inline:n<n's>| takes a first argument @@ -252,15 +252,15 @@ % \end{macrocode} % % \begin{macrocode} -\cs_generate_variant:Nn\cs_apply_inline:nn{nc} -\cs_generate_variant:Nn\cs_apply_inline:nnn{ncc} -\cs_generate_variant:Nn\cs_apply_inline:nnnn{nccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnn{ncccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnn{nccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnn{ncccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnn{nccccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnn{ncccccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnnn{nccccccccc} +%\cs_generate_variant:Nn\cs_apply_inline:nn{nc} +%\cs_generate_variant:Nn\cs_apply_inline:nnn{ncc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnn{nccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnn{ncccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnnn{nccccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnnnn{ncccccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnn{nccccccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnn{ncccccccc} +%\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnnn{nccccccccc} % \end{macrocode} %\fi % @@ -971,21 +971,21 @@ {\file_if_exist:nT{#1} {\group_begin: \bool_set_false:N\l_tmpa_bool - \ior_open:Nn\g_tmpa_ior{#1} - \iow_open:Nn\g_tmpa_iow{#2} + \ior_open:Nn\klg_tmpa_ior{#1} + \iow_open:Nn\klg_tmpa_iow{#2} \bool_do_until:Nn\l_tmpa_bool{ - \ior_if_eof:NTF\g_tmpa_ior + \ior_if_eof:NTF\klg_tmpa_ior {\bool_set_true:N\l_tmpa_bool} {\ior_get_str:NN - \g_tmpa_ior + \klg_tmpa_ior \l_tmpa_tl \exp_args:NNV \iow_now:Nn - \g_tmpa_iow + \klg_tmpa_iow \l_tmpa_tl} } - \ior_close:N\g_tmpa_ior - \iow_close:N\g_tmpa_iow + \ior_close:N\klg_tmpa_ior + \iow_close:N\klg_tmpa_iow \group_end:}} \cs_new_protected_with_variants:Nnn\kl_compare_files:Nnn{NnV,NVn,NVV} @@ -1000,22 +1000,22 @@ \file_if_exist:nT{#3} {\bool_set_false:N\l_tmpb_bool}} \bool_if:NF\l_tmpa_bool{ - \ior_open:Nn\g_tmpa_ior{#2} - \ior_open:Nn\g_tmpb_ior{#3} + \ior_open:Nn\klg_tmpa_ior{#2} + \ior_open:Nn\klg_tmpb_ior{#3} % \bool_do_until:Nn\l_tmpa_bool{ - \ior_if_eof:NTF\g_tmpa_ior + \ior_if_eof:NTF\klg_tmpa_ior {\bool_set_true:N\l_tmpa_bool - \ior_if_eof:NF\g_tmpb_ior + \ior_if_eof:NF\klg_tmpb_ior {\bool_set_false:N\l_tmp_bool}} - {\ior_if_eof:NTF\g_tmpb_ior + {\ior_if_eof:NTF\klg_tmpb_ior {\bool_set_true:N\l_tmpa_bool \bool_set_false:N\l_tmp_bool} {\ior_get_str:NN - \g_tmpa_ior + \klg_tmpa_ior \l_tmpa_tl \ior_get_str:NN - \g_tmpb_ior + \klg_tmpb_ior \l_tmpb_tl \tl_if_eq:NNF \l_tmpa_tl\l_tmpb_tl @@ -1023,17 +1023,17 @@ \bool_set_false:N\l_tmpb_bool} }} } - \ior_close:N\g_tmpa_ior - \ior_close:N\g_tmpb_ior} + \ior_close:N\klg_tmpa_ior + \ior_close:N\klg_tmpb_ior} \bool_if:NTF\l_tmpb_bool {\group_end:\bool_set_true:N#1} {\group_end:\bool_set_false:N#1} } \cs_new_protected:Nn\kl_tl_to_file:nn - {\iow_open:Nn\g_tmpa_iow{#1} - \iow_now:Nn\g_tmpa_iow{#2} - \iow_close:N\g_tmpa_iow} + {\iow_open:Nn\klg_tmpa_iow{#1} + \iow_now:Nn\klg_tmpa_iow{#2} + \iow_close:N\klg_tmpa_iow} % \end{macrocode} % % These macros are used for testing the modification of knowledges. @@ -1042,10 +1042,9 @@ % At the end, the two are compared. % % \begin{macrocode} -\ior_new:N\g_tmpa_ior -\ior_new:N\g_tmpb_ior -\iow_new:N\g_tmpa_iow -\iow_new:N\g_tmpb_iow +\ior_new:N\klg_tmpa_ior +\ior_new:N\klg_tmpb_ior +\iow_new:N\klg_tmpa_iow % \end{macrocode} % % diff --git a/Master/texmf-dist/source/latex/knowledge/knowledge.ins b/Master/texmf-dist/source/latex/knowledge/knowledge.ins index 7542c25b4b6..c203174f3f7 100644 --- a/Master/texmf-dist/source/latex/knowledge/knowledge.ins +++ b/Master/texmf-dist/source/latex/knowledge/knowledge.ins @@ -6,6 +6,7 @@ %% version 1.2 of this license or (at your option) any later %% version. The latest version of this license is in: %% + %% http://www.latex-project.org/lppl.txt %% %% and version 1.2 or later is part of all distributions of diff --git a/Master/texmf-dist/tex/latex/knowledge/knowledge.sty b/Master/texmf-dist/tex/latex/knowledge/knowledge.sty index dff9e0a83a7..6838bb84372 100644 --- a/Master/texmf-dist/tex/latex/knowledge/knowledge.sty +++ b/Master/texmf-dist/tex/latex/knowledge/knowledge.sty @@ -23,7 +23,7 @@ %% LaTeX version 1999/12/01 or later. %% \usepackage{expl3} -\ProvidesExplPackage{knowledge}{2017/10/18}{1.07}{} +\ProvidesExplPackage{knowledge}{2018/02/17}{1.10}{} %%%%%%%%%% \RequirePackage{l3keys2e} \RequirePackage{etoolbox} @@ -109,7 +109,6 @@ \makeatother \cs_new:Nn\if_true:TF{#1} \cs_new:Nn\if_false:TF{#2} -\cs_generate_variant:Nn\int_compare:nNnTF{cNnTF} \cs_generate_variant:Nn\use:nn{nx} \cs_new:Npn\cs_apply_inline:nn#1 {\cs_set:Npn\g_tmpa_cs:##1{#1} @@ -138,15 +137,6 @@ \cs_new:Npn\cs_apply_inline:nnnnnnnnnn#1 {\cs_set:Npn\g_tmpa_cs:##1##2##3##4##5##6##7##8##9{#1} \g_tmpa_cs:} -\cs_generate_variant:Nn\cs_apply_inline:nn{nc} -\cs_generate_variant:Nn\cs_apply_inline:nnn{ncc} -\cs_generate_variant:Nn\cs_apply_inline:nnnn{nccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnn{ncccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnn{nccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnn{ncccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnn{nccccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnn{ncccccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnnn{nccccccccc} \AtBeginDocument{\KAuxActivate} \NewDocumentCommand\KAuxActivate{}{ @@ -617,21 +607,21 @@ {\file_if_exist:nT{#1} {\group_begin: \bool_set_false:N\l_tmpa_bool - \ior_open:Nn\g_tmpa_ior{#1} - \iow_open:Nn\g_tmpa_iow{#2} + \ior_open:Nn\klg_tmpa_ior{#1} + \iow_open:Nn\klg_tmpa_iow{#2} \bool_do_until:Nn\l_tmpa_bool{ - \ior_if_eof:NTF\g_tmpa_ior + \ior_if_eof:NTF\klg_tmpa_ior {\bool_set_true:N\l_tmpa_bool} {\ior_get_str:NN - \g_tmpa_ior + \klg_tmpa_ior \l_tmpa_tl \exp_args:NNV \iow_now:Nn - \g_tmpa_iow + \klg_tmpa_iow \l_tmpa_tl} } - \ior_close:N\g_tmpa_ior - \iow_close:N\g_tmpa_iow + \ior_close:N\klg_tmpa_ior + \iow_close:N\klg_tmpa_iow \group_end:}} \cs_new_protected_with_variants:Nnn\kl_compare_files:Nnn{NnV,NVn,NVV} @@ -646,22 +636,22 @@ \file_if_exist:nT{#3} {\bool_set_false:N\l_tmpb_bool}} \bool_if:NF\l_tmpa_bool{ - \ior_open:Nn\g_tmpa_ior{#2} - \ior_open:Nn\g_tmpb_ior{#3} + \ior_open:Nn\klg_tmpa_ior{#2} + \ior_open:Nn\klg_tmpb_ior{#3} % \bool_do_until:Nn\l_tmpa_bool{ - \ior_if_eof:NTF\g_tmpa_ior + \ior_if_eof:NTF\klg_tmpa_ior {\bool_set_true:N\l_tmpa_bool - \ior_if_eof:NF\g_tmpb_ior + \ior_if_eof:NF\klg_tmpb_ior {\bool_set_false:N\l_tmp_bool}} - {\ior_if_eof:NTF\g_tmpb_ior + {\ior_if_eof:NTF\klg_tmpb_ior {\bool_set_true:N\l_tmpa_bool \bool_set_false:N\l_tmp_bool} {\ior_get_str:NN - \g_tmpa_ior + \klg_tmpa_ior \l_tmpa_tl \ior_get_str:NN - \g_tmpb_ior + \klg_tmpb_ior \l_tmpb_tl \tl_if_eq:NNF \l_tmpa_tl\l_tmpb_tl @@ -669,21 +659,20 @@ \bool_set_false:N\l_tmpb_bool} }} } - \ior_close:N\g_tmpa_ior - \ior_close:N\g_tmpb_ior} + \ior_close:N\klg_tmpa_ior + \ior_close:N\klg_tmpb_ior} \bool_if:NTF\l_tmpb_bool {\group_end:\bool_set_true:N#1} {\group_end:\bool_set_false:N#1} } \cs_new_protected:Nn\kl_tl_to_file:nn - {\iow_open:Nn\g_tmpa_iow{#1} - \iow_now:Nn\g_tmpa_iow{#2} - \iow_close:N\g_tmpa_iow} -\ior_new:N\g_tmpa_ior -\ior_new:N\g_tmpb_ior -\iow_new:N\g_tmpa_iow -\iow_new:N\g_tmpb_iow + {\iow_open:Nn\klg_tmpa_iow{#1} + \iow_now:Nn\klg_tmpa_iow{#2} + \iow_close:N\klg_tmpa_iow} +\ior_new:N\klg_tmpa_ior +\ior_new:N\klg_tmpb_ior +\iow_new:N\klg_tmpa_iow \cs_generate_variant:Nn\cs_gset_eq:NN{cN,cc} \NewDocumentCommand\OverloadCommand{mmm} {\exp_args:Nc\cs_gset_eq:NN{SUPER\cs_to_str:N#1}#1 @@ -781,6 +770,8 @@ {\msg_warning:nnn{knowledge}{knowledge~warning}{#1}} \cs_new:Nn\knowledge_error:n {\msg_error:nnn{knowledge}{knowledge~error}{#1}} +\cs_new:Npn\knowledge_werror:Nn#1 + {\bool_if:NTF#1\knowledge_error:n\knowledge_warning:n} \msg_new:nnnn{knowledge}{knowledge~info}{#1}{#2} \msg_new:nnnn{knowledge}{knowledge~warning}{#1}{#2} \msg_new:nnnn{knowledge}{knowledge~error}{#1}{#2} @@ -899,6 +890,9 @@ \cs_new:Nn\knowledge_option_bool_new:n {\bool_new:c{knowledge_option_#1_bool} \exp_args:Nnc\knowledge_option_bool_new:nN{#1}{knowledge_option_#1_bool}} +\bool_new:N\knowledge_warningstrict_bool +\bool_set_false:N\knowledge_warningstrict_bool +\KnowledgeConfigureBooleanOption[\knowledge_warningstrict_bool]{strict} \bool_new:N\knowledge_configuration_quotation_bool \KnowledgeConfigureBooleanOptionTF[\knowledge_configuration_quotation_bool]{quotation}{\klactivatequotation}{\kldeactivatequotation} \KnowledgeConfigureTrigger{protect~quotation}{\kl_protect_environment_quotation:n{#1}} @@ -1749,10 +1743,10 @@ %% \keys_define:nn { knowledge~directives } { namespace .code:n = { \tl_set:Nn\knowledge_knowledge_namespace_tl{#1} }, - force .choice:, - force / false .code:n = {\bool_set_false:N\knowledge_knowledge_force_bool}, - force / true .code:n = {\bool_set_true:N\knowledge_knowledge_force_bool}, - force .default:n = false, + append .choice:, + append / false .code:n = {\bool_set_false:N\knowledge_knowledge_append_bool}, + append / true .code:n = {\bool_set_true:N\knowledge_knowledge_append_bool}, + append .default:n = false, clear .choice:, clear / false .code:n = {\bool_set_false:N\knowledge_knowledge_clear_bool}, clear / true .code:n = {\bool_set_true:N\knowledge_knowledge_clear_bool}, @@ -1784,7 +1778,11 @@ \knowledge_at:N\ktuple_if_exist:NTF {\bool_if:NTF\knowledge_knowledgestyle_bool {\knowledge_at:N\ktuple_gclear:N} - {\knowledge_warning:n{knowledge~'#3'~(namespace=#1,~scope=#2)~is~redefined.}}} + {\bool_if:NF\knowledge_knowledge_append_bool + {\bool_if:NF\knowledge_knowledge_clear_bool + \knowledge_werror:Nn\knowledge_warningstrict_bool + {knowledge~'#3'~(namespace=#1,~scope=#2)~is~redefined.}}} + } {\knowledge_at:N\ktuple_new:N} \keys_set:nn { knowledgenow~directives } { #4 } } @@ -1801,27 +1799,37 @@ \cs_generate_variant:Nn\knowledge_set_now:nnnn{nnVn} \NewDocumentCommand\knowledge{} {\KAuxWriteLocation\__knowledge_knowledge} -\NewDocumentCommand\__knowledge_knowledge{m >{\SplitList{|}}o m } +\NewDocumentCommand\__knowledge_knowledge{t! t+ m >{\SplitList{|}}o m } { \kl_hide_begin: \group_begin: + % + \IfBooleanTF{#1}{% + \bool_set_false:N\knowledge_knowledge_append_bool + \bool_set_true:N\knowledge_knowledge_clear_bool + }% + \IfBooleanTF{#2}{% + \bool_set_true:N\knowledge_knowledge_append_bool + \bool_set_false:N\knowledge_knowledge_clear_bool + }% + % \tl_set_eq:NN\knowledge_namespace_tl \knowledge_default_namespace_tl % \bool_gset_false:N\knowledge_knowledge_is_synonym_bool % \use:x{ - \exp_not:n{\knowledge_knowledge_process:nn{#1}} - {\exp_not:V\knowledge_knowledgedefault_tl,\exp_not:n{#3}}} + \exp_not:n{\knowledge_knowledge_process:nn{#3}} + {\exp_not:V\knowledge_knowledgedefault_tl,\exp_not:n{#5}}} % \bool_if:NF\knowledge_knowledge_is_synonym_bool - {\tl_gset:Nn\knowledge_knowledge_synonym_tl{#1} + {\tl_gset:Nn\knowledge_knowledge_synonym_tl{#3} \tl_gset_eq:NN\knowledge_knowledge_synonyminstance_tl \knowledge_knowledge_instance_tl} % - \IfNoValueTF{#2}{}{ + \IfNoValueTF{#4}{}{ \cs_set:Nn\l_tmpa_cs:n {\exp_args:Nnx\knowledge_knowledge_process:nn{##1}{synonym}} - \ProcessList{#2}\l_tmpa_cs:n + \ProcessList{#4}\l_tmpa_cs:n } % \group_end: @@ -1847,19 +1855,17 @@ \bool_new:N\knowledge_knowledge_alsonow_bool \bool_new:N\knowledge_knowledge_is_synonym_bool \bool_new:N\knowledge_knowledge_autoref_bool +\bool_new:N\knowledge_knowledge_clear_bool +\bool_new:N\knowledge_knowledge_append_bool \tl_clear_new:N\knowledge_knowledge_synonym_tl \tl_clear_new:N\knowledge_knowledge_synonyminstance_tl -\tl_clear_new:N\knowledge_knowledge_clear_bool -\tl_clear_new:N\knowledge_knowledge_force_bool \tl_clear_new:N\knowledge_knowledge_export_bool \tl_clear_new:N\knowledge_knowledge_key_tl \tl_clear_new:N\knowledge_knowledge_namespace_tl \tl_clear_new:N\knowledge_knowledge_instance_tl \tl_clear_new:N\knowledge_knowledge_directives_tl \cs_new:Nn\knowledge_knowledge_process:nn -{ \bool_set_false:N\knowledge_knowledge_clear_bool - \bool_set_false:N\knowledge_knowledge_force_bool - \bool_set_false:N\knowledge_knowledge_export_bool +{ \bool_set_false:N\knowledge_knowledge_export_bool \bool_set_false:N\knowledge_knowledge_autoref_bool \bool_set_false:N\knowledge_knowledge_now_bool \bool_set_false:N\knowledge_knowledge_alsonow_bool @@ -1877,6 +1883,11 @@ {\bool_set_true:N\knowledge_knowledge_now_bool} {} % + \bool_if:NT\knowledge_knowledge_clear_bool + {\tl_put_left:Nn\knowledge_knowledge_directives_tl{clear,}} + \bool_if:NT\knowledge_knowledge_append_bool + {\tl_put_left:Nn\knowledge_knowledge_directives_tl{force,}} + % \bool_if:nTF{\knowledge_knowledge_now_bool} {\use:x{ \exp_not:N\knowledge_new_now:nnnn @@ -2387,7 +2398,7 @@ \NewKnowledgeParamBool*{autoref~link}\kl_autoreflink_bool \NewKnowledgeParamBool*{invisible}\kl_invisible_bool \NewKnowledgeParamBool*{italic}\kl_italic_bool -\NewKnowledgeParamBool*{sc}\kl_sc_bool +\NewKnowledgeParamBool*{smallcaps}\kl_smallcaps_bool \NewKnowledgeParamBool*{md}\kl_md_bool \NewKnowledgeParamBool*{up}\kl_up_bool \NewKnowledgeParamBool*{boldface}\kl_boldface_bool @@ -2547,7 +2558,7 @@ \knowledge_kl_display_generic_cond:Nn\kl_boldface_bool\kl_bf:n \knowledge_kl_display_generic_cond:Nn\kl_up_bool\kl_up:n \knowledge_kl_display_generic_cond:Nn\kl_italic_bool\kl_it:n - \knowledge_kl_display_generic_cond:Nn\kl_sc_bool\kl_sc:n + \knowledge_kl_display_generic_cond:Nn\kl_smallcaps_bool\kl_smallcaps:n \knowledge_kl_display_generic_cond:Nn\kl_typewriter_bool\kl_tt:n % if math \knowledge_kl_display_generic_cond:Nn\kl_mathop_bool\mathop @@ -2626,6 +2637,8 @@ \cs_new:Npn\kl_md:n{\mode_if_math:TF\mathmd\textmd} \cs_new:Npn\kl_sc:n{\mode_if_math:TF\mathsc\textsc} \cs_new:Npn\kl_it:n{\mode_if_math:TF\mathit\textit} +\cs_new:Npn\mathscerror#1{\knowledge_error:n{`smallcaps'~only~allowed~in~math~mode.}} +\cs_new:Npn\kl_smallcaps:n{\mode_if_math:TF\mathscerror\textsc} \cs_new:Npn\kl_tt:n{\mode_if_math:TF\mathtt\texttt} \cs_new:Npn\kl_bf:n{\mode_if_math:TF\mathbf\textbf} \cs_new:Npn\kl_underline:n{\mode_if_math:TF\use:n\underline} @@ -2972,7 +2985,7 @@ default style={intro,autoref target}, unknown style= intro unknown, unknown style cont= intro unknown cont, - style directive=intro style + style directive= intro style } \knowledgenewvariant\phantomintro{ namespace=default, |