diff options
Diffstat (limited to 'macros')
15 files changed, 1742 insertions, 1049 deletions
diff --git a/macros/latex/contrib/docshots/docshots.dtx b/macros/latex/contrib/docshots/docshots.dtx index 0ba48b98de..9163bc10a1 100644 --- a/macros/latex/contrib/docshots/docshots.dtx +++ b/macros/latex/contrib/docshots/docshots.dtx @@ -50,7 +50,7 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{docshots} %<*package> -[2022-11-10 0.3.0 TeX Samples Next to Their PDF Snapshots in DTX] +[2022-11-20 0.3.1 TeX Samples Next to Their PDF Snapshots in DTX] %</package> %<*driver> \documentclass{ltxdoc} @@ -366,7 +366,7 @@ Hello, world! %</verb> %\fi -% \section{Fine-uning Options} +% \section{Fine-tuning Options} % \DescribeMacro{\docshotOptions} % By default, we render the verbatim text using |\VerbatimInput| command with @@ -556,9 +556,10 @@ Hello, world! {\end{VerbatimOut}% % \end{macrocode} % If we are in |dtx| mode, leading percent characters must be removed: +% \changes{0.3.1}{2022/11/20}{A bug fixed, now handling of leading percentage symbols is done right.} % \begin{macrocode} \ifdefined\docshots@dtx% - \iexec[null]{perl -i -0777pe "s/(\\n|^)\\x{25} /\\1/g" + \iexec[null]{perl -i -0777pe "s/(\\n|^)\\x{25}\\s?/\\1/g" \docshots@tmpdir/\jobname/verbatim.tex}% \fi% % \end{macrocode} @@ -675,7 +676,7 @@ Hello, world! % \end{macro} % \begin{macro}{\docshotAfter} -% Finally, we define |\docshotAfter| command: +% Then, we define |\docshotAfter| command: % \begin{macrocode} \makeatletter\newcommand\docshotAfter[1]{ \iexec[\docshots@log,quiet]{/bin/echo -n '\detokenize{#1}' diff --git a/macros/latex/contrib/docshots/docshots.pdf b/macros/latex/contrib/docshots/docshots.pdf Binary files differindex 9b4f1afa94..ab77d8bf30 100644 --- a/macros/latex/contrib/docshots/docshots.pdf +++ b/macros/latex/contrib/docshots/docshots.pdf diff --git a/macros/latex/contrib/etoc/README.md b/macros/latex/contrib/etoc/README.md index b58480ffb9..ccb69c6990 100644 --- a/macros/latex/contrib/etoc/README.md +++ b/macros/latex/contrib/etoc/README.md @@ -1,6 +1,6 @@ <!-- --> - Source: etoc.dtx (1.09g) + Source: etoc.dtx (1.09h) Author: Jean-Francois Burnol Info: Completely customisable TOCs License: LPPL 1.3c @@ -97,6 +97,14 @@ etoc.sty, etoc.tex, etoc.pdf, etoc.dvi. RECENT CHANGES ============== +1.09h \[2022/11/20\] +-------------------- + +Documentation improvements. In particular, attached code snippets +are now visible via their filenames in the page margins. Also, +command names are doubly hyperlinked: first half links to the devoted +part of the user manual, second half links to the implementation part. + 1.09g \[2022/11/17\] -------------------- @@ -138,30 +146,3 @@ Also add `\etocimmediatesetlocaltop.toc`. Fix an obscure bug (see source code comments) in the `\etocsetlocaltop.toc` mechanism. - -1.09e \[2021/09/23\] --------------------- - -Needed (if etoc is used without hyperref) updates to -internal macros to prepare for the upcoming LaTeX November -2021 change to `\contentsline`. - -Related updates to the user macro `\etoctoccontentsline`. - -1.09d \[2021/07/13\] --------------------- - -Some minor synching with tableof 1.4c. - -Add `\etockeeporiginaltableofcontents` to provide a work-around to a -compatibility issue with listings's `\lstlistoflistings`, which abuses -`\tableofcontents` for doing something unrelated to the actual contents. -Thanks to Denis Bitouzé for report. - -Usage: `\usepackage{etoc}\etockeeporiginaltableofcontents`, then -however you must employ `\etoctableofcontents`, not `\tableofcontents`. - -1.09c \[2020/05/15\] --------------------- - -Syncs with KOMA-script deprecation of `\iftocfeature`. diff --git a/macros/latex/contrib/etoc/etoc.dtx b/macros/latex/contrib/etoc/etoc.dtx index 362219028f..4563c21dc9 100644 --- a/macros/latex/contrib/etoc/etoc.dtx +++ b/macros/latex/contrib/etoc/etoc.dtx @@ -2,20 +2,20 @@ % N.B.: this dtx file is NOT for use with \DocInput. The latex source of the % user manual is not prefixed with percent signs. %<*none> -\def\etocdtxtimestamp {Time-stamp: <17-11-2022 at 23:14:36 CET>}% +\def\etocdtxtimestamp {Time-stamp: <20-11-2022 at 21:44:51 CET>}% %</none> %<*!readme> %% %% Package: etoc -%% Version: 1.09g (DEVELOPMENT) +%% Version: 1.09h %% License: LPPL 1.3c %% Copyright (C) 2012-2022 Jean-Francois Burnol %% <jfbu at free dot fr> %</!readme> %<*none> -\def\etocpkgdate {2022/11/17} -\def\etocdocdate {2022/11/17} -\def\etocpkgversion {1.09g} +\def\etocpkgdate {2022/11/20} +\def\etocdocdate {2022/11/20} +\def\etocpkgversion {1.09h} \def\etocpkgdescription {Completely customisable TOCs (JFB)} %% German translation was last udpated on April 2015 and all new material %% was included since in English. During 2020/2021/2022 emerged a still @@ -33,7 +33,7 @@ \catcode32=13\catcode`\\=12^^Brelax^^A ^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A {% Package: etoc -% Version: 1.09g +% Version: 1.09h % License: LPPL 1.3c % Copyright (C) 2012-2022 Jean-Francois Burnol <jfbu at free dot fr> % @@ -60,7 +60,7 @@ %<*readme> <!-- --> - Source: etoc.dtx (1.09g) + Source: etoc.dtx (1.09h) Author: Jean-Francois Burnol Info: Completely customisable TOCs License: LPPL 1.3c @@ -157,6 +157,14 @@ etoc.sty, etoc.tex, etoc.pdf, etoc.dvi. RECENT CHANGES ============== +1.09h \[2022/11/20\] +-------------------- + +Documentation improvements. In particular, attached code snippets +are now visible via their filenames in the page margins. Also, +command names are doubly hyperlinked: first half links to the devoted +part of the user manual, second half links to the implementation part. + 1.09g \[2022/11/17\] -------------------- @@ -198,33 +206,6 @@ Also add `\etocimmediatesetlocaltop.toc`. Fix an obscure bug (see source code comments) in the `\etocsetlocaltop.toc` mechanism. - -1.09e \[2021/09/23\] --------------------- - -Needed (if etoc is used without hyperref) updates to -internal macros to prepare for the upcoming LaTeX November -2021 change to `\contentsline`. - -Related updates to the user macro `\etoctoccontentsline`. - -1.09d \[2021/07/13\] --------------------- - -Some minor synching with tableof 1.4c. - -Add `\etockeeporiginaltableofcontents` to provide a work-around to a -compatibility issue with listings's `\lstlistoflistings`, which abuses -`\tableofcontents` for doing something unrelated to the actual contents. -Thanks to Denis Bitouzé for report. - -Usage: `\usepackage{etoc}\etockeeporiginaltableofcontents`, then -however you must employ `\etoctableofcontents`, not `\tableofcontents`. - -1.09c \[2020/05/15\] --------------------- - -Syncs with KOMA-script deprecation of `\iftocfeature`. %</readme> %<*tex>------------------------------------------------------------------------- %% run pdflatex thrice on this file etoc.tex to produce the documentation @@ -472,38 +453,68 @@ Syncs with KOMA-script deprecation of `\iftocfeature`. \usepackage[utf8]{inputenc} \usepackage[hscale=0.66,vscale=0.75]{geometry} \pagestyle{headings} -% \usepackage{layout} - -% January 2014. work-around a bug in KOMA 3.12 (December 2013): +% \sectionmark uses \markboth in twoside but +% with an empty right mark! As a result if a section starts +% on an odd page, it does not appear in the header mark. +% Perhaps there was a subsection of 3 lines on that page +% and it is the subsection which decides what is in the header. \makeatletter -\def\buggysectionmark #1{% KOMA 3.12 as released to CTAN December 2013 - \if@twoside\expandafter\markboth\else\expandafter\markright\fi - {\MakeMarkcase{\ifnumbered{section}{\sectionmarkformat\fi}{}#1}}{}} -\ifx\buggysectionmark\sectionmark -\def\sectionmark #1{% - \if@twoside\expandafter\markboth\else\expandafter\markright\fi - {\MakeMarkcase{\ifnumbered{section}{\sectionmarkformat}{}#1}}{}} -\fi +% \newwrite\out +% \immediate\openout\out=\jobname.headings +% \immediate\write\out{\meaning\ps@headings} +% \immediate\closeout\out +% from \ps@headings: +% \renewcommand *{\sectionmark }[1]{\if@twoside \expandafter \markboth +% \else \expandafter \markright \fi {\MakeMarkcase {\Ifnumbered +% {section}{\sectionmarkformat }{}##1}}{}} +% \renewcommand *{\subsectionmark }[1]{\if@twoside \markright {\MakeMarkcase +% {\Ifnumbered {subsection}{\subsectionmarkformat }{}##1}}\fi } + +% Some custom \sectionmark to get headers more to my taste. +% But it is hard to find algorithm giving satisfaction in all cases. + +\renewcommand *{\sectionmark }[1]{% +% Que c'est pénible cette syntaxe \markboth/\markright de LaTeX ! +% Pourquoi est-ce que \markright n'a pas été définie comme #1#2-> truc avec #2 ?? + \if@twoside \expandafter \markboth \else + \expandafter\expandafter\expandafter \markright\expandafter \@firstoftwo + \fi + {\MakeMarkcase {\Ifnumbered {section}{\sectionmarkformat }{}#1}}% + {\MakeMarkcase {\Ifnumbered {section}{\sectionmarkformat }{}#1}}% +} + +% Par ailleurs je vais remplacer \firstmark par \botmark dans \rightmark +% dont la définition par défaut est : + +% \rightmark: +% macro:->\expandafter \@rightmark \firstmark \@empty \@empty + +\renewcommand*\rightmark{\expandafter\@rightmark\botmark \@empty\@empty} +% Au passage l'output de latexdef à un : supplémentaire bizarre +% $ latexdef botmark +% +% \botmark: +% \botmark: +% + +% Néanmoins pour les \part il ne faut clairement pas utiliser \botmark +% Tous mes \part sont après un \clearpage explicite +% Je crois que le plus simple est encore de faire ceci: +\def\ps@mypartheadings{% + \ps@headings + \let\@evenhead\@empty + \let\@oddhead\@empty +} + +% peut-être serait-ce mieux de mettre le \thispagestyle après mon \clearpage, +% explicitement dans la source +\def\part{\thispagestyle{mypartheadings}\scr@startpart {part}} + \makeatother -\makeatletter -% 2013/03/07. -% This macro allows to conveniently center a line inside a paragraph and still -% use therein \verb or other commands changing catcodes. -% Note: \centerline in LaTeX still uses \hsize and not \linewidth/\columnwidth - \def\@centeredline {\hbox to \linewidth - \bgroup \hss \bgroup - \aftergroup\centeredline@ } - \newcommand*\centeredline {% - \ifhmode - \\\relax - \def\centeredline@{\hss\egroup\hskip\z@skip}% - \else - \def\centeredline@{\hss\egroup}% - \fi - \afterassignment\@centeredline - \let\next=} +\usepackage{centeredline}% replaces the 2013/03/07 original code +\makeatletter % pour maintenir les % en début de ligne dans les blocs verbatim % @@ -723,7 +734,8 @@ pdftitle={The etoc package},% pdfsubject={Tables of contents with LaTeX},% pdfkeywords={LaTeX, table of contents},% pdfstartview=FitH,% -pdfpagemode=UseOutlines} +%%pdfpagemode=UseOutlines,% commented-out for 1.09h +} % added usage of package bookmark 2013/10/10 \usepackage{bookmark} @@ -827,12 +839,12 @@ pdfpagemode=UseOutlines} \setcounter{mycounti}{0}% \setcounter{mycountii}{0}% \def\thispartstatsauxi{% - \sbox{\firstnamei}{\etocname}% - \sbox{\firstnumberi}{\etocnumber}% + \sbox{\firstnamei}{\footnotesize\etocname}% + \sbox{\firstnumberi}{\footnotesize\etocnumber}% \def\thispartstatsauxi{}}% \def\thispartstatsauxii{% - \sbox{\firstnameii}{\etocname}% - \sbox{\firstnumberii}{\etocnumber}% + \sbox{\firstnameii}{\footnotesize\etocname}% + \sbox{\firstnumberii}{\footnotesize\etocnumber}% \def\thispartstatsauxii{}}% \begingroup \etocsetstyle{subsection} @@ -840,17 +852,18 @@ pdfpagemode=UseOutlines} {} {\thispartstatsauxii \stepcounter{mycountii}% - \sbox{\lastnameii}{\etocname}% - \sbox{\lastnumberii}{\etocnumber}} + \sbox{\lastnameii}{\footnotesize\etocname}% + \sbox{\lastnumberii}{\footnotesize\etocnumber}} {} \etocsetstyle{section} {} {} {\thispartstatsauxi \stepcounter{mycounti}% - \sbox{\lastnamei}{\etocname}% - \sbox{\lastnumberi}{\etocnumber}} - {Here are some statistics for this part: it contains \arabic{mycounti} + \sbox{\lastnamei}{\footnotesize\etocname}% + \sbox{\lastnumberi}{\footnotesize\etocnumber}} + {{\footnotesize\itshape + Here are some statistics for this part: it contains \arabic{mycounti} section\ifnum\value{mycounti}>1 s\fi{} and \arabic{mycountii} subsection\ifnum\value{mycountii}>1 s\fi. The name of the first section is @@ -863,7 +876,8 @@ pdfpagemode=UseOutlines} ``\unhbox\firstnameii{}'' and the corresponding number is ``\unhbox\firstnumberii''. The name of the last subsection is ``\unhbox\lastnameii{}'' and its number is - ``\unhbox\lastnumberii''.\fi } + ``\unhbox\lastnumberii''.\fi + \par}} \etocinline % october 10, 2013. \etocsetnexttocdepth {2}% @@ -902,18 +916,71 @@ pdfpagemode=UseOutlines} \newcommand\etoc{% \texorpdfstring{{\color{joli}\ttfamily\bfseries etoc}}{etoc}\xspace} -\DeclareRobustCommand\csa [1] {{\ttfamily\hyphenchar\font45 \char`\\ #1}} -\DeclareRobustCommand\csb [1] - {\hyperref[#1] {\ttfamily\hyphenchar\font45 \char`\\ #1}} +% hyperlinks to source code... added November 20, 2022 +% works in sync with macrocode hacks explained after \StopEventually +% which were added in August 2022 +% imported/adapted from code originally added to xint.dtx + +% FINALLY, after many hesitations and great suffering with \marginpar +% I decide to simply divide the name into two parts and use two +% distinct hyperlinks, so as to not render the reading to painful. +\usepackage{xinttools} + +% \makeatletter +% \newsavebox\sourcelinkbox +% \sbox\sourcelinkbox{\color{red}\normalfont\footnotesize\itshape src} +% % This simply is not workable. I can not use \marginpar in footnotes, +% % in multicols, etc... and I can not avoid mysterious margin par lost +% % messages and ! LaTeX Error: Float(s) lost. on page 25 for example. +% \def\marginsourcelink#1{\normalmarginpar\marginpar{% +% {%\normalfont\footnotesize#1... +% \ifodd\value{page}\else\hfill\fi +% {\hyperref[etocmacro-#1]{\usebox\sourcelinkbox}}% +% \ifodd\value{page}\hfill\fi +% }% +% }}% +% % +% % Si j'utilise \smash à l'intérieur, la zone cliquable devient réduite à rien verticalement +% % ah ok avec \smash à l'extérieur +% \def\exponentsourcelink#1{{\m@th\kern-\wd\sourcelinkbox +% \smash{$^{\raisebox{0.75ex}{{\hyperref[etocmacro-#1]{\usebox\sourcelinkbox}}}}$}% +% }}% +% \makeatother + +\def\csbi#1{\hyperref[#1]{\ttfamily\hyphenchar\font45 \char`\\ #1}} + +% use a slightly different colour for second half? +\DeclareRobustCommand\csb[1]{% + \edef\nbmoitie{\the\numexpr\xintLength{#1}/2}% + \hyperref[#1]{\ttfamily\hyphenchar\font45 \char`\\ \xintKeepUnbraced{\nbmoitie}{#1}}% + \ifcsname r@etocmacro-#1\endcsname + %\marginsourcelink{#1}% + \hyperref[etocmacro-#1]{\ttfamily\hyphenchar\font45 \xintTrim{\nbmoitie}{#1}}% + \else + % for .toc suffixed macros + \ifcsname r@etocmacro-\xintTrimUnbraced{-4}{#1}\endcsname + \hyperref[etocmacro-\xintTrimUnbraced{-4}{#1}]{\ttfamily\hyphenchar\font45 + \xintTrim{\nbmoitie}{#1}}% + \else + \hyperref[#1]{\ttfamily\hyphenchar\font45 \xintTrim{\nbmoitie}{#1}}% + \fi + \fi +} + +\DeclareRobustCommand\csa [1] + {{\ttfamily\hyphenchar\font45 \char`\\ #1}} \newcommand\cshyp[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}} \newcommand\csbhyp[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}} -\newcommand\toc{\csa{tableofcontents}\xspace} -\newcommand\localtoc{\csa{localtableofcontents}\xspace} -\newcommand\localtocwrdp{\csa{localtableofcontentswithrelativedepth}\xspace} +\DeclareRobustCommand\ctanpkg[1] + {\texorpdfstring{\href{https://ctan.org/pkg/#1}{#1}}{#1}} + +\newcommand\toc{\csb{tableofcontents}\xspace} +\newcommand\localtoc{\csb{localtableofcontents}\xspace} +\newcommand\localtocwrdp{\csb{localtableofcontentswithrelativedepth}\xspace} \newcommand\lowast{\raisebox{-.25\height}{*}} \newcommand\starit[1]{\csa{#1\lowast}} @@ -1070,9 +1137,58 @@ etoc-im-me-di-ate-set-local-top \def\ExtractDateStamp #1<#2-#3-#4 at #5:#6:#7 #8>% {D:#4#3#2#5#6#7\csname#8\endcsname} \edef\DateForSamples {\expandafter\ExtractDateStamp\etocdtxtimestamp} -\attachfilesetup{icon=Paperclip, mimetype=application/x-tex, appearance=false, - author={Jean-François Burnol}, date=\DateForSamples}% print=false ? -% attention Paperclip pas PaperClip !! +\attachfilesetup{%icon=Paperclip,% attention Paperclip pas PaperClip !! + mimetype=application/x-tex, + %appearance=false, +% author={Jean-François Burnol}, +% author={\pdfescapestring{Jean-François Burnol}}, +% TODO: resolve this at some point in my future life + author={Jean-Francois Burnol}, +% doing this has fixed the date shown in Acrobat annotation panel +% but now some strange seemingly unrelated date is printed in +% the "Comment panel" + created=\DateForSamples, + modified=\DateForSamples, +% allright this one next sets the dates shown in the "Comment Panel", +% whereas the above two (or only modified) impacts the panel of +% annotations on the left in my (very old) Adobe Reader. Not yet +% tested with evince + date=\DateForSamples + }% + +\colorlet{etocsnippet}{blue} +\newcommand\marginattach[1]{% #1 is from some legacy mark-up and is ignored + \noindent Depending on your PDF viewer\normalmarginpar + \marginpar + {% + \textattachfile[description={in section \the\value{section}}]% + {etocsnippet-\snippetno.tex}% + {\textcolor{etocsnippet}{etocsnippet-\snippetno.tex}}% + }, + clicking on the margin filename may allow to extract it.% + \stepcounter{snippet}% +} +% Sadly, on non-attachement supporting viewers such as Skim.app, +% the filename is not even searchable : entering "etocsnippet" +% in the PDF viewer search form does not find the margin texts. + +% But I did not want to add to the filename the section number, +% or perhaps even the page number (which could have been perilous +% and I did not want to have to test and experiment, as I have +% done enough for today with these code snippets). + +% In Acrobat the description field gives rise to some "tooltip" +% display on hover, which displays the description field. + +\newcounter{snippet}%[section] +\stepcounter{snippet} +\makeatletter +\newcommand\snippetno{% + \ifnum\value{snippet}<10 0\fi\the\value{snippet}% +%%% emulating former manual mark-up (with reset at each section) but I drop this +%%% \ifnum\value{snippet}>0 -\@Alph{\numexpr\value{snippet}+\@ne\relax}\fi +} +\makeatother \begin{document}%\layout \rmfamily @@ -1103,17 +1219,21 @@ etoc-im-me-di-ate-set-local-top \fi \ifnum\tikztreelevel=2 % hard-coded section numbers for branching + % il y a un décalage de 3 avec les numéros de sections numérotées \if1\ifnum\tikznumberofcurrentgrandchild>2 \ifnum\tikznumberofcurrentgrandchild<6 0% \else - \ifnum\tikznumberofcurrentgrandchild>21 - \ifnum\tikznumberofcurrentgrandchild<28 0% + \ifnum\tikznumberofcurrentgrandchild>20 % était 21 mais + % \etocsetlocaltop déplacé + \ifnum\tikznumberofcurrentgrandchild<27 0% était 28 mais + % \etocsetlocaltop déplacé \else - \ifnum\tikznumberofcurrentgrandchild>51 + \ifnum\tikznumberofcurrentgrandchild>50 % était 51 \ifnum\tikznumberofcurrentgrandchild<58 0% \fi\fi\fi\fi\fi\fi 1% -% le "9+" choisi manuellement jusqu'à obtenir quelque chose de bien + % ceci correspond aux sections qui seront sur le bord rectangulaire + % le "9+" choisi manuellement jusqu'à obtenir quelque chose de bien \pgfmathsetmacro\tikzoffsetofcurrentchild{(\tikzsiblingdistance)*(7+\tikznumberofcurrentgrandchild +\tikzdeltaofcurrentgrandchild)}% \ifdim\tikzoffsetofcurrentchild pt<\tikzlevelheight @@ -1143,30 +1263,32 @@ etoc-im-me-di-ate-set-local-top %\fi \fi\fi\fi\fi \else - % NEW BRANCH ADDED AT 1.09f + % les sections spéciales pas mises sur bord rectangulaires mais à + % distance constante du parent + % NEW BRANCH ADDED AT 1.09f \ifnum\tikznumberofcurrentgrandchild<6 \tikzset{level distance=8cm}% TikZ est tout de même assez génial dans l'interface \fi \pgftransformrotate {\ifnum\tikznumberofcurrentgrandchild<6 -12 - \else\ifnum\tikznumberofcurrentgrandchild<28 180 + \else\ifnum\tikznumberofcurrentgrandchild<27 180 \else0\fi\fi + \pgfkeysvalueof{/tikz/sibling angle}*\tikznumberofcurrentgrandchild}% \pgftransformxshift {\the\tikzleveldistance}% \ifnum\tikznumberofcurrentgrandchild=5 \global\advance\tikzdeltaofcurrentgrandchild by-3 \fi - \ifnum\tikznumberofcurrentgrandchild=27 + \ifnum\tikznumberofcurrentgrandchild=26 % était 27 mais déplacement \etoclocaltop \global\advance\tikzdeltaofcurrentgrandchild by-6 \fi \ifnum\tikznumberofcurrentgrandchild=57 - \global\advance\tikzdeltaofcurrentgrandchild by-6 + \global\advance\tikzdeltaofcurrentgrandchild by-7 % était -6 \fi \fi \global\advance\tikznumberofcurrentgrandchild by1 \fi } -%version circulaire utilisée avec les version 1.08a--1.09e du manuel. +%version circulaire utilisée avec les versions 1.08a--1.09e du manuel. % \def\tikzmycustomgrowth {% % \pgftransformreset % \ifnum\tikztreelevel=1 @@ -1232,6 +1354,8 @@ etoc-im-me-di-ate-set-local-top % title page toc % 1.09f uses a prepend for last part so we need to delay % start of tree construction in \treetok +% MEMO: le gap entre fin et début se situe donc entre Errors and Catastrophes +% et Timestamp, sibling distance doit être ajusté manuellement \treetok{} \makeatletter \etocsettocstyle @@ -1293,15 +1417,12 @@ etoc-im-me-di-ate-set-local-top % level 1 concept/.append style={font=\Large, text width = 3cm}, % ancienne version circulaire % level 2/.append style={level distance=12.5cm, sibling angle=360/39},% -% % distance par rapport au CENTRE ! (avec le code tel qu'en ce moment) -% 39 hard coded mais je pourrais aussi le calculer -% % pour version rectangulaire, par tâtonnements: % réactivée pour 1.09f (étonnamment, juste quelques petits ajustements, mais ça % a tout de même pris pas mal de temps...) level 2/.append style={level width=21cm, level height=30cm, - sibling distance=2.21cm,% ajusté à la + sibling distance=2.22cm,% ajusté à la % main... dépend de ce qui qu'on conserve par % les depth tags... % 1.09f pour essayer certaines parties en circulaire @@ -1316,7 +1437,7 @@ etoc-im-me-di-ate-set-local-top }% end of \hbox \endgroup% fin de la défintion de la mind map pour la page de titre -\noindent\null +\noindent\null\par\vskip-5cm\hbox{\hypertarget{FRONTPAGE}{}}\vskip5cm % On l'envoie au shipout \AddToShipoutPictureFG*{\put(.5\paperwidth,.5\paperheight) @@ -1336,29 +1457,57 @@ etoc-im-me-di-ate-set-local-top {\noindent \bfseries\Large \leaders\hrule height1pt\hfill - \MakeUppercase{Table of Contents}\let\thefootnote\empty + TABLE OF CONTENTS\let\thefootnote\empty \footnote{Documentation (\etocdocdate) generated from the source file with timestamp ``\etocdtxtimestamp''.}\setcounter{footnote}{0}% } \pdfbookmark[1]{Table of contents}{MAINTOC}% +%\begin{framed} +\begingroup\footnotesize\itshape + Starting with 1.08h, about 25 code samples (especially the longer ones) + are incorporated into the PDF file (thanks to \textsc{Scott + Pakin}'s \href{http://www.ctan.org/pkg/attachfile}{attachfile} package) as + \textbf{file attachement annotations}. Each file is represented by its + filename in the margin after the verbatim rendering of the corresponding + code. Clicking on this filename will on supporting viewers trigger some + dialog for extracting the file, or perhaps even will extract it + automatically and open it in some text editor. This is much better than + copy-paste which often loses indentation. +At 1.09h the formerly used icon in the text body has been replaced by the +filename itself, placed in the page margin. + + In some PDF viewers side panels may provide a convenient clickable list of + all these \textbf{attachments annotations}. + +\endgroup +%\end{framed} +% https://helpx.adobe.com/acrobat/using/comments.html + +% I move colours mostly used only after stopeventually +\definecolor{etocnamecolor}{RGB}{228,57,0} +\colorlet{verbcolor}{Maroon} +\colorlet{privatecommentcolor}{cyan} +\colorlet{macrocodecommentcolor}{gray} +\colorlet{macrocodenewmacrocolor}{verbcolor} +\colorlet{macrocodelinktouserdoccolor}{etocnamecolor}% and bold face +\colorlet{macrocodelinktosectioncolor}{DarkBlue}% and bold face +\colorlet{macrocodelinktocodelinecolor}{DarkBlue} +\colorlet{macrocodenoncscolor}{Green} + +%\ifnum\NoSourceCode=0 \begin{framed} - Starting with |1.08h|, about 25 code samples (especially the longer - ones) are incorporated into the PDF file (thanks to \textsc{Scott - Pakin}'s \href{http://www.ctan.org/pkg/attachfile}{attachfile} - package) as \emph{file attachement annotations}. Each file is represented - by an icon after the verbatim rendering of the corresponding code. - Clicking suitably on the icon will open a dialog to open or save the - file contents. This is much better than copy-paste which loses - indentation. There is also in some viewer a \emph{Comment pane} which can - be opened on the right side of the main window and which provides a - convenient clickable list of all these \emph{attachments annotations}. - - PDF viewers unable to make these attachments accessible to the - user may replace the clickable icons by some blank space. + Throughout the documentation the command names displayed + {\textcolor{RoyalBlue}{with this colour}} are doubly hyperlinked: the left + half of the name links to the user documentation, the second half links to + the source code. You can try it out now: \csb{localtableofcontents}. But + read this first: if you get lost inside the source code, clicking on control + sequences displayed {\textcolor{macrocodelinktouserdoccolor}{with this + colour}} brings you back to the part of the user manual discussing that + specific command. \ifnum\NoSourceCode=1 (but this PDF does not include the source code)\fi \end{framed} -% https://helpx.adobe.com/acrobat/using/comments.html +%\fi \begingroup \etocsetlevel{subsection}{3} @@ -1391,14 +1540,14 @@ etoc-im-me-di-ate-set-local-top based on a multi-column format, with, optionally, a ruled title or framed contents. - The \csa{tableofcontents} command may be used arbitrarily many times% + The \toc command may be used arbitrarily many times% % -\footnote{Except if \texttt{\string\etockeeporiginaltableofcontents} - (\textcolor{Green}{\bfseries New with 1.09d}) is issued in the preamble - after package loading. Then the macro \texttt{\string\etoctableofcontents}, - not \texttt{\string\tableofcontents}, must be used if the \etoc features - are to apply to the global TOC. This was added to fix a compatiblity issue - with \texttt{listings}'s \texttt{\string\lstlistoflistings}, as it needs the +\footnote{\label{etockeeporiginaltableofcontents}% + If \csb{etockeeporiginaltableofcontents} is issued in the preamble + after package loading, then \toc keeps the non-\etoc meaning and one must + use \csb{etoctableofcontents} in its place to get the \etoc features. This + was added to fix a compatiblity issue with \ctanpkg{listings}'s + \texttt{\string\lstlistoflistings}, as it needs the \texttt{\string\tableofcontents} macro to keep its original meaning.} % and it @@ -1423,12 +1572,25 @@ etoc-im-me-di-ate-set-local-top \section{Foreword} -Popular packages dealing with TOCs include |tocloft|, |titletoc| -and |minitoc|. Why another one? I started \etoc +%\ifnum\NoSourceCode=0 +\begin{framed} + Throughout the documentation the command names displayed + {\textcolor{RoyalBlue}{with this colour}} are doubly hyperlinked: the left + half of the name links to the user documentation, the second half links to + the source code. You can try it out now: \csb{localtableofcontents}. But + read this first: if you get lost inside the source code, clicking on control + sequences displayed {\textcolor{macrocodelinktouserdoccolor}{with this + colour}} brings you back to the part of the user manual discussing that + specific command. \ifnum\NoSourceCode=1 (but this PDF does not include the source code)\fi +\end{framed} +%\fi + +Popular packages dealing with TOCs include \ctanpkg{tocloft}, \ctanpkg{titletoc} +and \ctanpkg{minitoc}. Why another one? I started \etoc for my own use, and found out only later about these mentioned packages. -As is well explained in the |tocloft| package documentation, +As is well explained in the \ctanpkg{tocloft} package documentation, the standard \LaTeX{} layout for the Table of Contents is buried in the class definitions. In particular, most of the lengths therein are hardcoded, and the only way for the user @@ -1436,7 +1598,7 @@ to change them is to recopy the class definitions into the document and then change them to obtain what is desired (within suitable \csa{makeatletter} and \csa{makeatother}). The more reasonable alternative is to use a dedicated package such as -|tocloft| or to use another flexible document class. +\ctanpkg{tocloft} or to use another flexible document class. However, although now things are hopefully not hard-coded, one still has to go through the package or class interface. This @@ -1452,8 +1614,8 @@ manner: they are made available via the \csb{etocname}, \csb{etocnumber}, and \csb{etocpage} commands. \etoc appears to be (at least partially) compatible with the -|article|, |book|, |report|, |scrartcl|, |scrbook|, |scrreprt| and -|memoir| classes. +|article|, |book|, |report|, \ctanpkg{scrartcl}, \ctanpkg{scrbook}, \ctanpkg{scrreprt} and +\ctanpkg{memoir} classes. \section{License} @@ -1479,7 +1641,7 @@ manner: they are made available via the \csb{etocname}, Not quite. The simplest way is to use |enumerate| environments, with the customizing facilities of packages such as -|enumitem|,\footnote{\url{http://ctan.org/pkg/enumitem}} to +\ctanpkg{enumitem}, to display the data fetched by \etoc from the |.toc| file. The data consists of the \emph{name} (\csb{etocname}), \emph{number} (\csb{etocnumber}), and \emph{page number} (\csb{etocpage}) as @@ -1616,7 +1778,7 @@ the second is executed after the TOC contents. \etoc provides four (customizable) higher level toc styles: \csb{etocmulticolstyle}, \csb{etoctocstyle}, \csb{etocruledstyle}, and \csb{etocframedstyle}. All use the -|multicol| package with a default of two columns +\ctanpkg{multicol} package with a default of two columns (single-column mode is obtained with the optional argument |[1]|). These commands must be followed either by \toc or \localtoc. @@ -1625,18 +1787,25 @@ These commands must be followed either by \toc or \localtoc. \label{etoctoclines} \label{etocstandardlines} -Both for the ``line styles'' and the ``toc display style'', it is -possible to switch into a compatibility mode which uses the -defaults from the -document class.\footnote{for the ``toc display style'' - \etoc checks if it knows the class, and if not defaults to - the |article| class layout. It will also check if - \texttt{tocloft} has customized the TOC title.} -This is activated by:\\ -\makebox[5.2cm][l]{\csb{etocstandardlines}} - |% `line entries' as without \usepackage{etoc}|\\ -\makebox[5.2cm][l]{\csb{etocstandarddisplaystyle}} - |% `toc display' as without \usepackage{etoc}| +Both for the ``line styles'' and the ``toc display style'', \etoc defaults to +a compatibility mode which uses the defaults from the document +class.% +% +\footnote{\label{fn:compat}for the ``toc display style'' \etoc checks if it knows the class, + and then uses emulation code which was added manually to its source, and + if not it defaults to the |article| class layout. No automated way to recover + the global toc display for arbitrary document classes is implemented. But \etoc + will detect if \ctanpkg{tocloft} has customized the TOC title.} +% +This can always be re-activated by:\\ +% \makebox[5.2cm][l]{\csb{etocstandardlines}} +% |% `line entries' as without \usepackage{etoc}|\\ +% \makebox[5.2cm][l]{\csb{etocstandarddisplaystyle}} +% |% `toc display' as without \usepackage{etoc}| +\csb{etocstandardlines}\hfill +|% `line entries' as without \usepackage{etoc}|\\ +\csb{etocstandarddisplaystyle}\hfill +|% `toc display' as without \usepackage{etoc}| If the command \csb{etocsetstyle} has \emph{not been used in the @@ -1644,7 +1813,7 @@ preamble} the package will be at |\begin{document}| in this compatibility mode: hence just adding \csa{usepackage\{etoc\}} should hopefully not change anything to the look of a previously existing document, under the |article|, |book|, - |report|, |scrartcl|, |scrbook|, |scrreprt| and |memoir| + |report|, \ctanpkg{scrartcl}, \ctanpkg{scrbook}, \ctanpkg{scrreprt} and \ctanpkg{memoir} classes. Any use of \csb{etocsetstyle} in the \emph{preamble or body} of @@ -1656,13 +1825,13 @@ preamble} the package will be at |\begin{document}| in this with the help of \csb{etocsetstyle}, if their scope was not limited to a group or environment. - The command \csb{etocdefaultlines} resets the line styles as + The command \csb{etocdefaultlines} sets the line styles to custom ones pre-defined internally by \etoc and described in \autoref{etocdefaultlines}. Even if \csb{etocsetstyle} has been used, the global display style -remains initially as defined by the document class (or the -|tocloft| package); one needs to use the command +remains initially as defined by the document class or the +\ctanpkg{tocloft} package (but see footnote\footref{fn:compat}); one needs to use the command \csb{etocsettocstyle} or its variants to exit from this compatibility mode at the ``toc display style'' level. It will be re-activated if use if made of \csb{etocstandarddisplaystyle}. @@ -1671,11 +1840,12 @@ See further \autoref{sec:anothercompat}. \section{A first example} \label{sec:firstexample} +\label{invisiblelocaltableofcontents} Let us present a first example of specification for line styles. Immediately after the start of \autoref{part:overview} we inserted in the source file: -\centeredline{|\invisiblelocaltableofcontents \label{toc:overview}|} This +\centeredline{\csb{invisiblelocaltableofcontents} |\label{toc:overview}|} This sets-up the label |toc:overview|, and we can use it at any location in the document: \centeredline{|\tableofcontents \ref{toc:overview}|} And as we used |\invisible...|,\footnote{this is a shortcut for setting temporarily the @@ -1683,7 +1853,7 @@ document: \centeredline{|\tableofcontents \ref{toc:overview}|} And as we used and not even the heading.} the local TOC will exist only through its clones elsewhere in the document. -\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo} +\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo} \begingroup\parindent 0pt \parfillskip 0pt \leftskip 0cm \rightskip 1cm \etocsetstyle {section} {} @@ -1740,8 +1910,33 @@ which was inspired from what \LaTeX2e's |\@dottedtocline| macro does. Here is how it was produced: \filecontentsprint\foo -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} - +% vendredi 18 novembre 2022 +% very strange problem/bug with \marginpar which did not work +% prior to add \normalmarginpar. Whether or not using any +% extra text. Unless using \normalmarginpar, the test text HELLO +% was placed in left not right margin and beyond page borders, +% one saw only last O. Strange. +% I do not understand what is happening. +% > \normalmarginpar=macro: +% ->\global \@mparbottom \z@ \@reversemarginfalse . +% l.1753 \show\normalmarginpar +% ? +% > 0.0pt. +% l.1754 \showthe\@mparbottom +% % 0.0pt +% The \@mparbottom is already 0pt... but one has strangely +% > \if@reversemargin=\iftrue. +% l.1765 \makeatletter\show\if@reversemargin +% \makeatother +% ? +% Why is it currently \iftrue? +% The strange placement happens whether or not I put some text +% before using \marginpar. +% \marginpar +% {\textattachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex}{\textcolor{blue}{HELLO}}} +% +% +\marginattach{} \section{A second example} \label{sec:secondexample} @@ -1753,7 +1948,7 @@ is done via the technique of \emph{depth tags}, described in layout is a bit like the one of the \hyperref[toc:main]{main document TOC}, although the line styles are coded very differently. -\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo} +\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo} \begingroup \newcommand*{\DotsAndPage} {\nobreak\leaders\hbox{\bfseries\normalsize\hbox to .75ex {\hss.\hss}}% @@ -1808,7 +2003,7 @@ layout is a bit like the one of the \hyperref[toc:main]{main document The code: \filecontentsprint\foo -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \section{A Beautiful Thesis example} @@ -1820,7 +2015,7 @@ sub-sections in an average length memoir. The line style specifications have some redundancy for clarity, and do not care about what to do at possible page breaks. Also, they do not worry about potential multi-column use. -\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo} +\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo} \begingroup % we start a group to keep the style changes local \newlength{\tocleftmargin} \setlength{\tocleftmargin}{5cm} \newlength{\tocrightmargin} \setlength{\tocrightmargin}{1cm} @@ -1854,7 +2049,7 @@ breaks. Also, they do not worry about potential multi-column use. \filecontentsexec\foo \filecontentsprint\foo -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \section{Linked list of the main package commands} @@ -1872,7 +2067,7 @@ breaks. Also, they do not worry about potential multi-column use. % Je sépare les macros les plus essentielles pour les mettre en avant \begin{framed}\multicolsep0pt\relax - \begin{multicols}{3}\parindent0pt\relax + \begin{multicols}{3}\parindent0pt\relax\let\csb\csb \flushleft \csb{tableofcontents}\par (optional \csa{ref} or \csa{label})\par @@ -1899,7 +2094,7 @@ breaks. Also, they do not worry about potential multi-column use. %\parshape 1 -1.5cm \dimexpr\linewidth+3cm\relax %\begin{minipage}{\dimexpr\linewidth+3cm\relax} -\begin{multicols}{2}\parindent0pt\relax +\begin{multicols}{2}\parindent0pt\relax\let\csb\csb \csb{etocaftercontentshook}\par \csb{etocaftertitlehook}\par \csb{etocaftertochook}\par @@ -1916,11 +2111,9 @@ breaks. Also, they do not worry about potential multi-column use. \csb{etocimmediatedepthtag.toc}\par \csb{etocimmediatesettocdepth.toc}\par \csb{etocimmediatetoccontentsline}\par - \csb{etocimmediatesetlocaltop.toc}\par \csb{etocinline}\par \csb{etoclink}\par \csb{etoclocalframed}\par - \csb{etoclocaltop}\par \csb{etoclocalmulticol}\par \csb{etoclocalruled}\par \csb{etocmulticolstyle}\par @@ -1934,7 +2127,6 @@ breaks. Also, they do not worry about potential multi-column use. \csb{etocruledstyle}\par \csb{etocruled}\par \csb{etocsetlevel}\par - \csb{etocsetlocaltop.toc}\par \csb{etocsetnexttocdepth}\par \csb{etocsetstyle}\par \csb{etocsettagdepth}\par @@ -1960,7 +2152,7 @@ breaks. Also, they do not worry about potential multi-column use. \end{multicols} %\end{minipage}\par -The above is not an exhaustive list of all the package user commands, although +The above is not an exhaustive list of all the package user commands. And for legacy arbitrary reasons some of the more obscure commands are included here. @@ -1977,14 +2169,20 @@ here. \etocstandardlines \localtableofcontents -\section{The \toc, \localtoc and \localtocwrdp commands} +\section{The \csbhyp{tableofcontents}, \csbhyp{localtableofcontents} and + \csbhyp{localtableofcontentswithrelativedepths} commands} \label{tableofcontents} +\label{etoctableofcontents} \label{localtableofcontents} \label{localtableofcontentswithrelativedepth} -\begin{description} +\begin{description}\let\csb\csb \item[\toc] can be used arbitrarily many times in the document. Styling either - globally the TOC or its individual entries is customizable at any time in the document. + globally the TOC or its individual entries is customizable at any time in + the document. + + \csb{etoctableofcontents} is a synonym to \etoc's \toc. See + footnote\footref{etockeeporiginaltableofcontents} on page \pageref{etockeeporiginaltableofcontents}. \item[\localtoc] will print local tables of contents: \emph{i.e.} all sections and sub-units inside a given chapter, or all subsubsections and lower inside a given @@ -2038,7 +2236,7 @@ current value of the |tocdepth| counter is obeyed. As an example the table of contents of \autoref{part:custom} is in a \hyperref[toc:d]{float} which appears \vpageref{toc:d}. -\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo} +\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo} \begin{figure}[ht!] \centering \begingroup @@ -2055,7 +2253,8 @@ example the table of contents of \filecontentsexec\foo We used this: \filecontentsprint\foo -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} In the above example, not +\marginattach{} +In the above example, not only did we use |\ref{toc:c}| to print here the distant (local) table of contents which has been labeled |toc:c| but we added a (possibly confusing) |\label{toc:d}|. This is done for the down-to-earth reason of being able @@ -2074,7 +2273,7 @@ This original local table of contents is to be found \vpageref{toc:c}. \label{sec:tocdepth} The intrinsic levels manipulated by \etoc are numeric: from -|-2| (which corresponds to |book| in the |memoir| class) +|-2| (which corresponds to |book| in the \ctanpkg{memoir} class) down (from the big to the small) to |5| (|subparagraph|). But the assignment of a numeric level to a given name can be modified at any time with the command @@ -2103,7 +2302,7 @@ explained further in \autoref{part:surprising}. relevance to the \textbf{|tocdepth|} counter in the standard classes and are recapitulated in this table: \centeredline{ \fbox{\begin{tabular}{rc} - (|memoir| class) book&-2\\ part&-1\\ chapter&0 \\ + (\ctanpkg{memoir} class) book&-2\\ part&-1\\ chapter&0 \\ section&1\\ subsection&2 \\ subsubsection&3 \\ paragraph&4 \\ subparagraph& 5 \end{tabular}}} @@ -2126,6 +2325,7 @@ table of contents of all the paragraphs from the document! \section{The \csbhyp{etocsettocdepth} and \csbhyp{etocsetnexttocdepth} commands} \label{etocsettocdepth} \label{etocsetnexttocdepth} +\label{invisibletableofcontents} The |tocdepth| counter has no bearing on what gets written to the |.toc| file; its action is only on the actual typesetting of the table of @@ -2144,13 +2344,15 @@ numeric (from |-3| to |5|) or a division name such as |subsection| or corresponding to a document division). This does the appropriate |\setcounter{tocdepth}{numeric_level}|. -As is explained in the next subsection, |tocdepth| is used by |hyperref|, and +As is explained in the next subsection, |tocdepth| is used by \ctanpkg{hyperref}, and one must take steps to prevent its changes from influencing the bookmarks, too. So, \etoc has \csb {etocsetnexttocdepth}\marg{level} whose influence ceases -immediately after the next table of contents. Thus, |\invisibletableofcontents| -is essentially |\etocsetnexttocdepth{none}\tableofcontents|. +immediately after the next table of contents. The package defines +\csb{invisibletableofcontents} +essentially as +\centeredline{\csb{etocsetnexttocdepth}|{none}|\csb{tableofcontents}} -The simplest course is thus to have after |\begin{document}| and before the +The simplest organization is probably to have after |\begin{document}| and before the first |\tableofcontents| a single instance of the \csb{etocsettocdepth} command, with argument the deepest level (or most commonly used deepest level) among the tables of contents of the document, and to use locally, @@ -2181,7 +2383,7 @@ The simplest course is thus to have after |\begin{document}| and before the When modifying the counter |tocdepth| for the purposes of multiple uses of \toc or \localtoc, one should be aware that -package |hyperref| by default takes into account the +package \ctanpkg{hyperref} by default takes into account the \emph{current} value of the |tocdepth| counter to decide whether the |pdf| file will contain a bookmark corresponding to sectioning commands encountered in the source file. Thus, @@ -2190,10 +2392,10 @@ value after having temporarily modified it for a given table of contents. Or, there is the \emph{bookmarksdepth=n} option of package -|hyperref|, with \emph{n} the desired document bookmarks +\ctanpkg{hyperref}, with \emph{n} the desired document bookmarks maximal depth, which can be numeric or the name of a level known to -|hyperref|. This documentation previously passed |bookmarksdepth=3| as -option to |hyperref|, so even if |tocdepth| was left to |1| +\ctanpkg{hyperref}. This documentation previously passed |bookmarksdepth=3| as +option to \ctanpkg{hyperref}, so even if |tocdepth| was left to |1| by inadvertance after printing a certain table of contents this did not modify the bookmark tree of the |pdf| file. Now that \csb{etocsetnexttocdepth} has been added to the package, we have used it @@ -2206,8 +2408,12 @@ systematically and there was no need for |bookmarksdepth=3| anymore. \label{etocimmediatesettocdepth.toc} This command \csb{etocsettocdepth.toc} implements some functionality of -|tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}. I thank Denis \textsc{Bitouzé} for drawing - my attention to the incompatibility of this package with \etoc.}, a package +\ctanpkg{tocvsec2}% +% +\footnote{I thank Denis \textsc{Bitouzé} for drawing + my attention to the incompatibility of this package with \etoc.}, +% +a package which however was incompatible with \etoc (it can still be used for its |secnumdepth|-related commands, but its |toc|-related activities will get canceled by \etoc) and more-or-less designed for a single table of contents. @@ -2273,7 +2479,7 @@ re-activate it. The package does initially \csb{etocobeytoctocdepth}. % \begin{enumerate*}[label={(\roman*)}] % \item the second argument to \csb{etocsetlevel} must be numeric, % \item it can not be set to |-3| (which would be necessary if one wanted to -% exclude an entire Book from a TOC in a |memoir| document with multiple such +% exclude an entire Book from a TOC in a \ctanpkg{memoir} document with multiple such % Books \dots admittedly a possibly rare case!), % \item it is a bit of a hack as |partIII| is not a real division unit, but just % a \emph{tag}. @@ -2463,58 +2669,6 @@ empty, this does mean that \etoc considered the just encountered local table of contents to be empty (for that run) and thus printed nothing (not even a |\par|). -% pas traduit -\section{The \csbhyp{etoclocaltop} command} -\label{etoclocaltop} - -\textbf{New with 1.09 (2019/03/09)}. - -Within either the TOC style -(\csb{etocsettocstyle}) or the local title styles (\csb{etocsetstyle}), the -control sequence \csb{etoclocaltop} is made equivalent for the duration of -\csb{localtableofcontents} to a numeric (self-delimiting) denotation of the -current top level. - -Thus: it will in numeric contexts (|\ifnum|, |\ifcase|, ...) represent zero -for a local TOC corresponding to chapter, or one if in a section, or two if in -a subsection, etc..., assuming of course here that the default levels are -obeyed (see \autoref{sec:tocdepth}). - -\begin{framed} - \csb{etoclocaltop} from inside the TOC heading (first argument of - \csb{etocsettocstyle}) has the correct value \emph{only under - \csb{etocchecksemptiness} regime}. Special circumstances correspond to - some special values: - \begin{description}[nolistsep] - \item[|-3|] (|-\thr@@|)\newline - signals that \etoc considers the local TOC to be - ``unknown''; this happens at the last local TOC, for the first \LaTeX\ run - after adding a new \localtoc to the document. In doubt, \etoc assumes the - TOC will prove non empty, hence it prints (independently of whether the - check for emptiness was activated or not) the heading as specified by - \csb{etocsettocstyle}. Thus, check if \csb{etoclocaltop} gives |-3| as a - a \meta{number} to detect that situation from within the first argument of - \csb{etocsettocstyle}, if desired. - \item[|-1000|](|-\@m|)\newline is in case of a \localtoc - being considered ``known'' (although it may still refer to the data in the - |.toc| file from the previous run) but without the check for emptiness - having been executed. - \item[|-10000|](|-\@M|)\newline is the value when accessed from the title - of a global TOCs. - \end{description} -\end{framed} -\begin{framed} - When executed from within a local table of contents \textbf{line styles} - (\csb{etocsetstyle}), \csb{etoclocaltop} always will hold the correct value, - whether or not the emptiness check was executed. - - For a global table of contents however, it will always keep the value |-3|. -\end{framed} - -Attention! \cs{etoclocaltop} is only to be queried; modifying it is strictly -forbidden and falls under the most rigorous prosecution allowed by federal -law. - \section{Adding commands to the \texorpdfstring{\texttt{.toc}}{.toc} file} \label{sec:addingtotoc} @@ -2541,7 +2695,7 @@ document and to use where needed something like: \tableofcontents \let\myclearpage\relax \end{verbatim} -The |memoir| class has the command \csa{settocdepth} which +The \ctanpkg{memoir} class has the command \csa{settocdepth} which writes a \csa{changetoc\-depth} command inside the |.toc| file. This will impact the typesetting by \etoc of \emph{all} tables of contents, with (possibly) unexpected results: imagine the @@ -2551,9 +2705,9 @@ in the main table of contents. Then a local table of contents in one of these chapters will print a title but will be without any entry. -As the |memoir| class by itself allows multiple\toc +As the \ctanpkg{memoir} class by itself allows multiple\toc these issues already arise there, - independently of \etoc, see page 170 of the |memoir| + independently of \etoc, see page 170 of the \ctanpkg{memoir} manual. For this specific issue, the commands \csb{etocsettocdepth.toc}, @@ -2591,7 +2745,7 @@ I use the following trick: either in the preamble using I found out experimentally that the option |hidelinks| could indeed be set many times with |\hypersetup| (this is not the - case of all |hyperref| options). + case of all \ctanpkg{hyperref} options). \clearpage @@ -2612,7 +2766,7 @@ and \autoref{part:globalcmds}. As a further example we now print the local table of contents of \autoref{part:globalcmds}. First we will test the compatibility mode.\footnote{the -present document uses the |scrartcl| class, and we check here that +present document uses the \ctanpkg{scrartcl} class, and we check here that the \etoc compatibility mode does respect the customizing done via the class commands.} The original was invisibly defined with a label at the beginning of \autoref{part:globalcmds}. @@ -2648,7 +2802,7 @@ Well, there is actually an alternative. It is possible to use the order to achieve effects like the following, all things being otherwise equal to the document class defaults: \begin{enumerate}[noitemsep] -\item get the |hyperref| link to encapsulate only the names, but not the numbers +\item get the \ctanpkg{hyperref} link to encapsulate only the names, but not the numbers of each entry of the table of contents, \item use the document class style for chapters and sections, but modify it only for subsections, @@ -2662,7 +2816,8 @@ automatically in \csb{etocsavedsectiontocline}, \csb{etocsavedchaptertocline} etc... the meaning of the \LaTeX\ |\l@section|, |\l@chapter|, etc... macros as they were at the time the TOC is typeset. -\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex} +%\showthe\catcode`\- +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \makeatletter \newcommand{\MyStandardTOC}{% \begingroup @@ -2685,7 +2840,8 @@ they were at the time the TOC is typeset. \endgroup} \makeatother \end{filecontentshere} -\attachfile[description={demo \the\value{section}-A}]{etocsnippet-\the\value{section}-A.tex} +\marginattach{-A} +%\showthe\catcode`\- One can add to the above arbitrary text formatting commands, for example replace |\etocpage| by |\textcolor{blue}{\etocpage}|. @@ -2694,16 +2850,16 @@ If the document has only one table of contents then there is no need to put the commands inside a macro, or even inside a group.\footnote{and if moreover one just wants to keep the same layout as in the default, one may question why using \etoc... there is \emph{one} good reason: numbers and names -are separately \texttt{hyperref} links, whereas normally there is only one link +are separately \ctanpkg{hyperref} links, whereas normally there is only one link holding both the number and the name corresponding to one toc entry.} With these commands \etoc will construct a TOC completely identical to what would have been done by -one of the document class: |article|, |book|, |scrartcl|, |scrbook|.\footnote{For the -|memoir| class, one needed prior to \etoc |1.08k| a bit more: each of the command \csa{booknumberline}, +one of the document class: |article|, |book|, \ctanpkg{scrartcl}, \ctanpkg{scrbook}.\footnote{For the +\ctanpkg{memoir} class, one needed prior to \etoc |1.08k| a bit more: each of the command \csa{booknumberline}, \csa{partnumberline} and \csa{chapternumberline} had to be saved. They can now be used directly in the line styles, because their meanings are not modified anymore by \etoc during its TOC typesetting.} -The number and the name of each entry are each separately an |hyperref| link, as +The number and the name of each entry are each separately an \ctanpkg{hyperref} link, as is always the case with \etoc, when not in compatibility mode. Replacing \csb{etocnumber} with \csb{etocthenumber} will give a TOC where the numbers are not links anymore, but the names still are. Or one may decide to use \csb{etocthename} @@ -2711,13 +2867,13 @@ and keep an hyperlinked number with \csb{etocnumber}. Here is a subtler example where one only marginally modifies the -sections (adding color to the number and removing the |hyperref| link) and keeps +sections (adding color to the number and removing the \ctanpkg{hyperref} link) and keeps the subsections as in the default, \emph{except} for those of one specific section, for which the layout is completely modified: \MyQuasiStandardTOC{\ref{toc:overview}} \bigskip This example only has sections and subsections, and the code used in \csa{MyStandardTOC} was: -\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \etocsetstyle{section}{} {\ifnum\etocthenumber=4 \etocsetstyle{subsection} @@ -2741,12 +2897,12 @@ This example only has sections and subsections, and the code used in \csa{MyStan {\etocsavedsectiontocline{\numberline{{\color{cyan}\etocthenumber}}\etocname}{\etocpage}} {}% \end{filecontentshere} -\attachfile[description={demo \the\value{section}-B}]{etocsnippet-\the\value{section}-B.tex} +\marginattach{-B} Notice the page head-mark added by this standard TOC. Sections and subsections are printed exactly as in the default (except for the subsections of one specific user-chosen section and except for the color of the section numbers), with no need to specify explicitely any length, font or other formatting -instructions. But we had to examine the |scrartcl| sources to determine what to +instructions. But we had to examine the \ctanpkg{scrartcl} sources to determine what to use for \csa{leftskip} and \csa{rightskip} for our customized section entries. @@ -2757,9 +2913,9 @@ As explained in \autoref{subs:compat}: without explicit use of an hand regarding the ``toc line styles''. It is sometimes asked by users (for example those using \etoc for its \csb{localtableofcontents}) how to stay close to but not completely identical with the design implemented by the -standard classes, such as |book|. I can recommend package |tocloft| for this, +standard classes, such as |book|. I can recommend package \ctanpkg{tocloft} for this, as it is compatible with \etoc (see \autoref{subs:tocloft}) and thus \etoc will -obey the |tocloft| customizations (as long as no use has been made of +obey the \ctanpkg{tocloft} customizations (as long as no use has been made of \csb{etocsetstyle}). It is also possible to modify only the style for, say, sections and leave the parts, chapters, subsections as in the document class, via the technique from \autoref{sec:anothercompat}. @@ -2791,7 +2947,7 @@ besides, with the \csa{TOCcomputenumwidths} from \autoref{sec:thirdexampleextra} these macros will actually hold a dimension using |pt| as dimensional unit. -\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} % it will be easy to globally shift the TOC horizontally if needed \def\TOCleftmargin {0pt} \def\TOCrightmargin {2.55em}% like LaTeX's \@tocrmarg @@ -2889,7 +3045,7 @@ using |pt| as dimensional unit. } \makeatother \end{filecontentshere} -\attachfile[description={demo \the\value{section}-A}]{etocsnippet-\the\value{section}-A.tex} +\marginattach{-A} Nota Bene: the code deliberately handles the non-numbered sectioning units unlike the way of the standard document classes (particularly regarding the alignment of multi-line headings.) @@ -2902,7 +3058,7 @@ TOC, or rather before using \localtoc. If one wants a full TOC at end of document one will naturally have to issue again \csa{TOCglobalstyle} there. -\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \makeatletter \newcommand*\TOClocalstyle {% \etocsettocstyle @@ -2949,7 +3105,7 @@ TOC at end of document one will naturally have to issue again }% end of \TOClocalstyle \makeatother \end{filecontentshere} -\attachfile[description={demo \the\value{section}-B}]{etocsnippet-\the\value{section}-B.tex} +\marginattach{-B} As mentioned previously, this handles non-numbered (multi-line) sectioning units somewhat differently from what happens in the standard document classes. @@ -2974,7 +3130,7 @@ line styles and some colors added (it has been put in a float which appears % environment. This bug has nothing to do with \etoc.} % RETIRÉ le 28 avril 2015 pour 1.08f -\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \etocdefaultlines \begingroup \renewcommand{\etoccolumnsep}{2em} @@ -3007,7 +3163,7 @@ line styles and some colors added (it has been put in a float which appears \end{figure} \endgroup \end{filecontentshere} -\attachfile[description={demo \the\value{section}-A}]{etocsnippet-\the\value{section}-A.tex} +\marginattach{-A} \filecontentsexec\filecontentsheremacro @@ -3060,7 +3216,7 @@ code is used also for \hyperref[toc:clone]{this other toc}. % attention car \ref{toc:floating} fera référence au compteur de % toutes les toc, pas visibletoc. -\begin{filecontentshere}{etocsnippet-\the\value{section}.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \begin{figure}[htbp!]\centering \colorlet{subsecnum}{black} \colorlet{secbackground}{green!30} @@ -3138,7 +3294,7 @@ code is used also for \hyperref[toc:clone]{this other toc}. (\emph{cf.} \hyperref[toc:clone]{this other toc})} \end{figure} \end{filecontentshere} -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \filecontentsexec\filecontentsheremacro @@ -3161,7 +3317,7 @@ many matters do not seem to be widely shared). %%%% dvipdfmx does not know how to handle completely. Apart from that the output %%%% is ok, thus no need to try seriously to avoid them. -\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo} +\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo} \begingroup \newsavebox{\forsubsections} \etocsetstyle{part}{\upshape. \etocskipfirstprefix} @@ -3191,7 +3347,7 @@ many matters do not seem to be widely shared). The code used: \filecontentsprint\foo -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \clearpage @@ -3264,10 +3420,10 @@ it here we just wrote:\par\smallskip \centeredline{| ||\addcontentsline{toc}|\marg{level\_name}\marg{name}} but its usefulness is to circumvent\footnote{using \csa{addtocontents} rather than \csa{addcontentsline}} the patching for automatic creation - of bookmarks done to \csa{addcontentsline} by the |hyperref| package, + of bookmarks done to \csa{addcontentsline} by the \ctanpkg{hyperref} package, as pdf bookmarks don't make much sense here (and would elicit a complaint - of |hyperref| that the bookmark level is `unknown').\footnote{% + of \ctanpkg{hyperref} that the bookmark level is `unknown').\footnote{% The package provides a starred variant \staritb{etoctoccontentsline}, which does allow the creation of bookmarks and has a third mandatory argument which is the @@ -3296,7 +3452,7 @@ it here we just wrote:\par\smallskip Here are the implementation details: \begingroup -\begin{filecontentshere}{etocsnippet-\the\value{section}.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} < in the preamble > \newcounter{visibletoc} \renewcommand{\etocaftertitlehook} @@ -3319,7 +3475,7 @@ Here is the numbered and linked list of all tables of contents which are displayed within this document: \tableofcontents. \endgroup \end{filecontentshere} -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \endgroup After |\etocsetstyle{visibletoc}{..}{..}{..}{..}|, all future TOCs (not in @@ -3363,8 +3519,8 @@ the exercise number would then have been available via \csb{etocnumber}, and \csb{etocname} would have been empty. It doesn't matter which one of the two methods is used. The \etoc command \csb{etoctoccontentsline}|{..}{..}| is provided as a substitute to \csa{addcon\-tentsline}|{toc}{..}{..}|: this is to -avoid the patching which is done by |hyperref| to \csa{addcontentsline} in its -process of creation of bookmarks. If one wants to authorize |hyperref| to create +avoid the patching which is done by \ctanpkg{hyperref} to \csa{addcontentsline} in its +process of creation of bookmarks. If one wants to authorize \ctanpkg{hyperref} to create bookmarks at a specific level \meta{n}, one can use (here with \meta{n}$=$|2|) the starred variant \starit{etoctoccontentsline} which has an additional argument: @@ -3375,12 +3531,12 @@ argument: The counter |exerci| is already incremented by the |exerci| theorem environment, and provides the correct destination for the link added by package -|hyperref|. The command \csa{exercisetotoc} adds for each exercise a line +\ctanpkg{hyperref}. The command \csa{exercisetotoc} adds for each exercise a line to the |.toc| file, corresponding to a fictitious document unit with name `|exercise|'. A four-column list, including the sections, can then be typeset with the following code: -\begin{filecontentshere}{etocsnippet-\the\value{section}.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \etocsetnexttocdepth{2} % sections are at level 1 and will show up \begingroup \etocsetlevel{exercise}{2} % but: @@ -3398,7 +3554,7 @@ typeset with the following code: \tableofcontents \endgroup \end{filecontentshere} -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} A related command \csb{etocimmediatetoccontentsline} (and its starred version) is also provided. For discussion and the meaning of ``immediate'', refer to @@ -3406,8 +3562,8 @@ the analogous case of \csb{etocimmediatedepthtag.toc}. \section{The TOC as a tree}\label{tocastree} -Using |tikz|\footnote{\url{http://ctan.org/pkg/pgf}} and the package -|forest|\footnote{\url{http://ctan.org/pkg/forest}} we shall display the table +Using \ctanpkg{tikz} and the package +\ctanpkg{forest} we shall display the table of contents of this part as a tree. The technique is to use the \etoc modified command \toc not for typesetting, but to prepare a macro, or rather here a \emph{token list} variable, with all the @@ -3422,7 +3578,7 @@ commands in \csa{treetok} would be of no use: to which number or name would they then refer to, in a delayed execution? We need to store, not the macro names, but the macro contents. And also we wish -to maintain the correct |hyperref| hyperlinks.\footnote{This manual up to the +to maintain the correct \ctanpkg{hyperref} hyperlinks.\footnote{This manual up to the version of May 14, 2013 used package |tikz-qtree| but there were problems with hyperlinks. No such problem arises either when using |forest| or the native |tikz| syntax for trees (which will be illustrated in the next section).} The @@ -3464,7 +3620,7 @@ which will be given the contents of |\treetok|. \let\appendtotok\relax -\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo} +\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo} % \newtoks\treetok % put this (uncommented) preferably in the preamble % \newtoks\tmptok % (idem) @@ -3530,7 +3686,7 @@ The resulting tree has been put in a \hyperref[toc:forest]{float}, which appears \vpageref[above]{toc:forest}. Here is the code used for its production: \filecontentsprint\foo -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} Why |\hypersetup{hidelinks}|? as explained in \autoref{ssec:hidelinks}, I prefer the links in TOCs not to be colorized, nor framed, so this document inserts a command @@ -3543,7 +3699,7 @@ originating in |\etocthelinkedname|, etc\dots{} will be executed in the normal environment for links (which, in this document, is to colorize them). Rather than having \etoc's code try to guess what the current ``style'' -for links is (a concept not really provided by |hyperref| it +for links is (a concept not really provided by \ctanpkg{hyperref} it seems) and store it in |\etocthelinkedname|, etc\dots, I opted for the simpler solution to leave it up to the user to recreate whatever conditions are desired. So here it is necessary to re-issue @@ -3581,7 +3737,7 @@ contents of this (or another) document part, only a \csa{sectiontok} and a \csa{subsectiontok} will be needed. -\begin{filecontentshere}{etocsnippet-\the\value{section}.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} % \newtoks\treetok % put this (uncommented) preferably in the preamble % \newtoks\sectiontok % \newtoks\subsectiontok @@ -3627,7 +3783,7 @@ contents of this (or another) document part, only a \csa{sectiontok} and a \end{tikzpicture} \end{figure} \end{filecontentshere} -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \filecontentsexec\filecontentsheremacro @@ -3709,7 +3865,7 @@ example was motivated on |2015/03/11| by \let\appendtotok\relax \expandafter\let\csname c@partco\endcsname\relax -\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo} +\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo} \begingroup % \newtoks\treetok % done in preamble % \newtoks\parttok @@ -3836,7 +3992,7 @@ example I excluded some sections from the display, using the technique of the appears \vpageref{toc:mindmap}. \filecontentsprint\foo -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} An interesting alternative is to use \etoc rather to convert the entire TOC into a TikZ tree (perhaps excluding some parts) and print it out to a file from which it can be recovered and manipulated directly by the author of the @@ -3856,7 +4012,7 @@ suitable tikz picture. See also for an elaboration of this. -\section{The TOC as a table} +\section{The TOC as a (long) table} \label{sec:tocastable} With release |1.08| it is easier to typeset a TOC as a table. It is @@ -3885,7 +4041,7 @@ conditions and a few caveats: Here is an example of a TOC as a |longtable| (yes this is only \emph{one} table), as is possible relatively simply now with |1.08|. The code follows. -\begin{filecontentsdef}{etocsnippet-\the\value{section}-A.tex}{\foo} +\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo} \begingroup \etocglobaldefs % necessary for \etocname etc... to survive & \makeatletter @@ -3951,7 +4107,7 @@ as is possible relatively simply now with |1.08|. The code follows. \filecontentsexec\foo \filecontentsprint\foo -\attachfile[description={demo \the\value{section}-A}]{etocsnippet-\the\value{section}-A.tex} +\marginattach{-A} Examining the code above the reader will wonder why the |\\| are always given first in \meta{prefix+contents} and not, as is more intuitive, rather last. In some favorable cases (but almost never @@ -3996,7 +4152,7 @@ For the hardliner's old way see \autoref{ssec:tocastableold}. Here is also a much simpler example. It is a local table of contents. -\begin{filecontentsdef}{etocsnippet-\the\value{section}-B.tex}{\foo} +\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo} \begin{center} \etocsetstyle{section} {} @@ -4021,7 +4177,7 @@ contents. \filecontentsexec\foo \filecontentsprint\foo -\attachfile[description={demo \the\value{section}-B}]{etocsnippet-\the\value{section}-B.tex} +\marginattach{-B} \section{A TOC self-adjusting widths for its typesetting} \label{sec:thirdexampleextra} @@ -4029,7 +4185,7 @@ contents. This is a continuation of \autoref{sec:thirdexample}. The goal is to adjust automatically the ``numwidths'' used for typesetting the unit numbers in the (local) tables of contents. -\begin{filecontentshere}{etocsnippet-\the\value{section}.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \makeatletter \newcommand*\TOCcompute@numwidths [2]{% #1=empty/"local", #2=minimal indent \begingroup @@ -4084,7 +4240,7 @@ automatically the ``numwidths'' used for typesetting the unit numbers in the }% \makeatother \end{filecontentshere} -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} The optional parameter to \csa{TOCcomputenumwidths} specifies the minimal indent. In case nothing is numbered you may wish a higher value than |0.5em|. For each local table of contents to have its own width computations, the macro @@ -4102,7 +4258,7 @@ Notes: simultaneously compute the numwidths and then typeset the (local) table of contents. \item if you want to adjust the |tocdepth| recall from - \autoref{ssec:bookmarksdepth} that it influences |hyperref| hence you may + \autoref{ssec:bookmarksdepth} that it influences \ctanpkg{hyperref} hence you may need to use a group |\begingroup...\endgroup|. Or, one can use \csb{etocsetnexttocdepth}\marg{level} but (with the code as here) this must then be issued twice, once for \csa{TOCcomputelocalnumwidths}, once for @@ -4131,7 +4287,7 @@ Notes: % with xcolor, as xcolor modifies \fbox % (try \section{\fbox{A}} with and without xcolor). The fix % was to \protect the \fbox used in the |enumitem| label. -% Strangely enough, with |hyperref| active, the problem did +% Strangely enough, with \ctanpkg{hyperref} active, the problem did % not show up. Anyhow I now use \fcolorbox rather than \fbox % and there is no problem anymore. Also I don't have now to % use \normalcolor which already needed protection. @@ -4184,7 +4340,7 @@ obtained in the following manner:% \csa{rmfamily} instead.} \begingroup\small -\begin{filecontentshere}{etocsnippet-\the\value{section}.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \etocsetstyle{section} {\begin{enumerate}} {\normalsize\bfseries\rmfamily\item} @@ -4204,7 +4360,7 @@ obtained in the following manner:% {\etocname} {.\hfil\par\endgroup\pagebreak[3]} \end{filecontentshere} -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \endgroup These provisory style definitions rely on the automatic @@ -4225,13 +4381,13 @@ where no provision is made for them and added the definitive: \end{verbatim} This is also the situation with the default package line styles! -Each \csb{etocsetstyle} command has five mandatory arguments:\\ -\hbox to \linewidth -{\hfil\csb{etocsetstyle}\color{blue}\marg{levelname}% - \marg{start}\marg{prefix}\marg{contents}\marg{finish}\hfil} +Each \csb{etocsetstyle} command has five mandatory arguments: +\centeredline +{\csb{etocsetstyle}\color{blue}\marg{levelname}% + \marg{start}\marg{prefix}\marg{contents}\marg{finish}} The initially recognized \meta{levelname}'s are the sectioning levels of the standard document classes: from \emph{part} (or -\emph{book} which is used by the |memoir| class) down to +\emph{book} which is used by the \ctanpkg{memoir} class) down to \emph{subparagraph}. The \meta{start} code is executed when a toc entry of that level is @@ -4244,10 +4400,10 @@ typeset by executing first the \meta{prefix} code and then the The (robust) commands \csb{etocname}, \csb{etocnumber} and \csb{etocpage} are provided for use inside the \meta{prefix} and \meta{contents} parts of the \csb{etocsetstyle} specification. They represent of course, the name, number, -and page number of the corresponding toc entry. If package |hyperref| is +and page number of the corresponding toc entry. If package \ctanpkg{hyperref} is active in the document and has added hyperlinks to the TOC data, then these links are kept in the commands \csb{etocname}, \csb{etocnumber} and -\csb{etocpage} (this last one will have a link only if |hyperref| was passed +\csb{etocpage} (this last one will have a link only if \ctanpkg{hyperref} was passed option \emph{linktoc=all}.)% % \footnote{In case of \emph{linktoc=page}, only \csb{etocpage} is an hyperlink; @@ -4306,7 +4462,7 @@ an unnumbered section (which ended up in the table of contents via an \csa{addcontentsline} command).\footnote{as seen we use \csa{fcolorbox} rather than \csa{fbox}. Due to some redefinition made by package |xcolor|, had we used - \csa{fbox} (and not used |hyperref|) we would have needed + \csa{fbox} (and not used \ctanpkg{hyperref}) we would have needed \csa{protect}\csa{fbox}.} The \csb{etocifnumbered}\marg{A}\marg{B} command executes @@ -4346,7 +4502,7 @@ The command \csb{etocifnumbered} is robust; \csb{etocxifnumbered} It is sometimes desirable to have access to the name, number and page number without the hyperref link data: something similar to the starred -variant of the \csa{ref} command, when package |hyperref| is used. For +variant of the \csa{ref} command, when package \ctanpkg{hyperref} is used. For example one may wish to use the unit or page number in some kind of numeric context, or change its formatting. This is provided by \csb{etocthename}, \csb{etocthenumber}, and \csb{etocthepage}. @@ -4360,14 +4516,14 @@ preceded by |\protect|. The command \csb{etoclink}\marg{text} can be used in the line style specifications in a manner analogous to \csb{etocname}, \csb{etocnumber} and -\csb{etocpage}. It creates a link (if such a link was added by |hyperref| to +\csb{etocpage}. It creates a link (if such a link was added by \ctanpkg{hyperref} to the |.toc| file entry) whose target is the corresponding document unit and whose name is the given \meta{text} mandatory argument. -Hence |\etoclink{\etocthename}| is under default conditions of |hyperref| like +Hence |\etoclink{\etocthename}| is under default conditions of \ctanpkg{hyperref} like the original |\etocname|, because the latter is already hyperlinked. Under \emph{linktoc=page} context |\etoclink{\etocthename}| adds the hyperlink which -is missing from \csb{etocname}. Similarly under the default |hyperref| +is missing from \csb{etocname}. Similarly under the default \ctanpkg{hyperref} condition (\emph{linktoc=section}) \csb{etocpage} is not an hyperlink, but one can use |\etoclink{\etocthepage}|. @@ -4381,21 +4537,43 @@ The command \csb{etoclink} is robust. Since |etoc 1.08j| it contains the link destination in an already expanded form, so for example can be used even after a |&| in a tabular construction, if \csb{etocglobaldefs} was issued. -\section{The \csbhyp{etocthelinkedname}, \csbhyp{etocthelinkednumber}, -\csbhyp{etocthelinkedpage} and \csbhyp{etocthelink} commands} + +% Sadly the [] syntax influences both the header and the entry in the TOC +% Which is clearly a design limitation of LaTeX. +% Ah! I see it seems KOMA has a way out there is \scr@osectarg +% I had to dig a bit into scrartcl.cls and then make a divination +% of where to look in the pdf, once I had gone through the barrier +% of the html opener (why? as the documentation is not in html format!) + +% Another special feature of KOMA-Script is the handling of the optional +% argument of the sectioning commands \part, \chapter, etc. down to +% \subparagraph. You can change its function and meaning with the options +% headings=optiontohead, headings=optiontotoc and headings=optiontoheadandtoc. + +% Mais j'ai déjà utilisé parfois le [] pour vraiment impacter la toc +% Donc je dois faire manuellement +\makeatletter\scr@activate@xsection{1}\makeatother +% [] goes to head but {} to toc + +% What would really be useful is an option for the length of {} to be measured +% and opt for [] only if does not fit on one header line +\section[The \csbhyp{etocthelinkedname} et al.\protect\@{} commands] + {The \csbhyp{etocthelinkedname}, \csbhyp{etocthelinkednumber}, + \csbhyp{etocthelinkedpage} and \csbhyp{etocthelink} commands} \label{etocthelinkedname} \label{etocthelinkednumber} \label{etocthelinkedpage} \label{etocthelink} +\makeatletter\scr@activate@xsection{0}\makeatother These macros are fragile and contain the link destination in already expanded form. So their meaning can be stored for delayed usage. For example this is done here when doing the \hyperref[tocastree]{examples with trees}. Notice though that \csb{etocthelinkednumber} and \csb{etocthelinkedname} are -hyperlinks only if |hyperref| was configured to let the heading name be -linked (this is the default). So under |hyperref| option \emph{linktoc=page}, +hyperlinks only if \ctanpkg{hyperref} was configured to let the heading name be +linked (this is the default). So under \ctanpkg{hyperref} option \emph{linktoc=page}, both \csb{etocthelinkednumber} and \csb{etocthelinkedname} are no different from respectively \csb{etocthenumber} and \csb{etocthename}. @@ -4420,7 +4598,7 @@ Obsolete example of \begingroup {\end{itemize*}.}% \etocsetnexttocdepth {section}% \etocsettocstyle {a table of contents done as an inline - \texttt{enumitem} environment: }{}% + \ctanpkg{enumitem} environment: }{}% \etocinline\tableofcontents \ref{toc:globalcmds} \endgroup @@ -4449,7 +4627,7 @@ anymore here for \csb{etocthelinkedname}, as \csb{etocname} works. Example of \begingroup\etocglobaldefs % <-- NEW mit etoc 1.08. \etocsetstyle {section} - {\begin{itemize*}[itemjoin={{; }}, itemjoin*={{, und }}]} + {\begin{itemize*}[itemjoin={{; }}, itemjoin*={{, and }}]} {} {\item [{\bfseries\etocnumber.}] \etocname\ (\emph{p. \etocpage })} {\end{itemize*}.}% @@ -4462,14 +4640,14 @@ Example of Example of \begingroup\etocglobaldefs % <-- NEW mit etoc 1.08. \etocsetstyle {section} - {\begin{itemize*}[itemjoin={{; }}, itemjoin*={{, und }}]} + {\begin{itemize*}[itemjoin={{; }}, itemjoin*={{, and }}]} {} {\item [{\bfseries\etocnumber.}] \etocname\ (\emph{p. \etocpage })} {\end{itemize*}.}% \etocsetnexttocdepth {section}% \etocsettocstyle {a table of contents done as an inline - \texttt{enumitem} environment: }{}% + \ctanpkg{enumitem} environment: }{}% \etocinline\tableofcontents \ref{toc:globalcmds} \endgroup @@ -4532,7 +4710,7 @@ These level assignments can be modified at anytime: see technique. As one further example, let's mention here that the \hyperref[toc:main]{main table of contents} of this document was typeset following these instructions: -\begin{filecontentshere}{etocsnippet-\the\value{section}.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \etocsettocdepth {subsubsection} % set the initial tocdepth \etocdefaultlines % use the package default line styles. At this early stage in % the document they had not yet been modified by \etocsetstyle @@ -4549,7 +4727,7 @@ contents} of this document was typeset following these instructions: \tableofcontents \label{toc:main} \endgroup \end{filecontentshere} -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} In this way, the subsections used the style originally designed for subsubsections, the subsubsections were not printed. Without this modification, the appearance would have been very different: the package line styles were @@ -4582,7 +4760,7 @@ Let us switch to the color red, and also add this command to the |.toc| file: \subsection{This is a (pale) red subsection for illustrative purposes} -Actually, this title here was printed black, due to the way the |scrartcl| class +Actually, this title here was printed black, due to the way the \ctanpkg{scrartcl} class works (it would have been red in the |article| class), but we are more interested in how it looks in the tables of contents: it does appear red in the \hyperref[toc:main]{main table of contents} at the beginning of @@ -4618,7 +4796,7 @@ file. \addtocontents{toc}{\string\normalcolor} Back to black. Note that this scope problem arises in real life in a -multi-lingual document, as the |babel| package writes to the |.toc| file the +multi-lingual document, as the \ctanpkg{babel} package writes to the |.toc| file the language changes occurring in the document. @@ -4654,8 +4832,7 @@ shortcuts: \etocruled[1]{Title} (or \etoclocalruled[1]{Title}) \label{etocsettocstyle} This is a command with two mandatory arguments:\\ -\centerline{\csb{etocsettocstyle}\marg{before\_toc}% -\marg{after\_toc}} +\centeredline{\csb{etocsettocstyle}\marg{before\_toc}\marg{after\_toc}} The \marg{before\_toc} part is responsible for typesetting the heading, for example it can be something like \starit{section}|{\contentsname}|. @@ -4706,9 +4883,9 @@ The commands to be described next \csb{etocmulticolstyle}, \label{etocmulticol} \label{etoclocalmulticol} -This is a command with one optional and one mandatory argument:\\ -\centerline{\csb{etocmulticolstyle}% - \oarg{number\_of\_columns}\marg{heading}} The +This is a command with one optional and one mandatory argument: +\centeredline{\csb{etocmulticolstyle}\oarg{number\_of\_columns}\marg{heading}} +The \meta{number\_of\_columns} can go from 1 to 10 (it defaults to 2; if its value is 1, naturally no |multicols| environment is then created). The \meta{heading} will typically be some `vertical' material like: @@ -4726,8 +4903,8 @@ configured: After \csb{etocmulticolstyle} all future \csa{tableofcontents} will use the specified style, if it does not get changed in-between. A shortcut for just one table of contents and -no impact on the styles of later TOCs is:\\ -\centerline{\csb{etocmulticol}\oarg{number\_of\_columns}\marg{heading}} +no impact on the styles of later TOCs is: +\centeredline{\csb{etocmulticol}\oarg{number\_of\_columns}\marg{heading}} And there is also \csb{etoclocalmulticol}\oarg{number\_of\_columns}\marg{heading}. @@ -4767,7 +4944,7 @@ which does not uppercase. \label{etoclocalruled} The general format of \csb{etocruledstyle} is:\\ -\centerline{\csb{etocruledstyle}% +\centeredline{\csb{etocruledstyle}% \oarg{number of columns}\marg{title of the toc}} \noindent The title is horizontal material (the |LR| mode of @@ -4787,10 +4964,10 @@ the \hyperref[toc:a]{start of the second part of this As a shortcut to set the style with \csb{etocruledstyle} and then issue a -\csa{tableofcontents}, all inside a group +\toc, all inside a group so that future table of contents will not be -affected, there is:\\ -\centerline{\csb{etocruled}\oarg{number\_of\_columns}\marg{title}} +affected, there is: +\centeredline{\csb{etocruled}\oarg{number\_of\_columns}\marg{title}} And the local form will be \csb{etoclocalruled}. \subsection{The commands \csbhyp{etocframedstyle}, \csbhyp{etocframed}, and \csbhyp{etoclocalframed}} @@ -4798,11 +4975,11 @@ And the local form will be \csb{etoclocalruled}. \label{etocframed} \label{etoclocalframed} -Same mechanism:\\ -\centerline{\csb{etocframedstyle}% +Same mechanism: +\centeredline{\csb{etocframedstyle}% \oarg{number\_of\_columns}\marg{title}} -and the accompanying shortcut:\\ -\centerline{\csb{etocframed}\oarg{number\_of\_columns}\marg{title}} The +and the accompanying shortcut: +\centeredline{\csb{etocframed}\oarg{number\_of\_columns}\marg{title}} The shortcut is used if one does not want to modify the style of the next TOCs (the other way is to put the whole thing inside braces or a |\begingroup...\endgroup|; there is also \csb{etoclocalframed} for a @@ -4818,9 +4995,9 @@ border are specified via suitable |\renewcommand|'s (see A |minipage| is used, hence the produced table of contents isn't compatible with a page break. For allowing page breaks, use of the commands of -\href{http://ctan.org/pkg/mdframed}{mdframed}\footnote{\url{http://ctan.org/pkg/mdframed}} +\ctanpkg{mdframed} or -\href{http://ctan.org/pkg/tcolorbox}{tcolorbox}\footnote{\url{http://ctan.org/pkg/tcolorbox}} +\ctanpkg{tcolorbox} in the arguments of \csb{etocsettocstyle} is recommended. @@ -4878,6 +5055,8 @@ class should be obeyed, too. \subsubsection{The commands \csbhyp{etocarticlestyle}, \csbhyp{etocbookstyle}, \dots} +\label{etocarticlestyle} +\label{etocbookstyle} These are the commands used internally by \etoc in compatibility mode depending on the document class. For example \csb{etocarticlestyle} instructs @@ -4927,14 +5106,15 @@ document. The first line tells essentially to use |\section*{\contentsname}|, and the second line says to insert the title in the |.toc| file itself (thus to be -displayed by the main table of contents). Notice that |hyperref| package will +displayed by the main table of contents). Notice that \ctanpkg{hyperref} package will then automatically create suitable anchor and one should \emph{not} use explicitly \cs{phantomsection} here (it would let the anchor be located below not above the title). -With this set-up issuing \localtoc|*| will ignore the \csb{etocaftertitlehook} +% problème avec \xspace +With this set-up issuing \localtoc\unskip|*| will ignore the \csb{etocaftertitlehook} hence not send the local toc title to the |.toc| file. This mimicks the -|memoir| class behavior, and can also be used with it. For more on |memoir| +\ctanpkg{memoir} class behavior, and can also be used with it. For more on \ctanpkg{memoir} class with \etoc, see \autoref{ssec:memoir}. There are further hook macros: @@ -5045,7 +5225,9 @@ can be followed with optional labels or references:\par \medskip -New with |1.08e|: \localtoc \csa{ref}|{toc:far}| as synonym for \toc +%New with |1.08e|: + +\localtoc \csa{ref}|{toc:far}| acts the same as \toc \csa{ref}|{toc:far}|. % (obsolète depuis 1.08e) @@ -5102,7 +5284,7 @@ medium series; we modify the \csb{etocfontone} command for that. Also we use dot leaders which are less spread out than in the package default. -\begin{filecontentshere}{etocsnippet-\the\value{section}.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \etocruledstyle[2]{\normalfont\normalsize\rmfamily\itshape \fbox{\parbox{.6\linewidth}{ \leftskip 0pt plus .5fil @@ -5123,13 +5305,40 @@ leaders which are less spread out than in the package default. \tableofcontents \endgroup \end{filecontentshere} -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \filecontentsexec\filecontentsheremacro \section{Customizing \etoc} \subsection{Customizing the \etoc pre-defined line styles} +\label{etocfontminustwo} +\label{etocfontminusone} +\label{etocfontzero} +\label{etocfontone} +\label{etocfonttwo} +\label{etocfontthree} +\label{etocsepminustwo} +\label{etocsepminusone} +\label{etocsepzero} +\label{etocsepone} +\label{etocseptwo} +\label{etocsepthree} +\label{etocminustwoleftmargin} +\label{etocminustworightmargin} +\label{etocminusoneleftmargin} +\label{etocminusonerightmargin} +\label{etocbaselinespreadminustwo} +\label{etocbaselinespreadminusone} +\label{etocbaselinespreadzero} +\label{etocbaselinespreadone} +\label{etocbaselinespreadtwo} +\label{etocbaselinespreadthree} +\label{etoctoclineleaders} +\label{etocabbrevpagename} +\label{etocpartname} +\label{etocbookname} + We will simply list the relevant commands as defined in the package. Customizing them goes through suitable @@ -5176,7 +5385,7 @@ within \etoc. As already explained, when itself very discrete and acts only at the global level, and the TOC entries are (hopefully) formatted as would have happened in the absence of \etoc.\footnote{with the - KOMA-script classes, we noticed that + \ctanpkg{KOMA-script} classes, we noticed that \csb{etocstandarddisplaystyle} was apparently needed for the KOMA options |toc=left| to be active at the level of the line entries.} @@ -5194,6 +5403,27 @@ switching off the compatibility mode. \subsection{Customizing the toc display styles} \label{ssec:customdisplay} +\label{etocabovetocskip} +\label{etocbelowtocskip} +\label{etoccolumnsep} +\label{etocmulticolsep} +\label{etocmulticolpretolerance} +\label{etocmulticoltolerance} +\label{etocdefaultnbcol} +%\label{etocinnertopsep}% déjà défini +\label{etoctoprule} +\label{etoctoprulecolorcmd} +\label{etocinnerleftsep} +\label{etocinnerrightsep} +\label{etocinnerbottomsep} +\label{etocleftrule} +\label{etocrightrule} +\label{etocbottomrule} +\label{etocleftrulecolorcmd} +\label{etocrightrulecolorcmd} +\label{etocbottomrulecolorcmd} +\label{etocbkgcolorcmd} +\label{etocframedmphook} Again we list the relevant macros, what they do should be legible from their names. Note that \csa{renewcommand}'s and @@ -5249,8 +5479,8 @@ in |ex|'s or |em|'s as in this example: \centeredline{|\renewcommand{\etoctoprule}{\hrule height 1ex}|} The package code is done in such a manner that it is the font size in instance at the end of typesetting -the title argument to \csb{etocruledtoc} or -\csb{etocframedtoc} which will be used for the meaning of the +the title argument to \csb{etocruled} or +\csb{etocframed} which will be used for the meaning of the `1ex'. Of course also the other rule commands can have their dimensions in font relative units, but their values are decided on the basis of the font in effect just before the @@ -5272,7 +5502,7 @@ this example so we included the title as part of the \meta{start} code at section level, to get it \emph{inside} the frame. -\begin{filecontentshere}{etocsnippet-\the\value{section}.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \begingroup \definecolor{subsecnum}{RGB}{13,151,225} \definecolor{secbackground}{RGB}{0,177,235} @@ -5344,7 +5574,7 @@ the frame. \tableofcontents \label{toc:clone} \ref{toc:globalcmds} \endgroup \end{filecontentshere} -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \filecontentsexec\filecontentsheremacro % 1.07l on the occasion of traduction into German documentation @@ -5384,6 +5614,58 @@ use or not colors is left to the user. %\section{... and tricks} +% pas traduit +\section{The \csbhyp{etoclocaltop} command} +\label{etoclocaltop} + +%\textbf{New with 1.09 (2019/03/09)}. + +Within either the TOC style +(\csb{etocsettocstyle}) or the local title styles (\csb{etocsetstyle}), the +control sequence \csb{etoclocaltop} is made equivalent for the duration of +\csb{localtableofcontents} to a numeric (self-delimiting) denotation of the +current top level. + +Thus: it will in numeric contexts (|\ifnum|, |\ifcase|, ...) represent zero +for a local TOC corresponding to chapter, or one if in a section, or two if in +a subsection, etc..., assuming of course here that the default levels are +obeyed (see \autoref{sec:tocdepth}). + +\begin{framed} + \csb{etoclocaltop} from inside the TOC heading (first argument of + \csb{etocsettocstyle}) has the correct value \emph{only under + \csb{etocchecksemptiness} regime}. Special circumstances correspond to + some special values: + \begin{description}[nolistsep] + \item[|-3|] (|-\thr@@|)\newline + signals that \etoc considers the local TOC to be + ``unknown''; this happens at the last local TOC, for the first \LaTeX\ run + after adding a new \localtoc to the document. In doubt, \etoc assumes the + TOC will prove non empty, hence it prints (independently of whether the + check for emptiness was activated or not) the heading as specified by + \csb{etocsettocstyle}. Thus, check if \csb{etoclocaltop} gives |-3| as a + a \meta{number} to detect that situation from within the first argument of + \csb{etocsettocstyle}, if desired. + \item[|-1000|](|-\@m|)\newline is in case of a \localtoc + being considered ``known'' (although it may still refer to the data in the + |.toc| file from the previous run) but without the check for emptiness + having been executed. + \item[|-10000|](|-\@M|)\newline is the value when accessed from the title + of a global TOCs. + \end{description} +\end{framed} +\begin{framed} + When executed from within a local table of contents \textbf{line styles} + (\csb{etocsetstyle}), \csb{etoclocaltop} always will hold the correct value, + whether or not the emptiness check was executed. + + For a global table of contents however, it will always keep the value |-3|. +\end{framed} + +Attention! \cs{etoclocaltop} is only to be queried; modifying it is strictly +forbidden and falls under the most rigorous prosecution allowed by federal +law. + \section[The \csbhyp{etocsetlocaltop.toc} command] {The \csbhyp{etocsetlocaltop.toc} and \csbhyp{etocimmediatesetlocaltop.toc} commands} @@ -5574,18 +5856,18 @@ sections and subsections it has. Well, each one of this paragraph is a table of contents! We designed a macro \csa{thispartstats} to do that. It uses ``storage'' boxes to keep the information about the first and last section or subsection. Using boxes is the simplest manner to -encapsulate the |hyperref| link for later use (whether there is one or +encapsulate the \ctanpkg{hyperref} link for later use (whether there is one or none). However, one cannot modify then the font or the color. % (using the % \TeX{} primitive \csa{setbox} rather than the \LaTeX{} \csa{sbox} would % allow to change the color of the un-boxed saved box) If such a need arises, one must switch from using boxes to using macros, and store the -|hyperref| data for later use as was done in the code presented in +\ctanpkg{hyperref} data for later use as was done in the code presented in \autoref{sec:molecule}. We present also this second method. But first, the code of \csa{thispartstats}:\par -\begin{filecontentshere}{etocsnippet-\the\value{section}-A.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \newsavebox\firstnamei \newsavebox\firstnumberi \newsavebox\lastnamei \newsavebox\lastnumberi \newsavebox\firstnameii \newsavebox\firstnumberii @@ -5597,32 +5879,33 @@ But first, the code of \csa{thispartstats}:\par \setcounter{mycounti}{0}% \setcounter{mycountii}{0}% \def\thispartstatsauxi{% - \sbox{\firstnamei}{\etocname}% - \sbox{\firstnumberi}{\etocnumber}% + \sbox{\firstnamei}{\footnotesize\etocname}% + \sbox{\firstnumberi}{\footnotesize\etocnumber}% \def\thispartstatsauxi{}}% \def\thispartstatsauxii{% - \sbox{\firstnameii}{\etocname}% - \sbox{\firstnumberii}{\etocnumber}% + \sbox{\firstnameii}{\footnotesize\etocname}% + \sbox{\firstnumberii}{\footnotesize\etocnumber}% \def\thispartstatsauxii{}}% \begingroup \etocsetstyle{subsection} {} {} {\thispartstatsauxii \stepcounter{mycountii}% - \sbox{\lastnameii}{\etocname}% - \sbox{\lastnumberii}{\etocnumber}} {}% + \sbox{\lastnameii}{\footnotesize\etocname}% + \sbox{\lastnumberii}{\footnotesize\etocnumber}} {}% \etocsetstyle{section} {} {} {\thispartstatsauxi \stepcounter{mycounti}% - \sbox{\lastnamei}{\etocname}% - \sbox{\lastnumberi}{\etocnumber}} - {Here are some statistics for this part: it contains \arabic{mycounti} + \sbox{\lastnamei}{\footnotesize\etocname}% + \sbox{\lastnumberi}{\footnotesize\etocnumber}} + {{\footnotesize\itshape + Here are some statistics for this part: it contains \arabic{mycounti} section\ifnum\value{mycounti}>1 s\fi{} and \arabic{mycountii} subsection\ifnum\value{mycountii}>1 s\fi. The name of the first section is \unhbox\firstnamei{} and the corresponding number is \unhbox\firstnumberi. The name of the last section is \unhbox\lastnamei{} and its number is \unhbox\lastnumberi. The name of the first subsection is \unhbox\firstnameii{} and the corresponding number is \unhbox\firstnumberii. The name of the last - subsection is \unhbox\lastnameii{} and its number is \unhbox\lastnumberii.}% + subsection is \unhbox\lastnameii{} and its number is \unhbox\lastnumberii.\par}}% \etocinline % cancels the automatic \par automatically before the TOC \etocsettocstyle {}{} \etocsetnexttocdepth{2}% @@ -5630,10 +5913,10 @@ But first, the code of \csa{thispartstats}:\par \endgroup } \end{filecontentshere} -\attachfile[description={demo \the\value{section}-A}]{etocsnippet-\the\value{section}-A.tex} +\marginattach{-A} And now, the variant with macros rather than boxes (this variant as it stands here is for using within a section). -\begin{filecontentshere}{etocsnippet-\the\value{section}-B.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \makeatletter \newcommand*\firstsubname {} \newcommand*\lastsubname {} \newcommand*\firstsubnumber {} \newcommand*\lastsubnumber {} @@ -5662,7 +5945,7 @@ stands here is for using within a section). } \makeatother \end{filecontentshere} -\attachfile[description={demo \the\value{section}-B}]{etocsnippet-\the\value{section}-B.tex} +\marginattach{-B} \section{Using depth tags} \label{ssec:tocwithdepthtags} @@ -5688,7 +5971,7 @@ underneath the numbers contrarily to the code from lengths (now that this has been done once, it can be recycled easily) we get: -\begin{filecontentsdef}{etocsnippet-\the\value{section}.tex}{\foo} +\begin{filecontentsdef}{etocsnippet-\snippetno.tex}{\foo} \etocsetnexttocdepth {all} \begingroup \parindent 0pt \leftskip 0cm \rightskip .75cm \parfillskip -\rightskip @@ -5757,7 +6040,7 @@ get: \filecontentsexec\foo \filecontentsprint\foo -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \section{Typesetting the TOC as a table (the old way)} \label{ssec:tocastableold} @@ -5801,7 +6084,7 @@ external macros inserted in the |.toc| file by other packages. Note: rather than |\toks| registers it would be easier here to use \eTeX{} \csa{unexpanded} primitive. See for example \autoref{sec:mindmap}. -\begin{filecontentshere}{etocsnippet-\the\value{section}.tex} +\begin{filecontentshere}{etocsnippet-\snippetno.tex} \newtoks\toctabletok \newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2 #1\expandafter\expandafter\expandafter {\expandafter\the\expandafter #1#2}} @@ -5849,20 +6132,18 @@ Note: rather than |\toks| registers it would be easier here to use \eTeX{} \the\toctabletok \endgroup \end{filecontentshere} -\attachfile[description={demo \the\value{section}}]{etocsnippet-\the\value{section}.tex} +\marginattach{} \clearpage \etocdepthtag.toc {etocandworld} \part{\etoc and the outside world} -\section{Compatibility with other packages} - -\subsection{Generalities} +\section{Constraints on the \texttt{.toc} file constitution} The contents of the |.toc| file (if it already exists) are read into memory by -\etoc once, at the time of |\begin{document}|.\footnote{New with |1.07m|. - Earlier versions read the |.toc| file at the time of +\etoc once, at the time of |\begin{document}|.\footnote{% + Versions earlier than |1.07m| read the |.toc| file at the time of \csa{usepackage\{etoc\}}. Thanks to Denis Bitouzé who signaled a Babel related problem, which turned out to be caused by this.} @@ -5888,7 +6169,8 @@ Also a |\else| immediately following \csa{tableofcontents} or \centeredline{|\renewcommand\tableofcontents{\oldtableofcontents foo}|} as this will make the |\label/\ref| mechanism impossible. - Rather use \centeredline{|\renewcommand\etocaftertochook{foo}|} and there + Rather, redefine \csb{etocaftertochook} +\centeredline{|\renewcommand\etocaftertochook{foo}|} and there is also \csb{etocaftercontentshook} which is executed a bit earlier\footnotemark{} just before the closing part of the toc display style (and thus still within a group.) @@ -5912,92 +6194,53 @@ Also a |\else| immediately following \csa{tableofcontents} or not use the \csa{contentsline} macro or if the \csa{contentsline} macro does not invoke the \csa{l@<divisionunit>} macros. -\subsection{Compatibility with \texttt{beamer}} - -For the very reasons mentioned right before, \etoc is incompatible with the -|beamer| class. However, if |beamer| is used in an article mode, i.e., with -the article class in conjunction with the |beamerarticle| package, then \etoc -should work. - -\subsection{Compatibility with \texttt{Babel}} - -\begin{framed} - One must load \etoc \emph{after} \texttt{babel}. This is in order for - |babel|'s shorthands to be active at the time when \etoc loads the |.toc| - file. -\end{framed} - -\subsection{Compatibility with \texttt{hyperref}} - -Please inform the author in case of issues: \etoc was from the start designed -to be |100%| compatible with package |hyperref|. - -The macros \csb{etocname}, \csb{etocnumber}, and \csb{etocpage} contain the -|hyperref| links, if present (note that the \emph{linktoc=all} option of -|hyperref| tells it to put a link also in the page number corresponding to a -given toc entry). For example, the tables of contents of the present document -are all fully linked. It doesn't matter whether \etoc or |hyperref| is loaded -first. - -% \typeout{ICI} -% \showhyphens{Compatibility} -% [] \T1/txss/m/n/10.95 Com-pat-i-bil-ity - -% 2015/11/12 -% Pour une raison que j'ignore dans la TOC principale j'ai un problème avec -% cette sous-section. - -\subsection{Com\-pat\-i\-bil\-ity with \texttt{multicol}} - -\etoc loads the package |multicol|. - -\subsection{Compatibility with \texttt{tocloft}}\label{subs:tocloft} - -Release |1.07k| added compatibility with package -|tocloft|:\footnote{\url{http://ctan.org/pkg/tocloft}} steps are -taken to prevent the redefinition of |\tableofcontents| done by -|tocloft| at |\begin{document}|. -% -As long as \etoc is left in compatibility mode the customization done by -|tocloft| will be obeyed, for both the line styles and the TOC title. -One may still benefit from the \emph{depth tags} management by \etoc, -from its |\localtableofcontents|, from its |\label+\ref| mechanism. One -may use |\etocsetstyle| to define via \etoc the layout for one TOC and -then use rather |tocloft| for another one, if |\tableofcontents| follows -\csb{etocstandardlines} and \csb{etocstandarddisplaystyle}. In this -compatibility mode |\etocsetlevel{division unit}{6}| will render -invisible the chosen division level, but exchanging levels is otherwise -not possible. - -\begin{framed} - One should load \etoc \emph{after} \texttt{tocloft}. A warning is - issued if otherwise, because if \etoc is loaded before it will realize that at - the time of |\begin{document}| and trick \texttt{tocloft} into believing - having been loaded with the |titles| option. -\end{framed} - -It is possible to modify midway in the document the macros \csa{l@section}, -\csa{l@subsection} ... but the effect will be seen only in table of contents -typeset by \etoc in compatibility mode (and of course after those -customizations). It will have no effect on true \etoc TOCs. +\section{Compatibility with document classes} + +\etoc has mainly been tested with the |article| and |book| standard classes. +Some compatibility layer with the \ctanpkg{KOMA-script} and \ctanpkg{memoir} classes was added at +|1.05| of |2012/12/01|. Such compatibilty layer regards what this +documentation calls the global display style: when \etoc gets activated +because the user employed some \csb{etocsetstyle}|{section}| (etc), i.e.\@ it +is not used purely in compatibility mode (which happens I guess for +\csb{localtableofcontents} functionality as it does not require reading the +user manual), \etoc tries in absence of usage by the user of +\csb{etocsettocstyle} to create itself a ``TOC display style'' emulating the +default behaviour of the document class. There does not seem to be an easy +way to extract this in an automated manner dynamically, so it is basically +some manual work which the author initiated in 2012 and which got sporadically +updated since. + +\subsection{Compatibility with the \ctanpkg{KOMA-script} classes} +\label{etocscrartclstyle} +\label{etocscrbookstyle} +\label{etocscrreprtstyle} + +Not really tested. But nominally supported, as the code contains this +\begin{verbatim} +\@ifclassloaded{scrartcl} + {\renewcommand*\etocstandarddisplaystyle{\etocscrartclstyle}}{} +\end{verbatim} +and \cs{etocscrartclstyle} tries to emulate the global display style of the +\cs{tableofcontents} command with the class \ctanpkg{scrartcl}. It was last updated +at |1.09f|. -\subsection{Compatibility with the \texttt{memoir} class} +\subsection{Compatibility with the \ctanpkg{memoir} class} \label{ssec:memoir} \label{etocmemoirtoctotocfmt} \label{etocmemoirstyle} -Release |1.07l| has also improved the compatibility with the |memoir| class: its +Release |1.07l| has also improved the compatibility with the \ctanpkg{memoir} class: its |appendix| level has been made known to \etoc. It is at the same level as |chapter|, thus the chapter line style should possibly do a test for some user defined boolean whose activation may be added to the |.toc| file at the suitable location via |\addtocontents{toc}{..}|, if one needs to distinguish the two kinds of divisions. -The |memoir| mechanism relative to \toc versus \toc|*| is obeyed +The \ctanpkg{memoir} mechanism relative to \toc versus \toc|*| is obeyed automatically, and applies with \localtoc too. But, attention, this means that \localtoc should preferentially be used with -the |*|. Else the |memoir| mechanism will insert a specific line in the +the |*|. Else the \ctanpkg{memoir} mechanism will insert a specific line in the |.toc| file, using by default the |chapter| sectioning level. But \etoc has already written to the |.toc| file an instruction that the user wants a local table of contents. As a result, the fake |chapter| will let \etoc consider @@ -6012,8 +6255,8 @@ mechanism instructs to compile once more, and we end in a never stabilizing conundrum. Thus we see that the fact that \localtoc by default use like the global \toc a -chapter style is inconvenient. One can use the |memoir| macros to modify this: -according to |memoir| documentation, |\tocheadstart| and |\printtoctitle| seem +chapter style is inconvenient. One can use the \ctanpkg{memoir} macros to modify this: +according to \ctanpkg{memoir} documentation, |\tocheadstart| and |\printtoctitle| seem to be the most relevant. If you do that you will probably want the added line in |.toc| file to use |{section}| not |{chapter}|. \etoc provides to this effect \csb{etocmemoirtoctotocfmt}\marg{kind}\marg{name} whose first argument @@ -6024,12 +6267,12 @@ appropriate. Hence \etocmemoirtoctotocfmt{section}{\contentsname} \end{verbatim} seems the natural choice in this context as an addition to the customizing the -|memoir| toc related macros to achieve a section like rendering (for more -details on the latter, please refer to |memoir| manual). This is appropriate +\ctanpkg{memoir} toc related macros to achieve a section like rendering (for more +details on the latter, please refer to \ctanpkg{memoir} manual). This is appropriate for local TOCs in chapters. Adapt to finer sectioning levels. Another approach is to overrule the \etoc -default under |memoir| like this +default under \ctanpkg{memoir} like this \begin{verbatim} \etocarticlestyle % means to use \section*{\contentsname} (and marks) \renewcommand{\etocaftertitlehook}{\addcontentsline{toc}{section}{\contentsname}} @@ -6041,34 +6284,105 @@ use \localtoc after a \csa{chapter}. But if you want one after a \csa{section}, you should modify \csb{etocaftertitlehook} to assign |subsection| level to the \localtoc own styling. +\subsection{Compatibility with \ctanpkg{beamer}} + +For the reasons mentioned already regarding the constraints on the |.toc| file +constitution, \etoc is incompatible with the +\ctanpkg{beamer} class. However, if \ctanpkg{beamer} is used in an article mode, i.e., with +the article class in conjunction with the \ctanpkg{beamerarticle} package, then \etoc +should work. + +\section{Compatibility with other packages} + +\subsection{Compatibility with \ctanpkg{babel}} + +\begin{framed} + One must load \etoc \emph{after} \ctanpkg{babel}. This is in order for + \ctanpkg{babel}'s shorthands to be active at the time when \etoc loads the |.toc| + file. +\end{framed} + +\subsection{Compatibility with \ctanpkg{hyperref}} + +Please inform the author in case of issues: \etoc was from the start designed +to be |100%| compatible with package \ctanpkg{hyperref}. + +The macros \csb{etocname}, \csb{etocnumber}, and \csb{etocpage} contain the +\ctanpkg{hyperref} links, if present (note that the \emph{linktoc=all} option of +\ctanpkg{hyperref} tells it to put a link also in the page number corresponding to a +given toc entry). For example, the tables of contents of the present document +are all fully linked. It doesn't matter whether \etoc or \ctanpkg{hyperref} is loaded +first. + +% \typeout{ICI} +% \showhyphens{Compatibility} +% [] \T1/txss/m/n/10.95 Com-pat-i-bil-ity + +% 2015/11/12 +% Pour une raison que j'ignore dans la TOC principale j'ai un problème avec +% cette sous-section. + +\subsection{Com\-pat\-i\-bil\-ity with \ctanpkg{multicol}} + +\etoc loads the package \ctanpkg{multicol}. + +\subsection{Compatibility with \ctanpkg{tocloft}}\label{subs:tocloft} -\subsection{Compatibility with package \texttt{tocvsec2}} +Release |1.07k| added compatibility with package +\ctanpkg{tocloft}: steps are +taken to prevent the redefinition of |\tableofcontents| done by +\ctanpkg{tocloft} at |\begin{document}|. +% +As long as \etoc is left in compatibility mode the customization done by +\ctanpkg{tocloft} will be obeyed, for both the line styles and the TOC title. +One may still benefit from the \emph{depth tags} management by \etoc, +from its |\localtableofcontents|, from its |\label+\ref| mechanism. One +may use |\etocsetstyle| to define via \etoc the layout for one TOC and +then use rather \ctanpkg{tocloft} for another one, if |\tableofcontents| follows +\csb{etocstandardlines} and \csb{etocstandarddisplaystyle}. In this +compatibility mode |\etocsetlevel{division unit}{6}| will render +invisible the chosen division level, but exchanging levels is otherwise +not possible. + +\begin{framed} + One should load \etoc \emph{after} \ctanpkg{tocloft}. A warning is + issued if otherwise, because if \etoc is loaded before it will realize that at + the time of |\begin{document}| and trick \ctanpkg{tocloft} into believing + having been loaded with the |titles| option. +\end{framed} + +It is possible to modify midway in the document the macros \csa{l@section}, +\csa{l@subsection} ... but the effect will be seen only in table of contents +typeset by \etoc in compatibility mode (and of course after those +customizations). It will have no effect on true \etoc TOCs. + +\subsection{Compatibility with \ctanpkg{tocvsec2}} \etoc used to be incompatible with package - |tocvsec2|\footnote{\url{http://ctan.org/pkg/tocvsec2}}; it now cohabits, sort - of, as it deactivates |tocvsec2|'s modification of |\tableofcontents| + \ctanpkg{tocvsec2}; it now cohabits, sort + of, as it deactivates \ctanpkg{tocvsec2}'s modification of |\tableofcontents| and also cancels its other |toc|-related macros, but reimplements partially their functionality with \csb{etocsettocdepth.toc}. By the way, at least two latex runs are necessary for new uses of this command in a document to have an effect in tables of contents. -\subsection{Compatibility with package \texttt{tableof}} +\subsection{Compatibility with \ctanpkg{tableof}} It is possible to use simultaneously \etoc and -{\color{niceone}|tableof|}\footnote{\url{http://ctan.org/pkg/tableof}}. Release -|1.08| of \etoc requires at least version |1.4a| of |tableof|. If +\ctanpkg{tableof}. Release +|1.08| of \etoc requires at least version |1.4a| of \ctanpkg{tableof}. If \csb{etocglobaldefs} is put in the preamble, this must be after the loading of -package |tableof|. {\color{niceone}|tableof|} command \csa{nexttocwithtags} +package \ctanpkg{tableof}. {\color{niceone}\ctanpkg{tableof}} command \csa{nexttocwithtags} should work as expected. -{\color{niceone}|tableof|} commands \csa{tableof}, \csa{tablenotof}, ... will +\ctanpkg{tableof} commands \csa{tableof}, \csa{tablenotof}, ... will typeset the (a priori global) table of contents according to the document -class defaults, obeying the \etoc depth tags; as explained in the |tableof| +class defaults, obeying the \etoc depth tags; as explained in the \ctanpkg{tableof} documentation they do not typeset a TOC title. They should \emph{not} be used in case \csb{etocglobaldefs} was issued before, except if its scope has been terminated since then, or \csb{etoclocaldefs} has cancelled its influence. -\subsection{Compatibility with package \texttt{tocstyle}} +\subsection{Compatibility with \ctanpkg{tocstyle}} Unknown. (not tested a.t.t.o.w). @@ -6076,8 +6390,8 @@ Unknown. (not tested a.t.t.o.w). \section{\TeX nical matters} The \csb{etocname}, \csb{etocnumber}, \csb{etocpage} commands are protected -against premature expansion. They contain suitable |hyperref| links if package -|hyperref| is loaded and active for the TOC. The commands \csb{etoclink} and +against premature expansion. They contain suitable \ctanpkg{hyperref} links if package +\ctanpkg{hyperref} is loaded and active for the TOC. The commands \csb{etoclink} and \csb{etocifnumbered} are also protected against premature expansion. Also \csb{etociffirst} and \csb{etoctoccontentsline}. @@ -6098,22 +6412,24 @@ The correct local table of contents will be displayed only on the second compilation. -\section{Errors and catastrophes} +%%% de-\section this for matters of avoiding too cramped mindmap TOC +%%%\section{Errors and catastrophes} After using \csb{etocsetstyle} for one level, the remaining uncustomized levels use the \etoc default styles (those which are activated by \csb{etocdefaultlines}). One has to - make sure that all levels needed for the next table of + make sure that \textbf{all levels} needed for the next table of contents are mutually compatible: in particular the \etoc default line styles expect each to be started in ``vertical mode''. When using multiple \toc commands in a document, one should beware from adding typesetting instructions directly in the |.toc| file, as they will be - executed by \etoc for all TOCs: even for a \localtoc it doesn't matter if - that instruction seems to concern material outside of its scope, it will get - executed nevertheless. If absolutely necessary extra commands in the |.toc| - file should be configured in such a way that they can be activated or - deactivated easily from the document source, as need be. + executed by \etoc for \textbf{all TOCs}: even for a \localtoc it doesn't + matter if that instruction seems to concern material outside of its scope, + it will get executed nevertheless. If absolutely necessary to add extra + commands to the |.toc| file, make it in such a way that they can be + activated or deactivated easily from the document source, e.g.\@ via some + booleans. As is usual with toc and labels, after each change, one has to run latex a certain number of times to let the produced @@ -6126,6 +6442,46 @@ contents will be displayed only on the second compilation. \localtableofcontents +% IL FAUT METTRE AVANT \section{Timestamps} SINON FOUTU +% (non plus maintenant puisque j'utilise \botmark pas \firstmark +% dans le \rightmark) +% Que c'est pénible cette syntaxe \markboth/\markright de LaTeX ! +% Pourquoi est-ce que \markright n'a pas été définie comme #1#2-> truc avec #2 ?? +\makeatletter +\if@twoside +\renewcommand *{\sectionmark }[1]{% + \markboth + {\unexpanded{\ifodd\value{page}(\hyperref[imp]{implementation}, + \hyperlink{FRONTPAGE}{user manual + front page})\hfill\fi + \hyperref[changelog]{\thesection. Change history}% + \ifodd\value{page}\else\hfill(\hyperref[imp]{implementation}, + \hyperlink{FRONTPAGE}{user manual + front page})\fi}}% + {\unexpanded{\ifodd\value{page}(\hyperref[imp]{implementation}, + \hyperlink{FRONTPAGE}{user manual + front page})\hfill\fi + \hyperref[changelog]{\thesection. Change history}% + \ifodd\value{page}\else\hfill(\hyperref[imp]{implementation}, + \hyperlink{FRONTPAGE}{user manual + front page})\fi}}% +} +\else\error +% faudrait cependant que je réfléchisse à quoi faire exactement en oneside +% mais comme ceci ne peut arriver que si quelqu'un customise etoc.tex +% ce qui n'arrivera JAMAIS, je laisse tomber +\renewcommand *{\sectionmark }[1]{% + \markright + {\unexpanded{\ifodd\value{page}(\hyperref[imp]{implementation}, + \hyperlink{FRONTPAGE}{user manual + front page})\hfill\fi + \hyperref[changelog]{\thesection. Change history}% + \ifodd\value{page}\else\hfill(\hyperref[imp]{implementation}, + \hyperlink{FRONTPAGE}{user manual + front page})\fi}}% +} +\fi +\makeatother \section{Timestamp} This is the documentation as of \texttt{\etocdocdate}, printed from the @@ -6138,7 +6494,7 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. \renewcommand\lowast{{\normalsize\raisebox{-.4\height}{*}}} \small - \section{Change history} + \section{Change history}\label{changelog} \setlength{\columnsep}{\etoccolumnsep} @@ -6199,7 +6555,14 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. \def {\ifvmode\advance\jfverbadim.5em\relax\else\expandafter\jfverbaspace\fi}}\x \makeatother \begin{jfverbatim} -1.09g [2022/11/17]^ +1.09h [2022/11/20]^ + + Documentation improvements. In particular, attached code snippets + are now visible via their filenames in the page margins. Also, + command names are doubly hyperlinked: first half links to the devoted + part of the user manual, second half links to the implementation part. + +~1.09g [2022/11/17]^ Compatibility hotfix with recent hyperref 7.00u of 2022-11-13. Thanks to Denis Bitouzé for signaling the breakage to the author. @@ -6692,7 +7055,61 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. \small -\section{Implementation} +% Que c'est pénible cette syntaxe \markboth/\markright de LaTeX ! +% Pourquoi est-ce que \markright n'a pas été définie comme #1#2-> truc avec #2 ?? +\makeatletter +\if@twoside +\renewcommand *{\sectionmark }[1]{% + \markboth + {\unexpanded{{% +% counteract some changes done by my macrocode hooks +% so we must make sure it is in a scope limiting context +% (perhaps it is already, will not check, wasted already +% too much time on this header matter) November 2022 + \hypersetup{linkcolor=RoyalBlue}% + \ifodd\value{page}(\hyperref[changelog]{change log}, + \hyperlink{FRONTPAGE}{user manual + front page})\hfill\fi + \hyperref[imp]{\thesection. Implementation}% + \ifodd\value{page}\else\hfill(\hyperref[changelog]{change log}, + \hyperlink{FRONTPAGE}{user manual + front page})\fi + }}% + } + {\unexpanded{{% + \hypersetup{linkcolor=RoyalBlue}% + \ifodd\value{page}(\hyperref[changelog]{change log}, + \hyperlink{FRONTPAGE}{user manual + front page})\hfill\fi + \hyperref[imp]{\thesection. Implementation}% + \ifodd\value{page}\else\hfill(\hyperref[changelog]{change log}, + \hyperlink{FRONTPAGE}{user manual + front page})\fi + }}% + }% +} +\else +% faudrait cependant que je réfléchisse à quoi faire exactement en oneside +% mais comme ceci ne peut arriver que si quelqu'un customise etoc.tex +% ce qui n'arrivera JAMAIS, je laisse tomber +\renewcommand *{\sectionmark }[1]{% + \markright + {\unexpanded{{% + \hypersetup{linkcolor=RoyalBlue}% + \ifodd\value{page}(\hyperref[changelog]{change log}, + \hyperlink{FRONTPAGE}{user manual + front page})\hfill\fi + \hyperref[imp]{\thesection. Implementation}% + \ifodd\value{page}\else\hfill(\hyperref[changelog]{change log}, + \hyperlink{FRONTPAGE}{user manual + front page})\fi + }}% + }% +} +\fi +\makeatother + +\section{Implementation}\label{imp} % ce \noindent est obsolète 2022/08/26 à cause des hooks à macrocode plus bas % transférés depuis xint.dtx. Il est doublement obsolète car je rajoute un @@ -6772,16 +7189,16 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. %%% \catcode`^ 11 \catcode`_ 11 } %%% \def\xintexprMakePrivateLetters{\xintMakePrivateLetters \catcode`! 11 } %%% \let\MakePrivateLetters\xintMakePrivateLetters -\definecolor{xintnamecolor}{RGB}{228,57,0} -\colorlet{verbcolor}{Maroon} -% -\colorlet{privatecommentcolor}{cyan} -\colorlet{macrocodecommentcolor}{gray} -\colorlet{macrocodenewmacrocolor}{verbcolor} -\colorlet{macrocodelinktouserdoccolor}{xintnamecolor}% and bold face -\colorlet{macrocodelinktosectioncolor}{DarkBlue}% and bold face -\colorlet{macrocodelinktocodelinecolor}{DarkBlue} -\colorlet{macrocodenoncscolor}{Green} +% \definecolor{etocnamecolor}{RGB}{228,57,0} +% \colorlet{verbcolor}{Maroon} +% +% \colorlet{privatecommentcolor}{cyan} +% \colorlet{macrocodecommentcolor}{gray} +% \colorlet{macrocodenewmacrocolor}{verbcolor} +% \colorlet{macrocodelinktouserdoccolor}{etocnamecolor}% and bold face +% \colorlet{macrocodelinktosectioncolor}{DarkBlue}% and bold face +% \colorlet{macrocodelinktocodelinecolor}{DarkBlue} +% \colorlet{macrocodenoncscolor}{Green} \def\xintdocMacrocodeFallbackColorCmd{\normalcolor} \odef\init@crossref{\init@crossref% \everypar{\refstepcounter{CodelineNo}% @@ -6851,11 +7268,11 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. {\xintdocMacrocodeFallbackColorCmd\special@escape@char\macro@namepart}% \else \ifcsname alreadydefined-\macro@namepart\endcsname - \hyperref[xintmacro-\macro@namepart]{\special@escape@char\macro@namepart}% + \hyperref[etocmacro-\macro@namepart]{\special@escape@char\macro@namepart}% \else % this will make a rather large number of macro names in the string pool... \global\expandafter\let\csname alreadydefined-\macro@namepart\endcsname\@empty - \label{xintmacro-\macro@namepart}% + \label{etocmacro-\macro@namepart}% \stepcounter{xintMacroCnt}% % try to link to a labeled reference in the user documentation (xint-all.pdf) \ifcsname r@\xintdoclabelprefix\macro@namepart\endcsname @@ -6885,11 +7302,11 @@ version is \texttt{\etocpkgversion}, of \texttt{\etocpkgdate}. \if0\ifx\next\scan@macro0\else\ifx\next\lowast0\else1\fi\fi \expandafter\in@\expandafter{\expandafter.\macro@namepart,}% {.def,.edef,.let,.gdef,.xdef,% - .chardef,.newif,.newtoks,.newcommand,}%.odef,.oodef,.fdef,}% + .chardef,.newif,.newtoks,.newcommand,.DeclareRobustCommand,}%.odef,.oodef,.fdef,}% \ifin@\labelmacro@allowedtrue\fi \fi - \ifcsname r@xintmacro-\macro@namepart\endcsname - \hyperref[xintmacro-\macro@namepart]{\special@escape@char\macro@namepart}% + \ifcsname r@etocmacro-\macro@namepart\endcsname + \hyperref[etocmacro-\macro@namepart]{\special@escape@char\macro@namepart}% \else {\xintdocMacrocodeFallbackColorCmd\special@escape@char\macro@namepart}% \fi @@ -6954,6 +7371,44 @@ functioning, because the historical evolution is the way the author can remember and understand the code. There are a few precious isolated paragraphs which may prove vaguely useful to people not the author. +\etoc,\marginpar{\footnotesize\rmfamily\itshape\raggedright This + paragraph and the next were added very late in the history of the package, at + 1.09h.\par} when not left in compatibility mode, hijacks the \cs{contentsline} +expansion so as to not execute \cs{l@chapter}, \cs{l@section} etc..., but +rather (via \cs{Etoc@lxyz}), to parse the data and extract from it the name, +number and page number. Indeed, for legacy reasons the \LaTeX{} |.toc| data +is \emph{not structured}, but incorporates already to some extent typesetting +macros. This part of \etoc maneuvers is fragile as 1) it requires the |.toc| +file to be built from \cs{contentsline} entries, and 2) of course it will be +easily broken by changes to how data is stored there. Fortunately this +happens rarely. The |7.00u| release of \ctanpkg{hyperref} was such an instance. + +The other +core part of \etoc present from day one of the package is that +it creates (but only virtually, and dynamically, not statically) a tree-like +structure of the sectioning levels present in the |.toc| file. It could be +fun to actually implement officially such a tree (where the children of a +sectioning title are the sectioning levels at a greater depth such as +subsections versus a section). Let us recall that \LaTeX{} provides zero +means to know from a subsection for example, what is the title of the section containing +it, or chapter, or part. To do this one has to create a really structured +document which neither core \LaTeX{} nor the main document classes do. This +remark was given for document body, but it also applies to |.toc| data. But +\etoc adds at least some kind of follow-up to the successive encountered +sectioning titles, and is thus able, to ``on-the-fly'' add some kind of +structure and follow the succession of levels. Ultimately this is why the +\cs{etocsetstyle} offers \marg{start} and \marg{finish} parts in additions to +\marg{contents} (which I divided into a \marg{prefix} and a \marg{contents}). +At some point one could imagine that a really \emph{structured} document (in +opposition to what core \LaTeX{} from thirty years ago up to nowadays has to +offer) would store in the |.toc| data directly a tree structure, where each +node would have attributes name, number, page number, completely separated +from any typesetting. Once this exists then basically \etoc disappears. In +brief, once \etoc ideas will have permeated the society, it will disappear as +its was born only to palliate the absence of real structure in the |.toc| file +(absence inherited from the absence of real structure in a \LaTeX{} document +body). + % 9 avril 2015 (1.08d) pour forcer indentation après macrocode % par un effet particulier si avant macrocode un enumerate, inefficient, % mais vraiment pas envie d'investiguer. @@ -6972,6 +7427,8 @@ paragraphs which may prove vaguely useful to people not the author. % \makeatother +% This is obsolete as 1.09g of 2022/11/17 has removed this hack, also +% for colorizing reasons from 1.09n. % November 2012 % I don't want to have to type at this location (far from the top of the % file) explicitly the package version or version date, as it is @@ -6996,7 +7453,7 @@ paragraphs which may prove vaguely useful to people not the author. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{etoc} -[2022/11/17 v1.09g Completely customisable TOCs (JFB)] +[2022/11/20 v1.09h Completely customisable TOCs (JFB)] \RequirePackage{multicol} \DeclareOption*{\PackageWarning{etoc}{Option `\CurrentOption' is unknown.}} \ProcessOptions\relax @@ -7012,7 +7469,7 @@ paragraphs which may prove vaguely useful to people not the author. % \end{macrocode} % |\etocglobaldefs| should be used only for special things such as TOC as a % table; it should be put in a group to limit its scope. If used in the -% preamble, it must come \emph{after} |tableof| if the latter is loaded too. +% preamble, it must come \emph{after} \ctanpkg{tableof} if the latter is loaded too. % \begin{macrocode} \let\Etoc@global\@empty % 1.08 2015/03/10 \def\etocglobaldefs{\let\Etoc@global\global\let\tof@global\global} @@ -7170,9 +7627,9 @@ paragraphs which may prove vaguely useful to people not the author. %^^A I wonder since when. No time to lose on checking that. %^^A Answer: 2020-02-27 ltdefns.dtx 1.5g |\@gobblethree|: Macro added % -% |1.09g| adapts to |hyperref| depending on +% |1.09g| adapts to \ctanpkg{hyperref} depending on % whether the latter is at |7.00u| or earlier. Indeed internal changes to -% |hyperref| at |7.00u| broke \etoc. Thanks to Denis~\textsc{Bitouzé} for +% \ctanpkg{hyperref} at |7.00u| broke \etoc. Thanks to Denis~\textsc{Bitouzé} for % reporting the issue. % \begin{macrocode} \AtBeginDocument{% @@ -7590,11 +8047,11 @@ paragraphs which may prove vaguely useful to people not the author. % START OF MAINLY OBSOLETE COMMENTS % % |2013/03/07|: up to |1.06| \etoc defined only \csa{etocname}, \csa{etocnumber} and -% \csa{etocpage}. The |hyperref| added data is recycled in the simplest +% \csa{etocpage}. The \ctanpkg{hyperref} added data is recycled in the simplest % manner, prefixing it with \csa{leavevmode}. The included % \csa{Hy@tocdestname} is (was, see below |1.07f| and |1.08a|) left % unexpanded. We have to spend some time with delimited macros to dis-entangle -% the |.toc| data, and reconstruct the possible |hyperref| data. If the page +% the |.toc| data, and reconstruct the possible \ctanpkg{hyperref} data. If the page % number is not hyperlinked, \csa{etocpage} does \emph{not} add the link found % possibly in the name. % @@ -7673,7 +8130,7 @@ paragraphs which may prove vaguely useful to people not the author. % Potential (but rather exotic) brace removal problems avoided at |1.08n|. % % |1.09g| delays definition of \cs{Etoc@getthepage} to \cs{AtBeginDocument} to -% check if |hyperref| is at version |7.00u 2022-11-13| or later, as that +% check if \ctanpkg{hyperref} is at version |7.00u 2022-11-13| or later, as that % version replaced \cs{hyper@linkstart} with \cs{protected} macro % \cs{Hy@toclinkstart} which furthermore requires one more expansion step. % Formerly, the \cs{ifEtoc@hyperref} test was executed via the expansion of @@ -7749,9 +8206,10 @@ paragraphs which may prove vaguely useful to people not the author. \futurelet\Etoc@getnb@token\Etoc@getnb } % \end{macrocode} -% |1.09g| adds an \cs{Etoc@getnb@a} which defaults to \cs{Etoc@getnb@nohyp} -% and gets defined only at begin document to adapt to |hyperref| depending on -% whether the latter is at |7.00u| or earlier. +% |1.09g| adds an \cs{Etoc@getnb@a} which +% gets defined only at begin document to adapt to \ctanpkg{hyperref} depending on +% whether the latter is at |7.00u| or earlier. In absence of \ctanpkg{hyperref} +% it is \cs{let} to \cs{Etoc@getnb@nohyp}. % \begin{macrocode} \def\Etoc@getnb {% \ifx\Etoc@getnb@token\bgroup @@ -7779,11 +8237,11 @@ paragraphs which may prove vaguely useful to people not the author. % whole thing. And I added a |\futurelet|-based brace detection in % |\Etoc@getnb| so here |#1| is guaranteed not braced now. % -% |1.08n| tries to handle reasonably the |\nonumberline| of KOMA-script. +% |1.08n| tries to handle reasonably the |\nonumberline| of \ctanpkg{KOMA-script}. % If it expands to |\numberline{}|, \etoc will thus consider the line % numbered with an empty number. % -% At |1.09f| complications to get rid of a KOMA-script |\nonumberline| +% At |1.09f| complications to get rid of a \ctanpkg{KOMA-script} |\nonumberline| % even though its meaning is |\empty| then, but for case of delayed use. % \begin{macrocode} \def\Etoc@getnb@nohyp #1{% @@ -7860,10 +8318,21 @@ paragraphs which may prove vaguely useful to people not the author. % in this branch (hyperref does not brace the hyperlink). So we ignore % the |\ifEtoc@bracedname| setting. % -% At |1.09f| complications to get rid of a KOMA-script |\nonumberline| +% At |1.09f| complications to get rid of a \ctanpkg{KOMA-script} |\nonumberline| % even though its meaning is |\empty| then, but for case of delayed use. +% +% At |1.09h| I converted the |#5#6| into |#5|, the |#5#6| had been kept +% around for ages here, perhaps a legacy of early versions, anyway +% here the macro really wants the |#4| anyhow only (and |#3|) and there +% can be only one \cs{etoc@}. +% +% The |7.00u| \ctanpkg{hyperref} has modified the mark-up, but \cs{Etoc@getnb@a} +% defined at begin document has caused the expansion of \cs{Hy@toclinkstart} +% so we are back to the |<7.00u| situation; and \cs{Hy@toclinkend} is anyhow +% gobbled as part of |#5| as was formerly \cs{hyper@linkend} so we don't have +% to worry about that \ctanpkg{hyperref} change. % \begin{macrocode} -\def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@ {% +\def\Etoc@getnb@hyp #1#2#3#4#5\etoc@ {% \edef\Etoc@tmp {{#3}}% \Etoc@global\edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}% \Etoc@global\def\etocthename {#4}% temporary definition @@ -7961,7 +8430,7 @@ paragraphs which may prove vaguely useful to people not the author. \def\Etoc@getit@nameisbraced {\futurelet\Etoc@getit@token\Etoc@getit } % \end{macrocode} % |1.09g| delays defining \cs{Etoc@getit} to at begin document to adapt to -% |hyperref| depending on whether the latter is at |7.00u| or earlier. +% \ctanpkg{hyperref} depending on whether the latter is at |7.00u| or earlier. % \begin{macrocode} \def\Etoc@getit@nohyp #1\hspace#2#3\etoc@ {% \ifx\relax#2% @@ -7998,8 +8467,11 @@ paragraphs which may prove vaguely useful to people not the author. % For |1.08p| fix of hyperref's extra brace (see |\Etoc@@getnb|, % |\Etoc@@getit|), this branch should not suffer the issue, hence I % don't bother checking |\ifEtoc@bracedname| status. +% +% At |1.09h| the |#5#6| becomes |#5|, the |#5#6| was for some legacy reason +% I guess, but here the macro really wants the |#4| anyhow only (and |#3|). % \begin{macrocode} -\def\Etoc@getit@hyp #1#2#3#4#5#6\etoc@ {% +\def\Etoc@getit@hyp #1#2#3#4#5\etoc@ {% \edef\Etoc@tmp {{#3}}% \Etoc@global\edef\etocthelink ##1{\noexpand\hyperlink \Etoc@tmp{##1}}% \Etoc@global\def\etocthename {#4}% temporary definition @@ -8535,7 +9007,7 @@ paragraphs which may prove vaguely useful to people not the author. % |1.07g| defines |\etoctableofcontents| to be able to undo the evil and % brutal doings of some packages with |\tableofcontents|. % -% |1.08| patches |tableof|'s influence. Version |1.4a| or later of |tableof| +% |1.08| patches \ctanpkg{tableof}'s influence. Version |1.4a| or later of \ctanpkg{tableof} % is needed. % \begin{macrocode} \let\etocaftertitlehook \@empty @@ -8551,10 +9023,10 @@ paragraphs which may prove vaguely useful to people not the author. \Etoc@tocdepthset % new with 1.08h (\etocsetnexttocdepth) \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents % \end{macrocode} -% Prior to its release |1.4c|, |tableof| added a group pair via |\tof@begin| +% Prior to its release |1.4c|, \ctanpkg{tableof} added a group pair via |\tof@begin| % and |\tof@finish|. This was removed at |1.4c|. So no need to do anything now % here about silencing |\tof@begingroup| and |\tof@endgroup|: they are -% inserted only in the |tableof| private copy of the |.toc| file which is +% inserted only in the \ctanpkg{tableof} private copy of the |.toc| file which is % used by its own table of contents typesetting command. % % |1.08i| removes definition of |\etoc@startlocaltoc| from here. It is done @@ -8579,7 +9051,7 @@ paragraphs which may prove vaguely useful to people not the author. \Etoc@tocdepthset % new with 1.08h (\etocsetnexttocdepth) \begingroup % closed in \Etoc@t@bleofcontents or \Etoc@localtableofcontents % \end{macrocode} -% Same comment relative to |tableof|. No need to do anything here. +% Same comment relative to \ctanpkg{tableof}. No need to do anything here. % \begin{macrocode} \@ifstar {\let\Etoc@aftertitlehook\@empty\Etoc@localtable@fcontents} @@ -8687,24 +9159,24 @@ paragraphs which may prove vaguely useful to people not the author. % \end{macrocode} % |\contentsline| was set to |\Etoc@etoccontentsline| by a non-global |\let|, % and it will recover its normal value from exiting a scope limiting group. -% But |tableof| (since |1.4a|) under |\etocglobaldefstrue| does a global +% But \ctanpkg{tableof} (since |1.4a|) under |\etocglobaldefstrue| does a global % redefinition of |\contentsline|. Its |\tof@finish| then does a global % restore of |\contentsline|, but it will be to the \etoc set % value. |\tof@finish| is active only if either the table of contents was % typeset using |\tableof|, |\tablenotof|, |\tableoftaggedcontents|, or % |\nextocwithtags| was used. If not active it is either undefined (no -% package |tableof|) or |\@empty|. Prior to |tableof| |1.4c|, the +% package \ctanpkg{tableof}) or |\@empty|. Prior to \ctanpkg{tableof} |1.4c|, the % |\tof@finish| closed a group and could be undefined as well, but not if % |\etocglobaldefstrue|. % % \etoc |1.09c| tested here only equality to |\@empty| to decide if it is % needed to globally restore |\contentsline| but this meant the global restore -% was done systematically in case of absence of package |tableof|. +% was done systematically in case of absence of package \ctanpkg{tableof}. % % If rather than |\@empty| the |\tof@finish| fall-back was |\relax| we could % use here |\@ifundefined| to check in one go (matters of speaking because % expansion of |\@ifundefined| is not in "one-go"). Maybe I should update -% |tableof|, but for time being I will simply add an extra test. All this is +% \ctanpkg{tableof}, but for time being I will simply add an extra test. All this is % probably lots of time on irrelevant issue. % \begin{macrocode} \ifx\Etoc@global\global @@ -8738,13 +9210,6 @@ paragraphs which may prove vaguely useful to people not the author. \expandafter\def \csname Etoc@end@\csname Etoc@#1@\endcsname\endcsname {#5}% } -% \end{macrocode} -% Since the |1.09f 2022/08/30| release, some syntax highlighting is -% done ; but for some reason the \cs{etocfontone} below is colorized -% not like others. For |1.09g 2022/11/17| hotfix release due to -% breaking change in |hyperref 7.00u 2022-11-13| I simply do not have time to -% investigate the matter... will be for next time. If there is one! -% \begin{macrocode} \def\etocfontminustwo {\normalfont \LARGE \bfseries} \def\etocfontminusone {\normalfont \large \bfseries} \def\etocfontzero {\normalfont \large \bfseries} @@ -8783,12 +9248,12 @@ paragraphs which may prove vaguely useful to people not the author. % Versions earlier than |1.08b| (and since |1.05 2012/12/01|) defined % \csa{etocpartname} (for use by \etoc's own line styles) to expand to % \csa{partname}. But this didn't make sense in the context for example of -% |babel| and |frenchb|, because \csa{frenchpartname} does things depending on -% the current value of the counter |part|. The code in recent |frenchb| (but +% \ctanpkg{babel} and \ctanpkg{babel-french}, because \csa{frenchpartname} does things depending on +% the current value of the counter |part|. The code in recent \ctanpkg{babel-french} (but % not yet |v2.5a| when |\etocpartname| was introduced) constructs control % sequences |\ordinali|, etc... If the part counter is zero, this gives % |\ordinal|. Usually this is not defined, hence no error happens (as it is -% constructed via |\csname|), but under class |memoir| the bug showed up. All +% constructed via |\csname|), but under class \ctanpkg{memoir} the bug showed up. All % this to explain that I found out about this long lasting problem only on % |2015/03/14|. Probably a sign that \etoc's own line styles are rarely % used... @@ -9284,7 +9749,7 @@ paragraphs which may prove vaguely useful to people not the author. \parskip \cftparskip \@nameuse {cfttocbeforelisthook}} {\@nameuse {cfttocafterlisthook}\endgroup\restorefromonecol}} % \end{macrocode} -% |1.09c| (|2020/05/15|) does an update as KOMA-script has deprecated +% |1.09c| (|2020/05/15|) does an update as \ctanpkg{KOMA-script} has deprecated % |\iftocfeature|. Thanks to Bilel Omrani for report. I did not check % if cloning of KOMA code required some further updates. % @@ -9305,7 +9770,7 @@ paragraphs which may prove vaguely useful to people not the author. % \end{macrocode} % |1.09f| adds this \csa{list@fname} definition hunk although % \csa{listoftocname} is presumably always defined. Only to match -% closely KOMA-script code. +% closely \ctanpkg{KOMA-script} code. % \begin{macrocode} \@ifundefined{listoftocname}% {\def\list@fname{\listofname~toc}}% @@ -9347,7 +9812,7 @@ paragraphs which may prove vaguely useful to people not the author. {% % \end{macrocode} % At |1.09f| I considered adding this \csa{BeforeClosingMainAux} hunk -% to the second argument of \csa{etocsettocstyle}-emulation of KOMA-script. +% to the second argument of \csa{etocsettocstyle}-emulation of \ctanpkg{KOMA-script}. % But: % \begin{itemize} % \item there seems to be no interface to \csa{tocbasic@end@toc@file}, @@ -9423,7 +9888,7 @@ paragraphs which may prove vaguely useful to people not the author. \Etoc@redefetocstyle{chapter}}{} % \end{macrocode} %|1.07k (2014/03/06)| adds the |appendix| to the list of known levels if class -%|memoir| is detected. +%\ctanpkg{memoir} is detected. % \begin{macrocode} \@ifclassloaded{memoir} {\etocsetlevel{appendix}{0}% @@ -9432,12 +9897,12 @@ paragraphs which may prove vaguely useful to people not the author. \renewcommand*\etocstandarddisplaystyle{\etocmemoirstyle} \Etoc@redefetocstyle{chapter}}{} % \end{macrocode} -%|1.07k (2014/03/06)| adds the compatibility with the |tocloft| package; in -% compatibility mode etoc will obey the |tocloft| customisation for the division +%|1.07k (2014/03/06)| adds the compatibility with the \ctanpkg{tocloft} package; in +% compatibility mode etoc will obey the \ctanpkg{tocloft} customisation for the division % headings as well as for the toc title. % -%|1.07l (2014/04/02)| fixes the bug from the |tocloft| compatibility layer which -%was |memoir| incompatible: |memoir| has its version of |tocloft| which doesn't +%|1.07l (2014/04/02)| fixes the bug from the \ctanpkg{tocloft} compatibility layer which +%was \ctanpkg{memoir} incompatible: \ctanpkg{memoir} has its version of \ctanpkg{tocloft} which doesn't %have the |\if@cftnctoc| boolean. % \begin{macrocode} \def\etoctocloftstyle {% @@ -9522,15 +9987,15 @@ paragraphs which may prove vaguely useful to people not the author. {\@ifstar{\Etoc@addcontentsline@@immediately}{\Etoc@addtocontents@immediately}} % \end{macrocode} % All the following added for version |1.07g [2013/10/13]|. Motivated by -% a demand about |tovsec2|. But it is impossible to make |tocvsec2| -% compatible, if not re-doing all `toc' macros in |tocvsec2| +% a demand about |tovsec2|. But it is impossible to make \ctanpkg{tocvsec2} +% compatible, if not re-doing all `toc' macros in \ctanpkg{tocvsec2} % (|1.3, 2011/08/07|). I do not retain the stack idea, which does not convince % me as useful. The empty line in the |.toc| file is put there by -% |tocvsec2| (see its code line 143). +% \ctanpkg{tocvsec2} (see its code line 143). % % I take this opportunity to add to the start of the toc file % |\let\etoc@startlocaltoc\@gobble| in case |etoc| is not detected, I should -% possibly have done that long ago (like I did in |tableof|). +% possibly have done that long ago (like I did in \ctanpkg{tableof}). % % In |1.07h| I decide that I should not have used |\Etoc@| but |\etoc@| for % |\Etoc@settocdepth|. So I now use lowercase and add a temporary line for @@ -9628,8 +10093,8 @@ paragraphs which may prove vaguely useful to people not the author. {\@namedef{Etoc@depthof@#1}{\@nameuse{Etoc@#2@@}}}% } % \end{macrocode} -% We must cancel all |tocvsec2| toc-related actions. But a check must be done -% for the memoir class, as its |tocvsec2| emulation does not have the +% We must cancel all \ctanpkg{tocvsec2} toc-related actions. But a check must be done +% for the memoir class, as its \ctanpkg{tocvsec2} emulation does not have the % incompatible things etoc needs to revert. This extra check added with etoc % |1.07l|. Release |1.08g| modifies the info message under class memoir (and % downgrades it from warning to info). diff --git a/macros/latex/contrib/etoc/etoc.pdf b/macros/latex/contrib/etoc/etoc.pdf Binary files differindex 1cf82dd474..e498315e2d 100644 --- a/macros/latex/contrib/etoc/etoc.pdf +++ b/macros/latex/contrib/etoc/etoc.pdf diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf Binary files differindex 191739e8f6..db0eac769e 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.pdf +++ b/macros/latex/contrib/nicematrix/nicematrix-french.pdf diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx index 479c0b204b..f36475a7a5 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -17,8 +17,8 @@ % % \fi % \iffalse -\def\myfileversion{6.13c} -\def\myfiledate{2022/11/15} +\def\myfileversion{6.13d} +\def\myfiledate{2022/11/20} % % %<*batchfile> @@ -1796,7 +1796,7 @@ version 2005/12/01 or later. % of the colors to the size of the tabular.}). % % \smallskip -% \begin{BVerbatim}[boxwidth=13cm,baseline=c] +% \begin{BVerbatim}[boxwidth=12.5cm,baseline=c] % \begin{NiceTabular}{c} % \CodeBefore % ~emphase#\definecolorseries{BlueWhite}{rgb}{last}{blue}{white}@ @@ -6439,7 +6439,7 @@ version 2005/12/01 or later. \tl_set_rescan:Nno #1 { - \char_set_catcode_other:N >_ + \char_set_catcode_other:N > \char_set_catcode_other:N < } #1 diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf Binary files differindex 7f09289c8a..42858eec70 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.pdf +++ b/macros/latex/contrib/nicematrix/nicematrix.pdf diff --git a/macros/latex/contrib/pagecolor/README b/macros/latex/contrib/pagecolor/README index a1dc382c79..0bae5caeb6 100644 --- a/macros/latex/contrib/pagecolor/README +++ b/macros/latex/contrib/pagecolor/README @@ -1,4 +1,4 @@ -README for pagecolor package, 2017/05/29, v1.0i +README for pagecolor package, 2022-11-20, v1.1a TABLE OF CONTENTS @@ -18,25 +18,25 @@ TABLE OF CONTENTS ============== This LaTeX package provides the command \thepagecolor, which gives -the current page (background) colour, i. e. the argument used with +the current page (background) color, i. e. the argument used with the most recent call of \pagecolor{...}. -The command \thepagecolornone gives the same colour as -\thepagecolor, except when the page background colour is "none". +The command \thepagecolornone gives the same color as +\thepagecolor, except when the page background color is "none". In that case \thepagecolor is white and \thepagecolornone is none. -When \nopagecolor is unknown (e.g. Xe(La)TeX) or broken (crop package) +When \nopagecolor is unknown or broken (crop package), this package provides a replacement. -Similar to \newgeometry and \restoregeometry of the geometry -package \newpagecolor{...} and \restorepagecolor are provided. +Similar to \newgeometry and \restoregeometry of the geometry package +\newpagecolor{...} and \restorepagecolor are provided. This material is published under the LPPL 1.3c: This work may be distributed and/or modified under the conditions of the LaTeX Project -Public License, either version 1.3c of this license or (at your option) any -later version. This version of this license is in -http://www.latex-project.org/lppl/lppl-1-3c.txt +Public License, either version 1.3c of this license or (at your option) +any later version. This version of this license is in +https://www.latex-project.org/lppl/lppl-1-3c.txt and the latest version of this license is in -http://www.latex-project.org/lppl.txt +https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX version -2005/12/01 or later. +2008-05-04 or later. 2 DOWNLOAD @@ -52,7 +52,7 @@ driver (pagecolor.drv), pagecolor.dtx, installation file (pagecolor.ins), the style file (pagecolor.sty), and this README, already sorted in a TDS tree: -http://mirrors.ctan.org/install/macros/latex/contrib/pagecolor.tds.zip +https://mirrors.ctan.org/install/macros/latex/contrib/pagecolor.tds.zip 3 INSTALLATION @@ -105,8 +105,8 @@ g) Copy the documentation files to ===================== pagecolor loads other packages: -kvoptions, xcolor (if the color package has not been loaded -before pagecolor), ifpdf, and ifluatex, +kvoptions and +xcolor, if the color package has not been loaded before pagecolor which again load other packages (see the result of the \listfiles command in the log-file of the example). @@ -142,8 +142,8 @@ A bug report should contain: contain any unnecessary packages and code. * Used drivers/programs. * Version information about used packages and programs. -* If you are using LaTeX, then add "\listfiles". Then - a list of version information is printed at the end +* If you are using LaTeX, then add "\listfiles" to the document. + Then a list of version information is printed at the end of the LaTeX run. * Please no other files than the minimal test file. The other files .log, .dvi, .ps, .pdf are seldom diff --git a/macros/latex/contrib/pagecolor/pagecolor-example.pdf b/macros/latex/contrib/pagecolor/pagecolor-example.pdf Binary files differindex dba8dd4f91..ae63e8048c 100644 --- a/macros/latex/contrib/pagecolor/pagecolor-example.pdf +++ b/macros/latex/contrib/pagecolor/pagecolor-example.pdf diff --git a/macros/latex/contrib/pagecolor/pagecolor.dtx b/macros/latex/contrib/pagecolor/pagecolor.dtx index 7df746c450..c23d9c4b86 100644 --- a/macros/latex/contrib/pagecolor/pagecolor.dtx +++ b/macros/latex/contrib/pagecolor/pagecolor.dtx @@ -1,10 +1,10 @@ % \iffalse meta-comment % % File: pagecolor.dtx -% Version: 2017/05/29 v1.0i +% Version: 2022-11-20 v1.1a % -% Copyright (C) 2011 - 2017 by -% H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de> +% Copyright (C) 2011 - 2022 by +% H.-Martin Muench <Martin dot Muench at Uni-Bonn dot de> % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -14,7 +14,7 @@ % and the latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of -% LaTeX version 2005/12/01 or later. +% LaTeX version 2005-12-01 or later. % % This work has the LPPL maintenance status "maintained". % @@ -31,7 +31,7 @@ % % Also a TDS.ZIP file is provided that contains all the files % already sorted in a TDS tree: -% http://mirror.ctan.org/install/macros/latex/contrib/pagecolor.tds.zip +% https://mirror.ctan.org/install/macros/latex/contrib/pagecolor.tds.zip % %<*ignore> \begingroup @@ -48,7 +48,7 @@ \input docstrip.tex \Msg{******************************************************************} \Msg{* Installation *} -\Msg{* Package: pagecolor 2017/05/29 v1.0i Provides thepagecolor (HMM)*} +\Msg{* Package: pagecolor 2022-11-20 v1.1a Provides thepagecolor (HMM)*} \Msg{******************************************************************} \keepsilent @@ -60,13 +60,13 @@ This is a generated file. Project: pagecolor -Version: 2017/05/29 v1.0i +Version: 2022-11-20 v1.1a -Copyright (C) 2011 - 2017 by - H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de> +Copyright (C) 2011 - 2022 by + H.-Martin Muench <Martin dot Muench at Uni-Bonn dot de> The usual disclaimer applies: -If it doesn't work right that's your problem. +If it does not work right that is your problem. (Nevertheless, send an e-mail to the maintainer when you find an error in this package.) @@ -74,11 +74,11 @@ This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. This version of this license is in - http://www.latex-project.org/lppl/lppl-1-3c.txt + https://www.latex-project.org/lppl/lppl-1-3c.txt and the latest version of this license is in - http://www.latex-project.org/lppl.txt + https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of -LaTeX version 2005/12/01 or later. +LaTeX version 2005-12-01 or later. This work has the LPPL maintenance status "maintained". @@ -91,9 +91,9 @@ the README, and the derived files pagecolor-example.tex, pagecolor-example.pdf. In memoriam - Claudia Simone Barth + 1996/01/30 - Tommy Muench + 2014/01/02 - Hans-Klaus Muench + 2014/08/24 + Claudia Simone Barth + 1996-01-30 + Tommy Muench + 2014-01-02 + Hans-Klaus Muench + 2014-08-24 \endpreamble \let\MetaPrefix\DoubleperCent @@ -148,21 +148,15 @@ In memoriam % % \begin{macrocode} %<*driver> -\NeedsTeXFormat{LaTeX2e}[2014/05/01] +\NeedsTeXFormat{LaTeX2e}[2021-11-15] \ProvidesFile{pagecolor.drv}% - [2017/05/29 v1.0i Provides thepagecolor (HMM)] -\documentclass{ltxdoc}[2014/09/29]% v2.0u -\usepackage{xcolor}[2007/01/21]% v2.11 -\definecolor{darkgreen}{rgb}{0.0, 0.3, 0.0}% -\usepackage{holtxdoc}[2012/03/21]% v0.24 -%% pagecolor may work with earlier versions of LaTeX2e and those -%% class and package, but this was not tested. -%% Please consider updating your LaTeX, class, and package -%% to the most recent version (if they are not already the most -%% recent version). + [2022-11-20 v1.1a Provides thepagecolor (HMM)] +\documentclass{ltxdoc}[2020/12/05]% v2.1b +\usepackage{xcolor}[2021/10/31]% v2.13 +\usepackage{holtxdoc}[2019/12/09]% v0.30 \hypersetup{% pdfsubject={Providing the thepagecolor command (HMM)},% - pdfkeywords={LaTeX, pagecolor, thepagecolor, H.-Martin Muench},% + pdfkeywords={LaTeX, pagecolor, thepagecolor},% pdfencoding=auto,% pdflang={en},% breaklinks=true,% @@ -178,8 +172,7 @@ In memoriam pdfnewwindow=true% } \CodelineIndex -\hyphenation{printing docu-ment} -\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}% +\hyphenation{docu-ment} \begin{document} \DocInput{pagecolor.dtx}% \end{document} @@ -188,24 +181,6 @@ In memoriam % % \fi % -% \CheckSum{335} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% % \GetFileInfo{pagecolor.drv} % % \begingroup @@ -223,85 +198,69 @@ In memoriam % }%^^A % \expandafter\endgroup\x % -% \DoNotIndex{\",\-,\,,\\,\noindent} -% \DoNotIndex{\documentclass,\usepackage,\ProvidesPackage,\begin,\end} -% \DoNotIndex{\MessageBreak} -% \DoNotIndex{\NeedsTeXFormat,\DoNotIndex,\verb} -% \DoNotIndex{\def,\edef,\gdef,\xdef,\global} -% \DoNotIndex{\ifx,\listfiles,\mathord,\mathrm} -% \DoNotIndex{\kvoptions,\SetupKeyvalOptions,\ProcessKeyvalOptions} -% \DoNotIndex{\smallskip,\bigskip,\space,\thinspace,\ldots} -% \DoNotIndex{\indent,\noindent,\newline,\linebreak,\pagebreak,\newpage} -% \DoNotIndex{\textbf,\textit,\textsf,\texttt,\textsc} -% \DoNotIndex{\textquotedblleft,\textquotedblright} -% \DoNotIndex{\plainTeX,\TeX,\LaTeX,\pdfLaTeX} -% \DoNotIndex{\section,\color,\pagenumbering} -% \DoNotIndex{\pagecolourtmpa,\pagecolourtmpb,\pagecolourtmpc} +% \DoNotIndex{\,,\@bsphack,\@esphack,\\} +% \DoNotIndex{\documentclass,\usepackage,\begin,\end,\pagenumbering,\bigskip,\smallskip} +% \DoNotIndex{\space,\newline,\noindent,\pagebreak,\section,\textbf,\textsf,\color,\gdef} +% \DoNotIndex{\GenerateLogMacros,\holtxdoc,\Oberdiek,\hyperref,\kvoptions,\options,\OCG} +% \DoNotIndex{\lipsum,\ifdefined,\IfPackageAtLeastTF,\IfPackageLoadedTF,\ifx,\listfiles} +% \DoNotIndex{\M\"{u}nch,\Alternatives,\transparent,\newcommand,\verb} +% \DoNotIndex{\pagecolor@info@noline,\pagecolor@warning,\pagecolor@warning@noline} % % \title{The \xpackage{pagecolor} package} -% \date{2017/05/29 v1.0i} -% \author{H.-Martin M\"{u}nch\\\xemail{Martin.Muench at Uni-Bonn.de}} +% \date{2022-11-20 v1.1a} +% \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}} % % \maketitle % % \begin{abstract} -% This \LaTeX{} package provides the command |\thepagecolor|, -% which gives the current page (background) colour, +% \noindent This \LaTeX{} package provides the command |\thepagecolor|, +% which gives the current page (background) color, % \hbox{i.\,e. the} argument used with the most recent call of |\pagecolor{...}|. -% The command |\thepagecolornone| gives the same colour as |\thepagecolor|, -% except when the page background colour is +% The command |\thepagecolornone| gives the same color as |\thepagecolor|, +% except when the page background color is % \textquotedblleft|none|\textquotedblright. In that case |\thepagecolor| is % |white| and |\thepagecolornone| is |none|.\\ -% When |\nopagecolor| is unknown (e.\,g. \XeLaTeX ) or broken -% (\xpackage{crop} package) this package provides a replacement. +% When |\nopagecolor| is unknown or in case of the \xpackage{crop} package +% broken, this package provides a replacement.\\ % Similar to |\newgeometry| and |\restoregeometry| of the \xpackage{geometry} -% package\\ -% |\newpagecolor{<|\textit{some colour} |>}| and |\restorepagecolor| +% package |\newpagecolor{<|\textit{some color}|>}| and |\restorepagecolor| % are provided. % \end{abstract} % % \bigskip % % \noindent Disclaimer for web links: The author is not responsible for any contents -% referred to in this work unless he has full knowledge of illegal contents. -% If any damage occurs by the use of information presented there, only the -% author of the respective pages might be liable, not the one who has referred -% to these pages. -% -% \bigskip -% -% \noindent {\color{darkgreen} Save per page about $200\unit{ml}$ water, -% $2\unit{g}$ CO$_{2}$ and $2\unit{g}$ wood:\\ -% Therefore please print only if this is really necessary.} -% -% \newpage +% referred to in this work unless having full knowledge of illegal contents. +% If any damage occurs by the use of information presented there, +% only the author of the respective pages might be liable, +% not the one who has referred to these pages. % % \tableofcontents % % \bigskip % -% \section{Introduction\label{s:Introduction}} +% \section{Introduction} % \indent This \LaTeX{} package provides the command |\thepagecolor|, -% which gives the current page (background) colour, -% \hbox{i.\,e. the} argument used with the most recent call of |\pagecolor{...}|. -% The package should be loaded before any package sets a page (background) -% colour, but after \xpackage{xcolor} or \xpackage{color} package. -% Its option |pagecolor={...}| is used to set the initial |\pagecolor{...}|.\\ -% The command |\thepagecolornone| gives the same colour as |\thepagecolor|, -% except when the page background colour is +% which gives the current page (background) color, +% \hbox{i.\,e. the} argument used with the most recent call of |\pagecolor{...}|. +% (\verb|\pagecolor| needs to be defined before by the \xpackage{xcolor} or +% \xpackage{color} package.) The \xpackage{pagecolor} package should be loaded +% before any package sets a page (background) color, but obviously after +% the \xpackage{xcolor} or \xpackage{color} package. +% Its option |pagecolor={...}| is used to set the initial |\pagecolor{...}|. +% \newline +% The command |\thepagecolornone| gives the same color as |\thepagecolor|, +% except when the page background color is % \textquotedblleft|none|\textquotedblright (e.\,g. result of using the -% |\nopagecolor| command). In that case |\thepagecolor| is |white| and\linebreak +% |\nopagecolor| command). In that case |\thepagecolor| is |white| and % |\thepagecolornone| is |none|. -% When |\nopagecolor| is unknown (e.g. \XeLaTeX ) or broken -% (\xpackage{crop} package) this package provides a replacement -% depending on option |nopagecolor|. +% When |\nopagecolor| is unknown or in case of the \xpackage{crop} package +% broken, this package provides a replacement depending on option |nopagecolor|. % Similar to |\newgeometry| and |\restoregeometry| of the \xpackage{geometry} -% package -% |\newpagecolor{<|\textit{some colour}|>}| and |\restorepagecolor| +% package\linebreak +% |\newpagecolor{<|\textit{some color}|>}| and |\restorepagecolor| % are provided. % -% \newpage -% % \section{Usage} % % \indent Just load the package placing @@ -311,52 +270,53 @@ In memoriam % \noindent in the preamble of your \LaTeXe{} source file. % This should be done before another package uses |\pagecolor|. % Afterwards |\pagecolor{...}| can be used to change the page (background) -% colour as usual. Then |\thepagecolor| gives the current page (background) -% colour (in the same format as given with |\pagecolor{...}|).\\ +% color as usual. Then |\thepagecolor| gives the current page (background) +% color (in the same format as given with |\pagecolor{...}|).\\ % Similar to |\newgeometry| and |\restoregeometry| of the \xpackage{geometry} % package\\ -% |\newpagecolor{<|\textit{some colour} |>}| and |\restorepagecolor| +% |\newpagecolor{<|\textit{some color}|>}| and |\restorepagecolor| % are provided:\\ -% |\newpagecolor{<|\textit{some colour} |>}| will execute -% |\pagecolor{<|\textit{some colour} |>}| and remember the page colour used before. -% |\restorecolor| (without argument) restores the page colour to the one used before -% use of the |\newpagecolor{...}| command. When you want to change the colour for -% just one page and do not want to (or cannot) manually determine where the page ends,\\ -% |\newpagecolor{<|\textit{some colour}|>}\afterpage{\restorepagecolor}|\\ +% |\newpagecolor{<|\textit{some color}|>}| will execute +% |\pagecolor{<|\textit{some color}|>}| and remember the page color used before. +% |\restorecolor| (without argument) restores the page color to the one used before +% use of the |\newpagecolor{...}| command. When you want to change the color for +% just one page and do not want to (or cannot) manually determine where that page ends,\\ +% |\newpagecolor{<|\textit{some color}|>}\afterpage{\restorepagecolor}|\\ % does the trick (and requires a |\usepackage{afterpage}| in the document's % preamble), or for short\\ % |\newcommand{\onepagecolor}[1]{%|\\ % | \newpagecolor{#1}\afterpage{\restorepagecolor}}|\\ % in the preamble and\\ -% |\onepagecolor{<|\textit{some colour}|>}| in the document. +% |\onepagecolor{<|\textit{some color}|>}| in the document. +% +% \pagebreak % % \subsection{Options} % \DescribeMacro{options} % \indent The \xpackage{pagecolor} package takes the following options: % -% \subsubsection{pagecolor\label{sss:pagecolor}} +% \subsubsection{pagecolor} % \DescribeMacro{pagecolor} -% \indent The option |pagecolor={...}| takes as value a colour. This +% \indent The option |pagecolor={...}| takes as value a color. This % could be as simple as |black| or |white|, but when \hbox{e.\,g. the} % \xpackage{xcolor} package is used (loaded before \xpackage{pagecolor}!), -% also colours like |red!50!green!20!blue| are possible. +% also colors like |red!50!green!20!blue| are possible. % The default is |pagecolor={none}|. A |\pagecolor{...}| command with -% the given colour is used to initialise the pagecolour. +% the given color is used to initialise the pagecolor. % % -% \subsubsection{nopagecolor\label{sss:nopagecolor}} +% \subsubsection{nopagecolor} % \DescribeMacro{nopagecolor} -% \indent The option |nopagecolor={...}| takes as value a colour. This +% \indent The option |nopagecolor={...}| takes as value a color. This % could be as simple as |white| or |black|, but when \hbox{e.\,g. the} % \xpackage{xcolor} package is used (loaded before \xpackage{pagecolor}!), -% also colours like |red!50!green!20!blue| are possible. +% also colors like |red!50!green!20!blue| are possible. % The default is |nopagecolor={none}|. When |\nopagecolor| is unknown -% (e.\,g. \XeLaTeX ) or broken (\xpackage{crop} package) |\nopagecolor| -% is replaced by a |\pagecolor| command using the colour defined with the -% |nopagecolor| option. If |\nopagecolor| is not available and -% |nopagecolor| is |none|, it is used |white| instead of |none|. -% -% \newpage +% or broken \hbox{(e.\,g.} \xpackage{crop} package) +% |\nopagecolor| is replaced by a |\pagecolor| command +% using the color defined with the |nopagecolor| option. +% If |\nopagecolor| is not available and |nopagecolor| is |none|, +% it is used |white| instead of |none|. % % \section{Alternatives\label{s:Alternatives}} % @@ -369,10 +329,10 @@ In memoriam % (fully or partially) transparent, % \url{https://www.ctan.org/pkg/transparent}. % -% \item[-] \xpackage{hrefhide} package: It allows to -% \textquotedblleft hide\textquotedblright{} some (hyperlinked) text when +% \item[-] OCG (Optional Content Groups): It allows for example +% to \textquotedblleft hide\textquotedblright{} something when % printing the document while keeping the layout, -% \url{https://www.ctan.org/pkg/hrefhide}. +% \url{https://www.ctan.org/search?phrase=ocg}. % \end{description} % % \bigskip @@ -388,8 +348,8 @@ In memoriam % % \begin{macrocode} %<*example> -\documentclass[british]{article}[2014/09/29]% v1.4h -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\NeedsTeXFormat{LaTeX2e}[2021-11-15] +\documentclass[british]{article}[2021/10/04]% v1.4n \usepackage[% extension=pdf,% plainpages=false,% @@ -399,70 +359,57 @@ In memoriam pdftitle={pagecolor package example},% pdfauthor={H.-Martin Muench},% pdfsubject={Example for the pagecolor package},% - pdfkeywords={LaTeX, pagecolor, thepagecolor, page colour,% - H.-Martin Muench},% + pdfkeywords={LaTeX, pagecolor, thepagecolor, page color, page colour},% pdfview=Fit,pdfstartview=Fit,% pdfpagelayout=SinglePage% -]{hyperref}[2012/11/06]% v6.83m -\usepackage[x11names]{xcolor}[2007/01/21]% v2.11 - % The xcolor package would not be needed for just using - % the base colours. The color package would be sufficient for that. -\definecolor{darkgreen}{rgb}{0.0, 0.3, 0.0}% +]{hyperref}[2022-02-21]% v7.00n + +\usepackage[x11names]{xcolor}[2021/10/31]% v2.13 + % The xcolor package would not be needed for just using the base colors. + % The color package would be sufficient for that. + \usepackage[pagecolor={LightGoldenrod1},% - nopagecolor={none}]{pagecolor}[2017/05/29]% v1.0i + nopagecolor={none}]{pagecolor}[2022-11-20]% v1.1a \usepackage{afterpage}[2014/10/28]% v1.08 % The afterpage package is generally not needed, - % but the |\newpagecolor{somecolour}\afterpage{\restorepagecolor}| + % but the |\newpagecolor{somecolor}\afterpage{\restorepagecolor}| % construct shall be demonstrated. -\usepackage{lipsum}[2014/07/27]% v1.3 +\usepackage{lipsum}[2021-09-20]% v2.7 % The lipsum package is generally not needed, % but some blind text is needed for the example. -\usepackage{hologo}[2012/04/26]% v1.10 - % The hologo package is only needed to write - % \hologo{pdfTeX}, \hologo{LuaTeX}, and \hologo{XeTeX}. - -\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}% -\listfiles% +\listfiles \begin{document} \pagenumbering{arabic} \section*{Example for pagecolor} This example demonstrates the use of package\newline -\textsf{pagecolor}, v1.0i as of 2017/05/29 (HMM).\newline +\textsf{pagecolor}, v1.1a as of 2022-11-20 (HMM).\newline The used options were\newline -\verb|pagecolor={LightGoldenrod1}| (\verb|pagecolor={none}| -would be the default), and -\verb|pagecolor={none}| (which is the default).\newline - -\noindent For more details please see the documentation!\newline +\verb|pagecolor={LightGoldenrod1}|\newline +(\verb|pagecolor={none}| would be the default), and\newline +\verb|nopagecolor={none}| (which is the default). -\noindent {\color{darkgreen} Save per page about $200\unit{ml}$ water, -$2\unit{g}$ CO$_{2}$ and $2\unit{g}$ wood:\newline -Therefore please print only if this is really necessary.}\newline +\noindent For more details please see the documentation! -% \end{macrocode} -% \pagebreak -% \begin{macrocode} -\noindent The current page (background) colour is\newline +\noindent The current page (background) color is\newline \verb|\thepagecolor|\ =\ \thepagecolor \newline (and \verb|\thepagecolornone|\ =\ \thepagecolornone , which would only be different from \verb|\thepagecolor|, -when the page colour would be \verb|none|). +when the page color would be \verb|none|). \pagebreak \pagecolor{rgb:-green!40!yellow,3;green!40!yellow,2;red,1} -{\color{white} The current page (background) colour is\newline -\verb|\thepagecolor|\ =\ \thepagecolor . \newline} +{\color{white} The current page (background) color is\newline +\verb|\thepagecolor|\ =\ \thepagecolor .} -{\color{\thepagecolor} And that makes this text practically invisible. -\newline} +{\color{\thepagecolor} And that makes this text practically invisible.} {\color{white} Which made the preceding line of text practically -invisible.} +invisible, but it can be copied and pasted.} \pagebreak \newpagecolor{red} @@ -473,23 +420,23 @@ This page uses \verb|\newpagecolor{red}|. \restorepagecolor {\color{white}And this page uses \verb|\restorepagecolor| to restore -the page colour to the value it had before the red page.} +the page color to the value it had before the red page.} \pagebreak \pagecolor{none} This page uses \verb|\pagecolor{none}|. If the \verb|\nopagecolor| -command is known (\hologo{pdfTeX} and \hologo{LuaTeX}; not yet for -dvips, dvipdfm(x) or \hologo{XeTeX}), the page colour is now +command is known, the page color is now \verb|none| (because option \verb|nopagecolor={none}|), otherwise -\verb|white| (or the colour given with option \verb|nopagecolor={...}|): +\verb|white| (or the color given with option \verb|nopagecolor={...}|): +\newline \verb|\thepagecolor|\ =\ \thepagecolor\ and \verb|\thepagecolornone|\ =\ \thepagecolornone . \pagebreak \restorepagecolor -{\color{white}\verb|\restorepagecolor| restored the page colour again.} +{\color{white}\verb|\restorepagecolor| restored the page color again.} \pagebreak \pagecolor{green} @@ -502,14 +449,14 @@ This page is green due to \verb|\pagecolor{green}|. {\color{white}\verb|\newpagecolor{blue}\afterpage{\restorepagecolor}|% \newline was used here, i.\,e.~this page is blue, and the next one will -automatically have the same page colour before it was changed to blue +automatically have the same page color before it was changed to blue here (i.\,e. green).} \smallskip {\color{red}\textbf{\lipsum[1-11]}} \bigskip -The page colour was changed back at the end of the page - +The page color was changed back at the end of the page -- in mid-sentence! \end{document} @@ -530,8 +477,8 @@ in mid-sentence! % \end{macrocode} % % \begin{macrocode} -\NeedsTeXFormat{LaTeX2e}[2014/05/01] -\ProvidesPackage{pagecolor}[2017/05/29 v1.0i +\NeedsTeXFormat{LaTeX2e}[2021-11-15] +\ProvidesPackage{pagecolor}[2022-11-20 1.1a Provides thepagecolor (HMM)] % \end{macrocode} % @@ -539,68 +486,49 @@ in mid-sentence! % % \begin{macrocode} %% Provides the \thepagecolor, \thepagecolornone, \newpagecolor{...}, -%% and \restorepagecolor commands and the a replacement for the -%% \nopagecolor command, if it is not available. +%% and \restorepagecolor commands and a replacement for the +%% \nopagecolor command, if this is not available. % \end{macrocode} % -% We need the \xpackage{kvoptions} package by \textsc{Heiko Oberdiek}: -% -% \begin{macrocode} -\RequirePackage{kvoptions}[2011/06/30]% v3.11 -% \end{macrocode} -% -% and either the \xpackage{color} or the \xpackage{xcolor} package: +% We want to wrap the messages nicely: % % \begin{macrocode} -%% \RequirePackage{ either color or xcolor }: -\@ifpackageloaded{xcolor}{% xcolor loaded - \@ifpackagelater{xcolor}{2007/01/21}{% - % 2007/01/21, v2.11, or even more recent: OK - }{% else: older package version - \PackageWarning{pagecolor}{% - It is requested version `2007/01/21' of package\MessageBreak% - xcolor, but only an older version is available\MessageBreak% - }% - }% - }{% xcolor not loaded - \@ifpackageloaded{color}{% - \RequirePackage{color}[2014/10/28]% v1.1a - }{% \else - \PackageWarning{pagecolor}{% - The pagecolor package must be loaded after either\MessageBreak% - package color or after package xcolor (at your\MessageBreak% - option). Neither package was loaded before package\MessageBreak% - pagecolor. Loading of package xcolor will now be\MessageBreak% - tried automatically.\MessageBreak% - When the pagecolor package is used with option\MessageBreak% - pagecolor using a colour requiring e. g. x11names\MessageBreak% - option for xcolor package, this will not work!\MessageBreak% - } - }% \fi - \RequirePackage{xcolor}[2007/01/21]% v2.11 - }% \fi +\RequirePackage{hardwrap}[2011/02/12]% v0.2 +\GenerateLogMacros{package}{pagecolor} + % \end{macrocode} % -% as well as the \xpackage{ifpdf} and the \xpackage{ifluatex} package, -% because only \pdfTeX{} and \LuaTeX{} provide the |\nopagecolor| command: +% We need the \xpackage{kvoptions} package: % % \begin{macrocode} -\RequirePackage{ifpdf}[2011/01/30]% v2.3 -\RequirePackage{ifluatex}[2010/03/01]% v1.3 +\RequirePackage{kvoptions}[2020-10-07]% v3.14 % \end{macrocode} % -% A last information for the user: +% and either the \xpackage{color} or the \xpackage{xcolor} package: % % \begin{macrocode} -%% pagecolor may work with earlier versions of LaTeX and the -%% packages, but this was not tested. Please consider updating -%% your LaTeX and packages to the most recent version -%% (if they are not already the most recent version). +%% \RequirePackage{ either color or xcolor }: +\IfPackageLoadedTF{xcolor}{% xcolor loaded + \RequirePackage{xcolor}[2021/10/31]% v2.13 + }{% xcolor not loaded + \IfPackageLoadedTF{color}{% + \RequirePackage{color}[2021/12/07]% v1.3c + }{\pagecolor@warning@noline{% + The pagecolor package must be loaded after either % + package color or after package xcolor (at your % + option). Neither package was loaded before package % + pagecolor. Loading of package xcolor will now be % + tried automatically. \\% + When the pagecolor package is used with option % + pagecolor using a color requiring e.g. x11names % + option for xcolor package, this will not work!% + } + } + \RequirePackage{xcolor}[2021/10/31]% v2.13 + } % \end{macrocode} % -% \indent See subsection~\ref{ss:Downloads} about how to get them.\\ -% % We process the options: % % \begin{macrocode} @@ -611,56 +539,44 @@ in mid-sentence! % \end{macrocode} % \begin{macro}{\nopagecolor}\label{nopagecolor} -% \begin{macrocode} -%% \nopagecolor is only available for pdf(La)TeX and Lua(La)TeX -%% but not for dvips, dvipdfm(x), Xe(La)TeX,... -% \end{macrocode} % -% therefore |pagecolor| and/or |nopagecolor| can only be |none|, -% if either \pdfTeX{} or \LuaTeX{} is used; otherwise |white| is fine -% or another colour (other colours) requested by the user with the two options. +% \verb|\nopagecolor| is nowadays readily available. Let us test nevertheless: % % \begin{macrocode} -\def\pagecolourtmpa{0} -\ifluatex\def\pagecolourtmpa{1}\fi -\ifpdf\def\pagecolourtmpa{1}\fi -\def\pagecolourtmpb{1} -\ifx\pagecolourtmpa\pagecolourtmpb\relax% -\else% - \PackageInfo{pagecolor}{\string\nopagecolor\space is undefined}% - \def\pagecolourtmpb{none}% - \edef\pagecolourtmpa{\pagecolor@nopagecolor}% - \ifx\pagecolourtmpa\pagecolourtmpb% - \PackageWarning{pagecolor}{% - Option nopagecolor=none requested but \string\nopagecolor\space% - unknown:\MessageBreak% - By option nopagecolor the "colour" to be used with% - \string\nopagecolor\MessageBreak% - is set. The current value is "none" (maybe by default),% - \MessageBreak% - but command \string\nopagecolor\space is undefined.\MessageBreak% - Therefore the colour cannot be "none".\MessageBreak% - Please change the option accordingly!\MessageBreak% - As first aid nopagecolor is now set to white\MessageBreak% - }% - \setkeys{pagecolor}{nopagecolor=white}% - \fi% - \edef\pagecolourtmpa{\pagecolor@pagecolor}% - \ifx\pagecolourtmpa\pagecolourtmpb% - \PackageWarning{pagecolor}{% - Option pagecolor=none (maybe by default) used,\MessageBreak% - but \string\nopagecolor\space is unknown.\MessageBreak% - Please use anotheroption value;\MessageBreak% - \pagecolor@nopagecolor\space\MessageBreak% - will be used now\MessageBreak% - }% - \setkeys{pagecolor}{pagecolor={\pagecolor@nopagecolor}}% - \fi% - \@ifundefined{nopagecolor}{% - \newcommand{\nopagecolor}{\pagecolor{\pagecolor@nopagecolor}}% - }{\renewcommand{\nopagecolor}{\pagecolor{\pagecolor@nopagecolor}}% - }% -\fi% +\ifdefined\nopagecolor\relax +\else + \pagecolor@info@noline{\string\nopagecolor\ is undefined!} + \def\pagecolortmpb{none} + \edef\pagecolortmpa{\pagecolor@nopagecolor} + \ifx\pagecolortmpa\pagecolortmpb +% \end{macrocode} +% \pagebreak +% \begin{macrocode} + \pagecolor@warning@noline{% + Option nopagecolor=none requested but \string\nopagecolor\ % + unknown: \\% + By option nopagecolor the "color" to be used with % + \string\nopagecolor\ % + is set. The current value is "none" (maybe by default), % + but command \string\nopagecolor\ is undefined. % + Therefore the color cannot be "none". % + Please change the option accordingly! - % + As first aid nopagecolor is now set to white.% + } + \setkeys{pagecolor}{nopagecolor=white} + \fi + \edef\pagecolortmpa{\pagecolor@pagecolor} + \ifx\pagecolortmpa\pagecolortmpb\relax + \pagecolor@warning@noline{% + Option pagecolor=none (maybe by default) used, % + but \string\nopagecolor\ is unknown. % + Please use another option value; % + \pagecolor@nopagecolor\ will be used now.% + } + \setkeys{pagecolor}{pagecolor={\pagecolor@nopagecolor}} + \fi + \newcommand{\nopagecolor}{\pagecolor{\pagecolor@nopagecolor}} +\fi % \end{macrocode} @@ -668,43 +584,43 @@ in mid-sentence! % % \begin{macro}{\pagecolor} % -% \pagebreak % We save the original |\pagecolor| command, % % \begin{macrocode} -\let\origpagecolour\pagecolor +\let\origpagecolor\pagecolor % \end{macrocode} % % before we redefine it to include a definition of |\thepagecolor| -% and \linebreak +% and\linebreak % |\thepagecolornone|: % % \begin{macrocode} \renewcommand{\pagecolor}[1]{\@bsphack% - \edef\pagecolourtmpa{#1}% - \def\pagecolourtmpb{none}% - \ifx\pagecolourtmpa\pagecolourtmpb\relax% - \@ifundefined{nopagecolor}{% - \PackageWarning{pagecolor}{% - pagecolor=none requested but \string\nopagecolor\space% - unknown:\MessageBreak% - \string\pagecolor{none} was used, but the command\MessageBreak% - \string\nopagecolor\space is undefined.\MessageBreak% - Please use another colour.\MessageBreak% - pagecolor=\pagecolor@nopagecolor \MessageBreak% - will be used now\MessageBreak% + \edef\pagecolortmpa{#1}% + \def\pagecolortmpb{none}% + \ifx\pagecolortmpa\pagecolortmpb\relax% + \ifdefined\nopagecolor\relax% + \nopagecolor% + \else% + \pagecolor@warning{% + pagecolor=none requested but \string\nopagecolor\ % + unknown: \\% + \string\pagecolor{none} was used, but the command % + \string\nopagecolor\ is undefined. % + Please use another color. \\% + pagecolor=\pagecolor@nopagecolor\ \\% + will be used now.% }% \xdef\thepagecolor{\pagecolor@nopagecolor}% \xdef\thepagecolornone{\pagecolor@nopagecolor}% - % although it should be "none" - \origpagecolour{\pagecolor@nopagecolor}% - }{\nopagecolor% - }% + % although it should be "none" + \origpagecolor{\pagecolor@nopagecolor}% + \fi% \else% \xdef\thepagecolor{#1}% \xdef\thepagecolornone{#1}% - \origpagecolour{\thepagecolornone}% + \origpagecolor{\thepagecolornone}% \fi% \@esphack% } @@ -712,80 +628,67 @@ in mid-sentence! % \end{macrocode} % \end{macro} % -% |\nopagecolor| is only defined for \pdfTeX{} and \LuaTeX , but not for dvips, -% dvipdfm(x) or \XeTeX . (We defined a replacement, see page~\pageref{nopagecolor}.) -% But additionally |\nopagecolor| does not work if the \xpackage{crop} package is used. -% A workaround needs to be defined: +% |\nopagecolor| regularly is defined. If it was not, we already defined a replacement, +% see page~\pageref{nopagecolor}. But additionally |\nopagecolor| does not work +% if the \xpackage{crop} package is used. A workaround needs to be defined: % % \begin{macrocode} -\let\orignopagecolour\nopagecolor\relax% +\let\orignopagecolor\nopagecolor\relax -\gdef\pagecolor@cl{0}% -\@ifpackageloaded{crop}{% crop loaded - \gdef\pagecolor@cl{1}% - \@ifpackagelater{crop}{2003/05/21}{% - % later than 2003/05/20 v1.9 might be OK - \PackageWarning{pagecolor}{% - \string\nopagecolor\space did not work with package% - \MessageBreak% - crop 2003/05/20 v1.9. A newer version is used, \MessageBreak% - which the pagecolor package does not know how to handle.% - \MessageBreak% +\gdef\pagecolor@cl{0} +\IfPackageLoadedTF{crop}{% crop loaded + \gdef\pagecolor@cl{1} + \IfPackageAtLeastTF{crop}{2017/11/20}{ + % later than 2017/11/19 v1.10 might be OK + \pagecolor@warning@noline{% + \string\nopagecolor\ did not work with package \\% + crop 2017/11/19 v1.10. A newer version is used, % + which the pagecolor package does not know how to handle. % Please contact the maintainer of the pagecolor package!% - \MessageBreak% }% -% \end{macrocode} -% \pagebreak -% \begin{macrocode} % Let us just hope everything got fixed: \renewcommand{\nopagecolor}{% \xdef\thepagecolor{white}% \xdef\thepagecolornone{none}% - \orignopagecolour% + \orignopagecolor% % That will not have any effect except when things got fixed! }% }{% else: older package version - \PackageWarning{pagecolor}{% - \string\nopagecolor\space does not work with\MessageBreak% - the used crop package. Using\MessageBreak% - \pagecolor@nopagecolor\MessageBreak% - as nopagecolor now\MessageBreak% - }% - \def\pagecolourtmpb{none}% - \edef\pagecolourtmpa{\pagecolor@nopagecolor}% - \ifx\pagecolourtmpa\pagecolourtmpb% - \PackageWarning{pagecolor}{% - Option nopagecolor=none requested \MessageBreak% - but this does not work with the crop package.\MessageBreak% - By option nopagecolor the "colour" to be used with % - \string\nopagecolor\MessageBreak% - is set. The current value is "none" (maybe by default),% - \MessageBreak% - but the crop package broke \string\nopagecolor .% - \MessageBreak% - Therefore the colour cannot be "none".\MessageBreak% - Please change the option accordingly!\MessageBreak% - As first aid nopagecolor is now set to white\MessageBreak% - }% - \setkeys{pagecolor}{nopagecolor=white}% - \fi% - \renewcommand{\nopagecolor}{\pagecolor{\pagecolor@nopagecolor}}% - }% + \pagecolor@warning@noline{% + \string\nopagecolor\ does not work with % + the used crop package. Using \\% + \pagecolor@nopagecolor\ \\% + as nopagecolor now.% + } + \def\pagecolortmpb{none} + \edef\pagecolortmpa{\pagecolor@nopagecolor} + \ifx\pagecolortmpa\pagecolortmpb\relax + \pagecolor@warning@noline{% + Option nopagecolor=none requested % + but this does not work with the crop package. % + By option nopagecolor the "color" to be used with % + \string\nopagecolor\ % + is set. The current value is "none" (maybe by default), % + but the crop package broke \string\nopagecolor . % + Therefore the color cannot be "none". % + Please change the option accordingly! % + As first aid nopagecolor is now set to white.% + } + \setkeys{pagecolor}{nopagecolor=white} + \fi + \renewcommand{\nopagecolor}{\pagecolor{\pagecolor@nopagecolor}} + } }{% crop not loaded - \def\pagecolourtmpa{0}% - \ifluatex\def\pagecolourtmpa{1}\fi% - \ifpdf\def\pagecolourtmpa{1}\fi% - \def\pagecolourtmpb{1}% - \ifx\pagecolourtmpa\pagecolourtmpb\relax% - \gdef\pagecolourtmpa{none}% - \else% - \gdef\pagecolourtmpa{\pagecolor@nopagecolor}% - \fi% + \ifdefined\nopagecolor\relax + \gdef\pagecolortmpa{none} + \else + \gdef\pagecolortmpa{\pagecolor@nopagecolor} + \fi \renewcommand{\nopagecolor}{% \xdef\thepagecolor{white}% - \xdef\thepagecolornone{\pagecolourtmpa}% - \orignopagecolour% - }% + \xdef\thepagecolornone{\pagecolortmpa}% + \orignopagecolor% + } } @@ -798,110 +701,108 @@ in mid-sentence! % \end{macrocode} % -% \pagebreak -% Now the page (background) colour as well as |\thepagecolor| are\\ -% |\pagecolor@pagecolor|. |\thepagecolornone| is |none|, if that colour is known, +% Now the page (background) color as well as |\thepagecolor| are\\ +% |\pagecolor@pagecolor|. |\thepagecolornone| is |none|, if that color is known, % otherwise it is |\pagecolor@nopagecolor|, and if that was |none| (but that unknown), % it is |white|. If |\pagecolor@pagecolor| was |none|, -% the page (background) colour is |none|, when known, otherwise +% the page (background) color is |none|, when known, otherwise % |\pagecolor@nopagecolor|, and if that was |none| (but that unknown), % it is |white|, and |\thepagecolor| is |\pagecolor@nopagecolor|, % and if that was also |none| but |none| unknown, then it is |white|. -% When the page (background) colour is changed, |\thepagecolor| and +% When the page (background) color is changed, |\thepagecolor| and % |\thepagecolornone| are changed accordingly. % % \begin{macro}{\newpagecolor} -% There have been requests (via e-mail and at \\ -% \url{https://tex.stackexchange.com/q/25137/6865}) to change the colour of just one +% There have been requests (via e-mail and at +% \url{https://tex.stackexchange.com/q/25137/6865}) to change the color of just one % (or two) page(s) only, similar to |\newgeometry| and |\restoregeometry| of the -% \xpackage{geometry} package (\url{https://www.ctan.org/pkg/geometry}).\\ +% \xpackage{geometry} package (\url{https://www.ctan.org/pkg/geometry}). % Therefore |\newpagecolor| and |\restorepagecolor| are introduced (as suggested by % \textsc{haoyun\_tex}): % % \begin{macrocode} \newcommand{\newpagecolor}[1]{% -\xdef\pagecolourtmpc{\thepagecolornone}% +\xdef\pagecolortmpc{\thepagecolornone}% \pagecolor{#1}% } % \end{macrocode} % \end{macro} % -% |\newpagecolor{<|\textit{some colour}|>}| will execute |\pagecolor{somecolour}| -% and remember the page colour used before. +% |\newpagecolor{<|\textit{some color}|>}| will execute |\pagecolor{some color}| +% and remember the page color used before. % % \begin{macro}{\restorepagecolor} % \begin{macrocode} -\newcommand{\restorepagecolor}{\pagecolor{\pagecolourtmpc}} +\newcommand{\restorepagecolor}{\pagecolor{\pagecolortmpc}} % \end{macrocode} % \end{macro} % -% |\restorecolor| (without argument) restores the page colour to the one used before +% |\restorecolor| (without argument) restores the page color to the one used before % use of the |\newpagecolor{...}| command. % % \begin{macrocode} -\gdef\pagecolourtmpc{\thepagecolor} +\gdef\pagecolortmpc{\thepagecolor} % \end{macrocode} % is just a precaution for |\restorecolor| being used when no |\newpagecolor{...}| % was used before it.\\ % -% When you want to change the colour for just one page and do not want to +% When you want to change the color for just one page and do not want to % (or cannot) manually determine where the page ends,\\ -% |\newpagecolor{<|\textit{some colour}|>}\afterpage{\restorepagecolor}|\\ +% |\newpagecolor{<|\textit{some color}|>}\afterpage{\restorepagecolor}|\\ % does the trick (and requires an additional |\usepackage{afterpage}| in the % document's preamble).\\ % % We checked whether the \xpackage{crop} package had been loaded before % the \xpackage{pagecolor} package, but maybe it has been loaded afterwards. -% This is checked |\AtBeginDocument|: +% This is checked at the end of |\begin{document}|: % % \begin{macrocode} -\AtBeginDocument{% - \def\pagecolourtmpb{0}% - \ifx\pagecolor@cl\pagecolourtmpb\relax% +\AddToHook{begindocument/end}{% + \def\pagecolortmpb{0}% + \ifx\pagecolor@cl\pagecolortmpb\relax% % crop not loaded before pagecolor, but maybe afterwards: - \@ifpackageloaded{crop}{% crop indeed loaded afterwards. + \IfPackageLoadedTF{crop}{% crop indeed loaded afterwards. \gdef\pagecolor@cl{1}% - \@ifpackagelater{crop}{2003/05/21}{% - % later than 2003/05/20 v1.9 might be OK - \PackageWarning{pagecolor}{% - \string\nopagecolor\space did not work with package\MessageBreak% - crop 2003/05/20 v1.9. A newer version is used, \MessageBreak% - which the pagecolor package does not know how to handle.% - \MessageBreak% - Please contact the maintainer of the pagecolor package!% - \MessageBreak% - }% - % Let us just hope everything got fixed: - \renewcommand{\nopagecolor}{% - \xdef\thepagecolor{white}% - \xdef\thepagecolornone{none}% - \orignopagecolour% - % That will not have any effect except when things got fixed! - }% +% \end{macrocode} +% \pagebreak +% \begin{macrocode} + \IfPackageAtLeastTF{crop}{2017/11/20}{% + % later than 2017/11/19 v1.10 might be OK + \pagecolor@warning{% + \string\nopagecolor\ did not work with package \\% + crop 2017/11/19 v1.10. A newer version is used, % + which the pagecolor package does not know how to handle. % + Please contact the maintainer of the pagecolor package!% + }% + % Let us just hope everything got fixed: + \renewcommand{\nopagecolor}{% + \xdef\thepagecolor{white}% + \xdef\thepagecolornone{none}% + \orignopagecolor% + % That will not have any effect except when things got fixed! + }% }{% else: older package version - \PackageWarning{pagecolor}{% - \string\nopagecolor\space does not work with\MessageBreak% - the used crop package. Using\MessageBreak% - \pagecolor@nopagecolor\MessageBreak% - as nopagecolor now\MessageBreak% + \pagecolor@warning{pagecolor}{% + \string\nopagecolor\space does not work with % + the used crop package. Using \\% + \pagecolor@nopagecolor\ \\% + as nopagecolor now.% }% - \def\pagecolourtmpb{none}% - \edef\pagecolourtmpa{\pagecolor@nopagecolor}% - \ifx\pagecolourtmpa\pagecolourtmpb% - \PackageWarning{pagecolor}{% - Option nopagecolor=none requested \MessageBreak% - but this does not work with the crop package.\MessageBreak% - By option nopagecolor the "colour" to be used with % - \string\nopagecolor\MessageBreak% - is set. The current value is "none" (maybe by default),% - \MessageBreak% - but the crop package broke \string\nopagecolor .\MessageBreak% - Therefore the colour cannot be "none".\MessageBreak% - Please change the option accordingly!\MessageBreak% - As first aid nopagecolor is now set to white\MessageBreak% + \def\pagecolortmpb{none}% + \edef\pagecolortmpa{\pagecolor@nopagecolor}% + \ifx\pagecolortmpa\pagecolortmpb% + \pagecolor@warning{% + Option nopagecolor=none requested % + but this does not work with the crop package. % + By option nopagecolor the "color" to be used with % + \string\nopagecolor\ is set. The current value is "none" % + (maybe by default), but the crop package broke % + \string\nopagecolor . Therefore the color cannot be "none". % + Please change the option accordingly! \\% + As first aid nopagecolor is now set to white.% }% \setkeys{pagecolor}{nopagecolor=white}% \fi% @@ -912,6 +813,8 @@ in mid-sentence! \fi% } +% \end{macrocode} +% % \begin{macrocode} %</package> % \end{macrocode} @@ -919,9 +822,7 @@ in mid-sentence! % \newpage % % \section{Installation} -% -% \subsection{Downloads\label{ss:Downloads}} -% +% \subsection{Downloads} % Everything is available at \url{https://www.ctan.org}, % but may need additional packages themselves.\\ % @@ -929,12 +830,12 @@ in mid-sentence! % For unpacking the |pagecolor.dtx| file and constructing the documentation % it is required: % \begin{description} -% \item[-] \TeX Format \LaTeXe{}: \url{https://www.CTAN.org} +% \item[-] \TeX Format \LaTeXe{} 2021-11-15 or newer: \url{https://www.CTAN.org} % -% \item[-] document class \xclass{ltxdoc}, 2015/03/26, v2.0w, +% \item[-] document class \xclass{ltxdoc}, 2020/12/05, v2.1b, % \url{https://www.ctan.org/pkg/ltxdoc} % -% \item[-] package \xpackage{holtxdoc}, 2012/03/21, v0.24, +% \item[-] package \xpackage{holtxdoc}, 2019/12/09, v0.30, % \url{https://www.ctan.org/pkg/holtxdoc} % \end{description} % @@ -942,25 +843,22 @@ in mid-sentence! % The |pagecolor.sty| for \LaTeXe{} (i.\,e. each document using % the \xpackage{pagecolor} package) requires: % \begin{description} -% \item[-] \TeX{} Format \LaTeXe{}, \url{https://www.CTAN.org} +% \item[-] \TeX{} Format \LaTeXe{} 2021-11-15 or newer, \url{https://www.CTAN.org} % -% \item[-] package \xpackage{kvoptions}, 2011/06/30, v3.11, -% \url{https://www.ctan.org/pkg/kvoptions} +% \item[-] package \xpackage{hardwrap}, 2011/02/12, v0.2, +% \url{https://www.ctan.org/pkg/hardwrap} % -% \item[-] package \xpackage{ifpdf}, 2011/01/30, v2.3, -% \url{https://www.ctan.org/pkg/ifpdf} -% -% \item[-] package \xpackage{ifluatex}, 2010/03/01, v1.3, -% \url{https://www.ctan.org/pkg/ifluatex} +% \item[-] package \xpackage{kvoptions}, 2020-10-07, v3.14, +% \url{https://www.ctan.org/pkg/kvoptions} % \end{description} % and either % \begin{description} -% \item[-] package \xpackage{xcolor}, 2007/01/21, v2.11, +% \item[-] package \xpackage{xcolor}, 2021/10/31, v2.13, % \url{https://www.ctan.org/pkg/xcolor} % \end{description} % or % \begin{description} -% \item[-] package \xpackage{color}, 2014/10/28, v1.1a, +% \item[-] package \xpackage{color}, 2021/12/07, v1.3c, % \url{https://www.ctan.org/pkg/color} (from the\\ % \xpackage{graphics} package bundle). % \end{description} @@ -969,7 +867,7 @@ in mid-sentence! % The |pagecolor-example.tex| requires the same file as all % documents using the \xpackage{pagecolor} package, i.\,e. % \begin{description} -% \item[-] package \xpackage{pagecolor}, 2017/05/29, v1.0i, +% \item[-] package \xpackage{pagecolor}, 2022-11-20, v1.1a, % \url{https://www.ctan.org/pkg/pagecolor}\\ % (Well, it is the example file for this package, and because you are reading the % documentation for the \xpackage{pagecolor} package, it~can be assumed that you already @@ -977,57 +875,51 @@ in mid-sentence! % \end{description} % and additionally: % \begin{description} -% \item[-] class \xpackage{article}, 2014/09/29, v1.4h, from \xpackage{classes}:\\ +% \item[-] class \xpackage{article}, 2021/10/04, v1.4n, from \xpackage{classes}:\\ % \url{https://www.ctan.org/pkg/classes} % -% \item[-] package \xpackage{xcolor}, 2007/01/21, v2.11, +% \item[-] package \xpackage{xcolor}, 2021/10/31, v2.13, % \url{https://www.ctan.org/pkg/xcolor}\\ -% This package would not be needed for the use of just base colours only, +% This package would not be needed for the use of just base colors only, % the \xpackage{color} package would be sufficient for that. % % \item[-] package \xpackage{afterpage}, 2014/10/28, v1.08, % \url{https://www.ctan.org/pkg/afterpage}\\ % This package is only needed for demonstrating the\\ -% |\newpagecolor{somecolour}\afterpage{\restorepagecolor}| construct. +% |\newpagecolor{somecolor}\afterpage{\restorepagecolor}| construct. % -% \item[-] package \xpackage{lipsum}, 2014/07/27, v1.3, +% \item[-] package \xpackage{lipsum}, 2021-09-20, v2.7, % \url{https://www.ctan.org/pkg/lipsum}\\ % This package is only needed for some blind text. -% -% \item[-] package \xpackage{hologo}, 2012/04/26, v1.10, -% \url{https://www.ctan.org/pkg/hologo}\\ -% This package is only needed to write \hologo{pdfTeX}, \hologo{LuaTeX}, -% and \hologo{XeTeX}. % \end{description} % % \DescribeMacro{Alternatives} % \DescribeMacro{transparent} -% \DescribeMacro{hrefhide} +% \DescribeMacro{OCG} % As possible alternatives in section~\ref{s:Alternatives}, Alternatives, % there are listed (newer versions might be available): % \begin{description} -% \item[-] package \xpackage{transparent}, 2007/01/08, v1.0, \\ +% \item[-] package \xpackage{transparent}, 2022-10-27, v1.5,\\ % \url{https://www.ctan.org/pkg/transparent} % -% \item[-] package \xpackage{hrefhide}, 2011/04/29, v1.0h, \\ -% \url{https://www.ctan.org/pkg/hrefhide} +% \item[-] OCG (Optional Content Groups),\\ +% \url{https://www.ctan.org/search?phrase=ocg} % \end{description} % % \DescribeMacro{Oberdiek} -% \DescribeMacro{hologo} % \DescribeMacro{holtxdoc} % \DescribeMacro{kvoptions} -% All packages of \textsc{Heiko Oberdiek's} bundle `oberdiek' -% (especially \xpackage{hologo}, \xpackage{holtxdoc}, and \xpackage{kvoptions}) +% All packages of the `oberdiek' bundle +% (especially \xpackage{holtxdoc} and \xpackage{kvoptions}) % are also available in a TDS compliant ZIP archive:\\ -% \url{http://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}.\\ +% \url{https://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}.\\ % It is probably best to download and use this, because the packages in there % are quite probably both recent and compatible among themselves.\\ % % \DescribeMacro{hyperref} % \noindent \xpackage{hyperref} is not included in that bundle and needs to be % downloaded separately,\\ -% \url{http://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\\ +% \url{https://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\\ % % \DescribeMacro{M\"{u}nch} % A hyperlinked list of my (other) packages can be found at @@ -1036,19 +928,19 @@ in mid-sentence! % \subsection{Package, unpacking TDS} % \paragraph{Package.} This package is available on \url{https://www.CTAN.org}. % \begin{description} -% \item[\url{http://mirror.ctan.org/macros/latex/contrib/pagecolor/pagecolor.dtx}]\hspace*{0.1cm} +% \item[\url{https://mirror.ctan.org/macros/latex/contrib/pagecolor/pagecolor.dtx}]\hspace*{0.1cm} % The source file. -% \item[\url{http://mirror.ctan.org/macros/latex/contrib/pagecolor/pagecolor.pdf}]\hspace*{0.1cm} +% \item[\url{https://mirror.ctan.org/macros/latex/contrib/pagecolor/pagecolor.pdf}]\hspace*{0.1cm} % The documentation. -% \item[\url{http://mirror.ctan.org/macros/latex/contrib/pagecolor/pagecolor-example.pdf}]\hspace*{0.1cm} +% \item[\url{https://mirror.ctan.org/macros/latex/contrib/pagecolor/pagecolor-example.pdf}]\hspace*{0.1cm} % The compiled example file, as it should look like. -% \item[\url{http://mirror.ctan.org/macros/latex/contrib/pagecolor/README}]\hspace*{0.1cm}\\ +% \item[\url{https://mirror.ctan.org/macros/latex/contrib/pagecolor/README}]\hspace*{0.1cm}\\ % \hspace*{1em}The README file. % \end{description} % % There is also a |pagecolor.tds.zip| available: % \begin{description} -% \item[\url{http://mirror.ctan.org/install/macros/latex/contrib/pagecolor.tds.zip}]\hspace*{0.1cm} +% \item[\url{https://mirror.ctan.org/install/macros/latex/contrib/pagecolor.tds.zip}]\hspace*{0.1cm} % Everything in TDS compliant, compiled format. % \end{description} % which additionally contains\\ @@ -1200,13 +1092,13 @@ in mid-sentence! % % \section{Acknowledgements} % -% I would like to thank \textsc{Heiko Oberdiek} for providing a~lot~(!) of +% I would like to thank \textsc{Heiko Oberdiek} for providing a lot of % useful packages (from which I also got everything I know about creating % a file in \xext{dtx} format, ok, say it: copying), and the % \Newsgroup{comp.text.tex} and \Newsgroup{de.comp.text.tex} newsgroups % for their help in all things \TeX{}, especially all contributors to the % discussion at -% \url{https://groups.google.com/forum/#!topic/comp.text.tex/UzV26-RNYPY}% +% \url{https://groups.google.com/g/comp.text.tex/c/UzV26-RNYPY}% % \ (\textsc{H.~Oberdiek} \& \textsc{Gouailles}).\\ % I thank \textsc{haoyun\_tex} for suggesting the |\newpagecolor|/|\restorepagecolor| % pair of commands and everyone at \url{https://tex.stackexchange.com/q/25137/6865} @@ -1215,7 +1107,7 @@ in mid-sentence! % and to \textsc{Reuben Thomas} for suggestions for improvements % of this documentation. % -% \bigskip +% \pagebreak % % \phantomsection % \begin{History}\label{History} @@ -1255,10 +1147,24 @@ in mid-sentence! % but some of the related code must already be performed earlier. % Bug found by \textsc{Heiner Richter} and reported by % \textsc{Johannes B\"{o}ttcher}, thanks! +% \item This version has been archived at\\ +% \url{https://web.archive.org/web/20161114093809/https://mirror.ctan.org/install/macros/latex/contrib/pagecolor.tds.zip} % \end{Version} % \begin{Version}{2017/05/29 v1.0i} % \item Documentation update following suggestions for improvements by % \textsc{Reuben Thomas}, thanks! +% \item This version has been archived at\\ +% \url{https://web.archive.org/web/20220120221237/https://mirror.ctan.org/install/macros/latex/contrib/pagecolor.tds.zip} +% \end{Version} +% \begin{Version}{2022-11-20 v1.1a} +% \item Conversion to UTF-8. +% \item Update to \LaTeX{} format 2021-11-15. +% \item Corrected an error in the example. +% \item \XeLaTeX{} and others now do know \verb|\nopagecolor|. +% \item Package \xpackage{crop} has been updated, but \verb|\nopagecolor| +% still applies to the physical background sheet instead of the logical foreground area. +% \item Now using the \xpackage{hardwrap} package. +% \item Documentation updates. % \end{Version} % \end{History} % @@ -1267,8 +1173,6 @@ in mid-sentence! % When you find a mistake or have a suggestion for an improvement of this package, % please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.) % -% \newpage -% % \PrintIndex % % \Finale diff --git a/macros/latex/contrib/pagecolor/pagecolor.pdf b/macros/latex/contrib/pagecolor/pagecolor.pdf Binary files differindex d2f611b6ee..08642c75e5 100644 --- a/macros/latex/contrib/pagecolor/pagecolor.pdf +++ b/macros/latex/contrib/pagecolor/pagecolor.pdf diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf Binary files differindex f59266ae1d..053c611434 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex index d4070a4559..937cb06065 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex @@ -6,11 +6,11 @@ \documentclass{article} \usepackage[french]{babel} +\usepackage{ProfLycee} \usepackage{mathtools} \usepackage{lualatex-math} \usepackage{luatexbase} \usepackage[math-style=french,bold-style=ISO]{fourier-otf} -\usepackage{ProfLycee} \usepackage{tkz-euclide} \usetikzlibrary{hobby} \usepackage[group-minimum-digits=4]{siunitx} @@ -62,8 +62,8 @@ \setlength{\parindent}{0pt} \definecolor{LightGray}{gray}{0.9} -\def\PLversion{2.0.1} -\def\PLdate{6 Novembre 2022} +\def\PLversion{2.0.4} +\def\PLdate{19 Novembre 2022} \tcbset{vignettes/.style={% nobeforeafter,box align=base,boxsep=0pt,enhanced,sharp corners=all,rounded corners=southeast,% @@ -241,6 +241,8 @@ Une commande pour simplifier des calculs sous forme fractionnaire. Une commande pour simplifier l'écriture d'un ensemble, avec espaces \og automatiques \fg. +Des commandes pour effectuer des calculs avec des suites récurrentes. + Une commande pour créer, en \TikZ, la \textit{toile} pour une suite récurrente. Une commande pour créer, en \TikZ, un cercle trigo avec options. @@ -328,7 +330,7 @@ Le {package} \ctex{ProfLycee} charge les {packages} : \item \ctex{xparse}, \ctex{xkeyval}, \ctex{xstring}, \ctex{simplekv} ; \item \ctex{listofitems}, \ctex{xintexpr} , \ctex{xintbinhex} et \ctex{xintgcd}; \item \ctex{tabularray}, \ctex{fontawesome5}, \ctex{tcolorbox} ; - \item \ctex{piton} (uniquement si compilation en \LuaLaTeX{} !) et \ctex{pythontex} + \item \ctex{piton} (uniquement si compilation en \LuaLaTeX{} !) et \ctex{pythontex}. \end{itemize} \end{codeinfo} @@ -342,9 +344,9 @@ J'ai utilisé les {packages} de C. Tellechea, je vous conseille d'aller jeter un %exemple de chargement pour une compilation en (pdf)latex \documentclass{article} \usepackage[french]{babel} +\usepackage{ProfLycee} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} -\usepackage{ProfLycee} ... \end{codetex} @@ -352,9 +354,9 @@ J'ai utilisé les {packages} de C. Tellechea, je vous conseille d'aller jeter un %exemple de chargement pour une compilation en (xe/lua)latex \documentclass{article} \usepackage[french]{babel} +\usepackage{ProfLycee} \usepackage{mathtools} \usepackage{fontspec} -\usepackage{ProfLycee} ... \end{codetex} @@ -418,7 +420,7 @@ Je préfère faire ces ajustements tant que le package est assez \textit{jeune} \begin{codetex}[listing only] ... -\usepackage[<options>]{ProfLycee-old} +\usepackage[<options>]{ProfLycee-old} %nouveautés non disponibles par contre... ... \end{codetex} @@ -533,18 +535,24 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent \SplineTikz[<options>]{<liste>} \TangenteTikz[<options>]{<liste>} -%toile pour une suite récurrente, dans un environnement tikz +%Présentation d'une solution par balayage (TVI) +\SolutionTVI[<options>]{<fonction>}{<valeur>} + +%Calculer le terme d'une suite récurrente simple, toile pour une suite récurrente simple +\CalculTermeRecurrence[<options>]{<fonction associée>} \ToileRecurrence[<clés>][<options du tracé>][<option supplémentaire des termes>] +%Mise en forme de la conclusion d'un seuil +\SolutionSeuil[<options>]{<fonction associée>}{<seuil>} +\end{codetex} + +\begin{codetex}[listing only] %présentation type calcul formel, dans un environnement tikz \CalculFormelParametres[<options>] \CalculFormelLigne[<options>]{<commande>}{<résultat>} -\end{codetex} -\begin{codetex}[listing only] %présentation de code Python \begin{CodePythonLst}(*)[<largeur>]{<commandes tcbox>}...\end{CodePythonLst} -\CodePythonLstFichier(*)[<largeur>]{<commandes tcbox<}{<script>} \begin{CodePiton}[<options>]...\end{CodePiton} \begin{CodePythontex}[<options>]...\end{CodePythontex} \begin{CodePythonMinted}(*)[<largeur>][<options>]...\end{CodePythonMinted} @@ -985,6 +993,184 @@ On obtient le résultat suivant (avec les éléments rajoutés utiles à la comp \newpage +\section{Présentation d'une solution d'équation par balayage}\label{solutiontvi} + +\subsection{Idée} + +\begin{codeidee} +\cmaj{2.0.4} L'idée est de présenter l'obtention d'une solution approchée d'équation par balayage, dans le cadre du TVI par exemple. Les calculs et tests sont effectués grâce au package \ctex{xinttools}, et le formatage par \ctex{tabularray} et \ctex{sinuitx}. +\end{codeidee} + +\begin{codeattention} +Le code ne trouve pas la solution, il met \textit{juste} en forme mais effectue quand même les calculs d'images et les tests. +\end{codeattention} + +\begin{codetex}[listing only] +\SolutionTVI[<options>]{<fonction>}{<valeur>} +\end{codetex} + +\subsection{Clés et arguments} + +\begin{codecles} +Plusieurs \Cle{Clés} sont disponibles pour cette commande, relative donc à une équation du type $f(x)=k$ : + +\begin{itemize} + \item la clé \Cle{NomFct} qui permet de spécifier le nom de la fonction ;\hfill{}défaut \Cle{f} + \item la clé \Cle{NomSol} qui permet de spécifier le nom de la fonction ;\hfill{}défaut \Cle{\textbackslash{}alpha} + \item les clés \Cle{va} et \Cle{vb} qui sont les bornes inférieure et supérieure de l'encadrement ; + \item la clé \Cle{Precision} qui est la précision des calculs pour les images ;\hfill{}défaut \Cle{2} + \item la clé \Cle{Stretch} qui permet d'espacer les lignes ;\hfill{}défaut \Cle{1.15} + \item les booléens \Cle{Balayage} ou \Cle{Calculatrice} pour afficher un texte en amont ;\hfill{}défaut \Cle{false} + \item le booléen qui affiche un texte avant, en spécifiant la calculatrice ;\hfill{}défaut \Cle{false} + \item le booléen \Cle{Majuscule} qui affiche le texte avant, avec une majuscule au début ;\hfill{}défaut \Cle{true} +\end{itemize} + +\smallskip + +Le premier argument mandataire est la fonction, en syntaxe \ctex{xint} et avec comme variable $x$, et le second la valeur de $k$. +\end{codecles} + +\begin{codetex}[] +Pour $f(x)=0$ avec $f(x)=x^2-2$. On obtient \SolutionTVI[va=1.414,vb=1.415,Precision=3]{x**2-2}{0}. +\end{codetex} + +\begin{codetex}[] +Avec $\varphi(t)=3t\,\rm{e}^{-0,5t+1}=5$, +\SolutionTVI[Majuscule=false,Calculatrice,va=1.02,vb=1.03,NomFct=\varphi]{3*x*exp(-0.5*x+1)}{5} +\end{codetex} + +\begin{codetex}[] +On s'intéresse à $g(x)=\num{1,5}$ avec $g(x)=\ln(x)$. +\SolutionTVI[Balayage,Stretch=1.5,va=4.48,vb=4.49,NomFct=g,Precision=4,NomSol={x_0}]{log(x)}{1.5}. +\end{codetex} + +\newpage + +\section{Suites récurrentes simples}\label{calcrecurr} + +\subsection{Idées} + +\begin{codeidee} +\cmaj{2.0.4} L'idée est de proposer des commandes pour effectuer des calculs avec des suites récurrentes du type $u_{n+1}=f\big(u_n\big)$ : + +\begin{itemize} + \item calcul de termes avec formatage(s) éventuel(s) ; + \item présentation de la conclusion de la recherche d'un seuil du type $u_n > S$ ou $u_n < S$. +\end{itemize} +\end{codeidee} + +\begin{codeattention} +Le code pour le seuil ne trouve pas la solution (\ldots), il met \textit{juste} en forme et effectue quand même les calculs d'images. +\end{codeattention} + +\begin{codetex}[listing only] +%commande pour calculer et formater +\CalculTermeRecurrence[<options>]{<fonction associée>} + +%mise en forme de la conclusion d'un seuil +\SolutionSeuil[<options>]{<fonction associée>}{<seuil>} +\end{codetex} + +\subsection{Clés et arguments} + +\begin{codecles} +Plusieurs \Cle{Clés} sont disponibles pour la commande du calcul d'un terme : + +\begin{itemize} + \item la clé \Cle{No} qui est le rang initial de la suite ; + \item la clé \Cle{UNo} qui est le terme initial de la suite ; + \item la clé \Cle{Precision} qui précise l'arrondi éventuel ;\hfill{}défaut \Cle{3} + \item la clé \Cle{N} qui est l'indice du terme à calculer ; + \item la clé \Cle{Format} (parmi \Cle{Arrondi/Fraction/Decimal/BrutDecimal}) pour le format de sortie ;\hfill{}défaut \Cle{Arrondi} + \item la clé \Cle{OptionFrac} (parmi \Cle{d/t}) pour l'affichage de la fraction.\hfill{}défaut \Cle{} +\end{itemize} + +\smallskip + +L'argument mandataire est la fonction associée à la suite, en syntaxe \ctex{xint} et avec comme variable $x$. +\end{codecles} + +\begin{codetex}[listing only] +Avec $\begin{dcases} u_0 = 50 \\ u_{n+1}=\dfrac{1}{u_n+2} \end{dcases}$. + +On obtient $u_{10} \approx \CalculTermeRecurrence[No=0,UNo=50,N=10]{1/(x+2)}$. +On obtient $u_{10} \approx \CalculTermeRecurrence[Precision=4,No=0,UNo=50,N=10]{1/(x+2)}$. +On obtient $u_{10} = \CalculTermeRecurrence[Format=Fraction,OptionFrac=d,No=0,UNo=50,N=10]{1/(x+2)}$. +On obtient $u_{10} \approx \CalculTermeRecurrence[Format=Decimal,No=0,UNo=50,N=10]{1/(x+2)}$. +On obtient $u_{10} = \CalculTermeRecurrence[Format=Brut,No=0,UNo=50,N=10]{1/(x+2)}$. +On obtient $u_{10} \approx \CalculTermeRecurrence[Format=BrutDecimal,No=0,UNo=50,N=10]{1/(x+2)}$. +\end{codetex} + +\begin{codesortie} +Avec $u_0 = 50$ et $u_{n+1}=\dfrac{1}{u_n+2}$. + +\smallskip + +On obtient $u_{10} \approx \CalculTermeRecurrence[No=0,UNo=50,N=10]{1/(x+2)}$ \hfill~sortie par défaut. + +\smallskip + +On obtient $u_{10} \approx \CalculTermeRecurrence[Precision=4,No=0,UNo=50,N=10]{1/(x+2)}$ \hfill~avec choix de la précision. + +\smallskip + +On obtient $u_{10} = \CalculTermeRecurrence[Format=Fraction,OptionFrac=d,No=0,UNo=50,N=10]{1/(x+2)}$ \hfill~en fraction (si besoin et possible). + +\smallskip + +On obtient $u_{10} \approx \CalculTermeRecurrence[Format=Decimal,No=0,UNo=50,N=10]{1/(x+2)}$ \hfill~nombre décimal formaté. + +\smallskip + +On obtient $u_{10} = \CalculTermeRecurrence[Format=Brut,No=0,UNo=50,N=10]{1/(x+2)}$\hfill~sortie brute par \ctex{xint}. + +\smallskip + +On obtient $u_{10} \approx \CalculTermeRecurrence[Format=BrutDecimal,No=0,UNo=50,N=10]{1/(x+2)}$\hfill~sortie brute décimale par \ctex{xint}. +\end{codesortie} + +\begin{codecles} +Plusieurs \Cle{Clés} sont disponibles pour la commande du seuil : + +\begin{itemize} + \item la clé \Cle{NomSuite} qui est le nom de la suite ;\hfill~défaut \Cle{u} + \item la clé \Cle{No} qui est le rang initial de la suite ; + \item la clé \Cle{UNo} qui est le terme initial de la suite ; + \item la clé \Cle{SolN} qui est la valeur de l'indice cherché ; + \item la clé \Cle{Precision} qui précise l'arrondi éventuel ;\hfill{}défaut \Cle{2} + \item la clé \Cle{Stretch} qui permet d'espacer les lignes ;\hfill{}défaut \Cle{1.15} + \item les booléens \Cle{Balayage} ou \Cle{Calculatrice} pour afficher un texte en amont ;\hfill{}défaut \Cle{false} + \item le booléen qui affiche un texte avant, en spécifiant la calculatrice ;\hfill{}défaut \Cle{false} + \item le booléen \Cle{Majuscule} qui affiche le texte avant, avec une majuscule au début ;\hfill{}défaut \Cle{true} + \item la clé \Cle{Sens} (parmi \Cle{<} ou \Cle{>}) pour indiquer le type de seuil.\hfill{}défaut \Cle{>} +\end{itemize} + +\smallskip + +Le premier argument mandataire est la fonction associée à la suite, en syntaxe \ctex{xint} et avec comme variable $x$, et le second est le seuil à dépasser. +\end{codecles} + +\begin{codetex}[] +Avec $\begin{dcases} u_1 = 2 \\ u_{n+1}=1+\dfrac{1+u_n^2}{1+u_n} \end{dcases}$, +on cherche $n$ tel que $u_n > 5$.\\ +\SolutionSeuil[Balayage,No=1,UNo=2,SolN=8]{1+(1+x**2)/(1+x)}{5}.\\ +\SolutionSeuil[Calculatrice,Precision=3,No=1,UNo=2,SolN=8]{1+(1+x**2)/(1+x)}{5}.\\ +\end{codetex} + +\subsection{Exemple d'utilisation} + +\begin{codetex}[] +Avec $\begin{dcases} u_1 = 2 \\ u_{n+1}=1+\dfrac{1+u_n^2}{1+u_n} \end{dcases}$, +on obtient le tableau de valeurs suivant : +\begin{tabular}{c|c} + $n$ & $u_n$ \\ \hline + 1 & 2 \\ + \xintFor* #1 in {\xintSeq{2}{8}} \do {#1 & \CalculTermeRecurrence[No=1,UNo=2,N=#1]{1+(1+x**2)/(1+x)} \\} +\end{tabular} +\end{codetex} + +\newpage + \section{Suites récurrentes et \og toile \fg}\label{recurr} \subsection{Idée} @@ -994,7 +1180,7 @@ L'idée est d'obtenir une commande pour tracer (en \TikZ) la \og toile \fg{} per \smallskip -Comme pour les autres commandes \TikZ, l'idée est de laisser l'utilisateur définir et créer son environnement \TikZ, et d'insérer la commande \ctex{recurrPL} pour afficher la \og toile \fg. +Comme pour les autres commandes \TikZ, l'idée est de laisser l'utilisateur définir et créer son environnement \TikZ, et d'insérer la commande \ctex{ToileRecurrence} pour afficher la \og toile \fg. \end{codeidee} \subsection{Commandes} @@ -1176,7 +1362,7 @@ Les sujets d'examens, depuis quelques années, peuvent comporter des \textit{cap À la manière du {package} \ctex{tkz-tab}, l'environnement de référence est un environnement \TikZ, dans lequel les lignes sont créées petit à petit, à l'aide de nœuds qui peuvent être réutilisés à loisir ultérieurement. \end{codeidee} -\subsection{La commande \og \CalculFormelParametres \fg} +\subsection{La commande \og CalculFormelParametres \fg} \begin{codeinfo} La première chose à définir est l'ensemble des paramètres \textit{globaux} de la fenêtre de calcul formel, à l'aide de \Cle{Clés}. @@ -1478,6 +1664,10 @@ def trace_parabole_tableaux(): \smallskip En \textit{partenariat} avec \ctex{tcolorbox}, on peut avoir une présentation de code Python ! + +\smallskip + +\cmaj{2.0.2} Depuis la version \ctex{0.95} du package \ctex{piton}, \Cle{left-margin=auto} est disponible et activée dans \ctex{ProfLycee}. \end{codeinfo} \begin{codeattention} @@ -3509,7 +3699,7 @@ L'utilisateur peut donc utiliser \og sa \fg{} méthode pour formater les résult \begin{codetex}[listing only] %avec un formatage manuel -\num[exponent-mode=scientific]{\BinomP{100}{0.02}{10}} +\num[exponent-mode=scientific]{\CalcBinomP{100}{0.02}{10}} \end{codetex} \begin{codesortie} @@ -5238,6 +5428,14 @@ La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0 \part{Historique} +{\small \bverb|v 2.0.4|~:~~~~Ajout d'une commande pour une présentation de solution par TVI (page \pageref{solutiontvi}) + +{\small \bverb| |~:~~~~Correction d'un bug avec \textsf{Arbre=3x3} (page \pageref{arbresprobas}) + +{\small \bverb|v 2.0.3|~:~~~~Commandes pour des suites récurrentes \textit{simples} (page \pageref{calcrecurr}) + +{\small \bverb|v 2.0.2|~:~~~~Option \textsf{left-margin=auto} pour le package \textsf{piton} (page \pageref{pythonpiton}) + {\small \bverb|v 2.0.1|~:~~~~Chargement du package \textsf{piton} uniquement si compilation en \LuaLaTeX{} (page \pageref{pythonpiton}) {\small \bverb|v 2.0.0|~:~~~~Refonte du code source avec modification des commandes} diff --git a/macros/latex/contrib/proflycee/tex/ProfLycee.sty b/macros/latex/contrib/proflycee/tex/ProfLycee.sty index 4e32d0963f..11154e5de3 100644 --- a/macros/latex/contrib/proflycee/tex/ProfLycee.sty +++ b/macros/latex/contrib/proflycee/tex/ProfLycee.sty @@ -3,14 +3,17 @@ % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ProfLycee}[2022/11/06 2.0.1 Aide pour l'utilisation de LaTeX en lycee] +\ProvidesPackage{ProfLycee}[2022/11/19 2.0.4 Aide pour l'utilisation de LaTeX en lycee] +% 2.0.4 Ajout d'une commande pour présenter un balayage (TVI) + calculs suites récurrentes +% 2.0.3 Correction d'un bug avec les arbres 3x3 +% 2.0.2 Ajout de l'option auto-margin sur piton % 2.0.1 Chargement de piton uniquement si lua... % 2.0.0 Refonte des commandes, des options, et de la documentation !!! % ------------------------------------------------------------------ % 1.3.7 Ajout d'un environnement simplifié pour du code python via piton % 1.3.6 Ajout d'un "générateur" de trinômes (ou mise en forme basique) % 1.3.5 Correction de bugs sur les calculs de probas (loi géométrique) -% 1.3.4 Ajout des calculs de probas geomtriques et hypergeometriques + petits schémas probas +% 1.3.4 Ajout des calculs de probas geométriques et hypergeometriques + petits schémas probas % 1.3.3 Ajout de commandes pour des arbres de probas classiques, en tikz % 1.3.2 Correction d'une commande liée à la conversion bintohex (suppression clé trait) % 1.3.1 Ajout d'une option pour ne pas afficher les bords des cases en pixelart @@ -65,13 +68,14 @@ \RequirePackage{ifthen} \RequirePackage{xparse} \RequirePackage{xkeyval} -\RequirePackage{xfp} +%\RequirePackage{xfp} %plus utile \RequirePackage{xstring} \RequirePackage{xintexpr} \RequirePackage{xintbinhex} \RequirePackage{simplekv} \RequirePackage{listofitems} \RequirePackage{tabularray} +\RequirePackage{hvlogos} \RequirePackage{siunitx} %test avec v3 \sisetup{% locale=FR,% @@ -121,6 +125,23 @@ \tcbuselibrary{minted} \fi +%-----------PRESENTATIONDECODES-------------- +\NewTCBListing{PresentationCode}{ O{ForestGreen} m }{% + sharp corners=downhill,enhanced,arc=12pt,skin=bicolor,% + colback=#1!5!white,colframe=#1!75!black,colbacklower=White,% + attach boxed title to top right={yshift=-\tcboxedtitleheight},title=Code \LaTeX,% + boxed title style={% + colframe=#1!75!black,colback=#1!15!white,% + ,sharp corners=downhill,arc=12pt,% + },% + fonttitle=\color{#1!90!black}\itshape\ttfamily\footnotesize,% + listing options={% + style=tcblatex,basicstyle=\footnotesize\ttfamily,% + keywordstyle=\bfseries\color{Blue},tabsize=4,% + },% + #2 +} + %---------------SPLINES---------------------- %------commande utile pour extraire des infos d'une liste \newcommand\extractcoeff[2]{% #1=liste & #2=numero @@ -597,7 +618,7 @@ \useKVdefault[envpiton]% \setKV[envpiton]{#1}% on paramètres les nouvelles clés et on les simplifie \ifboolKV[envpiton]{Lignes}%si lignes=true - {\PitonOptions{left-margin=12.75pt,line-numbers}}% + {\PitonOptions{left-margin=auto,line-numbers}}% {\PitonOptions{}}% \begin{tcolorbox}[stylepythontex,leftupper=8pt,colframe=Green,colback=ForestGreen!5,width=\CODPITlargeur,fontlower=\small,\CODPITalign] }% @@ -971,7 +992,7 @@ Option={} } -\newcommand\EcritureEnsemble[2][1]{% +\newcommand\EcritureEnsemble[2][]{% \useKVdefault[kvensemble]% \setKV[kvensemble]{#1}% \ifboolKV[kvensemble]{Mathpunct}% @@ -986,9 +1007,9 @@ {%si oui := fraction \StrBefore{\calculargument}{/}[\numerateur]%on extrait le numérateur \StrBehind{\calculargument}{/}[\denominateur]%on extrait le dénominateur - \ifblank{#1}{\ensuremath{\frac{\numerateur}{\denominateur}}}{}%si l'argument optionnel est vide - \IfStrEq{#1}{d}{\ensuremath{\dfrac{\numerateur}{\denominateur}}}{}%si l'arg opt est d - \IfStrEq{#1}{t}{\ensuremath{\tfrac{\numerateur}{\denominateur}}}{}%si l'arg opt est t + \ifblank{#1}{\ensuremath{\frac{\num{\numerateur}}{\num{\denominateur}}}}{}%si l'argument optionnel est vide + \IfStrEq{#1}{d}{\ensuremath{\dfrac{\num{\numerateur}}{\num{\denominateur}}}}{}%si l'arg opt est d + \IfStrEq{#1}{t}{\ensuremath{\tfrac{\num{\numerateur}}{\num{\denominateur}}}}{}%si l'arg opt est t }{%si non := entier \num{\calculargument}%on affiche l'entier, avec le package siunitx } @@ -2707,7 +2728,7 @@ \coordinate (R) at ({0*\PLAPespniv},{-4*\PLAPespfeuille}) ; \node[noeud] (A11) at ({1*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[1,1]}; \node[noeud] (A12) at ({1*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[5,1]}; - \node[noeud] (A13) at ({1*\PLAPespniv},{-7*\PLAPespfeuille}) {\PLARBREDONNES[10,1]}; + \node[noeud] (A13) at ({1*\PLAPespniv},{-7*\PLAPespfeuille}) {\PLARBREDONNES[9,1]}; \node[noeud] (A21) at ({2*\PLAPespniv},{-0*\PLAPespfeuille}) {\PLARBREDONNES[2,1]}; \node[noeud] (A22) at ({2*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[3,1]}; \node[noeud] (A23) at ({2*\PLAPespniv},{-2*\PLAPespfeuille}) {\PLARBREDONNES[4,1]}; @@ -2893,7 +2914,7 @@ \coordinate (R) at ({0*\PLAPespniv},{-4*\PLAPespfeuille}) ; \node[noeud] (A11) at ({1*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[1,1]}; \node[noeud] (A12) at ({1*\PLAPespniv},{-4*\PLAPespfeuille}) {\PLARBREDONNES[5,1]}; - \node[noeud] (A13) at ({1*\PLAPespniv},{-7*\PLAPespfeuille}) {\PLARBREDONNES[10,1]}; + \node[noeud] (A13) at ({1*\PLAPespniv},{-7*\PLAPespfeuille}) {\PLARBREDONNES[9,1]}; \node[noeud] (A21) at ({2*\PLAPespniv},{-0*\PLAPespfeuille}) {\PLARBREDONNES[2,1]}; \node[noeud] (A22) at ({2*\PLAPespniv},{-1*\PLAPespfeuille}) {\PLARBREDONNES[3,1]}; \node[noeud] (A23) at ({2*\PLAPespniv},{-2*\PLAPespfeuille}) {\PLARBREDONNES[4,1]}; @@ -3125,4 +3146,127 @@ }{}% } +%================TVISOLUTION============= OK! +\defKV[dichoto]{% + NomFct=\def\DHTnomfct{#1},% + va=\def\DHTva{#1},% + vb=\def\DHTvb{#1},% + Precision=\def\DHTprec{#1},% + NomSol=\def\DHTnomsol{#1}, + Stretch=\def\DHTstretch{#1} +} + +\setKVdefault[dichoto]{% + NomFct=f,% + Precision=2,% + NomSol=\alpha,% + Stretch=1.15,% + Balayage=false,% + Calculatrice=false,% + Majuscule=true +} + +\newcommand\SolutionTVI[3][]{% + \useKVdefault[dichoto]% + \setKV[dichoto]{#1}% + \xintdeffloatfunc varfct(x) := #2 ;% + \ifboolKV[dichoto]{Balayage}{\ifboolKV[dichoto]{Majuscule}{P}{p}ar balayage, on obtient }{}% + \ifboolKV[dichoto]{Calculatrice}{\ifboolKV[dichoto]{Majuscule}{P}{p}ar calculatrice, on obtient }{}% + \ensuremath{% + \left\lbrace \begin{tblr}{stretch=\DHTstretch,colsep=1pt,rll}% + {\DHTnomfct}{\left( \num{\DHTva} \right)} &\approx \num[minimum-decimal-digits=\DHTprec]{\xintFloatToDecimal{\xintfloateval{round(varfct(\DHTva),\DHTprec)}}} & \xintifGt{\xintfloateval{varfct(\DHTva)-#3}}{0}{> \num{#3}}{< \num{#3}} \: \\ % + {\DHTnomfct}{\left( \num{\DHTvb} \right)} &\approx \num[minimum-decimal-digits=\DHTprec]{\xintFloatToDecimal{\xintfloateval{round(varfct(\DHTvb),\DHTprec)}}} & \xintifGt{\xintfloateval{varfct(\DHTvb)-#3}}{0}{> \num{#3}}{< \num{#3}} \:% + \end{tblr}% + \right|% + \Rightarrow% + \num{\DHTva} < \DHTnomsol < \num{\DHTvb}% + }% +} + +%=================CALCSRECUR============= OK! +\NewDocumentCommand\CalculInterneTermeRecurrence{ m m m m }{%pas forcément utile + \xintdeffloatfunc varfctrecur(x) := #1 ;% + \xdef\vartmp{#3}% + \IfEq{#4}{\inteval{#2+1}}% + {\xdef\vartmp{\xintfloateval{varfctrecur(\vartmp)}}}% + {% + \foreach \i in {1,2,...,\inteval{#4-#2}}% + {\xdef\vartmp{\xintfloateval{varfctrecur(\vartmp)}}}% + }% + \xintFloatToDecimal{\vartmp}% +} + +\defKV[calculsuiterecur]{% + No=\def\SRninit{#1},% + UNo=\def\SRuninit{#1},% + Precision=\def\SRprec{#1},% + N=\def\SRnfinal{#1},% + Format=\def\SRformat{#1},% + OptionFrac=\def\SRoptfrac{#1} +} + +\setKVdefault[calculsuiterecur]{% + Precision=3,% + Format=Arrondi,% + OptionFrac={} +} + +\NewDocumentCommand\CalculTermeRecurrence{ O{} m }{% + \useKVdefault[calculsuiterecur]% + \setKV[calculsuiterecur]{#1}% + \xintdeffunc varfct(x) := #2 ;% + \xdef\vartmp{\fpeval{\SRuninit}}% + \IfEq{\SRnfinal}{\inteval{\SRninit+1}}% + {\xdef\vartmp{\xinteval{varfct(\vartmp)}}}% + {% + \foreach \i in {1,2,...,\inteval{\SRnfinal-\SRninit}}% + {\xdef\vartmp{\xinteval{varfct(\vartmp)}}}% + }% + \IfStrEq{\SRformat}{Arrondi}{\num[minimum-decimal-digits=\SRprec]{\xintfloateval{round(\vartmp,\SRprec)}}}{}% + \IfStrEq{\SRformat}{Fraction}{\ConversionFraction[\SRoptfrac]{\xinteval{\vartmp}}}{}% + \IfStrEq{\SRformat}{Brut}{\xinteval{\vartmp}}{}% + \IfStrEq{\SRformat}{Decimal}{\num{\xintfloateval{\vartmp}}}{}% + \IfStrEq{\SRformat}{BrutDecimal}{\xintFloatToDecimal{\vartmp}}{}% +} + +\defKV[suiteseuil]{% + No=\def\SEUILindiceinit{#1},% + UNo=\def\SEUILtermeinit{#1},% + NomSuite=\def\SEUILnomsuite{#1},% + SolN=\def\SEUILn{#1},% + Precision=\def\SEUILprec{#1},% + Stretch=\def\SEUILstretch{#1},% + Sens=\def\SEUILsens{#1} +} + +\setKVdefault[suiteseuil]{% + NomSuite=u,% + Precision=2,% + Stretch=1.15,% + Balayage=false,% + Calculatrice=false,% + Majuscule=true,% + Sens=> +} + +\newcommand\SolutionSeuil[3][]{%1=options + %2 = fonction + %3 = seuil + \useKVdefault[suiteseuil]% + \setKV[suiteseuil]{#1}% + \def\SEUILnmu{\inteval{\SEUILn-1}}% + \IfEq{\SEUILsens}{>}% + {\def\SensDeb{\leqslant}\def\SensFin{>}}% + {\def\SensDeb{\geqslant}\def\SensFin{<}}% + \ifboolKV[suiteseuil]{Balayage}{\ifboolKV[suiteseuil]{Majuscule}{P}{p}ar balayage, on obtient }{}% + \ifboolKV[suiteseuil]{Calculatrice}{\ifboolKV[suiteseuil]{Majuscule}{P}{p}ar calculatrice, on obtient }{}% + \ensuremath{% + \left\lbrace \begin{tblr}{stretch=\SEUILstretch,colsep=1pt,rll}% + \SEUILnomsuite_{\SEUILnmu} &\approx \CalculTermeRecurrence[Precision=\SEUILprec,No=\SEUILindiceinit,UNo=\SEUILtermeinit,N=\SEUILnmu]{#2} & \SensDeb\num{#3} \: \\ % + \SEUILnomsuite_{\SEUILn} &\approx \CalculTermeRecurrence[Precision=\SEUILprec,No=\SEUILindiceinit,UNo=\SEUILtermeinit,N=\SEUILn]{#2} & \SensFin\num{#3} \: % + \end{tblr}% + \right|% + \Rightarrow% + n \geqslant \SEUILn% + }% +} + \endinput
\ No newline at end of file |