Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hborders from the head and the foot when splitting lontblr #493

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sgolovan
Copy link

@sgolovan sgolovan commented Apr 4, 2024

Hi! It's rather a request for comment than a pull request: Currently, the longtblr (and longtabs) environment produces inconsistent hborders for hlines separating the head and the foot from the rest of the table when splitting it into pages. I'm attaching an example (a bit exaggerated) to show this.
tblr.pdf

What I've tried in this PR, is to copy the hborder (actually, the corresponding abovesep and belowsep since they are the only information left after parsing the table initially) from the first page (for the head) and from the last page (for the foot) to the rest of the pages.

The patch is fairly simple, but may be there is a better way.

Here is the test file (the second column is for comparison with booktabs).

\documentclass[a5paper,12pt]{article}
\usepackage[margin=0.5cm]{geometry}
\usepackage{booktabs}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\usepackage{paracol}
\usepackage{xtab}

\setlength{\aboverulesep}{10pt}
\setlength{\belowrulesep}{10pt}

\usepackage{}

\begin{document}
\begin{paracol}{2}

\vspace*{-27.2pt}
\begin{longtabs}
[
 caption = {A Table},
 label = {tblr:test},
]{
 colspec = {lll},
 rowhead = 2,
 rowfoot = 1,
 rows = {rowsep=0pt},
}
\toprule
 Head & Head & Head \\
 Head & Head & Head \\
\midrule
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
\midrule
 Foot & Foot & Foot \\
\bottomrule
\end{longtabs}

\switchcolumn

\centering
\topcaption{A Table} \label{tab:xtab}
\tablefirsthead{
\\[-2ex]
\toprule
 Head & Head & Head \\
 Head & Head & Head \\
\midrule}
\tablehead{\multicolumn{3}{c}{{\tablename\ \thetable: A Table (Continued)}}\\[0.87ex]
\toprule
 Head & Head & Head \\
 Head & Head & Head \\
\midrule}
\tabletail{\midrule
 Foot & Foot & Foot \\
 \bottomrule}
\tablelasttail{\midrule
 Foot & Foot & Foot \\
 \bottomrule}
\begin{xtabular}{lll}
 \shrinkheight{-2.9in}
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 \shrinkheight{-2.9in}
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
\end{xtabular}

\end{paracol}

\end{document}

@sgolovan
Copy link
Author

sgolovan commented Apr 4, 2024

There is a bugreport for this: #424

@muzimuzhi
Copy link
Collaborator

I tried reducing number of rows required to demonstrate the problem, but only got the first page break of xtabular at the middle of \tablefirsthead. Do you happen to know why?

Example: number of rows reduced

\documentclass[a5paper,12pt]{article}
\usepackage[margin=0.5cm, paperheight=10cm]{geometry}
\usepackage{booktabs}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\usepackage{paracol}
\usepackage{xtab}

\setlength{\aboverulesep}{10pt}
\setlength{\belowrulesep}{10pt}

\begin{document}
\begin{paracol}{2}

\begin{longtabs}
[
  caption = {A Table},
  label = {tblr:test},
]{
  colspec = {lll},
  rowhead = 2,
  rowfoot = 1,
  rows = {rowsep=0pt},
}
\toprule
  Head    & Head  & Head    \\
  Head    & Head  & Head    \\
\midrule
  Alpha   & Beta  & Gamma   \\
  Epsilon & Zeta  & Eta     \\
  Iota    & Kappa & Lambda  \\
  Nu      & Xi    & Omicron \\
  Rho     & Sigma & Tau     \\
  Phi     & Chi   & Psi     \\
  Alpha   & Beta  & Gamma   \\
  Epsilon & Zeta  & Eta     \\
  Iota    & Kappa & Lambda  \\
  Nu      & Xi    & Omicron \\
  Rho     & Sigma & Tau     \\
  Phi     & Chi   & Psi     \\
\midrule
  Foot    & Foot  & Foot    \\
\bottomrule
\end{longtabs}

\switchcolumn

\centering
\topcaption{A Table} \label{tab:xtab}
\tablefirsthead{
  \\[-2ex]
  \toprule
   Head & Head & Head \\
   Head & Head & Head \\
  \midrule}
\tablehead{\multicolumn{3}{c}{{\tablename\ \thetable: A Table (Continued)}}\\[0.87ex]
  \toprule
   Head & Head & Head \\
   Head & Head & Head \\
  \midrule}
\tabletail{\midrule
   Foot & Foot & Foot \\
   \bottomrule}
\tablelasttail{\midrule
   Foot & Foot & Foot \\
   \bottomrule}
\begin{xtabular}{lll}
  \shrinkheight{-2.9in}
  Alpha   & Beta  & Gamma   \\
  Epsilon & Zeta  & Eta     \\
  Iota    & Kappa & Lambda  \\
  Nu      & Xi    & Omicron \\
  Rho     & Sigma & Tau     \\
  Phi     & Chi   & Psi     \\
  Alpha   & Beta  & Gamma   \\
  Epsilon & Zeta  & Eta     \\
  Iota    & Kappa & Lambda  \\
  Nu      & Xi    & Omicron \\
  Rho     & Sigma & Tau     \\
  Phi     & Chi   & Psi     \\
\end{xtabular}

\end{paracol}

\end{document}

image

@sgolovan
Copy link
Author

sgolovan commented Apr 5, 2024

Unfortunately, xtabular is just very bad in breaking into pages. For longer tables \shrinkheight can help somewhat, but for a such short table id doesn't apparently.

@sgolovan
Copy link
Author

sgolovan commented Apr 5, 2024

Reducing the number of head rows helps:

\documentclass[a6paper,12pt,landscape]{article}
\usepackage[margin=0.5cm]{geometry}
\usepackage{booktabs}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\usepackage{paracol}
\usepackage{xtab}

\setlength{\aboverulesep}{10pt}
\setlength{\belowrulesep}{10pt}

\usepackage{}

\begin{document}
\begin{paracol}{2}

\vspace*{-27.2pt}
\begin{longtabs}
[
 caption = {A Table},
 label = {tblr:test},
]{
 colspec = {lll},
 rowhead = 1,
 rowfoot = 1,
 rows = {rowsep=0pt},
}
\toprule
 Head & Head & Head \\
\midrule
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
\midrule
 Foot & Foot & Foot \\
\bottomrule
\end{longtabs}

\switchcolumn

\centering
\topcaption{A Table} \label{tab:xtab}
\tablefirsthead{
\\[-2ex]
\toprule
 Head & Head & Head \\
\midrule}
\tablehead{\multicolumn{3}{c}{{\tablename\ \thetable: A Table (Continued)}}\\[0.87ex]
\toprule
 Head & Head & Head \\
\midrule}
\tabletail{\midrule
 Foot & Foot & Foot \\
 \bottomrule}
\tablelasttail{\midrule
 Foot & Foot & Foot \\
 \bottomrule}
\begin{xtabular}{lll}
 \shrinkheight{-2in}
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
 Alpha & Beta & Gamma \\
 Epsilon & Zeta & Eta \\
 Iota & Kappa & Lambda \\
 Nu & Xi & Omicron \\
 Rho & Sigma & Tau \\
 Phi & Chi & Psi \\
\end{xtabular}

\end{paracol}

\end{document}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants