Skip to content

Commit

Permalink
Remove NonStruct from footnote label (#1481)
Browse files Browse the repository at this point in the history
* remove unneeded NonStruct in footnote tagging

* improve docu

* more test files.

* title testfiles

* one more testfile

* clarify temporary tagsupport status
  • Loading branch information
u-fischer authored Oct 2, 2024
1 parent fc9af85 commit 948c666
Show file tree
Hide file tree
Showing 73 changed files with 8,113 additions and 8,341 deletions.
2 changes: 2 additions & 0 deletions required/latex-lab/changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2024-09-30 Ulrike Fischer <[email protected]>
* latex-lab-footnotes.dtx: remove unneeded NonStruct structure.

2024-09-30 Frank Mittelbach <[email protected]>
* latex-lab-math.dtx (subsection{Content grabbing}):
Expand Down
68 changes: 43 additions & 25 deletions required/latex-lab/latex-lab-footnotes.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
%
% for those people who are interested or want to report an issue.
%
\def\ltlabfootnotedate{2024-09-24}
\def\ltlabfootnoteversion{0.8f}
\def\ltlabfootnotedate{2024-09-30}
\def\ltlabfootnoteversion{0.8g}

%<*driver>
\documentclass{l3doc}
Expand Down Expand Up @@ -228,7 +228,8 @@
%
% To cater for different layout configurations there are four
% sockets that can be set by a package or
% class but there should be only one per document setting them, i.e., if two packages/classes set them they are mutually
% class but there should be only one per document setting them,
% i.e., if two packages/classes set them they are mutually
% incompatible (or rather the last one wins most likely).
% These are:
% \begin{description}
Expand Down Expand Up @@ -491,43 +492,67 @@
% \subsection{Technical details for the tagging}
%
% The following sockets are set up for kernel use, when doing tagging:
% There name and/or function will probably change as they currently
% mix tagging with the link support.
%
% TODO: review this sockets
% \begin{description}
% \item[\socket{tagsupport/fnmark} (1 argument)]
%
% \DescribeSocket[noprint]{tagsupport/fnmark}
%
%
% The socket is used in \cs{@footnotemark}/\cs{fnote_footnotemark:}
% and takes \cs{@makefnmark} as argument. It prints the mark in the text
% and surrounds it with a tagging structure and a link. As such it is
% not solely for tagging and so should not be used with \cs{UseTaggingSocket}
% as this would swallow the argument and loose the link support.
%
% \fmi{describe and decide on names}
%
%
% \item[\socket{tagsupport/fntext/begin} (no argument)]
%
% \DescribeSocket[noprint]{tagsupport/fntext/begin}
%
% This socket is used before the main processing socket
% (so before the \cs{insert} command). It opens the FEnote structure.
% As it sets also the tl-var for the current structure and this is used
% in destinations it should not use as tagging socket.
%
%
% \item[\socket{tagsupport/fntext/end} (no argument)]
%
% \DescribeSocket[noprint]{tagsupport/fntext/end}
%
% This socket is used after the main processing socket
% (so after the \cs{insert} command). It closes the FEnote structure.
%
% \item[\socket{tagsupport/fntext/mark} (1 argument)]
%
% \DescribeSocket[noprint]{tagsupport/fntext/mark}
%
%
% This socket is used around the mark in the footnote text.
% It adds tagging support but also link support, so like the other
% tagsupport sockets it should be always active.
%
% \item[\socket{tagsupport/fntext/text} (1 argument)]
%
% \DescribeSocket[noprint]{tagsupport/fntext/text}
%
% This socket handles mc-chunks around the text of the footnote. As it
% takes an argument (the text) is should not be use as tagging socket either.
%
% \end{description}
%
%
% The \emph{footnotemark} should create a \texttt{/Lbl} structure\footnote{to make it easier
% to identify the role we use \texttt{/footnotemark} which we rolemap to \texttt{/Lbl}} that should contain a \texttt{/Ref} entry pointing
% to identify the role we use \texttt{/footnotemark} which we rolemap to \texttt{/Lbl}}
% that should contain a \texttt{/Ref} entry pointing
% to the structure of the \emph{footnotetext}.
%
% The \emph{footnotetext} should create a \texttt{/FENote}\footnote{We tag it as \texttt{/footnote} and role map it.}
% structure with a \texttt{/Ref}
% The \emph{footnotetext} should create a \texttt{/FENote}%
% \footnote{We tag it as \texttt{/footnote} and role map it.}
% structure with a \texttt{/Ref}
% entry pointing to the structures of \emph{all} marks related to the note.
% The mark at the begin of the
% note is in a \texttt{/Lbl}\footnote{We tag it as \texttt{/footnotelabel}.}
Expand Down Expand Up @@ -582,8 +607,8 @@
% with their own structure number as a key in a property.
%
% A following \cs{footnotetext} compares its own \cs{@thefnmark} with the values in
% the prop. If there is a match it stores the structure numbers and removes the entries
% from the properties (so in a normal document the property will never contain more than
% the prop. If there is one or more match it stores the structure numbers and removes the entries
% from the property (so in a normal document the property will never contain more than
% a few entries).
%
% This works well as long as the \cs{footnotemark} commands are issued before the \cs{footnotetext} and
Expand Down Expand Up @@ -626,9 +651,9 @@
%
% \subsubsection{\cs{footref}}
%
% \cs{footref} use internally the same command to set the mark as \cs{footnotemark}, it only
% \cs{footref} uses internally the same command to set the mark as \cs{footnotemark}, it only
% defines \cs{@thefnmark} differently. This \cs{@thefnmark} is not suitable for the method described
% above, as it contains a reference command it can't be used to match a note, also \cs{footref} can
% above: as it contains a reference command it can't be used to match a note, also \cs{footref} can
% be used after the note has already been set. \cs{footref} disables therefore the automatic detection.
%
% Instead the \cs{label} command is
Expand Down Expand Up @@ -672,7 +697,7 @@
%
% A \cs{footnotetext} creates a bunch of destinations (in most cases this sums up to
% two destinations): one for every structure number in the \texttt{/Ref} (used as target
% by the mark commands) and one for the structure number of the footnotetest itself
% by the mark commands) and one for the structure number of the footnotetext itself
% (used as target by \cs{footref}s commands).
%
% \subsection{Implementation details regarding tagging}
Expand Down Expand Up @@ -899,8 +924,8 @@
% This is used to pass the structure number of the note around, e.g.
% to a label inside the note.
% \begin{macrocode}
\tl_new:N \l_@@_currentstruct_tl
\tl_set:Nn \l_@@_currentstruct_tl {1}
\tl_new:N \l_@@_currentstruct_tl
\tl_set:Nn \l_@@_currentstruct_tl {2}
% \end{macrocode}
%
%
Expand Down Expand Up @@ -1997,11 +2022,7 @@
% \begin{macrocode}
\tl_set:Ne \l_@@_currentstruct_tl { \tag_get:n{struct_num} }
% \end{macrocode}
% We want to move the label structure here. So we provide a container
% It number is |\l__fnote_currentstruct_tl| plus 1.
% \begin{macrocode}
\tag_struct_begin:n { tag=footnotelabel }\tag_struct_end:
% \end{macrocode}
%
% after we have opened the structure we can use the structure number to
% try to detect the connected marks. As with the marks we assume that sometimes
% no auto detection is done.
Expand Down Expand Up @@ -2084,12 +2105,9 @@
\MakeLinkTarget*{footnote*.\l_@@_currentstruct_tl}
% \end{macrocode}
% Now we add the tagging commands. We move the structure of the label to
% to the container at the begin of the note.
% \begin{NOTE}{UF}
% Check if the NonStruct is really needed. Perhaps we can simply move the mc.
% \end{NOTE}
% the begin of the footnote structure.
% \begin{macrocode}
\tag_struct_begin:n { tag=NonStruct,parent=\l_@@_currentstruct_tl +1 }
\tag_struct_begin:n { tag=footnotelabel,parent=\l_@@_currentstruct_tl,firstkid }
\tag_mc_begin:n { tag=Lbl }
#1
\tag_mc_end:
Expand Down
Loading

0 comments on commit 948c666

Please sign in to comment.