Replies: 1 comment 1 reply
|
I was able to create an implementation example that solved the above two requests.
Implementation\newcounter{countTblrNote}
\newcommand{\countStyle}[1]{\arabic{#1}}
\renewcommand{\thecountTblrNote}{\countStyle{countTblrNote}}
\ExplSyntaxOn
\NewDocumentCommand \newTblrNote { m }
{
\cs_if_exist:NT \hypersetup { \ExpTblrTemplate { note-border }{ normal } }
{
\refstepcounter{countTblrNote}
\label{tblrnote\int_to_arabic:n {\g__tblr_table_count_int}:#1}
\TblrOverlap
{
\__tblr_hyper_link:nn {#1}
{
\textsuperscript {
\UseTblrFont { note-tag }
\textasteriskcentered
\countStyle{countTblrNote}
}
}
}
}
}
\DefTblrTemplate{note-tag}{clossReference}
{
\textsuperscript{
\UseTblrFont{note-tag}
\textasteriskcentered
\ref{tblrnote\int_to_arabic:n {\g__tblr_table_count_int}:\InsertTblrNoteTag}
}
}
\ExplSyntaxOff
\SetTblrTemplate{note-tag}{clossReference}
\DefTblrTemplate{lastfoot}{clossReference}{
\UseTblrTemplate{note}{default}
\UseTblrTemplate{remark}{default}
\setcounter{countTblrNote}{0}
}
\SetTblrTemplate{lastfoot}{clossReference}
\SetTblrStyle{note-tag}{ font = \sffamily }
\SetTblrStyle{note}{ hang = 2em, font = \footnotesize }By using this, table footnotes can be automatically numbered for the following tables. \begin{talltblr}[
caption = {First table},
note{X} = {It is the first footnote in the first table},
note{a} = {It is the second footnote in the first table},
]{
colspec = {XXX}, width = 0.5\linewidth, hlines,
}
Alpha & Beta & Gamma \\
Epsilon & Zeta & Eta\newTblrNote{X} \\
Iota & Kappa & Lambda\newTblrNote{a} \\
\end{talltblr}
\vspace{0.5em}
\rule{0.8\linewidth}{0.5pt}
\vspace{0.5em}
\begin{talltblr}[
caption = {When referring to tags in the first table},
note{a} = {Same label name as the first table footnote, but refers to the table footnote for the second table},
note{X} = {The first table footnote cannot be closs-referenced},
]{
colspec = {XXX}, width = 0.5\linewidth, hlines,
}
Alpha & Beta & Gamma \\
Epsilon & Zeta & Eta\newTblrNote{a} \\
Iota & Kappa & Lambda \\
\end{talltblr}Duplicate table footnote tagsThis implementation can not handle duplicate table footnotes such as the following: \begin{talltblr}[
caption = {When tags are duplicated},
note{Dup} = {Duplicate table footnotes do not have the same footnote number},
]{
colspec = {XXX}, width = 0.5\linewidth, hlines,
}
Alpha & Beta & Gamma \\
Epsilon & Zeta & Eta\newTblrNote{Dup} \\
Iota & Kappa & Lambda\newTblrNote{Dup} \\
\end{talltblr}To avoid this, I considered rewriting \newcounter{countTblrNote}
\newcommand{\countStyle}[1]{\arabic{#1}}
\renewcommand{\thecountTblrNote}{\countStyle{countTblrNote}}
\ExplSyntaxOn
\NewDocumentCommand \newTblrNote { s m }
{
\cs_if_exist:NT \hypersetup { \ExpTblrTemplate { note-border }{ normal } }
\IfBooleanTF { #1 }
{
\TblrOverlap
{
\__tblr_hyper_link:nn {#2}
{
\textsuperscript {
\UseTblrFont { note-tag } \textasteriskcentered
\ref{tblrnote\int_to_arabic:n {\g__tblr_table_count_int}:#2}
}
}
}
}
{
\refstepcounter{countTblrNote}
\label{tblrnote\int_to_arabic:n {\g__tblr_table_count_int}:#2}
\TblrOverlap
{
\__tblr_hyper_link:nn {#2}
{
\textsuperscript {
\UseTblrFont { note-tag }
\textasteriskcentered
\countStyle{countTblrNote}
}
}
}
}
}
\ExplSyntaxOffNow, you can give \begin{talltblr}[
caption = {When tags are duplicated},
note{Dup} = {This implementation can handle duplicate tags},
]{
colspec = {XXX}, width = 0.5\linewidth, hlines,
}
Alpha & Beta & Gamma \\
Epsilon & Zeta & Eta\newTblrNote{Dup} \\
Iota & Kappa & Lambda\newTblrNote*{Dup} \\
\end{talltblr}However, considering the possibility of rearranging etc. later, this workaround is not practical. This is an ad hoc workaround. Automatic sorting of
|
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Currently,
noteand\TblrNoteprovided by tabularray require manual tagging. However, specifying tags manually is tedious, and it would be much easier if the tags were numbered automatically.Requirement
notesIs there anything else we should implement?
Example of table code
Help
Please give me any ideas or specific implementation examples regarding automatic numbering of table footnotes like this.
All reactions