From baa1b33f09a2124bfd68ba5f26e347bc9e3f3170 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 4 Jul 2018 21:27:36 +0000 Subject: etoc (4jul18) git-svn-id: svn://tug.org/texlive/trunk@48136 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/etoc/etoc.sty | 58 ++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 8 deletions(-) (limited to 'Master/texmf-dist/tex/latex/etoc') diff --git a/Master/texmf-dist/tex/latex/etoc/etoc.sty b/Master/texmf-dist/tex/latex/etoc/etoc.sty index 9b6277c8b90..4cb310fe559 100644 --- a/Master/texmf-dist/tex/latex/etoc/etoc.sty +++ b/Master/texmf-dist/tex/latex/etoc/etoc.sty @@ -23,10 +23,10 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{etoc} - [2018/06/15 v1.08o Completely customisable TOCs (JFB)] + [2018/07/04 v1.08p Completely customisable TOCs (JFB)] %% %% Package: etoc -%% Version: 1.08o-2018/06/15 +%% Version: 1.08p-2018/07/04 %% License: LPPL 1.3c %% Copyright (C) 2012-2018 Jean-Francois Burnol %% @@ -72,6 +72,7 @@ \newif\ifEtoc@notocifnotoc % 1.08e \def\etocnotocifnotoc {\Etoc@checksemptinesstrue\Etoc@notocifnotoctrue } \def\etoc@{\etoc@} +\newif\ifEtoc@bracedname % 1.08p \newcounter{etoc@tocid} \newcounter{etoc@tocdepth}% 1.07g \@ifclassloaded{memoir}{\def\Etoc@minf{-\thr@@}}{\def\Etoc@minf{-\tw@}} @@ -343,12 +344,12 @@ \futurelet\Etoc@getthepage@token \Etoc@getthepage #2\etoc@ % defines \etocthelinkedpage \futurelet\Etoc@getnb@token - \Etoc@getnb #1\relax\relax\etoc@ % sets number, name, and \etocthelink + \Etoc@@getnb #1\relax\relax\etoc@ % sets number, name, and \etocthelink \ifEtoc@number \else \ifnum\Etoc@level=\m@ne \futurelet\Etoc@getit@token - \Etoc@getit #1\hspace\relax\etoc@ % additional job for parts + \Etoc@@getit #1\hspace\relax\etoc@ % additional job for parts \fi \fi \Etoc@global\expandafter\let\csname etoclink \endcsname\etocthelink @@ -376,6 +377,28 @@ {\expandafter\hyperlink \Etoc@tmp{#4}}% \Etoc@global\edef\etocthelink##1{\noexpand\hyperlink\Etoc@tmp{##1}}% } +\def\Etoc@@getnb {% + \Etoc@bracednamefalse + \ifx\Etoc@getnb@token\bgroup + \expandafter\Etoc@getnb@checkifbraced + \else + \expandafter\Etoc@getnb + \fi +} +\def\Etoc@tworelax{\relax\relax} +\def\Etoc@getnb@checkifbraced #1#2\etoc@ {% + \def\Etoc@tmp{#2}% + \ifx\Etoc@tmp\Etoc@tworelax + \expandafter\expandafter\expandafter\Etoc@getnb@nameisbraced + \expandafter\@firstofone + \else + \expandafter\Etoc@getnb + \fi {#1}#2\etoc@ +} +\def\Etoc@getnb@nameisbraced {% + \Etoc@bracednametrue + \futurelet\Etoc@getnb@token\Etoc@getnb +} \def\Etoc@getnb {% \ifx\Etoc@getnb@token\bgroup \expandafter\Etoc@getnb@nohyp@nonbr @@ -407,8 +430,13 @@ \Etoc@global\Etoc@numbertrue \Etoc@global\def\etocthenumber {#2}% \Etoc@global\def\etocthelinkednumber {#2}% - \Etoc@global\def\etocthename {#3}% - \Etoc@global\def\etocthelinkedname {#3}% + \ifEtoc@bracedname + \Etoc@global\def\etocthename {{#3}}% + \Etoc@global\def\etocthelinkedname {{#3}}% + \else + \Etoc@global\def\etocthename {#3}% + \Etoc@global\def\etocthelinkedname {#3}% + \fi } \def\Etoc@getnb@nohyp@nonbr #1\etoc@ {% % \etocthename and \etocthelinkedname already defined in \Etoc@lxyz @@ -455,6 +483,15 @@ \expandafter{\expandafter\hyperlink \Etoc@tmp{#3}}% } \let\Etoc@getnb@hyp@nonbr\Etoc@getnb@nohyp@nonbr +\def\Etoc@@getit{% + \ifEtoc@bracedname + \expandafter\expandafter\expandafter\Etoc@getit@nameisbraced + \expandafter\@firstofone + \else + \expandafter\Etoc@getit + \fi +} +\def\Etoc@getit@nameisbraced {\futurelet\Etoc@getit@token\Etoc@getit } \def\Etoc@getit {% \if1\ifEtoc@hyperref \ifx\hyper@linkstart\Etoc@getit@token1\else0\fi @@ -474,8 +511,13 @@ \fi } \def\Etoc@getit@nohyp@getname #1\hspace\relax\etoc@ {% - \Etoc@global\def\etocthename {#1}% - \Etoc@global\def\etocthelinkedname {#1}% + \ifEtoc@bracedname + \Etoc@global\def\etocthename {{#1}}% + \Etoc@global\def\etocthelinkedname {{#1}}% + \else + \Etoc@global\def\etocthename {#1}% + \Etoc@global\def\etocthelinkedname {#1}% + \fi } \def\Etoc@getit@hyp #1#2#3#4#5#6\etoc@ {% \edef\Etoc@tmp {{#3}}% -- cgit v1.2.3