1

For my personal documentation, I have been using latex for a long time but as usual, I encounter difficulties with tables.

I mainly adopted supertabular because I can easily adapt the management of multiple columns or rows as well as colorization even if the table exceeds the height of a page. This time, I found myself with a problem that I was unable to correct, namely the fact that the content of a column (multirow) is found after the bottom of the table when changing pages.

I think I'm probably making a mistake somewhere, but I can't figure out where. Below you will find what I am trying to do and where the following errors appear:

  • the text in the left column is located below the table;
  • the text is not aligned to the left in the 2nd column despite the \raggedright command for this column;

I think these are probably errors on my part but I have just spent 48 hours with tex.stackexchange.com in particular but without finding anything conclusive.

Do you have a clue to give me?

(I read the documentation "https://tug.ctan.org/macros/latex/contrib/supertabular/supertabular.pdf" but I don't understand where to use the options indicated pageshow and debugshow).

(I can send the resulting pdf of the compilation. I use TexStudio with Debian GNU/Linux 11 (bullseye) )

Here is an extract of my code :

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[width=21.00cm, height=29.70cm, left=2.00cm, right=2.00cm, top=2.00cm, bottom=2.00cm]{geometry}

\usepackage{geometry} \usepackage[demo]{graphicx}

\setlength{\oddsidemargin}{0pt} \setlength{\headsep}{0pt}
\setlength{\textheight}{740pt} \setlength{\textwidth}{460pt} \setlength{\marginparsep}{0pt} \setlength{\marginparwidth}{0pt}

\usepackage{tabularx} \usepackage{multirow} \usepackage{xcolor,colortbl} \usepackage{supertabular}

\usepackage[margin=10pt,font=small,textfont=it,labelformat=simple]{caption} \captionsetup{labelformat=empty, justification=centering}

\begin{document} \subsection*{Espèces} Il existe encore de nombreuses divergences quand il s'agit de rentrer dans le détail des nomenclatures et notamment dans le classement des genres au sein des familles. Le tableau 2 ci-après présente la sous-classe Octocorallia donne un aperçu non exhaustif des genres concernés.

\newenvironment{changemargin}[2]{% \begin{list}{}{% \setlength{\topsep}{0pt}% \setlength{\leftmargin}{#1}% \setlength{\rightmargin}{#2}% \setlength{\listparindent}{\parindent}% \setlength{\itemindent}{\parindent}% \setlength{\parsep}{\parskip}% }% \item[]}{\end{list}}

\begin{changemargin}{-1.5cm}{0.5cm}

\begin{center} \renewcommand{\arraystretch}{1.5}

\tablefirsthead{% \hline \multicolumn{1}{|c}{Ordre} & \multicolumn{1}{|c}{Sous-ordre} & \multicolumn{1}{|c}{Famille} & \multicolumn{1}{|c}{Spécimen} & \multicolumn{1}{|l|}{Genre} \ \hline }

\tablehead{% \hline % \multicolumn{5}{l}{\small \textsl{$\dots$ suite du tableau}}\ \multicolumn{1}{|c}{Ordre} & \multicolumn{1}{|c}{Sous-ordre} & \multicolumn{1}{|c}{Famille} & \multicolumn{1}{|c}{Spécimen} & \multicolumn{1}{|l|}{Genre} \ \hline }

\tabletail{% \hline \multicolumn{5}{r}{\small\textsl{Suite page suivante$\dots$}} \ }

\tablelasttail{\hline}

\bottomcaption{Classement des genres appartenant à la sous-classe Octocorallia \\selon WoRMS (07/2014)}

%\begin{table}[H] \definecolor{vertf}{RGB}{000,255,000} \definecolor{vertc}{RGB}{139,255,139} \definecolor{grisf}{RGB}{209,209,209} \definecolor{grisc}{RGB}{229,229,229} \definecolor{rosef}{RGB}{255,191,191} \definecolor{rosec}{RGB}{255,218,218}

\begin{supertabular}{| >{\raggedright\arraybackslash}m{0.15\linewidth}| >{\raggedright\arraybackslash}m{0.15\linewidth}| >{\raggedright\arraybackslash}m{0.15\linewidth}| >{ \arraybackslash}m{0.20\linewidth}| >{\raggedright\arraybackslash}m{0.30\linewidth}| } \hline \multirow{19}{=}{ \cellcolor{rosec} Alcyona-cea (Alcyonaires) } & \multirow{5}{=}{ \cellcolor{vertc} Alcyoniina (Alcyoninés) } & \cellcolor{grisc} Alcyonidae (Alcyonidés) & \cellcolor{grisc} \includegraphics[width=\linewidth] {sarcophyton-2.jpg} & \cellcolor{grisc} \vspace{0.5em} Acrophytum, Alcyonium, Aldersladum, Anthomastus, Bellonella, Cladiella, Dampia, Dimorphophyton, Discophyton, Drifa, Elbeenus, Eleutherobia, Heteropolypus Inflatocalyx, Klyxum, Lampophyton, Lanthanocephalus, Litophyton, Lobophytum, Lobularia, Lohowia, Malacacanthus, Minabea, Notodysiferus, Paraminabea, Parerythropodium, Protodendron, Pseudoanthomastus, Rhytisma, \textbf{Sarcophyton}, Sinularia, Skamnarium, Sphaeralcyon, Thrombophyton, Verseveldtia \ \cline{3-5} \cellcolor{rosec} & \cellcolor{vertc} & \cellcolor{grisf} Nephtheidae\newline(Nephteidés) & \cellcolor{grisf} \vspace{0.5em} \includegraphics[width=\linewidth] {umbellulifera.jpg} & \cellcolor{grisf} \vspace{0.5em} \hbox{Umbellulifera (specimen),} Capnella, Chondronephthya, Chromonephthea, Coronephthya, Dendronephthya, Gersemi, Lemnalia, Leptophyton, Neospongodes, Nephthea, Pacifiphyton, Paralemnalia, Pseudodrifa, Scleronephthya, Stereonephthya \ \cline{3-5} \cellcolor{rosec} & \cellcolor{vertc} & \cellcolor{grisc} Nidaliidae\newline(Nidaliidés) & \cellcolor{grisc} \vspace{0.5em} \includegraphics[width=\linewidth] {chironephthya.jpg} & \cellcolor{grisc} \hbox{Chironephthya (specimen),} Agaricoides, Nephthyigorgia, Nidalia, Nidaliopsis, Orlikia, Pieterfaurea, Siphonogorgia \ \cline{3-5} \cellcolor{rosec} & \cellcolor{vertc} & \cellcolor{grisf} Paralcyoniidae (Paralcyoniidés) & \cellcolor{grisf} \vspace{0.5em} \includegraphics[width=\linewidth] {maasella.jpg} & \cellcolor{grisf} Maasella (specimen) \ \cline{3-5} \cellcolor{rosec} & \cellcolor{vertc} & \cellcolor{grisc} Xeniidae (Xéniidés) & \cellcolor{grisc} \vspace{0.5em} \includegraphics[width=\linewidth] {xenia.jpg} & \cellcolor{grisc} \hbox{Xenia (specimen),} Anthelia, Asterospicularia, Cespitularia, Funginus, Efflatounaria, Heteroxenia, Sympodium, Sansibia \ \hline \multirow{3}{=}{ \cellcolor{rosec} Pennatulacea (Pennatules) } & \cellcolor{vertc} Sessiliflorae & \cellcolor{grisc} Umbellulidae, Vertillidae, Protoptilidae $\dots$ & \cellcolor{grisc} \vspace{0.5em} \includegraphics[width=\linewidth] {cavernularia.jpg} & \cellcolor{grisc} Umbellula, \hbox{Cavernularia (specimen),} Cavernulina, Veretillum, Distichoptilum, Protoptilum $\dots$ \ \cline{2-5} \cellcolor{rosec} & \cellcolor{vertf} Subsessili-florae & \cellcolor{grisf} Halipteridae Pennatulidae Virgulariidae & \cellcolor{grisf} \vspace{0.5em} \includegraphics[width=\linewidth] {virgularia.jpg} & \cellcolor{grisf} Halipteris, Crassophyllum, Pennatulata $\dots$ Acanthoptilum, \hbox{Virgularia (Specimen)} \ \hline

\end{supertabular}

\end{center}

\end{changemargin}

Retour des marges à la normale. Il existe encore de nombreuses divergences quand il s'agit de rentrer dans le détail des nomenclatures et notamment dans le classement des genres au sein des familles.

\end{document}

PhLinuX
  • 13
  • 4
  • Welcome to TeX.SX! Please make your code compilable. Currently it does not work, e.g., because of undefined \leavemode (should it be \leavevmode?) command and not available image files etc.. At the same time, much of your code does not seem to be relevant to the question you're asking here. Please limit the example to only the code required for your issue to appear. You can have a look at this guide for how to prune your code for this purpose. – cabohah Mar 06 '24 at 14:37
  • Thank you for your reply and advise.

    I just modified the code to simplify it. I also removed the livevmode commands which ultimately turned out to be useless in my case. (Wich has removed my issue with cells color)

    – PhLinuX Mar 06 '24 at 18:04
  • Sorry I don't see any way to share the pictures used in this work example. They are mainly 600x800 sized – PhLinuX Mar 06 '24 at 18:17
  • If you'd follow the second link in my comment, you'd get information what you should do with pictures/images.BTW: There is still an error messages about line 155. – cabohah Mar 06 '24 at 19:06
  • However: AFAIK using \multirow in a supertabular is somehow tricky. You may need to move the text manually to the next page or repeat it manually at the next page. IMHO the best package for colorful tabulars with vertical and horizontal lines and several pages would be tabularray. – cabohah Mar 06 '24 at 19:12
  • 1
    Sorry I read too fast the 2nd link. I didn't know the [demo] option from graphix. I hope this is now ok. Also, I'm going to study tabularray thanks for your time. – PhLinuX Mar 06 '24 at 19:34
  • The problem with \multirow and page breaks is already object of some other questions, e.g., https://tex.stackexchange.com/q/324535/277964 or https://tex.stackexchange.com/q/52334/277964. It seems, if you want the page break inside the \multirow, there isn't an automatic solution. BTW: The not closed \hbox{… is still there and usually you should use LaTeX's \mbox instead of low level TeX's \hbox. – cabohah Mar 07 '24 at 07:43
  • Thanks again for your advise cabohah.

    I just edit my post, removed missed comments and give the code modified regarding the use of hbox.

    I was not able to install the tabularray package because I use Debian 11 with Latex2 or it seems unfortunately this package is only intended for Latex3.

    – PhLinuX Mar 08 '24 at 08:42
  • LaTeX3 kernel is already part of the LaTeX2 for several years. But tabularray is quite new and maybe the TeX Live of Debian 11 is too old. I do always use vanilla TeX Live. – cabohah Mar 08 '24 at 08:54

1 Answers1

1

The problem with the column text below the column is because of using \multirow inside a supertabular or longtable. It is a known issue. See, e.g., “Vertical long text in a multirow” or “table breaks spanning multiple pages”. Page breaks inside \multirow is not supported. So the only thing, you can do: manually break it. In your case, you can change the row argument of \multirow to place the text inside the table part of the first page. This is what I do in my example below. But if you like, you can also add one more \multirow in a row after the page break to show the text again on the next page. In this case, I would also reduce the row number of the first \multirow.

Your second problem with the alignment is, because you've added unwanted white spaces before and after \cellcolor{…}. In the example below, I've commented the end of line before \cellcolor{…} and removed the space after \cellcolor{…} to avoid these spaces.

Additionally I've changed the usage of one rodec to rosef to make the semantic edge clear. But you can revert it, if you do not like it.

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}% should not be needed since LaTeX 2018-04-01
\usepackage[T1]{fontenc}
\usepackage[width=21.00cm, height=29.70cm, left=2.00cm, right=2.00cm, top=2.00cm, bottom=2.00cm]{geometry}

\usepackage{geometry} \usepackage[demo]{graphicx}

\setlength{\oddsidemargin}{0pt}% I'd recommend to use geometry to \setlength{\headsep}{0pt} % change the page layout. It is much \setlength{\textheight}{740pt} % easier to handle. \setlength{\textwidth}{460pt} \setlength{\marginparsep}{0pt} \setlength{\marginparwidth}{0pt}

\usepackage{tabularx} \usepackage{multirow} \usepackage{xcolor,colortbl} \usepackage{supertabular}

\usepackage[margin=10pt,font=small,textfont=it,labelformat=simple]{caption} \captionsetup{labelformat=empty, justification=centering}

\begin{document} \subsection*{Espèces} Il existe encore de nombreuses divergences quand il s'agit de rentrer dans le détail des nomenclatures et notamment dans le classement des genres au sein des familles. Le tableau 2 ci-après présente la sous-classe Octocorallia donne un aperçu non exhaustif des genres concernés.

\newenvironment{changemargin}[2]{% \begin{list}{}{% \setlength{\topsep}{0pt}% \setlength{\leftmargin}{#1}% \setlength{\rightmargin}{#2}% \setlength{\listparindent}{\parindent}% \setlength{\itemindent}{\parindent}% \setlength{\parsep}{\parskip}% }% \item[]}{\end{list}}

\begin{changemargin}{-1.5cm}{0.5cm}

\begin{center} \renewcommand{\arraystretch}{1.5}

\tablefirsthead{% \hline \multicolumn{1}{|c}{Ordre} & \multicolumn{1}{|c}{Sous-ordre} & \multicolumn{1}{|c}{Famille} & \multicolumn{1}{|c}{Spécimen} & \multicolumn{1}{|l|}{Genre} \ \hline }

\tablehead{% \hline % \multicolumn{5}{l}{\small \textsl{$\dots$ suite du tableau}}\ \multicolumn{1}{|c}{Ordre} & \multicolumn{1}{|c}{Sous-ordre} & \multicolumn{1}{|c}{Famille} & \multicolumn{1}{|c}{Spécimen} & \multicolumn{1}{|l|}{Genre} \ \hline }

\tabletail{% \hline \multicolumn{5}{r}{\small\textsl{Suite page suivante$\dots$}} \ }

\tablelasttail{\hline}

\bottomcaption{Classement des genres appartenant à la sous-classe Octocorallia \\selon WoRMS (07/2014)}

%\begin{table}[H] \definecolor{vertf}{RGB}{000,255,000} \definecolor{vertc}{RGB}{139,255,139} \definecolor{grisf}{RGB}{209,209,209} \definecolor{grisc}{RGB}{229,229,229} \definecolor{rosef}{RGB}{255,191,191} \definecolor{rosec}{RGB}{255,218,218}

\begin{supertabular}{| >{\raggedright}m{0.15\linewidth}| >{\raggedright}m{0.15\linewidth}| >{\raggedright}m{0.15\linewidth}| m{0.20\linewidth}| >{\raggedright\arraybackslash}m{0.30\linewidth}| } \hline \multirow{14}{=}{\cellcolor{rosec}Alcyona-cea (Alcyonaires)} & \multirow{5}{=}{% \cellcolor{vertc}Alcyoniina (Alcyoninés) } & \cellcolor{grisc}Alcyonidae (Alcyonidés) & \cellcolor{grisc}\includegraphics[width=\linewidth] {sarcophyton-2.jpg} & \cellcolor{grisc} \vspace{0.5em} Acrophytum, Alcyonium, Aldersladum, Anthomastus, Bellonella, Cladiella, Dampia, Dimorphophyton, Discophyton, Drifa, Elbeenus, Eleutherobia, Heteropolypus Inflatocalyx, Klyxum, Lampophyton, Lanthanocephalus, Litophyton, Lobophytum, Lobularia, Lohowia, Malacacanthus, Minabea, Notodysiferus, Paraminabea, Parerythropodium, Protodendron, Pseudoanthomastus, Rhytisma, \textbf{Sarcophyton}, Sinularia, Skamnarium, Sphaeralcyon, Thrombophyton, Verseveldtia \ \cline{3-5} \cellcolor{rosec}& \cellcolor{vertc}& \cellcolor{grisf}Nephtheidae\newline(Nephteidés) & \cellcolor{grisf} \vspace{0.5em} \includegraphics[width=\linewidth] {umbellulifera.jpg} & \cellcolor{grisf} \vspace{0.5em} \hbox{Umbellulifera (specimen),} Capnella, Chondronephthya, Chromonephthea, Coronephthya, Dendronephthya, Gersemi, Lemnalia, Leptophyton, Neospongodes, Nephthea, Pacifiphyton, Paralemnalia, Pseudodrifa, Scleronephthya, Stereonephthya \ \cline{3-5} \cellcolor{rosec}& \cellcolor{vertc}& \cellcolor{grisc}Nidaliidae\newline(Nidaliidés) & \cellcolor{grisc} \vspace{0.5em} \includegraphics[width=\linewidth] {chironephthya.jpg} & \cellcolor{grisc}\hbox{Chironephthya (specimen),} Agaricoides, Nephthyigorgia, Nidalia, Nidaliopsis, Orlikia, Pieterfaurea, Siphonogorgia \ \cline{3-5} \cellcolor{rosec}& \cellcolor{vertc}& \cellcolor{grisf}Paralcyoniidae (Paralcyoniidés) & \cellcolor{grisf} \vspace{0.5em} \includegraphics[width=\linewidth] {maasella.jpg} & \cellcolor{grisf}Maasella (specimen) \ \cline{3-5} \cellcolor{rosec}& \cellcolor{vertc}& \cellcolor{grisc}Xeniidae (Xéniidés) & \cellcolor{grisc} \vspace{0.5em} \includegraphics[width=\linewidth] {xenia.jpg} & \cellcolor{grisc}\hbox{Xenia (specimen),} Anthelia, Asterospicularia, Cespitularia, Funginus, Efflatounaria, Heteroxenia, Sympodium, Sansibia \ \hline \multirow{3}{=}{% \cellcolor{rosef}Pennatulacea (Pennatules) } & \cellcolor{vertc}Sessiliflorae & \cellcolor{grisc}Umbellulidae, Vertillidae, Protoptilidae $\dots$ & \cellcolor{grisc} \vspace{0.5em} \includegraphics[width=\linewidth] {cavernularia.jpg} & \cellcolor{grisc}Umbellula, \hbox{Cavernularia (specimen),} Cavernulina, Veretillum, Distichoptilum, Protoptilum $\dots$ \ \cline{2-5} \cellcolor{rosef}& \cellcolor{vertf}Subsessili-florae & \cellcolor{grisf}Halipteridae Pennatulidae Virgulariidae & \cellcolor{grisf} \vspace{0.5em} \includegraphics[width=\linewidth] {virgularia.jpg} & \cellcolor{grisf}Halipteris, Crassophyllum, Pennatulata $\dots$ Acanthoptilum, \hbox{Virgularia (Specimen)} \ \hline

\end{supertabular}

\end{center}

\end{changemargin}

Retour des marges à la normale. Il existe encore de nombreuses divergences quand il s'agit de rentrer dans le détail des nomenclatures et notamment dans le classement des genres au sein des familles.

\end{document}

enter image description here

cabohah
  • 11,455
  • Thank you very much for your example and comments Cabohah. – PhLinuX Mar 08 '24 at 15:16
  • Yes, you are absolutely right. I didn't realize that the spaces I left for code clarity had been taken into account. (and ... I was stupidely trying to compensate them with \vspace !!!)

    Note: Changing rodec to rosef is good... rodec was a typo Thanks again.

    In any case, your result is therefore much better!

    Finally I abandoned supertabular (and tabularray for now ) and coded it with tabular with on each page a part of the table. I know it's cumbersome, but for long, multi-page columns, the initial content is repeated on each page.

    Many thanks again for your time.

    – PhLinuX Mar 08 '24 at 15:38