1

In my document, there is text that takes up the whole page. At the end of the last paragraph is a longtable made with the tabularray package.The position of the table is at the very beginning of the second page, but in this case the table is completely deformed.

I have tried making the table by removing the position or specifying it to be at the bottom of the page (i.e \begin{table}[h], or \begin{table}[b], or \begin{table}) but in all cases the table remains unconfigured.

Below is the MWE and some images.

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[portuguese]{babel}
\usepackage{blindtext}
\usepackage{tabularray}
\begin{document}
\blindtext[4]\par%
%
\begin{table}[h]
\centering
\begin{longtblr}[%
presep=0.75\bigskipamount,
postsep=\parskip,
headsep=12pt,
caption={The caption},
label={TAB:Example},
note{a}={Note 1},%
note{b}={Note 2},
note{c}={Note 3}
]{%
colspec = {%
X[m,l]%
X[m,l]%
X[c,m]%
X[c,m]%
}}
\hline
\textbf{Col 1} & \textbf{Col 2} & \textbf{Col 3} & \textbf{Col 4} & \textbf{Col 5} \\
\hline
\SetCell[r=3]{l,h} Example & Example \TblrNote{b} & 6 & 5,99 & 99,92 \\
                           & Example \TblrNote{c} & 5 & 5,26 & 95,14 \\
                           & \SetCell[r=1,c=1]{l,t} Example \TblrNote{b} Example \TblrNote{c} & 6 & 5,37 & 89,46 \\
                           & & & & \\
\SetCell[r=2]{l,h} Example & Example & 5 & 4,80 & 96,07 \\
                                     & Example \TblrNote{b} & 6 & 5,73 & 95,55 \\
\hline
\end{longtblr}%
\end{table}%
\end{document}

enter image description here

The table should look like this

enter image description here

2
  • 1
    a longtable inside a table environment doesn't make sense. It can't break anyway. Commented Jan 6, 2023 at 23:13
  • 1
    I can't reproduce table as you show in question. I ger table as you like to have.
    – Zarko
    Commented Jan 7, 2023 at 0:19

1 Answer 1

1
  • Provided MWE doesn't reproduce showed image, provided MWE works fine. Iz produce image of table which you show as desired result.
  • Blind text is longer than one page, it has one orphan line on the next page.
  • After this text line follows longtblr

For test I little bit modify your MWE (comment not used packages and table options, add first row style and option for table headers, all this changes doesn't influence on compilation result):

\documentclass[12pt,a4paper]{article}
%\usepackage[utf8]{inputenc}   % not needed anymore
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[portuguese]{babel}
\usepackage{blindtext}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}      % added, for better looking table

\begin{document}
\blindtext[4]%\par

%\begin{table}[h]              % longtblr (as any long table, had not to be encapsulated in table float
%\centering
    \begin{longtblr}[%
%presep=0.75\bigskipamount,
%postsep=\parskip,
%headsep=12pt,
caption = {The caption},
  label = {TAB:Example},
 note{a}={Note 1}, 
 note{b}={Note 2},
 note{c}={Note 3}
                    ]{colspec = {*{2}{X[l]}
                                 *{3}{X[c]}
                                 },   
                      row{1}  ={font=\bfseries, c},
                      rowhead = 1, 
                      }
    \toprule
Col 1   & Col 2 & Col 3 & Col 4 & Col 5      \\
    \midrule
\SetCell[r=3]{l,h}    Example 
    &   Example \TblrNote{b} 
                & 6     & 5,99  & 99,92     \\
    &   Example \TblrNote{c} 
                & 5     & 5,26  & 95,14     \\
    & \SetCell[r=1,c=1]{l,m} Example\TblrNote{b} Example \TblrNote{c}
                & 6     & 5,37  & 89,46     \\
\SetCell[r=2]{l,h} Example 
    & Example   & 5     & 4,80  & 96,07     \\
    & Example \TblrNote{b} 
                & 6     & 5,73  & 95,55     \\
    \bottomrule
\end{longtblr}
%\end{table}%

\blindtext
\end{document}

The (top part of the) second page of article looks as follows:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .