diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/etoc')
-rw-r--r-- | Master/texmf-dist/source/latex/etoc/etoc.dtx | 965 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/etoc/etoc.ins | 16 |
2 files changed, 565 insertions, 416 deletions
diff --git a/Master/texmf-dist/source/latex/etoc/etoc.dtx b/Master/texmf-dist/source/latex/etoc/etoc.dtx index f89033663b1..25c806beed9 100644 --- a/Master/texmf-dist/source/latex/etoc/etoc.dtx +++ b/Master/texmf-dist/source/latex/etoc/etoc.dtx @@ -1,49 +1,50 @@ % -*- coding: iso-latin-1; -*- %<*ins> \def\pkgname{etoc} -\def\pkgdate{2013/03/01} -\def\pkgversion{v1.07e} -\def\pkgdescription{easily customizable TOCs (jfB)} +\def\pkgdate{2013/03/07} +\def\pkgversion{v1.07f} +\def\pkgdescription{Completely customisable TOCs (jfB)} %</ins> %% %% Package `etoc' by Jean-Francois Burnol %% Copyright (C) 2012, 2013 by Jean-Francois Burnol %% -%<*none> -\def\lasttimestamp{Time-stamp: <03-03-2013 22:08:48 CET jfb>} -\def\docdate{2013/03/03} -\def\striptimestamp#1 <#2 #3 #4 #5>{#2 at #3 #4} -\edef\dtxtimestamp{\expandafter\striptimestamp\lasttimestamp} -\ProvidesFile{\pkgname.dtx} - [`\pkgname' source and documentation (\dtxtimestamp)] % % The copyright statement at the top of this file applies to `etoc.dtx' % and to its derived files. % -% They may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, -% either version 1.3 of this license or (at your -% option) any later version. The latest version of -% this license is in: -% -% http://www.latex-project.org/lppl.txt +% 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 +% and the latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. % -% and version 1.3 or later is part of all distributions of -% LaTeX version 2003/12/01 or later. +% The author of this work is Jean-Francois Burnol <jfbu at free dot fr>. +% This work has the LPPL maintenance status `author-maintained'. % % Installation: % ============ % -% `latex etoc.dtx' -% `latex etoc.dtx' (twice more) finishes producing the documentation +% `latex etoc.dtx' --> this extracts the style file `etoc.sty' % -% The file `etoc.sty' was generated in the first latex run. +% `latex etoc.dtx' (twice more) finishes producing the documentation % -% Put `etoc.sty' in a suitable location within the TeX installation: -% etoc.sty -> ..path..to../tex/latex/etoc/ +% Move `etoc.sty' to a suitable location within the TeX installation: +% etoc.sty -> <TDS>/tex/latex/etoc/etoc.sty % % The generated auxiliary files may be discarded. % +%<*none> +\def\lasttimestamp{Time-stamp: <06-04-2013 13:48:01 CEST jfb>} +\def\docdate{2013/04/06} +\def\striptimestamp#1 <#2 #3 #4 #5>{#2 at #3 #4} +\edef\dtxtimestamp{\expandafter\striptimestamp\lasttimestamp} +\ProvidesFile{\pkgname.dtx} + [`\pkgname' source and documentation (\dtxtimestamp)] \begingroup \input docstrip.tex \askforoverwritefalse @@ -65,13 +66,11 @@ %% As usual `latex etoc.ins' produces `etoc.sty' from the source `etoc.dtx' %% (an already existing etoc.sty in the same repertory will be overwritten) %% -%% Put the `etoc.sty' file in a suitable location within the TeX -%% installation: etoc.sty -> ................/tex/latex/etoc/ -%% -%% The generated auxiliary files may be discarded. +%% Move `etoc.sty' to a suitable location: +%% etoc.sty -> <TDS>/tex/latex/etoc/etoc.sty %% -%% See `etoc.dtx' for the statements of copyright and conditions of -%% distribution or modification. +%% The generated auxiliary files may be discarded. See `etoc.dtx' for the +%% statements of copyright and conditions of distribution or modification. %% \input docstrip.tex \askforoverwritefalse @@ -93,12 +92,40 @@ \usepackage[hscale=0.66,vscale=0.75]{geometry} \pagestyle{headings} -\makeatletter\let\check@percent\relax\makeatother +\makeatletter +% 2013/03/07. +% This macro allows to conveniently center a line inside a paragraph and still +% use there in \verb or other commands changing catcodes. +% A proposito, \centerline uses \hsize and not \linewidth!!! + \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=} + + \let\original@check@percent\check@percent + \let\check@percent\relax +\makeatother + \def\MacroFont{\ttfamily\small\baselineskip12pt\relax} -\usepackage{txfonts} % m'occuper de la taille de txtt: +\usepackage{txfonts} + +% m'occuper de la taille de txtt: % au passage je supprime le \hyphenchar \font\m@ne + +% ATTENTION ATTENTION ATTENTION Un changement de taille comme \small semble +% déclencher (peut-être) la relecture de t1txtt.fd et quoi qu'il en soit le +% \hyphenchar est REMIS à -1 !!! MERDE! (6 avril 2013) + \DeclareFontFamily{T1}{txtt}{} \DeclareFontShape{T1}{txtt}{m}{n}{ %medium <->s*[.96] t1xtt% @@ -152,55 +179,24 @@ \usepackage{graphicx} \usepackage{enumitem} - -% ok il faut ceci pour dvipdfmx: -%\def\pgfsysdriver{pgfsys-dvipdfm.def} - -\usepackage{tikz} -\usetikzlibrary{trees} % added for "cyclic" grow function 2013/03/02 -\usepackage{tikz-qtree} - -% I have tried this (2013/03/01) to fix the problem with hyperlinks -% in the produced tree: -% \usepackage{hopgf} -% (downloaded yesterday from a link found on tex-stackex) -% but it still does not work. Error messages from a run of dvipdfmx: -% ** WARNING ** Annotation out of page boundary. -% ** WARNING ** Current page's MediaBox: [0 0 595.276 841.89] -% ** WARNING ** Annotation: [94.3997 1200.33 146.512 1209.98] -% ** WARNING ** Maybe incorrect paper size specified. - -% UPDATE: 2013/03/03. This problem actually seems to be specific of the -% tikz-qtree, it miraculously went away when I constructed trees with the -% original TikZ syntax!! and there was no need of hopgf.sty (or was it a -% problem of final resizing?). And ok for dvipdfmx as well as pdflatex. - -% cependant j'ai un autre problème avec dvipdfmx qui donne par ailleurs: -% ** WARNING ** Obsolete four arguments of "endchar" will be used for Type 1 -% "seac" operator. -% ce qui semble lié à txtt, même après avoir retiré mon inclusion modifiée de -% t1txtt.fd. - -% J'ai mis un moment à comprendre que la raison était que j'ai rajouté des -% commentaires en français dans mes blocs verbatim, ce qui enclenche le problème -% avec dvipdfmx et les caractères diacritiques. - -% le plus simple serait peut-être donc de changer de police pour le monotype. -% non le plus simple est de retirer (les accents de) mes commentaires en -% français. OK, c'était bien cela le problème. - \definecolor{joli}{RGB}{225,95,0} \definecolor{JOLI}{RGB}{225,95,0} \definecolor{BLUE}{RGB}{0,0,255} \colorlet{niceone}{green!35!blue!75} - \usepackage[english]{babel} \AtBeginDocument{ \renewcommand\partname{Part} \addto\captionsenglish{\renewcommand\partname{Part}} } +% ok il faut ceci pour dvipdfmx: +%\def\pgfsysdriver{pgfsys-dvipdfm.def} + +\usepackage{tikz} +\usetikzlibrary{trees} % added for "cyclic" grow function 2013/03/02 +\usepackage{tikz-qtree} + \usepackage[%dvipdfmx, pdfencoding=pdfdoc,bookmarks=true]{hyperref} @@ -223,18 +219,6 @@ pdfpagemode=UseOutlines} % \def\href#1#2{{#2}} % \makeatother -% en fait je charge directement txtt en supprimant \hyphenchar\font\m@ne -\DeclareRobustCommand\csa[1]{{\ttfamily\hyphenchar\font45\char`\\#1}} -\DeclareRobustCommand\csb[1]{{% -\color{blue}\ttfamily\hyphenchar\font45\char`\\#1}} - -\newcommand\cshyp[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}} -\newcommand\csbhyp[1]{\texorpdfstring{\csb{#1}}{\textbackslash #1}} - -\newcommand\lowast{\raisebox{-.25\height}{*}} -\newcommand\starit[1]{\csa{#1\lowast}} -\newcommand\staritb[1]{\csb{#1\lowast}} - \usepackage{etoc} % executes \RequirePackage{multicol} %-------- @@ -288,6 +272,7 @@ pdfpagemode=UseOutlines} \makeatother %-------- % 2 mars \thispartstats macro: +% 7 mars je retire la phrase Click on the names or numbers to get confirmation! \newsavebox\firstnamei \newsavebox\firstnumberi @@ -343,8 +328,7 @@ pdfpagemode=UseOutlines} 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. - Click on the names or numbers to get confirmation!}% + \unhbox\lastnameii{} and its number is \unhbox\lastnumberii.}% \etocinline % don't do a \par automatically \etocsettocstyle {}{} \localtableofcontents @@ -393,6 +377,26 @@ pdfpagemode=UseOutlines} \newcommand\etoc{% \texorpdfstring{{\color{joli}\ttfamily\bfseries etoc}}{etoc}\xspace} +% en fait je charge directement txtt en supprimant \hyphenchar\font\m@ne +%\DeclareRobustCommand\csa[1]{{\ttfamily\hyphenchar\font45 \char`\\#1}} + +% OUI MAIS CE PUTAIN DE \small REMET LE \hyphenchar à -1!! +% Je l'ai déterminé en faisant pour tester: +% \makeatletter +% \DeclareRobustCommand\csb[1]{{\ttfamily\f@encoding\the\hyphenchar\font #1}} +% \makeatother + +\DeclareRobustCommand\csa[1]{{\ttfamily\hyphenchar\font45 \char`\\ #1}} +\DeclareRobustCommand\csb[1] +{{\color{blue}\ttfamily\hyphenchar\font45 \char`\\ #1}} + +\newcommand\cshyp[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}} +\newcommand\csbhyp[1]{\texorpdfstring{\csb{#1}}{\textbackslash #1}} + +\newcommand\lowast{\raisebox{-.25\height}{*}} +\newcommand\starit[1]{\csa{#1\lowast}} +\newcommand\staritb[1]{\csb{#1\lowast}} + \hyphenation{toc-depth sec-num-depth etoc-framed-style etoc-ruled-style} \hyphenation{etoc-toc-style-with-marks etoc-ruled etoc-framed} @@ -400,6 +404,10 @@ pdfpagemode=UseOutlines} \hyphenation{etoc-the-page etoc-the-name etoc-the-num-ber etoc-if-num-bered} \hyphenation{etoc-link etoc-stan-dard-lines etoc-toc-lines} \hyphenation{etoc-in-ner-top-sep} +\hyphenation{etoc-the-linked-name etoc-the-linked-num-ber etoc-the-linked-page} +\hyphenation{etoc-the-link} +\hyphenation{etoc-skip-first-pre-fix etoc-the-page + etoc-ruled-style etoc-mul-ti-col-style etoc-default-lines} \frenchspacing @@ -541,6 +549,12 @@ compatible with the |article|, |book|, |report|, |scrartcl|, \begin{multicols}{2} \begin{jfverbatim} +v1.07f [2013/03/07] + + new macros \etocthelinkedname, \etocthelinkednumber, + \etocthelinkedpage, and \etocthelink. + + v1.07e [2013/03/01] improvements in the package own line styles with @@ -828,9 +842,8 @@ of contents of Part \ref{part:custom}: \endgroup -We actually did something like:\\ -\hbox to \linewidth{\hss - \toc\space\csa{label}|{toc:d}|\csa{ref}|{toc:c}|\hss} Hence +We actually did something like: +\centeredline{\toc\space\csa{label}|{toc:d}|\csa{ref}|{toc:c}|} Hence \hyperref[toc:d]{\color{niceone}the present location} can itself now be referred to via |\ref{toc:d}|: it gives the id of this TOC\footnote{\emph{i.e} @@ -870,17 +883,15 @@ each time its value was changed. When displaying in that way many tables of contents in the same document one should of course beware of the impact of adding manually things -to the |.toc| file. For example, inserting\\ -\hbox to \linewidth{\hss - \csa{addtocontents}|{toc}{\string\clearpage}|\hss} just +to the |.toc| file. For example, inserting +\csa{addtocontents}|{toc}{\string\clearpage}| +just before a \csa{part} to fix the problem when some part entry (in the table of contents) is isolated at the bottom of one page, will cause problems with multiple TOCs: this \csa{clearpage} will be executed by \etoc each time a \toc or \localtoc command is encountered! The more prudent thing is to have -issued rather:\\ -\hbox to -\linewidth{\hss\csa{addtocontents}|{toc}{\string\myclearpage}|,\hss} +issued rather: {\csa{addtocontents}|{toc}{\string\myclearpage}|,} to have a |\let\myclearpage\relax| at the top level of the document and to use where needed something like: \begin{verbatim} @@ -919,19 +930,11 @@ can be used to print arbitrary ``lists of things'', using no other auxiliary file than the |.toc| file. This is explained further in the section \ref{sec:surprising}. -\subsection{Local table of contents for this part} +\section{Two examples} -Immediately after the |\part{Overview}| +Here is a simple example of use of the package +functionalities. Immediately after the |\part{Overview}| line in the source file we inserted: -% -% The \csa{label} command should follow \toc before the reference via -% \csa{ref} to the other TOC. Indeed a \csa{label} following it is -% detected by \toc (skipping spaces and an optional \texttt\lowast). A -% \csa{label} after the \csa{ref} will not be treated by \etoc -% itself and will refer to the latest reference point, possibly -% to some counter updated in the title of the TOC or, although -% this would require the user to have done a suitable set-up in the -% line styles, even some counter modified inside the TOC. \begin{verbatim} \setcounter{tocdepth}{-3} \localtableofcontents \label{toc:partone} @@ -941,110 +944,14 @@ The |tocdepth| having been set to -3, nothing at all was typeset, as \etoc cancels printing even the heading of the TOC if the |tocdepth| is -3 or less (and it is even ``-2 or less'', except for the |memoir| class). -We could then display here this TOC with:\par -\hbox to \linewidth{\hss|\tableofcontents \ref{toc:partone}|\hss} -But we have decided to use the \csa{etocframedstyle} package command, and the - produced table of contents has to fit on a single page. With all the recent - additions to the documentation there is not enough room here, so we wrap it up - in a figure environment and it will show on next page. +We will then display here this TOC with: +\centeredline{|\tableofcontents \ref{toc:partone}|} - -\setcounter{tocdepth}{3} - -\begin{figure*}[t!]\centering -\colorlet{subsecnum}{black} -\colorlet{secbackground}{green!30} -\colorlet{tocbackground}{red!20!green!20} - -\renewcommand{\etocbkgcolorcmd}{\color{tocbackground}} -\renewcommand{\etocleftrulecolorcmd}{\color{tocbackground}} -\renewcommand{\etocrightrulecolorcmd}{\color{tocbackground}} -\renewcommand{\etocbottomrulecolorcmd}{\color{tocbackground}} -\renewcommand{\etoctoprulecolorcmd}{\color{tocbackground}} - -\renewcommand{\etocleftrule}{\vrule width 3cm} -\renewcommand{\etocrightrule}{\vrule width 1cm} -\renewcommand{\etocbottomrule}{\hrule height 12pt} -\renewcommand{\etoctoprule}{\hrule height 12pt} - -\renewcommand{\etocinnertopsep}{0pt} -\renewcommand{\etocinnerbottomsep}{0pt} -\renewcommand{\etocinnerleftsep}{0pt} -\renewcommand{\etocinnerrightsep}{0pt} - -\newcommand\shiftedwhiterule[2]{% - \hbox to \linewidth{\color{white}% - \hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip -\vskip#2} - -\etocsetstyle{subsubsection}{\etocskipfirstprefix} -{\shiftedwhiterule{\leftskip}{6pt}} -{\sffamily\footnotesize -\leftskip2.3cm\hangindent1cm\rightskip.5cm\noindent -\hbox to 1cm{\color{subsecnum}\etocnumber\hss}% -\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill -\rlap{\hbox to .5cm{\hss\etocpage\hskip.1cm}}\par -\nointerlineskip\vskip3pt} -{} - -\etocsetstyle{subsection}{\etocskipfirstprefix} -{\shiftedwhiterule{1.5cm}{6pt}} -{\sffamily\small -\leftskip1.5cm\hangindent.8cm\rightskip.5cm\noindent -\hbox to .75cm{\color{subsecnum}\etocnumber\hss}% -\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill -\rlap{\hbox to .5cm{\hss\etocpage\hskip.1cm}}\par -\nointerlineskip\vskip3pt} -{} - -\newcommand{\coloredstuff}[2]{% - \leftskip0pt\rightskip0pt\parskip0pt - \fboxsep0pt % \colorbox uses \fboxsep also when no frame! - \noindent\colorbox{secbackground} - {\parbox{\linewidth}{% - \vskip5pt - {\noindent\color{#1}#2\par\nointerlineskip} - \vskip3pt}}% - \par\nointerlineskip} - -\etocsetstyle{section}{\coloredstuff{blue} - {\hfil \bfseries\large Contents of Part One\hfil}} -{\vskip3pt\sffamily\small} -{\coloredstuff{blue}{\kern1cm\hbox to .5cm{\etocnumber\hss}% - \etocname\hfill -{\hbox to .5cm{\hss\etocpage\hskip.1cm}}}% - \vskip6pt} -{} - -\etocframedstyle[1]{} -\hbox to \linewidth{\hss|\tableofcontents \ref{toc:partone}|\hss} -\tableofcontents \ref{toc:partone} -\end{figure*} - -The actual design is not pre-built in \etoc; it uses the \etoc -`framed' style with a background color and a dummy empty -title, the actual title having been put inside the frame as -part of the \meta{start} code of the section `line style'. The -frame borders have been set to have the same color as the one -which serves as background for the entire thing. This design -(with other colors) is in use also for -\hyperref[toc:clone]{\color{niceone}this other toc}, -and the coding used is to be found at its location. - -\section{A simple example} - -Here is a simpler example of use of the package -functionalities. We display again the local table of contents -for this part but -choose font sizes and style which would be used rather -for, respectively, chapters and sections in an average length -memoir. - - -First, the line style specifications. They have some -redundancy for clarity, and do not care about what to do at -possible page breaks. Also, this does not care about potential -multi-column use. +But first let us set up some line styles. We choose a style for sections and +sub-sections which would be suitable for, respectively, sections and +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{verbatim} \begingroup % we start a group to keep the style changes local @@ -1068,13 +975,13 @@ multi-column use. \hfill\makebox[-\tocrightmargin][l]{\makebox[0pt]{\etocpage}}\par} {} -% \color{cyan}\parindent0pt and \leftskip\tocleftmargin were repeated -% in the <start> code of the ``section style'', for clarity of code. - \etocsettocstyle{\color{cyan}\parindent0pt \leftskip\tocleftmargin \leavevmode\leaders\hrule height 1pt\hfill\ \huge\textit{My Beautiful Thesis}\par}{\bigskip} +% \color{cyan}\parindent0pt and \leftskip\tocleftmargin were repeated +% in the <start> code of the ``section style'', for clarity of code. + \tableofcontents \ref{toc:partone} \endgroup \end{verbatim} @@ -1135,6 +1042,101 @@ signification. % which sometimes leaves no option than to use rather % \csa{hbox}. } +\subsection{Again the table of contents of this part}\label{ssec:again} + +Let us now try out some more sophisticated line styles. The +display will use the \csa{etocframedstyle} package command, which +requires that the produced table of contents fits on a single +page. With all the recent additions to the documentation there is +not enough room here, so we wrap it up in a figure environment and +it will show \hyperref[toc:floating]{\color{niceone}on the next page.} + + +\setcounter{tocdepth}{3} + +\begin{figure*}[th!]\centering +\colorlet{subsecnum}{black} +\colorlet{secbackground}{green!30} +\colorlet{tocbackground}{red!20!green!20} + +\renewcommand{\etocbkgcolorcmd}{\color{tocbackground}} +\renewcommand{\etocleftrulecolorcmd}{\color{tocbackground}} +\renewcommand{\etocrightrulecolorcmd}{\color{tocbackground}} +\renewcommand{\etocbottomrulecolorcmd}{\color{tocbackground}} +\renewcommand{\etoctoprulecolorcmd}{\color{tocbackground}} + +\renewcommand{\etocleftrule}{\vrule width 3cm} +\renewcommand{\etocrightrule}{\vrule width 1cm} +\renewcommand{\etocbottomrule}{\hrule height 12pt} +\renewcommand{\etoctoprule}{\hrule height 12pt} + +\renewcommand{\etocinnertopsep}{0pt} +\renewcommand{\etocinnerbottomsep}{0pt} +\renewcommand{\etocinnerleftsep}{0pt} +\renewcommand{\etocinnerrightsep}{0pt} + +\newcommand\shiftedwhiterule[2]{% + \hbox to \linewidth{\color{white}% + \hskip#1\leaders\vrule height1pt\hfil}\nointerlineskip +\vskip#2} + +\etocsetstyle{subsubsection}{\etocskipfirstprefix} +{\shiftedwhiterule{\leftskip}{6pt}} +{\sffamily\footnotesize +\leftskip2.3cm\hangindent1cm\rightskip.5cm\noindent +\hbox to 1cm{\color{subsecnum}\etocnumber\hss}% +\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill +\rlap{\hbox to .5cm{\hss\etocpage\hskip.1cm}}\par +\nointerlineskip\vskip3pt} +{} + +\etocsetstyle{subsection}{\etocskipfirstprefix} +{\shiftedwhiterule{1.5cm}{6pt}} +{\sffamily\small +\leftskip1.5cm\hangindent.8cm\rightskip.5cm\noindent +\hbox to .75cm{\color{subsecnum}\etocnumber\hss}% +\color{black}\etocname\leaders\hbox to .2cm{\hss.}\hfill +\rlap{\hbox to .5cm{\hss\etocpage\hskip.1cm}}\par +\nointerlineskip\vskip3pt} +{} + +\newcommand{\coloredstuff}[2]{% + \leftskip0pt\rightskip0pt\parskip0pt + \fboxsep0pt % \colorbox uses \fboxsep also when no frame! + \noindent\colorbox{secbackground} + {\parbox{\linewidth}{% + \vskip5pt + {\noindent\color{#1}#2\par\nointerlineskip} + \vskip3pt}}% + \par\nointerlineskip} + +\etocsetstyle{section}{\coloredstuff{blue} + {\hfil \bfseries\large Contents of Part One\hfil}} +{\vskip3pt\sffamily\small} +{\coloredstuff{blue}{\kern1cm\hbox to .5cm{\etocnumber\hss}% + \etocname\hfill +{\hbox to .5cm{\hss\etocpage\hskip.1cm}}}% + \vskip6pt} +{} + + +% attention car \ref{toc:floating} fera référence au compteur de +% toutes les toc, pas visibletoc. + +\etocframedstyle[1]{} +\tableofcontents \label{toc:floating} \ref{toc:partone} +\vspace{-\baselineskip} +\centeredline{|\tableofcontents \ref{toc:partone}| +(\emph{cf.} \autoref{ssec:again} and \hyperref[toc:clone]{\color{niceone}this other toc})} +\end{figure*} + +The actual design is not pre-built in \etoc; it uses its `framed' style with a +background color. The frame borders have been set to have the same color as the +one serving as background for the entire thing. This design (with other colors) +is in use also for \hyperref[toc:clone]{\color{niceone}this other toc}, and the +reader is referred to \hyperref[toc:clone]{\color{niceone}its location} for the +coding used. + \section{Surprising uses of \etoc} \label{sec:surprising} @@ -1258,8 +1260,13 @@ displayed within this document: it here we just wrote:\footnote{click the `\protect\thevisibletoc' in the list to get confirmation... and click on the previous `\number \numexpr\csname c@visibletoc\endcsname-1\relax' for a surprise... -}\par\smallskip -{\leftskip1cm\rightskip5cm +\\ The \hyperref[toc:floating]{\color{niceone}floating TOC} \number + \numexpr\csname c@visibletoc\endcsname-2\relax\ is responsible for + some numbering madness here: the numbers are listed + in the order the TOCs appear in the document; but the numbering + itself is from the order of the TOCs in the \emph{source} of + this document... }\par\smallskip +{\leftskip1cm\rightskip2cm \ttfamily\small\baselineskip11pt \noindent Here is the numbered and linked list of all tables of contents which are displayed within this @@ -1291,9 +1298,9 @@ it here we just wrote:\footnote{click the `\protect\thevisibletoc' |\stepcounter{visibletoc}| followed by the command \csb{etoctoccontentsline}|{visibletoc}{\thevisibletoc}|. This \etoc command \csb{etoctoccontentsline}\marg{level\_name}\marg{name} has the same - effect as:\\ - \hbox to \linewidth{| |% - |\addcontentsline{toc}|\marg{level\_name}\marg{name}\hss} + effect as: + \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, @@ -1471,7 +1478,7 @@ this was done will be found on the above cited site. \ifextraidone\else \noindent\hskip.7\linewidth \hbox to .2\linewidth -% +% février (ou janvier?) 2013 % je modifie ici en ajoutant un \hss, pour compenser la plus petite % taille de txrm. Ok. {\hss\small\textsc{\bfseries Sections.\hss Page.}}\par\fi @@ -1778,10 +1785,10 @@ commands one of the document class: |article|, |book|, |scrartcl|, |scrbook|. \footnote{For the |memoir| class, one needs a bit more: each of the command \csa{booknumberline}, \csa{partnumberline} and \csa{chapternumberline} will have to be saved with a -\csa{let}, and, one then specifies:\\ -\hbox to \linewidth{% +\csa{let}, and, one then specifies: +\centeredline{% \csa{etocsetstyle\{chapter\}\{\}\{\}\{\string\savedchapterline\{% -\string\savedchapternumberline}\hss} +\string\savedchapternumberline}} \hbox to \linewidth{\hfil\hfil \ttfamily \{\csa{etocnumber}\}\csa{etocname}\}\{\csa{etocpage}\}\}\{\}\hfil} (and analogously for |part|, respectively |book|).} @@ -1860,6 +1867,17 @@ outcome to \csa{treetok} for later execution in a |tikzpicture|. #1\expandafter\expandafter\expandafter {\expandafter\the\expandafter #1#2}} + +% 7 mars: j'utilise \etocthelinkedname défini à partir de 1.07f +% mais bien sûr je sais que ça ne marche pas (sauf dans l'arbre pour le lien de +% la section du bas) dans un QTree. Mais ça marche parfaitement dans un arbre +% TikZ natif. +\newcommand*\PrepareSectionNode{% + \tmptok {\centering\bfseries}% + \appendtotok\tmptok\etocthelinkedname + \edef\qtreenode{ [.{\noexpand\parbox{2cm}{\the\tmptok}}}% +} +% --- date d'avant \etocthelinkedname etc... : % malheureusement ajouter un \hyperlink ne fonctionne pas, ou % fonctionne aléatoirement. La façon d'insérer % \hyperlink{\Hy@tocdestname}{\the\toks0 } @@ -1874,6 +1892,7 @@ outcome to \csa{treetok} for later execution in a |tikzpicture|. % \edef\qtreenode {[.{\noexpand\parbox{2cm}{\the\tmptok}} }% % \show\qtreenode % } + % voici un message d'erreur lorsque l'on fait ensuite (par exemple) % dvipdfmx: % ** WARNING ** Annotation out of page boundary. @@ -1884,11 +1903,6 @@ outcome to \csa{treetok} for later execution in a |tikzpicture|. % UPDATE: mais ça marche avec des arbres dans la syntaxe de TikZ! -\newcommand*\PrepareSectionNode{% - \tmptok {\centering\bfseries}% - \appendtotok\tmptok\etocthename - \edef\qtreenode{ [.{\noexpand\parbox{2cm}{\the\tmptok}}}% -} %%%%% ne marche pas, mais finalement le problème semble être avec %%%%% tikz-qtree, car l'analogue avec des arbres dans la syntaxe %%%%% de TikZ fonctionne!!! (3 mars) @@ -1899,9 +1913,11 @@ outcome to \csa{treetok} for later execution in a |tikzpicture|. % \noexpand\hyperlink{\Hy@tocdestname}{\the\tmptok}}}}% % } % \makeatother + +% 7 mars: j'utilise maintenant \etocthelinkedname \newcommand*{\PrepareSubsectionNode}{% \tmptok {\raggedright}% j'ai essayé aussi avec \sloppy - \appendtotok\tmptok\etocthename + \appendtotok\tmptok\etocthelinkedname \edef\qtreenode{ [.{\noexpand\parbox{6cm}{\the\tmptok}}}% } @@ -1944,16 +1960,21 @@ outcome to \csa{treetok} for later execution in a |tikzpicture|. } \smallskip -It would be perfectly possible to tell \etoc to insert in the argument to the - \csa{Tree} command from package |tikz-qtree| the |hyperref| links. The - technique for doing that will be explained in the next section. But here in +We told \etoc to insert the |hyperref| +links inside the argument to the + \csa{Tree} command (from package |tikz-qtree|).% +\footnote{this uses the macro \csa{etocthelinkedname} introduced with +package version |1.07f|. The same effect was achieved in earlier versions +in a more complicated +manner.} But here in our use of |tikz-qtree| we have been confronted with the problem that the - hyperlinks, even if correctly added to the \csa{treetok} token list, appeared - in the final document in completely wrong locations. -\footnote{|dvipdfmx| gives me errors:\quad + hyperlinks, even if correctly added to the \csa{treetok} token list, appear + in the final document in wrong locations (except for the bottom section and +the bottom subsection nodes). +\footnote{|dvipdfmx| complains:\quad |** WARNING ** Annotation out of page boundary.|\quad |Current page's MediaBox: [0 0 595.276 841.89]|\quad -|Annotation: [94.3997 1200.33 146.512 1209.98]|\\ +|Annotation: [94.3997 1200.33 146.512 1209.98]|. I read on the internet that there is some problem with |pgf| with regards to hyperlinks, but I don't know if this is the same issue (as this is my first ever use of TikZ). [2013/03/01]\\ @@ -1982,12 +2003,12 @@ therein: \newcommand*{\PrepareSectionNode}{% \tmptok {\centering\bfseries}% - \appendtotok\tmptok\etocthename + \appendtotok\tmptok\etocthelinkedname \edef\qtreenode{ [.{\noexpand\parbox{2cm}{\the\tmptok}}}% } \newcommand*{\PrepareSubsectionNode}{% \tmptok {\raggedright}% - \appendtotok\tmptok\etocthename + \appendtotok\tmptok\etocthelinkedname \edef\qtreenode{ [.{\noexpand\parbox{6cm}{\the\tmptok}}}% } %%%% only sections and subsections: @@ -2041,11 +2062,12 @@ therein: \subsection{The TOC as a molecule}\label{ssec:molecule} -It is also possible to construct a TOC tree obeying the TikZ syntax for -trees: this is a more complicated task for the \etoc line styles for reasons -related to the importance of braces in \TeX{}, they need, when filling up the - token list (and if not using very tricky tricks) to be -always balanced at each step. +It is also possible to construct a TOC tree obeying the TikZ syntax for trees: +this is a more complicated task for the \etoc line styles for reasons related to +the importance of braces in \TeX{}, they need, when filling up the token list to +be always balanced at each step (unfortunately \textsc{Leslie Lamport}'s book +has no mention whatsoever of token lists, and \LaTeX{} does not really expect +users to know about them; this whole section is thus for advanced users). The simplest strategy is to allocate a token list (or use a macro) for each level used: we may need a \csa{parttok}, a \csa{chaptertok}, a @@ -2054,35 +2076,31 @@ up the total \csa{treetok}. As we are interested here in the table of contents of this (or another) document part, only a \csa{sectiontok} and a \csa{subsectiontok} will be needed. -And the nice thing is that now, our hyperlinks do work. To tell \etoc to insert - the correct hyperlinks, rather than -trying to do things with \csa{etoclink} (which is a robust command\footnote{one -could access the contents of \csa{csname etoclink }\csa{endcsname} but -it contains \csa{Hy@tocdestname} \emph{unexpanded}, so it is easier to do as -shown in the sequel.}) the -simpler method\footnote{this paragraph and much of the details of the code -snippets will be understood only by users knowledgeable in advanced \LaTeX{} -programming.} is to store -|\hyperlink{A}{B}| in \csa{treetok} where |A| stands for the \emph{expansion} of -\cs{Hy@tocdestname}, -and |B| stands for the (one time) \emph{expansion} of \csa{etocthename}. - +And the nice thing is that now, our hyperlinks do work. As mentioned already we +can not use the commands \csa{etocname}, etc\dots, for delayed execution. We can +on the other hand store the current values of \csa{etocthename}, etc\dots, but +don't get then the |hyperref| links. Earlier versions of this documentation +explained how to do things with |\hyperlink| and |\Hy@tocdestname|, but since +|1.07f|, the package provides \csa{etocthelinkedname}, etc\dots, specifically +for +this kind of task. + \begingroup \def\MacroFont{\small\ttfamily\baselineskip10pt\relax} \begin{verbatim} +% \newtoks\treetok \newtoks\sectiontok \newtoks\subsectiontok \newcommand*{\treenode}{} \newcommand*{\appendchildtree}[2]{% token list t1 becomes: t1 child {t2} \edef\tmp{\the#1 child {\the#2}}% #1\expandafter{\tmp}% } -\makeatletter \newcommand*{\preparetreenode}{% - \tmptok\expandafter{\etocthenumber}% takes less space than the name! - %% \edef\treenode{node {\the\tmptok}}% <-- for unlinked version - \edef\treenode{node {\noexpand\hyperlink{\Hy@tocdestname}{\the\tmptok}}}% + \tmptok\expandafter{\etocthelinkednumber}% expanded one time (mandatory) + \edef\treenode{node {\the\tmptok}}% } -\makeatother + +\setcounter{tocdepth}{2} \etocsetstyle{section} {\etocskipfirstprefix} {\appendchildtree\treetok\sectiontok} @@ -2095,8 +2113,6 @@ and |B| stands for the (one time) \emph{expansion} of \csa{etocthename}. {\preparetreenode \subsectiontok\expandafter{\treenode}} {\appendchildtree\sectiontok\subsectiontok} -\setcounter{tocdepth}{2} - \etocsettocstyle {\treetok{\node {\hyperref[part:one]{Overview}}}} {\global\appendtotok\treetok{ ;}} @@ -2117,7 +2133,7 @@ created (it uses the TikZ library |trees| for its ``cyclic'' grow method): edge from parent path={[dashed,very thick,color=cyan] (\tikzparentnode) --(\tikzchildnode)}] \the\treetok - \end{tikzpicture}% + \end{tikzpicture} \end{center} \end{verbatim} \endgroup @@ -2132,13 +2148,10 @@ created (it uses the TikZ library |trees| for its ``cyclic'' grow method): #1\expandafter{\tmp}% } -\makeatletter \newcommand*{\preparetreenode}{% - \tmptok\expandafter{\etocthenumber}% - %% \edef\treenode{node {\the\tmptok}}% unlinked version - \edef\treenode{node {\noexpand\hyperlink{\Hy@tocdestname}{\the\tmptok}}}% + \tmptok\expandafter{\etocthelinkednumber}% + \edef\treenode{node {\the\tmptok}}% } -\makeatother \etocsetstyle{section} {\etocskipfirstprefix} @@ -2175,11 +2188,12 @@ created (it uses the TikZ library |trees| for its ``cyclic'' grow method): \end{center} This is nice, and especially so as this ``molecule TOC'' is fully hyperlinked! -I don't know what went wrong for the trees -constructed with the \cs{Tree} command of package |tikz-qtree|, rather than -being coded as here with the original ``child'' TikZ syntax. +I don't know why it goes wrong for the trees +constructed with the \cs{Tree} command of package |tikz-qtree|, contrarily to +those coded as here with the original ``child'' TikZ syntax. -\clearpage +% attention à ce \clearpage +% \clearpage \etocsettocstyle @@ -2334,7 +2348,8 @@ typeset by executing first the \meta{prefix} code and then the \meta{contents} code. -The commands \csb{etocname}, \csb{etocnumber} and \csb{etocpage} are provided +The (robust) commands \csb{etocname}, \csb{etocnumber} and \csb{etocpage} are +provided for use inside the \marg{prefix} and \marg{contents} parts of the \csa{etocsetstyle} specification. They represent of course, the name, number, and page number of the corresponding toc @@ -2342,7 +2357,10 @@ entry.\footnote{\protect\fbox{% \parbox{.9\textwidth}{up to version \texttt{1.07a} the package put an \csa{xspace} in each of \csa{etocname}, \csa{etocnumber}, and \csa{etocpage}, but this -wasn't such a great idea and has now been removed.}}} +wasn't such a great idea and has now been removed.}}} If package |hyperref| is +active in the document and has added hyperlinks to the TOC data, then these +links are kept in the commands \csa{etocname}, \csa{etocnumber} and +\csa{etocpage} (this last one will have a link only if |hyperref| was passed option \emph{linktoc=all}.) \subsection{The \csbhyp{etocskipfirstprefix} command} @@ -2388,7 +2406,7 @@ syntax {\ttfamily label=\char32} from the package |enumitem|: {\end{enumerate}} \end{verbatim} Rather than just \csa{etocnumber} we then used something like -|\fbox{\etocnumber}|. Note that \csa{etocnumber} is a protected +|\fbox{\etocnumber}|. Note that \csa{etocnumber} is a robust command which explains why it can be used inside the label specification without needing an added |\protect|. @@ -2451,15 +2469,39 @@ commands \csa{etocname}, \csa{etocnumber} and \csa{etocpage}. It creates a link (if such a link was added by |hyperref| to the |.toc| file entry) whose destination is the corresponding document unit and whose name is the given argument. - Hence |\etoclink{\etocthename}| is like the original -|\etocname|, except that \csa{etocname} starts with a -\csa{leavevmode} (this was found out to be necessary when -|hyperref| has added its link data, during testing of various -uses of the first versions of \etoc). +|\etocname|. +Notice that if |hyperref| was not instructed to put a link in the page number +(via +its option \emph{linktoc=all}) then \etoc's \csa{etocpage} contains no link +either, but |\etoclink{\etocthepage}| does. + + +The command \csa{etoclink} is robust. + +\subsection{The \csbhyp{etocthelinkedname}, \csbhyp{etocthelinkednumber}, +\csbhyp{etocthelinkedpage} and \csbhyp{etocthelink} commands.} + +This is for advanced uses by advanced users. -The -command \csa{etoclink} is protected. +The \csa{etocthename} macro has +been mentioned before; using it in instructions such as +|\global\let\lastone\etocthename| in an \etoc line style will +define the macro |\lastone| to expand to the last name seen at the +corresponding level. But no facilities was previously available to +do the same with the link data. + +The package now provides \csa{etocthelinkedname} to do the similar +thing, with the link data included. It was used in this +documentation when doing the +\hyperref[tocastree]{examples with trees}. + +Also provided with the similar goal: \csa{etocthelinkednumber}, +\csa{etocthelinkedpage} (which contains a link only if |hyperref| +added one to the page number) and \csa{etocthelink}\marg{linkname} +which allows to make a link with an arbitrary name. + +All these commands are fragile. \section{The \csbhyp{etocsetlevel} command} @@ -2686,20 +2728,20 @@ And there is also \subsubsection{The command \csbhyp{etoctocstyle}} -\centerline{\color{blue}\csa{etoctocstyle}\oarg{kind}% +\centeredline{\color{blue}\csa{etoctocstyle}\oarg{kind}% \marg{number\_of\_columns}\marg{title}} -\hbox to \linewidth{\hss= +\centeredline{= \csa{etocmulticolstyle}|[|{\itshape number\_of\_columns}|]|% -|{\kind*{|\itshape title\upshape|}}|\hss} +|{\kind*{|\itshape title\upshape|}}|} where |kind| is one of |chapter|, |section|, . . . and defaults to |chapter| or |section| depending on the document class. \paragraph{\texorpdfstring{\csb{etoc\-toc\-style\-with\-marks}}{etoctocstylewithmarks}}% -\leavevmode\unskip{\color{blue}\oarg{kind}\marg{number\_of\_columns}\marg{title}\marg{mark}}\\ -\hbox to \linewidth -{\hss=\csa{etocmulticolstyle}|[|{\itshape number\_of\_columns}|]|% +\leavevmode\unskip{\color{blue}\oarg{kind}\marg{number\_of\_columns}\marg{title}\marg{mark}} +\centeredline +{=\csa{etocmulticolstyle}|[|{\itshape number\_of\_columns}|]|% |{\kind*{|\itshape title \ttfamily\upshape\string\markboth% -|{\MakeUppercase{|{\rmfamily\itshape mark}|}}}}|\hss} +|{\MakeUppercase{|{\rmfamily\itshape mark}|}}}}|} where |kind| is one of |chapter|, |section|, ... The actual display of the marks depends on the settings of the page style. There is variant \csb{etoctocstylewithmarksnouc} @@ -2903,13 +2945,15 @@ line styles and some colors added. % \clearpage +\begin{verbatim} \etocdefaultlines -\begingroup +\begingroup % we use a group to limit the scope of the next commands \renewcommand{\etoccolumnsep}{2em} \renewcommand{\etocinnerleftsep}{1.5em} \renewcommand{\etocinnerrightsep}{1.5em} % specify a background color for the toc contents \renewcommand{\etocbkgcolorcmd}{\color{yellow!10}} +%\renewcommand{\etocbkgcolorcmd}{\relax} % set up the top and bottom rules \renewcommand{\etoctoprule}{\hrule height 1pt} \renewcommand{\etoctoprulecolorcmd}{\color{red!25}} @@ -2929,18 +2973,19 @@ line styles and some colors added. in a frame, it has to be small enough to fit on the current page. It has the label |toc:b|.}}} % set up a label for future (or earlier...) reference +\setcounter{tocdepth}{3} \tableofcontents \label{toc:b} \ref{toc:globalcmds} \endgroup +\end{verbatim} + -\begin{verbatim} \etocdefaultlines -\begingroup % we use a group to limit the scope of the next commands +\begingroup \renewcommand{\etoccolumnsep}{2em} \renewcommand{\etocinnerleftsep}{1.5em} \renewcommand{\etocinnerrightsep}{1.5em} % specify a background color for the toc contents \renewcommand{\etocbkgcolorcmd}{\color{yellow!10}} -%\renewcommand{\etocbkgcolorcmd}{\relax} % set up the top and bottom rules \renewcommand{\etoctoprule}{\hrule height 1pt} \renewcommand{\etoctoprulecolorcmd}{\color{red!25}} @@ -2960,10 +3005,8 @@ line styles and some colors added. in a frame, it has to be small enough to fit on the current page. It has the label |toc:b|.}}} % set up a label for future (or earlier...) reference -\setcounter{tocdepth}{3} \tableofcontents \label{toc:b} \ref{toc:globalcmds} \endgroup -\end{verbatim} \subsection{A (crazy) inline display} @@ -3291,7 +3334,7 @@ Regarding colors, generally speaking all color commands inside \etoc are initially defined to do nothing, and the choice to use or not colors is left to the user. -% \clearpage +\clearpage \setcounter{tocdepth}{3} \begingroup @@ -3360,6 +3403,12 @@ use or not colors is left to the user. \etocframedstyle[1]{} +% CETTE TOC AUSSI AVAIT LE SYNDROME DU HYPHENCHAR -1 POUR TXTT +% NE SERAIT-CE PAS LE SMALL QUI PROVOQUE CELA? OUI BORDEL DE BORDEL DE BORDEL + +% POURQUOI BORDEL DE BORDEL \SMALL VA REPRENDRE T1TXTT ALORS QUE LE DOCUMENT +% CONTIENT LE DECLAREFONTFAMILY ?? FAIT CHIER LATEX, LATEX FAIT CHIER MERDEUHHH! + \tableofcontents \label{toc:clone} \ref{toc:globalcmds} \endgroup @@ -3485,9 +3534,8 @@ been limited to a group and one then wishes to let it again be \csa{let}\csa{etocbkgcolorcmd}\csa{relax}. Regarding the dimensions of the top rule they can be specified -in |ex|'s or |em|'s as in this example:\\ -\hbox to \linewidth{\hss -|\renewcommand{\etoctoprule}{\hrule height 1ex}|\hss} +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 \csa{etocruledtoc} or @@ -3578,7 +3626,38 @@ section \ref{sec:surprising} for other uses of this technique): \renewcommand{\columnseprule}{1pt} \etocmarkbothnouc{List of all subsections} + +% PUTAIN BORDEL j'en ai marre de me demander pourquoi mes noms de commandEs mis +% en \csb ne sont pas soumis à hyphénation ici alors qu'ils le sont ailleurs !! +% je me dis qu'il y a quelque chose avec multicol je n'arrive pas à repérer +% quoi. J'ai essayé plusieurs choses. Vraiment c'est chiant. + +% c'est à cause de \ttfamily mais pourtant le hyphenchar n'est pas -1, il doit + +% MERDE MERDE MERDE mais qui m'a rechangé le \hyphenchar de txtt !!!!! + +% Il est bien à 45 et pourtant l'hyphénation n'a lieu QUE si je mets +% explicitement \hyphenchar à 45 dans \csb ?????? +% \begingroup \ttfamily \the\hyphenchar\font \endgroup +% BORDEL DE BORDEL, le hyphenchar est mis à -1 dans certaines circonstances, ici +% même pour cette TOC il l'est et le fait de mettre le bloc verbatim avant ou +% après ne change rien, et il l'est aussi pour la TOC de la section One more +% example TOC layout MAIS IL EST BIEN À 45 PARTOUT AILLEURS. + +% IL Y A DU CODE QUELQUE PART QUI MET LE HYPHENCHAR À -1 MAIS JE NE SAIS PAS OÙ. + +% bien sûr on peut soupçonner verbatim ou \verb mais je n'ai vraiment pas le +% temps d'aller voir plus avant maintenant. L'explication doit être +% transparente, mais il est tout de même étrange que ce phénomène n'apparaisse +% qu'en deux endroits et je ne vois pas dans l'immédiat ce qu'il y a de commun. + +% C'EST LE \SMALL PUTAIN FAIT CHIER LATEX LE DECLAREFONTFAMILY EST DANS LE DOC +% POURQUOI ALLER LE RE-CHERCHER APRES UN SMALL FAIT CHIER PUTAIN FAIT CHIER + +% ************ LATEX FAIT CHIER !!!!! MERDEUUUUUUH *********** + \etocmulticol[3]{\subsection{All subsections of this document}} + \endgroup \setcounter{tocdepth}{3} @@ -3640,8 +3719,7 @@ But first, the coding of \csa{thispartstats}:\par 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. - Click on the names or numbers to get confirmation!}% + subsection is \unhbox\lastnameii{} and its number is \unhbox\lastnumberii.}% \etocinline % don't do a \par automatically (but this is not used, actually). \etocsettocstyle {}{} \localtableofcontents % to be used at the top level of a Part. @@ -3696,8 +3774,8 @@ And now, the variant which was used for \subsection{Compatibility with other packages} \etoc loads the package |multicol|.\footnote{\protect\fbox{up to version -\texttt{1.07a} it also used package \texttt{xspace}, and but this -has been removed.}} It is +\texttt{1.07a} it also used package \texttt{xspace}, but this +has been removed from later versions.}} It is |hyperref| aware and hopefully |hyperref| compatible! It doesn't matter whether \etoc or |hyperref| is loaded first. @@ -3780,7 +3858,6 @@ groups. All TOCs are typeset inside groups. \subsection{Errors and catastrophes} -\begin{small} After using \csa{etocsetstyle} for one level, the remaining uncustomized levels use the \etoc default styles (those which are activated by \csa{etocdefaultlines}). One has to @@ -3810,11 +3887,6 @@ time stamp ``\dtxtimestamp''. The package version is \pkgversion, of \pkgdate. See the source for copyright and license information.\par -\end{small} - - -\clearpage - \part{The code} This source file |etoc.dtx| produces @@ -3829,6 +3901,7 @@ the \TeX{} installation. \makeatletter \StopEventually{\check@checksum\end{document}} +\let\check@percent\original@check@percent \makeatother Writing-up source code comments is hopefully for a future @@ -3864,6 +3937,7 @@ release. % in the commented source code... % (c) 2012/11/19 jf burnol ;-) + \MakePercentIgnore % @@ -3909,6 +3983,7 @@ release. \newif\ifEtoc@notactive \newcounter{etoc@tocid} \newif\ifEtoc@mustclosegroup +\def\etoc@{\etoc@} % Delimiter in \Etoc@getnb etc.. macros. This def added 1.07f % \end{macrocode} % placeholder for comments % \begin{macrocode} @@ -4155,98 +4230,158 @@ release. \Etoc@next \@firstoftwo{\Etoc@swa{#1}}{\Etoc@swb{#1}}} % \end{macrocode} -% placeholder for 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 manner, +% prefixing it with \csa{leavevmode}. The included \csa{Hy@tocdestname} is left +% unexpanded. Due to the initial (enormously incredible and opposite to the +% credo of separating the content from the form) \LaTeX{} flaw of mixing (Parts +% having their own format, not to mention other classes) in the |.toc| file the +% number and the name we have to spend some time with delimited macros to +% dis-entangle this, and reconstruct the possible |hyperref| data. Note that if +% the page number is not hyperlinked, \csa{etocpage} does \emph{not} add the +% link found possibly in the name. +% +% Then |1.07| added \csa{etocthename}, \csa{etocthenumber}, \csa{etocthepage} +% which are left fragile and do not have the links data, and +% \csa{etoclink}\marg{linkname} which is robust and reconstructs an arbitrarily +% named link. A need (for things like building up a token list to be used in a +% |tikzpicture|) arose later to have some form of the link which could be saved +% by a simple command like one can do |\global\let\lastname\etocthename|, and +% avoid having to manipulate \csa{Hy@tocdestname}. So |1.07f| adds +% \csa{etocthelinkedname}, \csa{etocthelinkednumber}, \csa{etocthelinkedpage}, +% \csa{etocthelink}: they use \csa{hyperlink} with an expanded +% \csa{Hy@tocdestname}. +% +% One could now define \csa{etocname}, etc ... to be the robust versions of +% \csa{etocthelinkedname}, etc ..., but the original definitions are kept by +% sentimentalism. |1.07f| also adds \csa{leavevmode} to \csa{etoclink} which +% should have been done earlier, as it was included in \csa{etocname} etc... +% +% attention, \csa{@namedef}|{A}{B}| and not \csa{@namedef}|{A} {B}| !! +% on the other hand this gives a simple way to insert a space as the first +% token in the paramaters. For \csa{Etoc@again} (which appears later in the +% code), a \csa{@firstofone} construct is however the simplest of all. % \begin{macrocode} -\def\Etoc@lxyz #1#2{% - \@namedef{etoclink }{\leavevmode}% fall-back - \@namedef{etocpage }{\leavevmode #2}% fall-back - \Etoc@getthepage #2\etoc@ - \@namedef{etocname }{\leavevmode #1}% fall-back - \def\etocthename{#1}% - \Etoc@getnb #1\relax\relax\etoc@ - \ifEtoc@number\else +\def\Etoc@lxyz #1#2{% + \@namedef {etoclink }{\leavevmode}% fall-back + \def\etocthelink {}% fall-back + \@namedef {etocname }{\leavevmode #1}% fall-back (perhaps linked) + \def\etocthename {#1}% (if link, will be removed later) + \def\etocthelinkedname {#1}% will probably get redefined + \@namedef {etocpage }{\leavevmode #2}% (perhaps linked) + \Etoc@getthepage #2\etoc@ % defines also \etocthelinkedpage (and \etoclink) + \Etoc@getnb #1\relax\relax\etoc@ % gets number *and* name, and \etoclink + \ifEtoc@number\else \ifEtoc@part - \Etoc@getit #1\hspace\relax\etoc@ + \Etoc@getit #1\hspace\relax\etoc@ % additional job for parts \fi \fi} % \end{macrocode} % placeholder for comments % \begin{macrocode} -\def\Etoc@getnb #1{\let\Etoc@next\Etoc@getnb@nohyp +\def\Etoc@getthepage #1{% + \let\Etoc@next\Etoc@getthepage@nohyp \ifEtoc@hyperref\ifx #1\hyper@linkstart - \let\Etoc@next\Etoc@getnb@hyp + \let\Etoc@next\Etoc@getthepage@hyp \fi\fi - \Etoc@next #1} + \Etoc@next #1% +} +\def\Etoc@getthepage@nohyp #1\etoc@ {% + \def\etocthepage {#1}% + \def\etocthelinkedpage {#1}% +} +\def\Etoc@getthepage@hyp #1#2#3#4#5\etoc@ {% + \@namedef{etoclink } ##1{\leavevmode #1{#2}{#3}{##1}#5}% + \edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}% + \def\etocthepage {#4}% + \toks@ {#4}% + \edef\etocthelinkedpage {\noexpand\hyperlink {#3}{\the\toks@}}% +} % -\def\Etoc@getit #1{\let\Etoc@next\Etoc@getit@nohyp +\def\Etoc@getnb #1{% + \let\Etoc@next\Etoc@getnb@nohyp \ifEtoc@hyperref\ifx #1\hyper@linkstart - \let\Etoc@next\Etoc@getit@hyp + \let\Etoc@next\Etoc@getnb@hyp \fi\fi - \Etoc@next #1} + \Etoc@next #1% +} % -\def\Etoc@getthepage #1{\let\Etoc@next\Etoc@getthepage@nohyp +\def\Etoc@getit #1{% + \let\Etoc@next\Etoc@getit@nohyp \ifEtoc@hyperref\ifx #1\hyper@linkstart - \let\Etoc@next\Etoc@getthepage@hyp + \let\Etoc@next\Etoc@getit@hyp \fi\fi - \Etoc@next #1} -\def\Etoc@getthepage@nohyp #1\etoc@{\def\etocthepage{#1}} -\def\Etoc@getthepage@hyp #1#2#3#4#5\etoc@{% - \@namedef{etoclink }##1{#1{#2}{#3}{##1}#5}% - \def\etocthepage{#4}} + \Etoc@next #1% +} % \end{macrocode} % placeholder for comments % \begin{macrocode} -% -\def\Etoc@getnb@nohyp #1#2#3\etoc@{% - \def\Etoc@getname ##1\relax\relax\etoc@{% - \@namedef{etocname }{\leavevmode ##1}% - \def\etocthename{##1}% +\def\Etoc@getnb@nohyp #1#2#3\etoc@ {% + \def\Etoc@getname ##1\relax\relax\etoc@ {% + \@namedef {etocname }{\leavevmode ##1}% + \def\etocthename {##1}% + \def\etocthelinkedname {##1}% }% \ifx #1\numberline - \@namedef{etocnumber }{\leavevmode #2}% - \def\etocthenumber{#2}% + \@namedef {etocnumber }{\leavevmode #2}% + \def\etocthenumber {#2}% + \def\etocthelinkednumber {#2}% \Etoc@numbertrue \Etoc@getname #3\etoc@ - \else - \@namedef{etocnumber }{\leavevmode}% - \def\etocthenumber{}% + \else % then \etocthename and \etocthelinkedname already defined + \@namedef {etocnumber }{\leavevmode}% + \def\etocthenumber {}% + \def\etocthelinkednumber {}% \Etoc@numberfalse \fi } % \end{macrocode} % placeholder for comments % \begin{macrocode} -\def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@{% - \@namedef{etoclink }##1{#1{#2}{#3}{##1}#5}% - \def\Etoc@getname ##1\relax\relax\etoc@{% - \@namedef{etocname }{\leavevmode #1{#2}{#3}{##1}#5}% - \def\etocthename{##1}% - }% - \def\Etoc@getnbr ##1##2##3\etoc@{% - \ifx ##1\numberline - \@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##2}#5}% - \def\etocthenumber{##2}% - \Etoc@numbertrue - \Etoc@getname ##3\etoc@ - \else - \@namedef{etocnumber }{\leavevmode}% - \def\etocthenumber{}% - \Etoc@numberfalse - \def\etocthename{#4}% - \fi}% +\def\Etoc@getnb@hyp #1#2#3#4#5#6\etoc@ {% + \def\Etoc@getname ##1\relax\relax\etoc@ {% + \@namedef {etocname }{\leavevmode #1{#2}{#3}{##1}#5}% + \def\etocthename {##1}% + \toks@ {##1}% + \edef\etocthelinkedname {\noexpand\hyperlink {#3}{\the\toks@}}% + }% + \def\Etoc@getnbr ##1##2##3\etoc@ {% + \ifx ##1\numberline + \@namedef {etocnumber }{\leavevmode #1{#2}{#3}{##2}#5}% + \def\etocthenumber {##2}% + \toks@ {##2}% + \edef\etocthelinkednumber {\noexpand\hyperlink {#3}{\the\toks@}}% + \Etoc@numbertrue + \Etoc@getname ##3\etoc@ + \else + \@namedef {etocnumber }{\leavevmode}% + \def\etocthenumber {}% + \def\etocthelinkednumber {}% + \Etoc@numberfalse + \def\etocthename {#4}% + \toks@ {#4}% + \edef\etocthelinkedname {\noexpand\hyperlink {#3}{\the\toks@}}% + \fi + }% + \@namedef {etoclink }##1{\leavevmode #1{#2}{#3}{##1}#5}% + \edef\etocthelink ##1{\noexpand\hyperlink {#3}{##1}}% \Etoc@getnbr #4\relax\relax\etoc@ } % \end{macrocode} % placeholder for comments % \begin{macrocode} -\def\Etoc@getit@nohyp #1\hspace#2#3\etoc@{% - \def\Etoc@getname ##1\hspace\relax\etoc@{% - \@namedef{etocname }{\leavevmode ##1}% - \def\etocthename{##1}% +\def\Etoc@getit@nohyp #1\hspace#2#3\etoc@ {% + \def\Etoc@getname ##1\hspace\relax\etoc@ {% + \@namedef {etocname }{\leavevmode ##1}% + \def\etocthename {##1}% + \def\etocthelinkedname {##1}% }% \ifx\relax#2\else - \@namedef{etocnumber }{\leavevmode #1}% - \def\etocthenumber{#1}% + \@namedef {etocnumber }{\leavevmode #1}% + \def\etocthenumber {#1}% + \def\etocthelinkednumber {#1}% \Etoc@numbertrue \Etoc@getname #3\etoc@ \fi @@ -4254,22 +4389,35 @@ release. % \end{macrocode} % placeholder for comments % \begin{macrocode} -\def\Etoc@getit@hyp #1#2#3#4#5#6\etoc@{% - \def\Etoc@getname ##1\hspace\relax\etoc@{% - \@namedef{etocname }{\leavevmode #1{#2}{#3}{##1}#5}% - \def\etocthename{##1}% +\def\Etoc@getit@hyp #1#2#3#4#5#6\etoc@ {% + \def\Etoc@getname ##1\hspace\relax\etoc@ {% + \@namedef {etocname }{\leavevmode #1{#2}{#3}{##1}#5}% + \def\etocthename {##1}% + \toks@ {##1}% + \edef\etocthelinkedname {\noexpand\hyperlink {#3}{\the\toks@}}% }% - \def\Etoc@getnbr ##1\hspace##2##3\etoc@{% + \def\Etoc@getnbr ##1\hspace##2##3\etoc@ {% \ifx\relax##2\else - \@namedef{etocnumber }{\leavevmode #1{#2}{#3}{##1}#5}% - \def\etocthenumber{##1}% + \@namedef {etocnumber }{\leavevmode #1{#2}{#3}{##1}#5}% + \def\etocthenumber {##1}% + \toks@ {##1}% + \edef\etocthelinkednumber {\noexpand\hyperlink {#3}{\the\toks@}}% \Etoc@numbertrue \Etoc@getname ##3\etoc@ - \fi}% - \Etoc@getnbr #4\hspace\relax\etoc@} + \fi + }% + \Etoc@getnbr #4\hspace\relax\etoc@ +} % \end{macrocode} % placeholder for comments % \begin{macrocode} +\newcommand*\etocthename {} +\newcommand*\etocthenumber {} +\newcommand*\etocthepage {} +\newcommand*\etocthelinkedname {} +\newcommand*\etocthelinkednumber {} +\newcommand*\etocthelinkedpage {} +\newcommand*\etocthelink {} \DeclareRobustCommand*{\etocname} {} \DeclareRobustCommand*{\etocnumber}{} \DeclareRobustCommand*{\etocpage} {} @@ -4408,16 +4556,19 @@ release. \Etoc@tableofcontents}% \endgroup\ifEtoc@mustclosegroup\endgroup\fi} % \end{macrocode} -% placeholder for comments +% |[2013/03/07]|: I discover a \csa{@namedef} trick to construct the +% \csa{Etoc@again} space delimited macro:\\ +% | \@namedef {Etoc@again} {...stuff...}|\\ +% Original version was (copied from analogous stuff in |source2e|):\\ +% | {\def\1{\Etoc@again}\expandafter\gdef\1 {...stuff...}}|\\ +% and in the end (now that I think about it) I simply use |\@firstofone|.\par % \begin{macrocode} -\def\Etoc@getrefno #1#2\etoc@{#1} +\def\Etoc@getrefno #1#2\etoc@ {#1} \def\Etoc@getref #1{\@ifundefined{r@#1}{0}{\expandafter\expandafter\expandafter \Etoc@getrefno\csname r@#1\endcsname\relax\etoc@}} \def\Etoc@ref#1{\Etoc@localtableofcontents{\Etoc@getref{#1}}} -\def\Etoc@label#1{\label{#1}% - \futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} -{\def\1{\Etoc@again}\expandafter -\gdef\1 {\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents}} +\def\Etoc@label#1{\label{#1}\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} +\@firstofone{\def\Etoc@again} {\futurelet\Etoc@nexttoken\Etoc@t@bleofcontents} % \end{macrocode} % placeholder for comments % \begin{macrocode} @@ -4513,43 +4664,43 @@ release. % \end{macrocode} % placeholder for comments % \begin{macrocode} -\newcommand*\etocfontminustwo{\normalfont \LARGE \bfseries} -\newcommand*\etocfontminusone{\normalfont \large \bfseries} -\newcommand*\etocfontzero{\normalfont \large \bfseries} -\newcommand*\etocfontone{\normalfont \normalsize \bfseries} -\newcommand*\etocfonttwo{\normalfont \normalsize} -\newcommand*\etocfontthree{\normalfont \footnotesize} +\newcommand*\etocfontminustwo {\normalfont \LARGE \bfseries} +\newcommand*\etocfontminusone {\normalfont \large \bfseries} +\newcommand*\etocfontzero {\normalfont \large \bfseries} +\newcommand*\etocfontone {\normalfont \normalsize \bfseries} +\newcommand*\etocfonttwo {\normalfont \normalsize} +\newcommand*\etocfontthree {\normalfont \footnotesize} % \end{macrocode} % placeholder for comments % \begin{macrocode} -\newcommand*\etocsepminustwo{4ex \@plus .5ex \@minus .5ex} -\newcommand*\etocsepminusone{4ex \@plus .5ex \@minus .5ex} -\newcommand*\etocsepzero{2.5ex \@plus .4ex \@minus .4ex} -\newcommand*\etocsepone{1.5ex \@plus .3ex \@minus .3ex} +\newcommand*\etocsepminustwo {4ex \@plus .5ex \@minus .5ex} +\newcommand*\etocsepminusone {4ex \@plus .5ex \@minus .5ex} +\newcommand*\etocsepzero {2.5ex \@plus .4ex \@minus .4ex} +\newcommand*\etocsepone {1.5ex \@plus .3ex \@minus .3ex} %%\newcommand*\etocseptwo{1ex \@plus .15ex \@minus .15ex} % modified in 1.07e -\newcommand*\etocseptwo{.5ex \@plus .1ex \@minus .1ex} -\newcommand*\etocsepthree{.25ex \@plus .05ex \@minus .05ex} +\newcommand*\etocseptwo {.5ex \@plus .1ex \@minus .1ex} +\newcommand*\etocsepthree {.25ex \@plus .05ex \@minus .05ex} % \end{macrocode} % placeholder for comments % \begin{macrocode} -\newcommand*\etocbaselinespreadminustwo{1} -\newcommand*\etocbaselinespreadminusone{1} -\newcommand*\etocbaselinespreadzero{1} -\newcommand*\etocbaselinespreadone{1} -\newcommand*\etocbaselinespreadtwo{1} -\newcommand*\etocbaselinespreadthree{.9} +\newcommand*\etocbaselinespreadminustwo {1} +\newcommand*\etocbaselinespreadminusone {1} +\newcommand*\etocbaselinespreadzero {1} +\newcommand*\etocbaselinespreadone {1} +\newcommand*\etocbaselinespreadtwo {1} +\newcommand*\etocbaselinespreadthree {.9} % \end{macrocode} % placeholder for comments % \begin{macrocode} -\newcommand*\etocminustwoleftmargin{1.5em plus 0.5fil} -\newcommand*\etocminustworightmargin{1.5em plus -0.5fil} -\newcommand*\etocminusoneleftmargin{1em} -\newcommand*\etocminusonerightmargin{1em} -\newcommand*\etoctoclineleaders - {\hbox{\normalfont\normalsize\hb@xt@2ex {\hss.\hss}}} -\newcommand*\etocabbrevpagename{p.~} -\newcommand*\etocpartname{\partname} -\newcommand*\etocbookname{Book} +\newcommand*\etocminustwoleftmargin {1.5em plus 0.5fil} +\newcommand*\etocminustworightmargin {1.5em plus -0.5fil} +\newcommand*\etocminusoneleftmargin {1em} +\newcommand*\etocminusonerightmargin {1em} +\newcommand*\etoctoclineleaders + {\hbox{\normalfont\normalsize\hb@xt@2ex {\hss.\hss}}} +\newcommand*\etocabbrevpagename {p.~} +\newcommand*\etocpartname {\partname} +\newcommand*\etocbookname {Book} % \end{macrocode} % placeholder for comments % The macro \csa{etocdefaultlines} was initially called \csa{etoctoclines}. Now @@ -5078,7 +5229,7 @@ release. \newcommand*\etocstandardlines{\Etoc@standardtrue} \newcommand*\etoctoclines{\Etoc@standardfalse} % 1.07b \etocdefaultlines % for initialization -\etocstandardlines % removed silly AtBeginDocument temporarily added for 1.07 +\etocstandardlines \etocstandarddisplaystyle \endinput % \end{macrocode} @@ -5099,7 +5250,7 @@ release. Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum{2532} +\CheckSum{2622} \Finale %% diff --git a/Master/texmf-dist/source/latex/etoc/etoc.ins b/Master/texmf-dist/source/latex/etoc/etoc.ins index 745c72f312e..03e47de9e7f 100644 --- a/Master/texmf-dist/source/latex/etoc/etoc.ins +++ b/Master/texmf-dist/source/latex/etoc/etoc.ins @@ -1,7 +1,7 @@ \def\pkgname{etoc} -\def\pkgdate{2013/03/01} -\def\pkgversion{v1.07e} -\def\pkgdescription{easily customizable TOCs (jfB)} +\def\pkgdate{2013/03/07} +\def\pkgversion{v1.07f} +\def\pkgdescription{Completely customisable TOCs (jfB)} %% %% Package `etoc' by Jean-Francois Burnol %% Copyright (C) 2012, 2013 by Jean-Francois Burnol @@ -12,13 +12,11 @@ %% As usual `latex etoc.ins' produces `etoc.sty' from the source `etoc.dtx' %% (an already existing etoc.sty in the same repertory will be overwritten) %% -%% Put the `etoc.sty' file in a suitable location within the TeX -%% installation: etoc.sty -> ................/tex/latex/etoc/ +%% Move `etoc.sty' to a suitable location: +%% etoc.sty -> <TDS>/tex/latex/etoc/etoc.sty %% -%% The generated auxiliary files may be discarded. -%% -%% See `etoc.dtx' for the statements of copyright and conditions of -%% distribution or modification. +%% The generated auxiliary files may be discarded. See `etoc.dtx' for the +%% statements of copyright and conditions of distribution or modification. %% \input docstrip.tex \askforoverwritefalse |