summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx')
-rw-r--r--Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx44
1 files changed, 25 insertions, 19 deletions
diff --git a/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx b/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx
index d97ed2143af..92725e4d583 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-2019 by Thomas Colcombet
+% Copyright (C) 2017-2020 by Thomas Colcombet
% -----------------------------------
%
% This file may be distributed and/or modified under the
@@ -23,7 +23,7 @@
%
% \iffalse
%<head>\usepackage{expl3}
-%<head>\ProvidesExplPackage{knowledge}{2019/12/03}{1.20}{}
+%<head>\ProvidesExplPackage{knowledge}{2020/01/26}{1.21}{}
%<*driver>
\def\knowledgecode{active}
\input{knowledge.tex}
@@ -53,6 +53,7 @@
% \changes{1.18}{2019/10/03}{bug fix/improvement} %
% \changes{1.19}{2019/11/19}{bug fix} %
% \changes{1.20}{2019/12/03}{bug fix} %
+% \changes{1.21}{2020/01/26}{bug fix} %
% \GetFileInfo{knowledge.sty} %
% \DoNotIndex{}
%
@@ -72,8 +73,8 @@ This directory contains the package
name: knowledge
license: LaTeX Project Public License version 1.2 or above
- version: v1.20
- date: 2019/12/03
+ version: v1.21
+ date: 2020/01/26
author: Thomas Colcombet
mail: thomas.colcombet@irif.fr
web: https://www.irif.fr/~colcombe/knowledge_en.html
@@ -1291,8 +1292,8 @@ Content of the file knowledge-sources.zip:
\knowledge_scopetag_ensure:n{#1}
\bool_if:cTF{\knowledge_scopetag_tl[#1]_bool}
{}
- {\KAuxWriteX*{\exp_not:N\KAuxDeclaredScopeTag{#1}}
- \bool_gset_true:c{\knowledge_scopetag_tl[#1]_bool}}
+ {\bool_gset_true:c{\knowledge_scopetag_tl[#1]_bool}}
+ \KAuxWriteX*{\exp_not:N\KAuxDeclaredScopeTag{#1}}
}
% \end{macrocode}
% \AP The command \csintro{\knowledgescope} associates an "instance" to one or more "scopetags":
@@ -1321,22 +1322,22 @@ Content of the file knowledge-sources.zip:
\KnowledgeConfigureBooleanOption[\knowledge_configuration_label_autoscope_bool]{patch~label}
\KnowledgeConfigureBooleanOption[\knowledge_configuration_label_autoscope_bool]{label~scope}
% \end{macrocode}
-% \noindent\AP\csintro{\knowledgelabel} implicitly adds a call to \cs{\knowledgescope} (if \cs{\knowledge_configuration_label_autoscope_bool} is set to true), and then calls the original \cs{\label} code.
+% One first changes the behavior of \cs\label\ in the preamble.
% \begin{macrocode}
-\NewDocumentCommand\knowledgelabel{m}{
- \kl_hide_begin:
- \bool_if:NTF
+\global\let\knowledge_label_before_loading_package:n\label
+\cs_gset:Npn\label{
+ \mode_if_preamble:TF
+ \knowledge_label_in_preamble:n
+ \knowledge_label_before_loading_package:n
+}
+\cs_new:Npn\knowledge_label_in_preamble:n{
+ \bool_if:NTF
\knowledge_configuration_label_autoscope_bool
\knowledge_knowledgescope_one:n
\use_none:n
- {#1}
- \kl_hide_end:
- \cs_if_exist:NTF\LaTeXlabel\LaTeXlabel\use_none:n{#1}
}
-\let\scopeLabel\knowledgelabel%for backward compatibility
-\let\label\knowledgelabel
% \end{macrocode}
-% \AP In order to cicumvent this overloading, the normal \cs{\label} command
+% \AP In order to circumvent this overloading, the normal \cs{\label} command
% can be used using \csintro{\knowledge_latex_label:n}:
% \begin{macrocode}
\cs_new:Npn\knowledge_latex_label:n{
@@ -1443,8 +1444,13 @@ Content of the file knowledge-sources.zip:
\scope_if_triggers_area:nTF{##1}
{\scope_area_pop:n{##1}}
{}}
- \kutils_secure_latex_command:N\label
- \let\label\knowledgelabel
+}
+\AtBeginDocument{
+ \kutils_secure_latex_command:N\label
+ \def\label#1{\bool_if:NT
+ \knowledge_configuration_label_autoscope_bool
+ {\knowledge_knowledgescope_one:n{#1}}
+ \LaTeXlabel{#1}}
}
% \end{macrocode}
%
@@ -1516,7 +1522,7 @@ Content of the file knowledge-sources.zip:
{\scope_area_pop:n{knowledge~import~internal}}
\NewDocumentEnvironment{knowledge~context}{m}
{\ScopeActivate\scope_area_push:n{knowledge~context~internal}
- \knowledgelabel{#1}}
+ \knowledgescope{#1}}
{\scope_area_pop:n{knowledge~context~internal}}
% \end{macrocode}
% \subsection{Files}