TeX - LaTeX Asked by aejh on November 12, 2020
I’ve got some data in an expl3 sequence, which I’m using in a longtable. All works fine, but I’m getting an additional blank row after the inline map body. MWE:
documentclass{article}
usepackage{expl3}
usepackage{xparse}
usepackage{longtable}
ExplSyntaxOn
NewDocumentCommand{printData}{}
{
begin{longtable}{l}
hline
Minimal~Working~Example
hline
endhead
End
hline
endfoot
clist_map_inline:nn
{comma,separated,list,of,data,also,fails,with,seq}
{
##1
hline
}
% Uncomment to fill the blank row
% Mystery row here! hline
end{longtable}
}
ExplSyntaxOff
begin{document}
printData
end{document}
Which produces:
The intention is for the final loop of the inline map to close with an hline
, running straight into the footer. I’m on an older version of texlive and pdflatex (from Ubuntu 18.04), but this error is also present on overleaf, which I’m assuming is up to date, so I presume the error is mine.
Use clist_map_function:nN
otherwise a cell would be started; to the contrary, clist_map_function:nN
delivers its complete result before anything that TeX takes as the start of a cell is considered.
Tables are well known to be a source of problems of this kind.
documentclass{article}
usepackage{expl3}
usepackage{xparse}
usepackage{longtable}
ExplSyntaxOn
NewDocumentCommand{printData}{}
{
begin{longtable}{l}
hline
Minimal~Working~Example
hline
endhead
End
hline
endfoot
clist_map_function:nN {comma,separated,list,of,data} aejh_entry:n
end{longtable}
}
cs_new_protected:Nn aejh_entry:n { #1 hline }
ExplSyntaxOff
begin{document}
printData
end{document}
Correct answer by egreg on November 12, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP