5

I am making a long table using longtblr from the tabularray package. This table has some notes and footers, which appear on the last page where the table is.

I want to know if there is any way to put at the bottom of the table, on every page it is on, all the remarks (remark={text}) and the footers (note={text}), keeping the text "Continued on next page".

\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tabularray}
\usepackage{blindtext}
\begin{document}

\begin{longtblr}[
caption={Caption},
label={tab:label},
remark{Note}={I want this note on every page where the longtblr is}
]{%
hlines,
vlines,
rowhead=1,
colspec={X[l,m]}
}

\textbf{Header}\\
\blindtext \\
\blindtext \\
\blindtext \\
\blindtext \\
\blindtext \\
\blindtext \\
\blindtext \\
\blindtext \\
\end{longtblr}

\end{document}

First and second page:

enter image description here

Last page

enter image description here

1
  • If you have multiline notes or remarks, have a look at the new solution I posted.
    – marv
    Jan 21 at 11:04

2 Answers 2

8

You may define a new theme with the note in the continuation text in the foot by defining a new template for the continuation text.

\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tabularray}
\usepackage{blindtext}

%-----------------------added----------------------------
\NewTblrTheme{MyTheme}{
    \DefTblrTemplate{contfoot-text}{MyTmp}{%
            \raggedright\UseTblrTemplate{remark}{default}
            Continued on next page
    }
    \SetTblrTemplate{contfoot-text}{MyTmp}
}
%---------------------------------------------------------

\begin{document}
    \begin{longtblr}[
        theme = MyTheme, %<--- added
        caption={Caption},
        label={tab:label},
        remark{Note}={I want this note on every page where the longtblr is}
        ]{%
        hlines,
        vlines,
        rowhead=1,
        colspec={X[l,m]},
    }
        \textbf{Header}\\
        \blindtext \\
        \blindtext \\
        \blindtext \\
        \blindtext \\
        \blindtext \\
        \blindtext \\
        \blindtext \\
        \blindtext \\
    \end{longtblr}
\end{document}  

enter image description here

enter image description here

enter image description here

3

I would like to present an improved solution off Imran's solution. In my opinion, it is better to place the note (and remark) templates inside firstfoot and middlefoot and not in the contfoot-text template. This ensures the correct justification for multiline notes and remarks. Also, for consistency, one should use contfoot template and not hardcode the text.

I choose to specify this as default, but of course you can also use this in a theme as in Imran's solution.

\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tabularray}
\usepackage{blindtext}

% Notes and remarks on every page
\DefTblrTemplate{firstfoot, middlefoot}{default}{%
    \UseTblrTemplate{note}{default}
    \UseTblrTemplate{remark}{default}
    \UseTblrTemplate{contfoot}{default}
}

\begin{document}
    \begin{longtblr}[
        caption={Caption},
        label={tab:label},
        remark{Note}={I want this note on every page where the longtblr is},
        remark{Long Source}={This is a really long source, which will break over several lines. Using the correct templates ensures that the justification remains. With raggedright, the right side of multine notes and remarks will not be justified, which looks odd.}
        ]{%
            hlines,
            vlines,
            rowhead=1,
            colspec={X[l,m]},
        }
        \textbf{Header}\\
        \blindtext \\
        \blindtext \\
        \blindtext \\
        \blindtext \\
        \blindtext \\
        \blindtext \\
    \end{longtblr}
\end{document}

first page

second page

third page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.