Commit c4c3fcf0 authored by Thomas Colcombet's avatar Thomas Colcombet
Browse files

mini changes

parent 3210bcb5
\documentclass{article}
\usepackage[check-declarations]{expl3}
\usepackage[utf8]{inputenc}
\usepackage[svgnames]{xcolor}
\usepackage[composition,notion,hyperref,quotation]{knowledge}
\knowledge{A}{cyclic color}
\knowledge{B}{cyclic color}
\knowledge{C}{cyclic color}
\knowledge{D}{cyclic color}
\knowledge{E}{cyclic color}
\knowledge{F}{cyclic color}
\knowledge{G}{cyclic color}
\knowledge{H}{cyclic color}
\knowledge{I}{cyclic color}
\knowledge{J}{cyclic color}
\knowledge{K}{cyclic color}
\knowledge{L}{cyclic color}
\knowledge{M}{cyclic color}
\knowledgeconfigure{cyclic colors={yellow,orange,red,orange}}
\knowledge{N}{cyclic color}
\knowledge{O}{cyclic color}
\knowledge{P}{cyclic color}
\knowledge{Q}{cyclic color}
\knowledge{R}{cyclic color}
\knowledge{S}{cyclic color}
\knowledge{T}{cyclic color}
\knowledge{U}{cyclic color}
\knowledge{V}{cyclic color}
\knowledge{W}{cyclic color}
\knowledge{X}{cyclic color}
\knowledge{Y}{cyclic color}
\knowledge{Z}{cyclic color}
\begin{document}
"A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "W" "X" "Y" "Z"
\end{document}
\documentclass{article}
\usepackage[check-declarations]{expl3}
\usepackage[utf8]{inputenc}
\usepackage[svgnames]{xcolor}
\usepackage{expl3}
\usepackage[composition,notion,hyperref]{knowledge}
\knowledge{B}{autoref}
\knowledge{C}{autoref}
\knowledge{D}{autoref}
\knowledge{E}{autoref}
\knowledge{F}{autoref}
\begin{document}
Compiling this document should produce in the diagnose file:\\
1 undefined knowledge(s).\\
1 autoreference(s) are introduced twice.\\
1 autoreference(s) are used but not introduced.\\
1 autoreference(s) are properly used.\\
1 autoreference(s) are defined but not used.\\
\kl{A}, \kl{B}, \intro{C}, \intro{D}, \kl{D}, \intro{F}, \intro{F}
\end{document}
\ No newline at end of file
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage{showidx}
\usepackage{makeidx}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{knowledge}
\knowledgeconfigure{notion,quotation}
\makeindex
\knowledgestyle{intro notion}{color=red,md}
\knowledge{A}[a]{notion,index = Letters!{A,a}}
\knowledge{B}[b]{notion,index = Letters!{B,b}}
\knowledge{C}[c]{notion,index = Letters!{C,c}}
\knowledge{D}[d]{notion,index = Letters!{D,d}}
\knowledge{E}[e]{notion,index = Letters!{E,e}}
\knowledge{F}[f]{notion,index = Letters!{F,f}}
\knowledge{1}[one|One]{notion,index = Numbers!{One=1}}
\begin{document}
\AP "A""b""b""a""1"
\newpage
\AP "B""a"\intro{c}
\newpage
\AP ""A""
\newpage
\AP "A" and ""B""
\newpage
\AP "A" and ""B""
\newpage
\AP "A" and \reintro{B}
\printindex
\end{document}
\documentclass{article}
\usepackage{tikz-cd}
\usepackage[quotation]{knowledge}
\knowledgeconfigure{protect quotation={tikzcd}}
\begin{document}
"test"
\begin{tikzcd}
A \arrow[rd] \arrow[r,"e"] & B \\%
&D
\end{tikzcd}
"test"
\end{document}
\ No newline at end of file
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage[quotation,notion,scope]{knowledge}
%\knowledgeconfigure{bar suggestion=false}
\knowledge{A}{scope = scope1,notion}
\begin{scope}\knowledgescope{scope2}
\knowledge{B}{notion}
\end{scope}
\begin{scope}\label{scope3}
\knowledge{C}{notion}
\end{scope}
\knowledge{notion}
| D @ scope4
\knowledge{E}{notion}
\begin{document}
\knowledge{A'}{scope = scope1',notion}
\begin{scope}\knowledgescope{scope2'}
\knowledge{B'}{notion}
\end{scope}
\begin{scope}\label{scope3'}
\knowledge{C'}{notion}
\end{scope}
\knowledge{notion}
| D' @ scope4'
\knowledge{E'}{notion}
\begin{tabular}{c|c|c|c|c}
\kl{A},\kl(scope1){A}&\kl{B},\kl(scope2){B}&\kl{C},\kl(scope3){C}&\kl{D},\kl(scope4){D}&\kl{E}\\\hline
"A","A@@scope1"&"B","B@@scope2" & "C","C@@scope3" &"D","D@@scope4" & "E"\\\hline
\kl{A'},\kl(scope1'){A'}&\kl{B'},\kl(scope2'){B'}&\kl{C'},\kl(scope3'){C'}&\kl{D'},\kl(scope4'){D'}&\kl{E'}\\\hline
"A'","A'@@scope1'"&"B'","B'@@scope2'" & "C'","C'@@scope3'" &"D'","D'@@scope4'" & "E'"
\end{tabular}
\end{document}
\documentclass{standalone}
\begin{document}
This is in the subfile.
\end{document}
\documentclass{article}
\usepackage{standalone}
\usepackage{knowledge}
\begin{document}
This is in the main file.
\input{regression-standalone-input.tex}
This is again in the main file.
\end{document}
\documentclass{article}
\usepackage[silent]{../knowledge}
\begin{document}
\kl{test}
\end{document}
\ No newline at end of file
......@@ -23,7 +23,7 @@
%
% \iffalse
%<head>\usepackage{expl3}
%<head>\ProvidesExplPackage{knowledge}{2020/09/22}{1.24}{}
%<head>\ProvidesExplPackage{knowledge}{2021/03/31}{1.25}{}
%<*driver>
\def\knowledgecode{active}
\input{knowledge.tex}
......@@ -57,6 +57,7 @@
% \changes{1.22}{2020/03/05}{improvements} %
% \changes{1.23}{2020/04/25}{minor change} %
% \changes{1.24}{2020/09/22}{silent option} %
% \changes{1.25}{2021/03/31}{bug correction} %
% \GetFileInfo{knowledge.sty} %
% \DoNotIndex{}
%
......@@ -76,8 +77,8 @@ This directory contains the package
name: knowledge
license: LaTeX Project Public License version 1.2 or above
version: v1.24
date: 2020/09/22
version: v1.25
date: 2021/03/31
author: Thomas Colcombet
mail: thomas.colcombet@irif.fr
web: https://www.irif.fr/~colcombe/knowledge_en.html
......@@ -147,11 +148,6 @@ This directory contains the package
{}
% \end{macrocode}
%
% When uploading to arXiv, a 2016 version of LaTeX is used and one macro name has changed since this in \kl{expl3}. Let us correct it: it makes it possible to include the latest version of \kl(package){knowledge} as a .sty file:
% \begin{macrocode}
\cs_if_exist:NTF\ior_str_get:NN{}
{\cs_set_eq:NN\ior_str_get:NN\ior_get_str:NN}
% \end{macrocode}
%
%\AP One defines the code of \csintro{\klparse_ifnextchar:NTF}
% which is a link to \cs{\@ifnextchar},
......@@ -587,6 +583,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{cleveref}
% \end{macrocode}
%\begin{quote}\tt
%\csintro{\knowledge_option_aci_define:n}\{package name\}
......@@ -631,6 +628,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{cleveref}
% \end{macrocode}
%
% \subsubsection{Executing the package options}
......@@ -702,6 +700,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{ cleveref }{}
% \end{macrocode}
%
%
......@@ -2428,7 +2427,7 @@ This directory contains the package
\keys_if_exist:nnTF{ knowledge~directives }{ #2 }
{\IfBooleanTF{#1}
{\knowledgedirective:nnn{#2}{#3}{#4}}
{\msg_error:nnn{ knowledge }{ knowledgedirective~redifinition }{#2}}}
{\msg_error:nnn{ knowledge }{ knowledgedirective~redefinition }{#2}}}
{\knowledgedirective:nnn{#2}{#3}{#4}}
\kl_hide_end:
}
......@@ -2436,10 +2435,10 @@ This directory contains the package
\cs_set:cn
{knowledgedirective_#1:n}
{\keys_set:nn{ knowledge~directives }{#3}}
\keys_define:nn{ knowledge~directives }
\keys_define:nn{ knowledge~directives }
{#1 .code:n = {\use:c{knowledgedirective_#1:n}{##1}}}
\IfNoValueF{#2}
{\keys_define:nn{ knowledge~directives }{#2 .default:n = {#2}}}
\IfNoValueF{#2}
{\keys_define:nn{ knowledge~directives }{#1 .default:n = {#2}}}
}
% \end{macrocode}
%
......@@ -2525,7 +2524,7 @@ This directory contains the package
{\use:c{knowledge_kl_\tl_to_str:V\knowledge_kl_modifiers_tl _init_tl}}
{\knowledge_error:x
{Unknown~variant~modifier~sequence~`\exp_not:V\knowledge_kl_modifiers_tl'.}}
%
%
\knowledge_kl_modifiers_reset:
%
\knowledge_kl_use_styles:x{\knowledge_kl_default_style_tl}
......@@ -2698,7 +2697,8 @@ This directory contains the package
% When the \kl{knowledge} is found, it is eventually executed using
% \begin{code}
% \csintro{\knowledge_kl_exec:nnn}\{namespace\}\{instance\}\{key\}
% \end{code} The argument is a control sequence pointing to the \kl{knowledge}. It is first executed
% \end{code}
% The argument is a control sequence pointing to the \kl{knowledge}. It is first executed
% in order to set the variables.
% Then, the token of the \kl{knowledge} is stored in the variable \cs{\knowledge_kl_resourcetoken_tl}.
% Then, if a \kl{style} is given, it is executed. The next step is to update the \kl{knowledge}
......@@ -2775,8 +2775,6 @@ This directory contains the package
%
%
%
%
%
% \subsubsection{Error handling}
%
%
......@@ -2950,12 +2948,6 @@ This directory contains the package
{}}
% \end{macrocode}
%
% \begin{macrocode}
% \end{macrocode}
%
% \begin{macrocode}
% \end{macrocode}
%
% \subsubsection{Implementation of \cs{\knowledgenewvariant}}
%
% \begin{macrocode}
......@@ -3008,6 +3000,8 @@ This directory contains the package
\exp_not:c{knowledge_kl_\cs_to_str:N#1_unknown_style_cont_tl}
\exp_not:n{\tl_set_eq:NN\knowledge_kl_styledirectives_tl}
\exp_not:c{knowledge_kl_\cs_to_str:N#1 _styledirectives_tl}
\exp_not:n{\tl_set_eq:NN\knowledge_kl_display_process_tl}
\exp_not:c{knowledge_kl_\cs_to_str:N#1 _display_process_tl}
\exp_not:c{knowledge_kl_\cs_to_str:N#1 _autoknowledge_tl}
}
%
......@@ -3041,6 +3035,9 @@ This directory contains the package
namespace .code:n =
{\tl_set:cn{knowledge_kl_\knowledge_variant_key_tl _namespace_tl}{#1}},
%
display~code .code:n =
{\tl_set:cn{knowledge_kl_\knowledge_variant_key_tl _display_process_tl}{#1}},
%
unknown~warning .choices:nn = {true,false}
{\bool_set_text:cn{knowledge_kl_\knowledge_variant_key_tl _unknownwarning_bool}{#1}},
%
......@@ -3331,7 +3328,9 @@ This directory contains the package
%
%
%
%
% \csintro{\knowledge_kl_display_generic:n} applies a code to the current displaycode, which is surrounded by braces.
% \csintro{\knowledge_kl_display_generic_cond:Nn} does the same thing under condition
% of a boolean (see code of \cs{\knowledge_kl_default_compute_code:}).
% \begin{macrocode}
\cs_new:Nn\knowledge_kl_display_generic:n
{\tl_gset:Nx\knowledge_display_code_tl
......@@ -3344,8 +3343,17 @@ This directory contains the package
\cs_generate_variant:Nn\knowledge_kl_display_generic:n{x}
\cs_generate_variant:Nn\knowledge_kl_display_generic_cond:Nn{Nx}
% \end{macrocode}
% \AP \csintro{\knowledge_kl_compute_code:} tests whether a special display process is given, or otherwise
% defaults to the standard one.
% \begin{macrocode}
\cs_new:Nn\knowledge_kl_compute_code:{
\tl_if_exist_ne:NTF\knowledge_kl_display_process_tl
\knowledge_kl_display_process_tl
\knowledge_kl_default_compute_code:
}
% \end{macrocode}
% \begin{macrocode}
\cs_new:Nn\knowledge_kl_default_compute_code:{
\tl_if_exist_ne:NTF\knowledge_kl_forcedtext_tl
{\tl_gset_eq:NN\knowledge_display_code_tl\knowledge_kl_forcedtext_tl}
{\tl_gset_eq:NN\knowledge_display_code_tl\knowledge_kl_text_tl}
......@@ -3367,6 +3375,9 @@ This directory contains the package
%
\bool_if:NT\knowledge_xcolor_active_bool
\knowledge_kl_compute_code_xcolor:
%
\knowledge_kl_compute_code_hyperreftarget:
%
\bool_if:NT\knowledge_hyperref_active_bool
\knowledge_kl_compute_code_hyperref:
%
......@@ -3410,8 +3421,6 @@ This directory contains the package
{\exp_not:N\kl_hyperlink_silentref:nn
{\exp_not:V\knowledge_kl_ref_tl}}}
%
\knowledge_kl_compute_code_hyperreftarget:
%
\bool_if:NT\kl_autoreflink_bool
{\tl_if_exist_ne:NT\knowledge_kl_autoref_tl
{\knowledge_kl_display_generic:x
......@@ -3502,6 +3511,32 @@ This directory contains the package
}
% \end{macrocode}
%
%
% \subsection{Displaying labels}
% Code for \cs{\kref}, \cs{\kpageref}, \cs{\kcref} and \cs{\kCref}.
%
% \csintro{\knowledgedisplayref} is to be used when defining a variant. It takes a macro, and creates the display code
% which applies it to the label reference of the knowledge. See code of \cs{\kref}, \cs{\kcref}, \dots
% \begin{macrocode}
\cs_new:Nn\knowledge_labelref_display_process:n{
\tl_if_exist_ne:NTF\knowledge_kl_ref_tl
{\tl_gset:Nx\knowledge_display_code_tl
{\exp_not:n{#1}
{\exp_not:V\knowledge_kl_ref_tl}}
}{
\bool_if:NTF\kl_autoreflink_bool
{\tl_if_exist_ne:NT\knowledge_kl_autoref_tl
{\tl_gset:Nx\knowledge_display_code_tl
{\exp_not:n{#1}
{\exp_not:V\knowledge_kl_autoref_tl}}
}
}{ \tl_gset:Nn\knowledge_display_code_tl{???}
}
}
}
\cs_set_eq:NN\knowledgedisplayref\knowledge_labelref_display_process:n
% \end{macrocode}
%
% \subsubsection{Other commands}
%
% \paragraph{\cs{\AP} and \cs{\itemAP}}
......@@ -3797,7 +3832,7 @@ This directory contains the package
\NewKnowledgeParamTl*{ref}
\knowledge_directives_require_aci_package:nn
{url,ref,autoref}{hyperref}
{url}{hyperref}
% \end{macrocode}
% The commands \cs{\intro}, \cs{\kl} and \cs{\reintro} are made silent when
% creating the pdf names of sections (for avoiding warnings of the "hyperref@@package").
......@@ -3845,6 +3880,89 @@ This directory contains the package
\NewKnowledgeParamTl*[\knowledge_kl_index_key_tl]{index~key}
% \end{macrocode}
%
% \subsubsection{The \kl{cleveref option}}
%
% \begin{macrocode}
\bool_if:NTF\knowledge_cleveref_active_bool{
\knowledgenewvariant\kcref{
namespace=default,
unknown~style={kl~unknown,ref~unknown},
unknown~style~cont={kl~unknown~cont,ref~unknown},
default~style=autoref~link,
display~code={\knowledgedisplayref\cref}
}
\knowledgenewvariant\kCref{
namespace=default,
unknown~style={kl~unknown,ref~unknown},
unknown~style~cont={kl~unknown~cont,ref~unknown},
default~style=autoref~link,
display~code={\knowledgedisplayref\Cref}
}
\knowledgenewvariant\kcpageref{
namespace=default,
unknown~style={kl~unknown,ref~unknown},
unknown~style~cont={kl~unknown~cont,ref~unknown},
default~style=autoref~link,
display~code={\knowledgedisplayref\cpageref}
}
\knowledgenewvariant\kCpageref{
namespace=default,
unknown~style={kl~unknown,ref~unknown},
unknown~style~cont={kl~unknown~cont,ref~unknown},
default~style=autoref~link,
display~code={\knowledgedisplayref\Cpageref}
}
\knowledgenewvariant\knamecref{
namespace=default,
unknown~style={kl~unknown,ref~unknown},
unknown~style~cont={kl~unknown~cont,ref~unknown},
default~style=autoref~link,
display~code={\knowledgedisplayref\namecref}
}
\knowledgenewvariant\knameCref{
namespace=default,
unknown~style={kl~unknown,ref~unknown},
unknown~style~cont={kl~unknown~cont,ref~unknown},
default~style=autoref~link,
display~code={\knowledgedisplayref\nameCref}
}
\knowledgenewvariant\knamecrefs{
namespace=default,
unknown~style={kl~unknown,ref~unknown},
unknown~style~cont={kl~unknown~cont,ref~unknown},
default~style=autoref~link,
display~code={\knowledgedisplayref\namecrefs}
}
\knowledgenewvariant\knameCrefs{
namespace=default,
unknown~style={kl~unknown,ref~unknown},
unknown~style~cont={kl~unknown~cont,ref~unknown},
default~style=autoref~link,
display~code={\knowledgedisplayref\nameCrefs}
}
\knowledgevariantmodifier{\kcref*\kl}{\kcref}
\knowledgevariantmodifier{\kCref*\kl}{\kCref}
\knowledgevariantmodifier{\kcpageref*\kl}{\kcpageref}
\knowledgevariantmodifier{\kCpageref*\kl}{\kCpageref}
\knowledgevariantmodifier{\knamecref*\kl}{\knamecref}
\knowledgevariantmodifier{\knameCref*\kl}{\knameCref}
\knowledgevariantmodifier{\knamecrefs*\kl}{\knamecrefs}
\knowledgevariantmodifier{\knameCrefs*\kl}{\knameCrefs}
}{
\cs_new:Nn\knowledge_cleveref_error:N{
\newcommand#1{\knowledge_error:n{Use~package~'cleveref'~for~command~#1.}}
}
\knowledge_cleveref_error:N\kcref
\knowledge_cleveref_error:N\kCref
\knowledge_cleveref_error:N\kcpageref
\knowledge_cleveref_error:N\kCpageref
\knowledge_cleveref_error:N\knamecref
\knowledge_cleveref_error:N\knameCref
\knowledge_cleveref_error:N\knamecrefs
\knowledge_cleveref_error:N\knameCrefs
}
% \end{macrocode}
%
% \subsection{Fixes}
%
% \subsubsection{Hyperref in twocolumn}
......@@ -3993,8 +4111,23 @@ This directory contains the package
unknown style cont=intro unknown cont,
style directive=intro style
}
\knowledgestyle{ref unknown}{text=??}
\knowledgenewvariant\kref{
namespace=default,
unknown style={kl unknown,ref unknown},
unknown style cont={kl unknown cont,ref unknown},
default style=autoref link,
display code={\knowledgedisplayref\ref}
}
\knowledgenewvariant\kpageref{
namespace=default,
unknown style={kl unknown,ref unknown},
unknown style cont={kl unknown cont,ref unknown},
default style=autoref link,
display code={\knowledgedisplayref\pageref}
}
\knowledgevariantmodifier{\kref*\kl}{\kref}
\knowledgevariantmodifier{\kpageref*\kl}{\kpageref}
\knowledgevariantmodifier{\intro*\kl}{\intro}
\knowledgevariantmodifier{\reintro*\kl}{\reintro}
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment