TransWikia.com

Add table borders around notes created with package 'threeparttablex'

TeX - LaTeX Asked on April 28, 2021

I need to create a table with notes having the borders like this:

enter image description here

I use the package threeparttablex and it works perfectly for me. The only issue is that I do not know how to keep borders around the notes. The best I was able to do is this (see MWE below):

enter image description here

Can you please help me find ways to add all borders?

(I know there is an alternative solution to add a frame, but I want to make use of the original table borders.)

The minimal working example (MWE):

documentclass{report}
usepackage{longtable}
usepackage{threeparttablex}

begin{document}

begin{ThreePartTable}
    begin{TableNotes}
        item[a] Note A
    end{TableNotes}
    begin{longtable}[c]{ | c | c | }
        caption{Example}hline
        Left & Right hlinehline
        endhead
        % Below command gives only bottom border
        insertTableNoteshline
        % I want borders on all sides like this
        %multicolumn{2}{|l|}{textsuperscript{a} Note A}hline
        endlastfoot
        sample text & texttnote{a} 
        more text & text hline
    end{longtable}
end{ThreePartTable}

end{document}

One Answer

insertTableNotes does multicolumn{<number of cols>}{c}{...}; you can patch it to use {|c|} instead.

documentclass{report}
usepackage{longtable}
usepackage{threeparttablex}
usepackage{etoolbox}

patchcmdinsertTableNotes{{c}}{{|c|}}{}{}

begin{document}

begin{ThreePartTable}
    begin{TableNotes}
        item[a] Note Astrut
    end{TableNotes}
    begin{longtable}[c]{ | c | c | }
        caption{Example}hline
        Left & Right hlinehline
        endhead
        % Below command gives only bottom border
        insertTableNoteshline
        endlastfoot
        sample text & texttnote{a} 
        more text & text hline
    end{longtable}
end{ThreePartTable}

end{document}

Add a strut at the end of the last table note.

enter image description here

Correct answer by egreg on April 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP