Skip to content

Commit

Permalink
Fix #22
Browse files Browse the repository at this point in the history
  • Loading branch information
jfbu committed Jan 14, 2024
1 parent 7b77ab8 commit 6dfe94e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
15 changes: 15 additions & 0 deletions etoc.sty
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@
%% As ``to toc'' will use some \csa{addcontentsline}, we must make
%% \ctanpkg{hyperref} happy and also define the suitable |toclevel@| prefixed
%% extra macros.
%% ATTENTION! this means that \csa{toclevel@#1} will exist as \csa{relax} if
%% it did not exist beforehand (and then |\toclevel@@#1->\toclevel#1|).
\expandafter\edef\csname toclevel@@#1\endcsname
{\expandafter\noexpand\csname toclevel@#1\endcsname}%
%% TODO: review next code/comment in tagpdf context
Expand Down Expand Up @@ -392,6 +394,8 @@
}%
\let\etocthetocitembegintag\@empty
\let\etocthetocitemendtag\@empty
%% TODO check how this is called in LaTeX3 and use theirs
\protected\def\etoc@namedef#1{\expandafter\def\csname#1\endcsname}%
\def\Etoc@etoccontentsline@ #1#2#3#4{%
\Etoc@doendsandbegin
%% Experimental tagging support at \etocrelease{1.2e}. We need to manually
Expand Down Expand Up @@ -428,6 +432,9 @@
%% against \csa{edef} as \csa{etocthename} and one should use
%% \csa{protected@edef} when using it, or a single expansion.
\Etoc@global\edef\etocthetocitembegintag{%
\@ifundefined{toclevel@#1}%
{\etoc@namedef{toclevel@#1}{\the\numexpr\Etoc@level}}%
{}%
\__tag_toc_contentsline_begin:nnn
{#1}{\unexpanded\expandafter{\etocthename}}{#4}%
\tag_struct_begin:n{tag=Reference}%
Expand All @@ -443,6 +450,13 @@
}%
\fi
\ifEtoc@tagging
%% UPDATE: latex-lab needs \csa{toclevel@#1} and sets it
%% to 1 if it does not exist. But then a problem arise if
%% the actual level is 0, with a tocdepth at 0... \etocissue{22}!
\@ifundefined{toclevel@#1}%
{\etoc@namedef{toclevel@#1}{\the\numexpr\Etoc@level}}%
{}%
%%
%% TODO: this ties the hierarchy of levels to the one expected
%% by the kernel code which is probably good. Once I will have
%% understood better though the tagging business perhaps I should
Expand Down Expand Up @@ -1780,6 +1794,7 @@
%% in an \csa{hbox},
%% cf \url{https://github.com/latex3/tagging-project#54}
%% The location of these things is provisory.
%% cf \etocissue{17}.
\sbox\z@{%
\ifEtoc@tagactive
\AssignSocketPlug{tagsupport/minipage/before}{noop}%
Expand Down
16 changes: 2 additions & 14 deletions test_snippets/errorsummary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!!!! PROBLÈMES AVEC 8/18 TESTS:
!!!! PROBLÈMES AVEC 7/18 TESTS:
testsnippet-01.tex

! Package tagpdf Error: Parent-Child 'TOC/' --> 'enumerate/user'.
Expand Down Expand Up @@ -43,17 +43,6 @@ Type <return> to continue.

l.33 \endgroup

testsnippet-14.tex

! Package tagpdf Error: Parent-Child 'TOC/' --> 'Reference/pdf'.
(tagpdf) Relation is not allowed (struct 6, /TOC --> struct
(tagpdf) 7) on line 25

Type <return> to continue.
...

l.25 ...ed within this document: \tableofcontents.

testsnippet-19.tex

! Package tagpdf Error: Parent-Child 'Reference/' --> 'text-unit/user'.
Expand Down Expand Up @@ -87,12 +76,11 @@ Type <return> to continue.

l.6 ...ed\MyQuasiStandardTOC\MyQuasiStandardTOC{1}
\else
FAIL=8, PASS=10, TOTAL=18
FAIL=7, PASS=11, TOTAL=18
fail: testsnippet-01.tex
fail: testsnippet-02.tex
fail: testsnippet-04.tex
fail: testsnippet-12.tex
fail: testsnippet-14.tex
fail: testsnippet-19.tex
fail: testsnippet-20.tex
fail: testsnippet-25.tex

0 comments on commit 6dfe94e

Please sign in to comment.