对于我的个人文档,我已经使用乳胶很长时间了,但像往常一样,我在表格方面遇到了困难。
我主要采用这种方法是supertabular
因为即使表格超出页面高度,我也可以轻松调整多列或多行的管理以及颜色设置。这次,我遇到了一个无法纠正的问题,即multirow
在切换页面时,列()的内容位于表格底部之后。
我想我可能在某个地方犯了错误,但我不知道在哪里。下面你会发现我正在尝试做什么以及以下错误出现在哪里:
- 左栏文字位于表格下方;
- 尽管针对第二列有命令,但文本并未左对齐
\raggedright
;
我认为这些可能是我的错误,但我刚刚在 tex.stackexchange.com 上花了 48 个小时,但没有找到任何确凿的证据。
你能给我提供一点线索吗?
(我阅读了文档“https://tug.ctan.org/macros/latex/contrib/supertabular/supertabular.pdf”,但我不明白在哪里使用指示的选项pageshow
和debugshow
)。
(我可以发送编译结果的 pdf。我使用 TexStudio 和 Debian GNU/Linux 11(bullseye))
以下是我的代码的摘录:
\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}
答案1
列下方的列文本的问题是由于\multirow
在supertabular
或内使用 造成的longtable
。这是一个已知问题。例如,请参见“多行垂直长文本“ 或者 ”跨多页的表格分隔符\multirow
”。不支持内部分页符。所以,你唯一能做的就是:手动分页。对于你的情况,你可以更改的行参数\multirow
以将文本放置在第一页的表格部分内。这就是我在下面的例子中所做的。但是如果你愿意,你也可以\multirow
在分页符后的一行中再添加一个,以便在下一页再次显示文本。在这种情况下,我还会减少第一页的行数\multirow
。
对齐的第二个问题是,因为你在 之前和之后添加了不必要的空格\cellcolor{…}
。在下面的例子中,我注释了行尾之前\cellcolor{…}
并删除之后的空格\cellcolor{…}
以避免这些空格。
另外,我改变了其中一种用法rodec
,rosef
使语义边缘清晰。但是如果你不喜欢,你可以恢复它。
\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}