diff options
author | Karl Berry <karl@freefriends.org> | 2020-09-22 21:07:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-09-22 21:07:49 +0000 |
commit | fa6d66c6b0713c364893aa18d4eb1e867b67fbe2 (patch) | |
tree | b72b7331527d9ddabda1161c61ecd1f21802217b | |
parent | 68c10ab658f993b6a7303e1878535e6b0e86ac72 (diff) |
knowledge (22sep20)
git-svn-id: svn://tug.org/texlive/trunk@56404 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/knowledge/README.md | 28 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/knowledge/knowledge.pdf | bin | 729897 -> 733968 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/knowledge/knowledge.tex | 283 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx | 76 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/knowledge/knowledge.sty | 38 |
5 files changed, 250 insertions, 175 deletions
diff --git a/Master/texmf-dist/doc/latex/knowledge/README.md b/Master/texmf-dist/doc/latex/knowledge/README.md index 5d3e671a104..e0aaa063a64 100644 --- a/Master/texmf-dist/doc/latex/knowledge/README.md +++ b/Master/texmf-dist/doc/latex/knowledge/README.md @@ -1,31 +1,31 @@ %%%%%%%% This directory contains the package - name: knowledge - license: LaTeX Project Public License version 1.2 or above - version: v1.23 - date: 2020/04/25 - author: Thomas Colcombet - mail: thomas.colcombet@irif.fr - web: https://www.irif.fr/~colcombe/knowledge_en.html + name: knowledge + license: LaTeX Project Public License version 1.2 or above + version: v1.24 + date: 2020/09/22 + author: Thomas Colcombet + mail: thomas.colcombet@irif.fr + web: https://www.irif.fr/~colcombe/knowledge_en.html -Purpose: +### Purpose: The knowledge package for LaTeX offers a systematic way to handle notions/concepts/terms throughout a document. In combination with - hyperref, it is used for easily handling links inside a document (every + `hyperref`, it is used for easily handling links inside a document (every use of a concept is linked to its introduction), or outside the document (for centralizing the url's in a separate part). It also helps building an index, and deals with scoping of concepts as well as mathematics. It is designed to--as much as possible--not interfere with the writing of the document. -Install: +### Install: It is sufficient to have the file knowledge.sty accessible by LaTeX. - It can be produced by `make knowledge.sty' if necessary. - The documentation is in the file knowledge.pdf. - A starting example can be found in knowledge-example.tex. + It can be produced by `make knowledge.sty` if necessary. + The documentation is in the file `knowledge.pdf`. + A starting example can be found in `knowledge-example.tex`. -Content of the file knowledge-sources.zip: +### Content of knowledge-sources.zip: - README.md: this file generated while compiling knowledge.ins, the content is in knowledge-code.dtx - knowledge.sty: the package file (generated using knowledge.ins) diff --git a/Master/texmf-dist/doc/latex/knowledge/knowledge.pdf b/Master/texmf-dist/doc/latex/knowledge/knowledge.pdf Binary files differindex 272989ef3cf..46e28720fa5 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 98fc76744c2..7250cc49077 100644 --- a/Master/texmf-dist/doc/latex/knowledge/knowledge.tex +++ b/Master/texmf-dist/doc/latex/knowledge/knowledge.tex @@ -6,7 +6,7 @@ \usepackage{expl3} \usepackage{hyperref} %\usepackage{complexity} -\usepackage[quotation,scope]{knowledge} +\usepackage[quotation,scope,silent]{knowledge} \knowledgeconfigure{visible anchor points=false} \knowledgeconfigure{notion,diagnose line=false} \GetFileInfo{knowledge.sty} @@ -84,6 +84,13 @@ \let\subsubsubsection\paragraph +\knowledge{notion} + | semigroup@ex1 + | semigroups@ex1 + +\knowledge{notion} + | semigroup morphism@ex1 + \knowledge{not implemented}{link=to be done} \knowledge{to be done}{color=DarkRed} @@ -150,8 +157,6 @@ -\knowledge{_monoid}{style=kl unknown} -\knowledge{_semigroup}{style=kl unknown} @@ -295,6 +300,7 @@ \knowledge{protect link}{directive} \knowledge{strict}{directive} +\knowledge{silent}{directive} \knowledge{emphasize}{directive} \knowledge{underline}{directive} \knowledge{up}{directive} @@ -386,6 +392,7 @@ \knowledge{complexity}{package,url={https://www.ctan.org/pkg/complexity}} \knowledge{expl3}{package,url={https://www.ctan.org/pkg/expl3}} \knowledge{hyperref}{package,url={https://www.ctan.org/pkg/hyperref}} + \knowledge{acmart}{package,url={https://www.ctan.org/pkg/acmart}} \knowledge{tikzcd}{package,url={https://www.ctan.org/pkg/tikz-cd}} \knowledge{standalone}{package,url={https://www.ctan.org/pkg/standalone}} \knowledge{xcolor}{package,url={https://www.ctan.org/pkg/xcolor}} @@ -743,8 +750,10 @@ I have seen Till Tantau who explained me how to test whether a material is displ \item[2019-12-03] Corrected bug in the scope access. V1.20. \item[2020-01-25] Corrected bug when "knowledge@@package" is used without "hyperref@@package" (thanks to Rémi Nollet). \item[2020-01-25] Corrected bug that made the kaux file not stabilize (thanks to Rémi Nollet). V1.21 on CTAN. -\item[2020-03-05] No \texttt{hidelinks} and \texttt{breaklinks} are automatically activated unless the new option \kl{no patch} is activated. Doc update. V1.22 on CTAN. +\item[2020-03-05] Now \texttt{hidelinks} and \texttt{breaklinks} are automatically activated unless the new option \kl{no patch} is activated. Doc update. V1.22 on CTAN. \item[2020-04-25] Made the package compatible with 2016 versions of LaTeX. Useful when \texttt{knowledge.sty} is included with and compile in arXiv. V1.23 on CTAN. +\item[2020-05-02] Doc update ("acmart@@package" colors, thanks to Daniela Petri\c san). +\item[2020-09-22] Adding the "silent" option as suggested by Patrick Lambein-Monette. V1.24 on CTAN \end{compactdesc} \normalsize %\restoregeometry @@ -803,10 +812,6 @@ Then, in the preamble (or in an external file), one uses commands of the form ei \cs\knowledge\{\kl{url=}\{https://en.wikipedia.org/wiki/LaTeX\}\}\par \qquad\kl{|}\quad latex \end{code} -or equivalently -\begin{code} -\cs\knowledge\{latex\}\{\kl{url=}\{https://en.wikipedia.org/wiki/LaTeX\}\} -\end{code} This configures the text `\texttt{latex}' to be associated with the sole directive \kl{url=}, which means an hyperreference to this address. @@ -837,9 +842,10 @@ This package has been written for use in \kl[urllatex]{latex}. But in fact, I would like `\texttt{latex}' to also be properly typeset \LaTeX{}, and in \textcolor{gray}{gray}. This requires to load the package with the \kl(option){xcolor} option (for being able to use colors, obviously), or by loading the package "xcolor@@package" before, and then modify the \cs{\knowledge} command using extra "directives": -\begin{code}[10.9cm] -\cs\knowledge\{latex\}\{\kl{url=}https://en.wikipedia.org/wiki/LaTeX,\\ -\indent\qquad\kl{text=}\cs\LaTeX,~\kl{color=}gray\} +\begin{code}%[10.9cm] +\cs\knowledge\{\kl{url=}\{https://en.wikipedia.org/wiki/LaTeX\},\par + \qquad~\qquad\kl{text=}\cs\LaTeX,~\kl{color=}gray\}\par +\qquad\kl{|}\quad latex \end{code} \noindent yields with the same text @@ -860,10 +866,7 @@ It happens very often that there are several ways to name a notion, because of c the result is that the text `\textit{text}' is displayed, but urls, colors, etc from `\textit{knowledge}' are used. Another more systematic way to do it is to declare synonyms. -This can be achieved using a `\vbar' separated list of texts in the \kl[\knowledge synonyms]{optional parameter} of the\cs{\knowledge} command, it is possible to add a list of `synonyms', such as in: -% -\marginpar{\begin{hint} - Another syntax (called the "`\vbar'-notation") is: +This obtained by adding the corresponding lines: \begin{code}[4.35cm] \cs{\knowledge}\{"url="\dots\}\\ \indent~\vbar~Donald Ervin Knuth\\ @@ -871,50 +874,34 @@ This can be achieved using a `\vbar' separated list of texts in the \kl[\knowled \indent~\vbar~D. Knuth\\ \indent~\vbar~Knuth \end{code} - Other possibilities are to use the - "synonym" or "link=" directives. - \end{hint}} -% -\begin{code}[12.4cm] -\cs{\knowledge}\{latex\}[LaTeX\vbar Latex\vbar LATEX]\\ -\indent\qquad\{\kl{url=}http://en.wikipedia.org/wiki/LaTeX,\\ -\indent\qquad\kl{text=}\cs{\LaTeX}, \kl{color=}gray\} -\end{code} -This is interesting for people's name that can be displayed in various ways depending on the context. Hence -% - \begin{code}[12.4cm] - \cs\knowledge\{Donald Ervin Knuth\}[Donald Knuth\vbar Knuth]\\ - \indent\qquad\{\kl{url=}https://fr.wikipedia.org/wiki/Donald\_Knuth\} - \end{code} \noindent would allow \begin{center} \smallcode{\cs\kl\{Knuth\}}~~~as well as~~~\smallcode{\cs\kl\{Donald Knuth\}},\\ or simply \smallcode{\kl"Knuth\kl"}~~~as well as~~~\smallcode{\kl"Donald Knuth\kl"} and so on \end{center} to all point to the same web address. -It is even more convenient to use it for nouns that are sometimes in plural form or at the beginning of a sentence. Hence: -\begin{code}[12.4cm] -\cs\knowledge\{group\}[groups\vbar Groups\vbar group morphism\\ -\indent~~~~~~~~~~\vbar group morphisms\vbar Group morphisms]\\ -\indent~~~~~ \{\kl{url=}https://en.wikipedia.org/wiki/Group\_(mathematics)\} -\end{code} -\noindent -or the more readable and maintainable: +It is even more convenient to use it for nouns that are sometimes in plural form or at the beginning of a sentence. There is also a scoping feature that helps distinguishing the same names in a different context. For instance: \begin{code}[12.4cm] \cs\knowledge\{\kl{url=}https://en.wikipedia.org/wiki/Group\_(mathematics)\} -\indent~~~\vbar~~group\\ -\indent~~~\vbar~~groups\\ -\indent~~~\vbar~~Groups\\ -\indent~~~\vbar~~group morphism\\ -\indent~~~\vbar~~group morphisms\\ -\indent~~~\vbar~~Group morphisms +\qquad\indent~~~\vbar~~group\\ +\qquad\indent~~~\vbar~~groups\\ +\qquad\indent~~~\vbar~~Groups\\ +\qquad\indent~~~\vbar~~group morphism\\ +\qquad\indent~~~\vbar~~group morphisms\\ +\qquad\indent~~~\vbar~~Group morphisms\\ +\qquad\indent~~~\vbar~~morphism@GROUP\\ +\qquad\indent~~~\vbar~~morphisms@GROUP\\ +\qquad\indent~~~\vbar~~Morphisms@GROUP \end{code} \end{variation} \noindent makes it possible to use the notions in many contexts: \begin{code} -\kl"Groups\kl" form a category when equipped with \kl"group morphisms\kl". +\kl"Groups\kl" form a category when equipped with \kl"group morphisms\kl". Consider now some \kl"morphism@@GROUP\kl" \$\cs\alpha\$ ... \end{code} - +In the above code all quoted parts send the reader to the same wikipedia page about groups. +Note in particular that \smallcode{\kl"morphism@@GROUP\kl"} simply displays `morphism' at compilation. +The \smallcode{GROUP} part is a "scope". +In another part of the document, \smallcode{\kl"morphism@@RING\kl"} can be safely using while using an unspecialised \smallcode{\kl"morphism\kl"} would become quickly unmanageable. @@ -946,108 +933,120 @@ Then write the document using \cs{\intro} (or \kl{""...""} if \kl(option){quotat \cs{\kl} (or \kl{"..."} if \kl(option){quotation} is activated) when it is used. For instance: \begin{code}[12cm] \cs\AP{} -A \cs\intro\{semigroup\} is an ordered pair \verb|$(S,\cdot)$| where \verb|$\cdot$| is an -associative binary operator over~\verb|$S$|.\\ +A \cs\intro\{semigroup\} is an ordered pair \verb|$(S,\cdot)$| in which \verb|$S$| is a set and \verb|$\cdot$| is an +associative binary operator over~\verb|$S$|. A \cs\intro\{semigroup morphism\} is \kl{[...]}\\ \kl{[...]}\\ -\cs{\AP} -A \cs\intro\{monoid\} \verb|$(M,\cdot,1)$| is a \cs\kl\{semigroup\} \verb|$(M,\cdot)$| together -with a neutral element \verb|$1$|. +Consider a \cs\kl\{semigroup morphism\} between \cs\kl\{semigroups\} \verb|$S$| and \verb|$T$|. \kl{[...]} \end{code} \noindent or when the "quotation notation" is activated: \begin{code}[12cm] \cs\AP{} -A \kl{""}semigroup\kl{""} is an ordered pair \verb|$(S,\cdot)$| where \verb|$\cdot$| is an -associative binary operator over~\verb|$S$|.\\ -\kl{[...]}\\ +A \kl{""}semigroup\kl{""} is an ordered pair \verb|$(S,\cdot)$| in which \verb|$S$| is a set and \verb|$\cdot$| is an +associative binary operator over~\verb|$S$|. \cs\AP{} -A \kl{""}monoid\kl{""} \verb|$(M,\cdot,1)$| is a \kl"semigroup\kl" \verb|$(M,\cdot)$| together -with a neutral element \verb|$1$|. +A \kl{""}semigroup morphism\kl{""} is \kl{[...]}\\ +\kl{[...]}\\ +Consider a \kl"semigroup morphism\kl" between \kl"semigroups\kl" \verb|$S$| and \verb|$T$|. \kl{[...]} \end{code} This yields \knowledgeconfigure{visible anchor points=true}% -\marginpar{Note that the \cs{\AP} command is made visible thanks to a red corner.} -\begin{PDFoutput}[10cm] -\AP A \kl[_semigroup]{semigroup} is an ordered pair $(S,\cdot)$ where $\cdot$ is an -associative binary operator over~$S$.\\ +\marginpar{Note that the \cs{\AP} command is made visible thanks to a red corner. This red corner is shifted left in order to fall in the margin.} +\begin{PDFoutput}[11cm] +\AP A \intro[_semigroup]{semigroup} is an ordered pair $(S,\cdot)$ in which~$S$ is a set and $\cdot$ is an +associative binary operator over~$S$. +\AP A \intro[_semigroup morphism]{semigroup morphism} is \kl{[...]}\\ \kl{[...]}\\ -\AP A \kl[_monoid]{monoid} -$(M,\cdot,1)$ is a \kl[_semigroup]{semigroup} $(M,\cdot)$ together -with a neutral element~$1$. +Consider a \kl[_semigroup morphism]{semigroup morphism} between \kl[_semigroups]{semigroups} $S$ and $T$. \kl{[...]} \end{PDFoutput} \knowledgeconfigure{visible anchor points=false}% -\kl{Undefined knowledges} are in brown (it is an important feature that the compilation does not fail: undefined knowledges should not interfere with the writing of the document, which is the main activity of the writer). -One can now see the list of such problems in the file `\kl{filename.diagnose}'. -One can in particular find in the "`Undefined knowledges' section": +\marginpar{"Undefined knowledges" also yield warnings during the compilation. These can be avoided using the "silent" option.}% +\kl{Undefined knowledges} are displayed in orange the first time, and in brown the subsequent ones (it is an important feature that the compilation does not fail: undefined knowledges should not interfere with the main activity of the writer which is writing). +One can now see the list of such problems in the file `\kl{filename.diagnose}', in particular in the "`Undefined knowledges' section": \begin{verbatim} -\knowledge{semigroup}{} -\knowledge{monoid}{}\end{verbatim} -Which means that both `monoid' and `semigroup' are unknown \kl{knowledges}. +\knowledge{ignore} + | semigroup + | semigroups + | semigroup morphism +\end{verbatim}\noindent +which means that the strings `\texttt{semigroup}', `\texttt{semigroups}' and `\texttt{semigroup morphism}' are used but unknown knowledges. \AP -To solve this, let us copy these two (or more) lines in the paper\footnote{It is good practice to use a separate file, something like `paper-knowledge.tex'.}, adding the \kl{notion} directive (which is a configured version of the \kl{autoref} directive, meaning essentially that you want to use the features of the \cs{\intro} command), i.e., in the preamble: +To solve this, let us copy these four lines in the preamble\footnote{It is good practice to use a separate file, something like `paper-knowledge.tex'.}, replacing ignore by the \kl{notion} \kl{directive} and separating it into two blocks. We obtain: \begin{code}[6.7cm] -\cs\knowledge\{semigroup\}\{\kl{notion}\}\\ -\cs\knowledge\{monoid\}\{\kl{notion}\} +\cs\knowledge\{\kl{notion}\}\\ +\indent~~~\klbn|~~semigroup\\ +\indent~~~\klbn|~~semigroups\\ +\cs\knowledge\{\kl{notion}\}\\ +\indent~~~\klbn|~~semigroup morphism \end{code} +\noindent +This informally means that `\texttt{semigroup}' and `\texttt{semigroups}' are two strings that represent the same notion, and that +`\texttt{semigroup morphism}' is a different one. + The result is then (after two compilations): % \knowledgeconfigure{visible anchor points=true}% -\begin{PDFoutput}[10cm] -\knowledge{semigroup}{scope=document,notion}% -\knowledge{monoid}{scope=document,notion}% -\AP A \intro{semigroup} is an ordered pair $(S,\cdot)$ where $\cdot$ is an -associative binary operator over~$S$. +\marginpar{Note that the \cs{\AP} command is made visible thanks to a red corner.} +\begin{PDFoutput}[11cm] +\AP A \intro(ex1){semigroup} is an ordered pair $(S,\cdot)$ in which~$S$ is a set and $\cdot$ is an +associative binary operator over~$S$. +\AP A \intro(ex1){semigroup morphism} is \kl{[...]}\\ \kl{[...]}\\ -\AP A \intro{monoid} $(M,\cdot,1)$ is a \kl{semigroup} $(M,\cdot)$ together -with a neutral element~$1$. +Consider a \kl(ex1){semigroup morphism} between \kl(ex1){semigroups} $S$ and $T$. \kl{[...]} \end{PDFoutput} \knowledgeconfigure{visible anchor points=false}% % -Clicking on `semigroup' now jumps to the place where it was introduced, and very precisely at the -location of the red corner depicting the presence of the \cs{\AP}-command. -If now one adds the option \kl{electronic} while loading the package, then the red corners disappear as well as the brownish undefined knowledges which become black. When using the option \kl{paper}, the links are still there, but all texts are in black. +Clicking on `semigroups' now jumps to the place where it was introduced, and very precisely at the +location of the red corner depicting the presence of the \cs{\AP}-command before. The same goes for `semigroup morphism'. +If now one adds the option \kl{electronic} while loading the package, then the red corners disappear as well as the undefined knowledges which become black. When using the option \kl{paper}, the links are still there, but all texts are in black. -\AP -It is very often the case that for plain english (or other languages) some terms can be used in several forms; verbs can be conjugated; nouns can be plural, and so on. -So usually the lines added to the file look more like: -\begin{code}[10.7cm] -\cs\knowledge\{semigroup\}[semigroups\vbar Semigroups]\{\kl{notion}\}\\ -\cs\knowledge\{monoid\}[monoid\vbar Monoids]\{\kl{notion}\} -\end{code} -\noindent -or, using the more readable "`\vbar'-notation": -\begin{code}[10.7cm] +A more complete example would look as follows: +\begin{code}[6.7cm] \cs\knowledge\{\kl{notion}\}\\ \indent~~~\klbn|~~semigroup\\ \indent~~~\klbn|~~semigroups\\ \indent~~~\klbn|~~Semigroups\\ \cs\knowledge\{\kl{notion}\}\\ -\indent~~~\klbn|~~monoid\\ -\indent~~~\klbn|~~monoids\\ -\indent~~~\klbn|~~Monoids -\end{code} -Now, using a text like -\begin{code}[11cm] -\kl"Monoids\kl" are simply \kl{"}semigroups\kl{"} in which\dots -\end{code} -\noindent will properly be linked to the definition of a semigroup and a monoid. +\indent~~~\klbn|~~semigroup morphism\\ +\indent~~~\klbn|~~semigroup morphisms\\ +\indent~~~\klbn|~~morphism@SG\\ +\indent~~~\klbn|~~morphisms@SG +\end{code}\noindent +The most interesting part consists of the two last lines. These define `\texttt{morphism}' and `\texttt{morphisms}' to represent the same notion as `\texttt{semigroup morphism}' when in the scope `\texttt{SG}' (a convenient abbreviation chosen by the writer for meaning `semigroup'). This is particularly useful for separating morphisms of semigroups from, say, ring morphisms. +Now, using \smallcode{Take a \cs\kl\{morphism\} ...} would yield an unknown knowledge. However, +\smallcode{Take a \cs\kl(SG)\{morphism\} ...} or \smallcode{Take a \kl"morphism@@SG\kl" ...} would yield +\begin{PDFoutput}[6cm] +Take a \kl(ex1)[semigroup morphism]{morphism} ... +\end{PDFoutput}\noindent +which is properly linked to a semigroup morphism. +One can in particular imagine that \smallcode{\kl"morphism@@RG\kl"} would instead represent ring morphisms. + +Sometimes, one does not want to expand the knowledge base because the word is not specific. For instance + \smallcode{These \cs\kl[semigroup]\{algebraic objects\} \kl{[...]}}, or + \smallcode{These \kl"algebraic objects@semigroup\kl"\} \kl{[...]}}, +yields +\begin{PDFoutput}[6cm] +These \kl(ex1)[semigroup]{algebraic objects} \kl{[...]} +\end{PDFoutput}\noindent +The term is properly linked to the definition of semigroups. Finally, in particular for large documents, it is good to have an "index". For this, one should load the package "makeidx@@package" before "knowledge@@package". -Then use it normally: putting \cs{\makeindex} in the preamble and \cs{\printindex} at the end of the document. The \cs{knowledge} commands are not easily adapted: +Then use it normally: putting \cs{\makeindex} in the preamble and \cs{\printindex} at the end of the document. +Finally, the \cs{knowledge} commands are adapted in a straightforward manner: \begin{code}[10.7cm] -\cs\knowledge\{"notion","index="semigroup\}\\ -\indent~~~\vbar~~semigroup\\ -\indent~~~\vbar~~semigroups\\ -\indent~~~\vbar~~Semigroups\\ -\cs\knowledge\{"notion","index="monoid\}\\ -\indent~~~\vbar~~monoid\\ -\indent~~~\vbar~~monoids\\ -\indent~~~\vbar~~Monoids -\end{code} -\noindent -Now, the index (after running \texttt{makeidx}) contains all entries and references to the use of semigroups and monoids. +\cs\knowledge\{\kl{notion},"index="semigroup\}\\ +\indent~~~\klbn|~~semigroup\\ +\indent~~~\klbn|~~semigroups\\ +\indent~~~\klbn|~~Semigroups\\ +\cs\knowledge\{\kl{notion},"index="semigroup morphism\}\\ +\indent~~~\klbn|~~semigroup morphism\\ +\indent~~~\klbn|~~semigroup morphisms\\ +\indent~~~\klbn|~~morphism@SG\\ +\indent~~~\klbn|~~morphisms@SG +\end{code}\noindent +Now, the index (after running \texttt{makeidx}) contains all entries and references to the use of semigroups and semigroup morphisms. See Section~\ref{subsection:makeidx option} for more details on making an index. % @@ -1061,16 +1060,22 @@ See Section~\ref{subsection:makeidx option} for more details on making an index. \label{subsection:mathematics scenario} The examples above show various techniques for using \kl{knowledges} for enhancing the information associated to terms. In fact, these techniques are not incompatible with mathematics. Imagine, for instance that you would like each time a macro \kl[@token]{\monoid} is met, to display $\mathcal M$, you would do for instance: -\marginpar{% - \begin{hint} - Defining new macros is best done using \cs{\newrobustcmd} - (of the "etoolbox@@package" package), rather than \cs{\newcommand} as usual in \LaTeX. - This remark is general independently of the use of "knowledge@@package" - \end{hint}.} \begin{code}[7cm] \cs\newrobustcmd\kl[@token]\monoid\{\cs\mathcal\ M\} \end{code}\noindent Imagine that furthermore, you would like to hyperlink to the definition of a monoid. A standard \cs{\kl} command does the job\footnote{It is highly advised to not use the "quotation notation" in math mode or macros.}: +% +\marginpar{% + \begin{hint} + Defining new macros is best done using \cs{\newrobustcmd} + (of the "etoolbox@@package" package), rather than \cs{\newcommand} as usual in \LaTeX. + This remark is general independently of the use of "knowledge@@package". + \end{hint} + \begin{hint} + The package "mathcommand@@package" offers severals capabilities for redefining commands for math mode. + See Section~\ref{subsubsection:mathcommand} for more. + \end{hint}} +% \begin{code}[9cm] \cs\newrobustcmd\kl[@token]\monoid\{\cs\kl monoid]\{\cs\mathcal\ M\}\}\\~ @@ -1249,6 +1254,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[""silent""] is a Boolean option which, when activated, switches off all warnings during the compilation, but the recap ones at the end. \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. Usually, this is automatically set to true when the "composition mode" is used (the default), and to false when the "paper mode" or the "electronic mode" are used. @@ -1268,12 +1274,11 @@ A \intro{knowledge} is often informally used in this document. Essentially, it c Internally, a \kl{knowledge} is identified by three components: \begin{compactdesc} \itemAP[The \intro{knowledge name}] is a \kl{tex} string that has almost no limitation (but being well balanced, and containing no $\sharp$). It is the text entered by the user for defining and using the \kl{knowledge}. -\itemAP[The \intro{scope}] which is a simple string identifying where the \kl{knowledge} is usable. The scopes are generated by the system. +\itemAP[The \intro{scope}] which is a simple string identifying where the \kl{knowledge} is usable. Scopes can be created by the user, or automatically generated by the system. For instance, internally, each section will be uniquely named `\texttt{section-1}', `\texttt{section-2}', and so on (this is invisible for the user). Each \kl{knowledge} is primarily valid in exactly one such \kl{scope}. \kl{Knowledges} defined in the preamble are given the \kl{scope} `\texttt{document}'. - Usually, the user refers to scope using, for instance, labels. \itemAP[The \intro{namespace}] is a simple string that is used for avoiding clashes. It is most of the time simply `\texttt{default}'. It is `\texttt{style}' for \kl{styles} (that are internally as knowledges). - It is a possibility available to a developer to, when developing a new set of functionalities, use a different \kl{namespace} for avoiding clashes of names (for instance if one wants a french and an english set of knowledges that should not conflict, and would use separate sets of macros). + It is a possibility available to a developer to, when creating a new set of functionalities, use a different \kl{namespace} for avoiding clashes of names (for instance if one wants a french and an english set of knowledges that should not conflict, and would use separate sets of macros). Usually, a normal user does not see \kl{namespaces}. \end{compactdesc} @@ -1286,7 +1291,7 @@ In this section, we describe the main commands that create \kl{knowledges}. The main one is \cs{\knowledge}. It can also be used in combination with \cs{\knowledgedirective}, \cs{\knowledgestyle} and \cs{\knowledgedefault}. \subsubsection{General description of the \cs{\knowledge} command} - +\label{subsubsection:knowledge command general} The key command for introducing knowledges is \cs{\knowledge}. There are two syntaxes. The standard one is: \begin{center} @@ -2379,12 +2384,13 @@ should point to the same introduction location. \item[Variables] The more advanced case is when one wants to track variables. For instance, a macro variable~\cs\x\ could have a different meaning in two distinct theorems. This case is more similar to variables in a programming language, that have a scope. Here the situation is slightly more complicated since a variable could be introduced in a theorem, and then used many pages later in a proof section for instance. \end{description} -The first use is fairly easy. The second one requires a bit more care. We review them one after the other. +The first use is fairly easy. The second one requires a bit more care. We review them one after the other, after some advertisements for the "mathcommand@@package" package. \subsubsection{Defining macros for math: the "mathcommand@@package" package} +\label{subsubsection:mathcommand} -Defining macros is standard in \TeX, and it should be used systematically in writing scientific documents, in particular -when using the "knowledge@@package" package. +Defining macros is standard in \TeX, and it should be used systematically in writing scientific documents. +This is particularly true when using the "knowledge@@package" package. The standard way in \LaTeX\ for defining macros is to use \cs\newcommand. However, the resulting macro, if it has no optional parameters, is then expandable, and it is better to avoid it using instead \cs\newrobustcmd\ from the "etoolbox@@package" package (it has the same syntax). @@ -2407,10 +2413,10 @@ We shall use it in the advanced examples below. It allows: \item The package also gives access to the exponents and indices as well as primes that follow a command (see the documentation). \item It also has some facilities for disabling \LaTeX\ commands and provide suggestions of replacement (useful for remembering the macros and working with colleagues). \item Finally, it offers some commodity for redefining many variables in one command. - E.g. for defining \cs\calA, \cs\calB,\dots to be shortcuts for \smallcode{\cs\cal A}, \smallcode{\cs\cal B},\dots: + E.g. for defining \cs\calA, \cs\calB,\dots to be shortcuts for \smallcode{\cs\cal\{A\}}, \smallcode{\cs\cal\{B\}}, \dots: \begin{code} \cs\LoopCommands\{ABCDEFGHIJKLMNOPQRSTUVWXYZ\}[cal\#1]\par - ~~~~\quad\{\cs\newmathcommand\#2\{\cs\cal~\#1\}\} + ~~~~\quad\{\cs\newmathcommand\#2\{\cs\cal\{\#1\}\}\} \end{code} \end{itemize} @@ -2428,7 +2434,7 @@ Five points have to be kept in mind: \item Use the control sequence of the macro itself as the "knowledge" name. This does not cause problems and is easier to maintain. \item Use the \cs{\intro*} notation for introducing macros. -\item The surrounding space is broken by using the command \cs{\kl}. Commands like \cs\mathrel\ should be used to recover it. +\item The surrounding typography is broken when using the command \cs{\kl} (if someone knows how to solve that, please contact me). Commands such as \cs\mathrel\ should be used to recover it. \end{itemize} These five points are illustrated in the following code: \begin{code} @@ -2446,8 +2452,8 @@ Two variation may be comfortable to use. When writing a paper, in particular with coauthors, one may be tempted to not always use the macros designed for each case. For helping to remember the macro, one can use instead (using the "mathcommand@@package" package): \begin{code} -\cs\disablecommand\cs\rho\\ -\cs\suggestcommand\cs\rho\{Use \cs\myFunction.\}\\ +\cs\disablecommand\cs\circ\\ +\cs\suggestcommand\cs\rho\{Use instead \cs\comp\ for function composition.\}\\ \cs\newrobustcmd\cs\myFunction\{\cs\kl[\cs\myFunction]\{\cs\LaTeXrho\}\}\\ \cs\knowledge\cs\myFunction\{notion\}\\ {[...]}\\ @@ -2461,7 +2467,7 @@ that in the definition of \cs\myFunction, \cs\LaTeXrho\ is used instead of~\cs\r but~\cs\LaTeXrho\ gives access to its original meaning. \paragraph{Redefining the original \TeX\ macro} -Another situation is that one would like to use the \cs\rho\ control sequence for accessing our function instead of \cs\myFunction (simply because this is more convenient and easy to remember, and we know in advance that no confusion may arise). +Another situation is that one would like to use the \cs\rho\ control sequence for accessing our function instead of \cs\myFunction\ (simply because this is more convenient and easy to remember, and we know in advance that no confusion may arise). In this case, the "mathcommand@@package" package can also be of some help: \begin{code} \cs\renewmathcommand\cs\rho\{\cs\kl[\cs\rho]\{\cs\LaTeXrho\}\}\\ @@ -2504,7 +2510,7 @@ For obtaining this, this requires: In this section, we present some fixes that have been added to help the user solve problems. -\paragraph{Hyperref and twocolumn} It happens that the "hyperref@@package" and two-column mode yields a fatal error. This happens when a link spans across the boundary between two pages. This is an issue which is not related to the "knowledge@@package" package, but becomes severely more annoying when more links have to be used. +\paragraph{Hyperref and twocolumn} It happens that the "hyperref@@package" and two-column mode together may yield a fatal error. This happens when a link spans across the boundary between two pages. This is an issue which is not related to the "knowledge@@package" package, but becomes severely more annoying when more links have to be used. A \emph{workaround} can be tried by using using \begin{center} \smallcode{\cs\knowledgeconfigure\{""fix hyperref twocolumn""\}}. @@ -2686,7 +2692,7 @@ the incriminated environment using \cs\phantomsection, and then use \cs{\reintro \subsection{Name clash (eg with the "complexity@@package" package)} It may happen that an already defined command is redefined by the "knowledge@@package" package. -This happens in particular wen used in combination with the "complexity@@package" package: both package redefine the command \cs\AP. For "complexity@@package", this denotes a complexity class, and for "knowledge@@package", it is an "anchor point". +This happens in particular wen used in combination with the "complexity@@package" package: both packages try to define the command \cs\AP. For "complexity@@package", this denotes a complexity class, and for "knowledge@@package", it is an "anchor point". The problem has to be resolved by hand. The two following solutions are quick hacks: \begin{center} \begin{tabular}{ccc} @@ -2733,7 +2739,15 @@ The preamble thus looks like: This is an annoying feature of the "hyperref@@package" package to surround all links by red boxes (that may appear or not depending on the viewer). This is very heavy in document with many links. By default, this is deactivated when using the "knowledge@@package", unless the "no patch" option is used when loading the package. When the "no patch" option is used, the same effect can nevertheless be obtain, eg using \smallcode{\cs\hypersetup\{hidelinks\}}. +\subsubsection{Incorrect color for links in "paper mode" (e.g. red in with \kl(package){acmart})} +Some classes, like \kl(package){acmart}, change the default color of the hyperlinks of \kl(package){hyperref}. Since "knowledge@@package" does not apply any color to the links in "paper mode", this unexpected color appears. The black color of the "paper mode" can be forced by using: +\begin{code} +\cs\IfKnowledgePaperMode\\ + \cs\knowledgestyle\{"kl@@style"\}\{"color="black\}\\ + \cs\knowledgestyle\{"notion@@style"\}\{"color="black\}\\ +\cs{\ fi} +\end{code} \subsection{Problems with scope} \subsubsection{Problems in combination with \cs{\bibitem} and "thebibliography@@env"} @@ -2895,6 +2909,7 @@ If other kind of problems occur, report them to \texttt{thomas.colcombet@irif.fr \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[{{\kl(option)[quotation]{quotation=}\textmd{\{true,false\}}}}] activates or deactivates the "quotation notation". +\item["silent"] is a Boolean option which, when activated, switches off all warnings during the compilation, but the recap ones at the end. \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} diff --git a/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx b/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx index c76b3f0aac5..947040dac96 100644 --- a/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx +++ b/Master/texmf-dist/source/latex/knowledge/knowledge-code.dtx @@ -23,7 +23,7 @@ % % \iffalse %<head>\usepackage{expl3} -%<head>\ProvidesExplPackage{knowledge}{2020/03/05}{1.23}{} +%<head>\ProvidesExplPackage{knowledge}{2020/09/22}{1.24}{} %<*driver> \def\knowledgecode{active} \input{knowledge.tex} @@ -56,6 +56,7 @@ % \changes{1.21}{2020/01/26}{bug fix} % % \changes{1.22}{2020/03/05}{improvements} % % \changes{1.23}{2020/04/25}{minor change} % +% \changes{1.24}{2020/09/22}{silent option} % % \GetFileInfo{knowledge.sty} % % \DoNotIndex{} % @@ -73,31 +74,31 @@ % \begin{macrocode} This directory contains the package - name: knowledge - license: LaTeX Project Public License version 1.2 or above - version: v1.23 - date: 2020/04/25 - author: Thomas Colcombet - mail: thomas.colcombet@irif.fr - web: https://www.irif.fr/~colcombe/knowledge_en.html + name: knowledge + license: LaTeX Project Public License version 1.2 or above + version: v1.24 + date: 2020/09/22 + author: Thomas Colcombet + mail: thomas.colcombet@irif.fr + web: https://www.irif.fr/~colcombe/knowledge_en.html -Purpose: +### Purpose: The knowledge package for LaTeX offers a systematic way to handle notions/concepts/terms throughout a document. In combination with - hyperref, it is used for easily handling links inside a document (every + `hyperref`, it is used for easily handling links inside a document (every use of a concept is linked to its introduction), or outside the document (for centralizing the url's in a separate part). It also helps building an index, and deals with scoping of concepts as well as mathematics. It is designed to--as much as possible--not interfere with the writing of the document. -Install: +### Install: It is sufficient to have the file knowledge.sty accessible by LaTeX. - It can be produced by `make knowledge.sty' if necessary. - The documentation is in the file knowledge.pdf. - A starting example can be found in knowledge-example.tex. + It can be produced by `make knowledge.sty` if necessary. + The documentation is in the file `knowledge.pdf`. + A starting example can be found in `knowledge-example.tex`. -Content of the file knowledge-sources.zip: +### Content of knowledge-sources.zip: - README.md: this file generated while compiling knowledge.ins, the content is in knowledge-code.dtx - knowledge.sty: the package file (generated using knowledge.ins) @@ -200,10 +201,11 @@ Content of the file knowledge-sources.zip: % \begin{macrocode} \cs_new:Nn\knowledge_info:n {\msg_info:nnn{knowledge}{knowledge~info}{#1}} -\cs_new:Nn\knowledge_warning:n - {\msg_warning:nnn{knowledge}{knowledge~warning}{#1}} +\cs_new:Nn\knowledge_warning:n{ + \msg_warning:nnn{knowledge}{knowledge~warning}{#1} + } \cs_new:Nn\knowledge_error:n - {\msg_error:nnn{knowledge}{knowledge~error}{#1}} + {\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} @@ -220,6 +222,33 @@ Content of the file knowledge-sources.zip: \cs_generate_variant:Nn\knowledge_warning:n{x} \cs_generate_variant:Nn\knowledge_error:n{x} % \end{macrocode} +% +% \begin{macrocode} +\cs_new:Npn\knowledge_warning:nn{ + \bool_if:NTF\knowledge_warningsilent_bool + \use_none:nn + \msg_warning:nn +} +\cs_new:Npn\knowledge_warning:nnn{ + \bool_if:NTF\knowledge_warningsilent_bool + \use_none:nnn + \msg_warning:nnn +} +\cs_new:Npn\knowledge_warning:nnnn{ + \bool_if:NTF\knowledge_warningsilent_bool + \use_none:nnnn + \msg_warning:nnnn +} +\cs_generate_variant:Nn\knowledge_warning:nnnn{nnxx} +\cs_new:Npn\knowledge_warning:nnnnn{ + \bool_if:NTF\knowledge_warningsilent_bool + \use_none:nnnnn + \msg_warning:nnnnn +} +\cs_generate_variant:Nn\knowledge_warning:nnnnn{nnxxx} +% \end{macrocode} +% +% %\AP We provide now the `official' messages \csintro{knowledge~recursion}, \csintro{knowledge~unknown}, % \csintro{knowledge~unknown~in~scope}, \csintro{knowledge~unknown~label}, \csintro{package~required} and \csintro{knowledge~exists}. % \begin{macrocode} @@ -440,6 +469,11 @@ Content of the file knowledge-sources.zip: \KnowledgeConfigureBooleanOption[\knowledge_warningstrict_bool]{strict} % \end{macrocode} % \begin{macrocode} +\bool_new:N\knowledge_warningsilent_bool +\bool_set_false:N\knowledge_warningsilent_bool +\KnowledgeConfigureBooleanOption[\knowledge_warningsilent_bool]{silent} +% \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}} @@ -2799,7 +2833,7 @@ Content of the file knowledge-sources.zip: \cs_new:Nn\knowledge_kl_error_unknown_firsttime: {\bool_if:cTF{\knowledge_variant_var:n{unknownwarning_bool}} {\IfKnowledgePaperModeF{ - \msg_warning:nnxxx{ knowledge }{ knowledge~unknown } + \knowledge_warning:nnxxx{ knowledge }{ knowledge~unknown } {\exp_not:V\knowledge_kl_key_tl} {\exp_not:V\knowledge_kl_namespace_tl} {\seq_use:Nn\knowledge_visible_instances_seq{|}}} @@ -2833,7 +2867,7 @@ Content of the file knowledge-sources.zip: \cs_new:Nn\knowledge_kl_error_unknown_in_scope_firsttime: {\bool_if:cTF{\knowledge_variant_var:n{unknownwarning_bool}} {\IfKnowledgePaperModeF{ - \msg_warning:nnxxx{ knowledge }{ knowledge~unknown~in~scope } + \knowledge_warning:nnxxx{ knowledge }{ knowledge~unknown~in~scope } {\exp_not:V\knowledge_kl_key_tl} {\exp_not:V\knowledge_kl_namespace_tl} {\knowledge_kl_linkscope_tl}}}{} @@ -2869,7 +2903,7 @@ Content of the file knowledge-sources.zip: } % \IfKnowledgePaperModeF{ - \msg_warning:nnxx{ knowledge }{ knowledge~unknown~label } + \knowledge_warning:nnxx{ knowledge }{ knowledge~unknown~label } {\exp_not:V\knowledge_kl_key_tl} {\knowledge_kl_linkscope_tl}} % diff --git a/Master/texmf-dist/tex/latex/knowledge/knowledge.sty b/Master/texmf-dist/tex/latex/knowledge/knowledge.sty index fa431f68578..3e48b04ccb8 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}{2020/03/05}{1.23}{} +\ProvidesExplPackage{knowledge}{2020/09/22}{1.24}{} %%%%%%%%%% \RequirePackage{l3keys2e} \RequirePackage{etoolbox} @@ -830,8 +830,9 @@ } \cs_new:Nn\knowledge_info:n {\msg_info:nnn{knowledge}{knowledge~info}{#1}} -\cs_new:Nn\knowledge_warning:n - {\msg_warning:nnn{knowledge}{knowledge~warning}{#1}} +\cs_new:Nn\knowledge_warning:n{ + \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 @@ -842,6 +843,28 @@ \cs_generate_variant:Nn\knowledge_info:n{x} \cs_generate_variant:Nn\knowledge_warning:n{x} \cs_generate_variant:Nn\knowledge_error:n{x} +\cs_new:Npn\knowledge_warning:nn{ +\bool_if:NTF\knowledge_warningsilent_bool +\use_none:nn +\msg_warning:nn +} +\cs_new:Npn\knowledge_warning:nnn{ +\bool_if:NTF\knowledge_warningsilent_bool +\use_none:nnn +\msg_warning:nnn +} +\cs_new:Npn\knowledge_warning:nnnn{ +\bool_if:NTF\knowledge_warningsilent_bool +\use_none:nnnn +\msg_warning:nnnn +} +\cs_generate_variant:Nn\knowledge_warning:nnnn{nnxx} +\cs_new:Npn\knowledge_warning:nnnnn{ +\bool_if:NTF\knowledge_warningsilent_bool +\use_none:nnnnn +\msg_warning:nnnnn +} +\cs_generate_variant:Nn\knowledge_warning:nnnnn{nnxxx} \msg_new:nnn{ knowledge }{ knowledge~recursion } { The~knowledges~are~probably~cyclic,~starting~from\\<#1>~(namespace~'#2'),~ currently~at~'#3'.} @@ -959,6 +982,9 @@ \bool_new:N\knowledge_warningstrict_bool \bool_set_false:N\knowledge_warningstrict_bool \KnowledgeConfigureBooleanOption[\knowledge_warningstrict_bool]{strict} +\bool_new:N\knowledge_warningsilent_bool +\bool_set_false:N\knowledge_warningsilent_bool +\KnowledgeConfigureBooleanOption[\knowledge_warningsilent_bool]{silent} \bool_new:N\knowledge_configuration_quotation_bool \KnowledgeConfigureBooleanOptionTF[\knowledge_configuration_quotation_bool]{quotation}{\klactivatequotation}{\kldeactivatequotation} \KnowledgeConfigureTrigger{protect~quotation}{\kl_protect_environment_quotation:n{#1}} @@ -2452,7 +2478,7 @@ \cs_new:Nn\knowledge_kl_error_unknown_firsttime: {\bool_if:cTF{\knowledge_variant_var:n{unknownwarning_bool}} {\IfKnowledgePaperModeF{ - \msg_warning:nnxxx{ knowledge }{ knowledge~unknown } + \knowledge_warning:nnxxx{ knowledge }{ knowledge~unknown } {\exp_not:V\knowledge_kl_key_tl} {\exp_not:V\knowledge_kl_namespace_tl} {\seq_use:Nn\knowledge_visible_instances_seq{|}}} @@ -2484,7 +2510,7 @@ \cs_new:Nn\knowledge_kl_error_unknown_in_scope_firsttime: {\bool_if:cTF{\knowledge_variant_var:n{unknownwarning_bool}} {\IfKnowledgePaperModeF{ - \msg_warning:nnxxx{ knowledge }{ knowledge~unknown~in~scope } + \knowledge_warning:nnxxx{ knowledge }{ knowledge~unknown~in~scope } {\exp_not:V\knowledge_kl_key_tl} {\exp_not:V\knowledge_kl_namespace_tl} {\knowledge_kl_linkscope_tl}}}{} @@ -2518,7 +2544,7 @@ } % \IfKnowledgePaperModeF{ - \msg_warning:nnxx{ knowledge }{ knowledge~unknown~label } + \knowledge_warning:nnxx{ knowledge }{ knowledge~unknown~label } {\exp_not:V\knowledge_kl_key_tl} {\knowledge_kl_linkscope_tl}} % |