longtable 环境的问题:代码未编译

longtable 环境的问题:代码未编译

我正在为我的博士论文写一个表格,但它有点太长了,一页都放不下。我尝试使用包长桌将其拆分成两页,但 Latex 不会编译它,我不明白为什么。

这是我的“正常”表的代码:

\begin{table}
\footnotesize
\caption{Overview of the samples in the corpus of artists' materials.}
\label{table:corpus_artists_materials}
\centering
\begin{tabular}{cc}
\toprule
\multicolumn{2}{c}{\textbf{Reference samples}} \\
\midrule                                                                                                                                                                                                                                       
Synthesized ZnO & ZnO nanosmoke synthesized  \\
 & as in Zhang et al. (2020) \cite{zhangControlled2020} \\
\midrule                                                                                    
\textit{Br\"uggemann} & Two powders (2020, indirect and direct method) \\
\toprule
\multicolumn{2}{c}{\textbf{ZnO manufacturers}} \\
\midrule                                                                                                                                                                                                                         
KF Chemicals & One powder (historical) \\ 
Japan, since 1951 &  \\                                                                                                                                                                                             
\midrule
Kremer & Two powders (2010 and 2021) \\
Germany, since 1977 &  \\
\midrule                                                                                                                                                                                                      
Maastrichtsche zinkwit Maatschappij & Five powders of different grades (1907-1989) \\
The Netherlands, 1870-1989\footnote{Then acquired by the \textit{Vieille Montagne}.} & \\                                                                                                       
\midrule
Merck & One powder (historical) \\
Germany, since 1668 & \\                                                                                                                                                                                                          \midrule
Sikkens & One powder (historical) \\
The Netherlands, since 1792 &  \\                                                                                                                                                                                               \midrule 
Vieille Montagne & Six powders of different grades (1847-1989) \\
Belgium, 1837-1989\footnote{Then Union Minière, today Umicore.} &  \\                                                                                                                                        \midrule  
\multicolumn{2}{c}{\textbf{Colour manufacturers}} \\   
\midrule                                                                                                                                                                                                                                       
Blockx & Two paint tubes (1976 and 2021) \\
Belgium, since 1865 & One titan-zinc white paint tube (2021) \\
\midrule
Bocour & One paint tube (1933-75) \\
US, since 1932 & One titan-zinc white paint jar (1940-75) \\
\midrule
Charvin & One paint tube (2010) \\
France, since 1830 &  \\                                                                                                                                                                                                            \midrule
Craftint Manufacturing Company & One paint tube (1950s) \\
US, 1929-2018 &  \\                                                                                                                                                                                         \midrule
Fezandie \& Sperrle & One powder (historical) \\
US, until 1979 &  \\                                                                                                                                                                                                  \midrule
Grumbacher & Three paint tubes (1950s and two tubes from1960-75) \\
US, since 1905\footnote{Today in Chartpark, Inc.} &  \\                                                                                                                                      
\midrule
Lefranc & One paint tube (1930s) \\
France, 1720-1964\footnote{Then Lefranc \& Bourgeois.} & one paint sample (1950) \\
 & One powder with a binder (before 1964) \\
\midrule
Lefranc \& Bourgeois & Two paint tubes (after 1964, 2021) \\
France, since 1964 & One pastel (after 1964) \\
\midrule
Maimeri & One paint sample from a color chart (1939-46) \\
Italy, since 1923\footnote{In Fila group since 2014.} & One paint tube (1970s) \\
\midrule
Michael Harding & One paint tube (2021) \\
US, since 1982 &  \\
\midrule
Old Holland & One paint tube (2010) \\
The Netherlands, since 1664 &  \\
\midrule
Permanent Pigments & One powder (1933-55) \\
US, 1933-55 & One paint tube (1933-55) \\
\midrule
Ripolin & One paint sample from a color chart (1900) \\
France, since 1888 &  \\
\midrule
Sennelier & Two powders (after 1887, 2021) \\
France, since 1887 & Two paint tubes (after the 1920s, 2021) \\
\midrule
Talens & Two paint tubes (1930s)\footnote{From the same box: one in good condition, the other yellowed and dried.} \\
The Netherlands, 1889-1969\footnote{Then \textit{Sikkens} group, then \textit{Akzo Nobel}.} &  \\
\midrule
Vilhelm Pacht & One paint tube (1890-1909) \\
Denmark, since 1887 &  \\
\midrule                                                                                                                                                                                           
Winsor \& Newton & One paint tube (2021) \\
UK, since 1832 &  \\
\bottomrule
\end{tabular}
\end{table}

以下是整理后的表格:编制表格

这就是我想要的结果,但正如您所见,表格太长了。我想让 Latex 将其拆分成一个新页面,重复标题“品牌”和“样品”。这是我尝试过但没有成功的长表代码:

\begin{longtable}{cc} % Two columns
\caption{Overview of the samples in the corpus of artists' materials.}
\label{table:corpus_artists_materials}
\toprule
\textbf{Brand} & \textbf{Samples} \\
\midrule
\endfirsthead

\toprule
\textbf{Brand} & \textbf{Samples} \\
\midrule
\endhead

\bottomrule
\endfoot

\bottomrule
\endlastfoot

\toprule
\multicolumn{2}{c}{\textbf{Reference samples}} \\
\midrule                                                                                                                                                                                                                                       
Synthesized ZnO & ZnO nanosmoke synthesized  \\
 & as in Zhang et al. (2020) \cite{zhangControlled2020} \\
\midrule                                                                                    
\textit{Br\"uggemann} & Two powders (2020, indirect and direct method) \\
\toprule
\multicolumn{2}{c}{\textbf{ZnO manufacturers}} \\
\midrule                                                                                                                                                                                                                         
KF Chemicals & One powder (historical) \\ 
Japan, since 1951 &  \\                                                                                                                                                                                             
\midrule
Kremer & Two powders (2010 and 2021) \\
Germany, since 1977 &  \\
\midrule                                                                                                                                                                                                      
Maastrichtsche zinkwit Maatschappij & Five powders of different grades (1907-1989) \\
The Netherlands, 1870-1989\footnote{Then acquired by the \textit{Vieille Montagne}.} & \\                                                                                                       
\midrule
Merck & One powder (historical) \\
Germany, since 1668 & \\                                                                                                                                                                                                          \midrule
Sikkens & One powder (historical) \\
The Netherlands, since 1792 &  \\                                                                                                                                                                                               \midrule 
Vieille Montagne & Six powders of different grades (1847-1989) \\
Belgium, 1837-1989\footnote{Then Union Minière, today Umicore.} &  \\                                                                                                                                        \midrule  
\multicolumn{2}{c}{\textbf{Colour manufacturers}} \\   
\midrule                                                                                                                                                                                                                                       
Blockx & Two paint tubes (1976 and 2021) \\
Belgium, since 1865 & One titan-zinc white paint tube (2021) \\
\midrule
Bocour & One paint tube (1933-75) \\
US, since 1932 & One titan-zinc white paint jar (1940-75) \\
\midrule
Charvin & One paint tube (2010) \\
France, since 1830 &  \\                                                                                                                                                                                                            \midrule
Craftint Manufacturing Company & One paint tube (1950s) \\
US, 1929-2018 &  \\                                                                                                                                                                                         \midrule
Fezandie \& Sperrle & One powder (historical) \\
US, until 1979 &  \\                                                                                                                                                                                                  \midrule
Grumbacher & Three paint tubes (1950s and two tubes from1960-75) \\
US, since 1905\footnote{Today in Chartpark, Inc.} &  \\                                                                                                                                      
\midrule
Lefranc & One paint tube (1930s) \\
France, 1720-1964\footnote{Then Lefranc \& Bourgeois.} & one paint sample (1950) \\
 & One powder with a binder (before 1964) \\
\midrule
Lefranc \& Bourgeois & Two paint tubes (after 1964, 2021) \\
France, since 1964 & One pastel (after 1964) \\
\midrule
Maimeri & One paint sample from a color chart (1939-46) \\
Italy, since 1923\footnote{In Fila group since 2014.} & One paint tube (1970s) \\
\midrule
Michael Harding & One paint tube (2021) \\
US, since 1982 &  \\
\midrule
Old Holland & One paint tube (2010) \\
The Netherlands, since 1664 &  \\
\midrule
Permanent Pigments & One powder (1933-55) \\
US, 1933-55 & One paint tube (1933-55) \\
\midrule
Ripolin & One paint sample from a color chart (1900) \\
France, since 1888 &  \\
\midrule
Sennelier & Two powders (after 1887, 2021) \\
France, since 1887 & Two paint tubes (after the 1920s, 2021) \\
\midrule
Talens & Two paint tubes (1930s)\footnote{From the same box: one in good condition, the other yellowed and dried.} \\
The Netherlands, 1889-1969\footnote{Then \textit{Sikkens} group, then \textit{Akzo Nobel}.} &  \\
\midrule
Vilhelm Pacht & One paint tube (1890-1909) \\
Denmark, since 1887 &  \\
\midrule                                                                                                                                                                                           
Winsor \& Newton & One paint tube (2021) \\
UK, since 1832 &  \\
\bottomrule
\end{longtable}

有人能帮我吗?非常感谢!!!

答案1

您可以保留longtable环境;只需抑制边缘的空白填充,并让两列之间的空白成为内生的。

我还会将单元格内容左对齐而不是居中,并且我会用 替换大多数\midrule指令以\addlinespace创建不那么混乱的“外观”。

在此处输入图片描述

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{longtable,booktabs}

\begin{document}

\begingroup % localize scope of the next few instructions
\footnotesize
\setlength\tabcolsep{0pt}
\setlength\LTcapwidth{\textwidth}
\setlength\LTleft{0pt}  % see section 5 of user guide of 'longtable' package
\setlength\LTright{0pt}
\begin{longtable}{@{\extracolsep{\fill}} ll @{}}

\caption{Overview of the samples in the corpus of artists' materials.}
\label{table:corpus_artists_materials}\\

\toprule
Brand & Samples \\
\midrule
\endfirsthead

\multicolumn{2}{@{}l}{Table \thetable, continued}\\
\addlinespace
\toprule
Brand & Samples \\
\midrule
\endhead

\bottomrule
\endlastfoot

\multicolumn{2}{@{}l}{\textsc{Reference samples}} \\
\addlinespace   
Synthesized ZnO & ZnO nanosmoke synthesized  \\
 & as in Zhang et~al.\ (2020) \cite{zhangControlled2020} \\
\addlinespace                                                                                    
\textit{Brüggemann} & Two powders (2020, indirect and direct method) \\

\addlinespace\addlinespace
\multicolumn{2}{@{}l}{\textsc{ZnO manufacturers}} \\
\addlinespace                                                                                                                                                                                                                         
KF Chemicals & One powder (historical) \\ 
Japan, since 1951 &  \\                                                                                                                                                                                             
\addlinespace
Kremer & Two powders (2010 and 2021) \\
Germany, since 1977 &  \\
\addlinespace                                                                                                                                                                                                      
Maastrichtsche zinkwit Maatschappij & Five powders of different grades (1907--1989) \\
The Netherlands, 1870--1989\footnote{Then acquired by the \textit{Vieille Montagne}.} & \\                                                                                                       
\addlinespace
Merck & One powder (historical) \\
Germany, since 1668 & \\                                                                                                                                                                                                          \addlinespace
Sikkens & One powder (historical) \\
The Netherlands, since 1792 &  \\                                                                                                                                                                                               \addlinespace 
Vieille Montagne & Six powders of different grades (1847--1989) \\
Belgium, 1837--1989\footnote{Then Union Minière, today Umicore.} &  \\                                                                                                                                       

\addlinespace\addlinespace
\multicolumn{2}{@{}l}{\textsc{Colour manufacturers}} \\   
\addlinespace                                                                                                                                                                                                                                       
Blockx & Two paint tubes (1976 and 2021) \\
Belgium, since 1865 & One titan-zinc white paint tube (2021) \\
\addlinespace
Bocour & One paint tube (1933--75) \\
US, since 1932 & One titan-zinc white paint jar (1940--75) \\
\addlinespace
Charvin & One paint tube (2010) \\
France, since 1830 &  \\                                                                                                                                                                                                            \addlinespace
Craftint Manufacturing Company & One paint tube (1950s) \\
US, 1929--2018 &  \\                                                                                                                                                                                         \addlinespace
Fezandie \& Sperrle & One powder (historical) \\
US, until 1979 &  \\                                                                                                                                                                                                  \addlinespace
Grumbacher & Three paint tubes (1950s and 2 tubes from 1960--75) \\
US, since 1905\footnote{Today in Chartpark, Inc.} &  \\                                                                                                                                      
\addlinespace
Lefranc & One paint tube (1930s) \\
France, 1720--1964\footnote{Then Lefranc \& Bourgeois.} & One paint sample (1950) \\
 & One powder with a binder (before 1964) \\
\addlinespace
Lefranc \& Bourgeois & Two paint tubes (after 1964, 2021) \\
France, since 1964 & One pastel (after 1964) \\
\addlinespace
Maimeri & One paint sample from a color chart (1939--46) \\*
Italy, since 1923\footnote{In Fila group since 2014.} & One paint tube (1970s) \\
\addlinespace
Michael Harding & One paint tube (2021) \\*
US, since 1982 &  \\
\addlinespace
Old Holland & One paint tube (2010) \\*
The Netherlands, since 1664 &  \\
\addlinespace
Permanent Pigments & One powder (1933--55) \\*
US, 1933--55 & One paint tube (1933--55) \\
\addlinespace
Ripolin & One paint sample from a color chart (1900) \\*
France, since 1888 &  \\
\addlinespace
Sennelier & Two powders (after 1887, 2021) \\*
France, since 1887 & Two paint tubes (after the 1920s, 2021) \\
\addlinespace
Talens & Two paint tubes (1930s)\footnote{From the same box: one in good condition, the other yellowed and dried.} \\
The Netherlands, 1889--1969\footnote{Then \textit{Sikkens} group, then \textit{Akzo Nobel}.} &  \\
\addlinespace
Vilhelm Pacht & One paint tube (1890--1909) \\
Denmark, since 1887 &  \\
\addlinespace                                                                                                                                                                                           
Winsor \& Newton & One paint tube (2021) \\
UK, since 1832 &  \\


\end{longtable}
\endgroup

\end{document}

答案2

替换longtablexltabular。它可以规定表格宽度,并将长测试分成几行文本:

\documentclass[10pt,a4paper]{article}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%
\usepackage{lipsum}                              % for dummy text
%---------------------------------------------------------------%

\usepackage{xltabular}
\usepackage{booktabs}

\begin{document}
    \begin{xltabular}{\linewidth}{*{2}{>{\centering\arraybackslash}X}} % Two columns
\caption{Overview of the samples in the corpus of artists' materials.}
\label{table:corpus_artists_materials}  \\  % <---
\toprule
\textbf{Brand} & \textbf{Samples} \\
\midrule
\endfirsthead

\toprule
\textbf{Brand} & \textbf{Samples} \\
\midrule
\endhead

\bottomrule
\endfoot

\bottomrule
\endlastfoot

\toprule
\multicolumn{2}{c}{\textbf{Reference samples}} \\
\midrule
Synthesized ZnO & ZnO nanosmoke synthesized  \\
 & as in Zhang et al. (2020) \cite{zhangControlled2020} \\
\midrule
\textit{Br\"uggemann} & Two powders (2020, indirect and direct method) \\
\toprule
\multicolumn{2}{c}{\textbf{ZnO manufacturers}} \\
\midrule
KF Chemicals & One powder (historical) \\
Japan, since 1951 &  \\
\midrule
Kremer & Two powders (2010 and 2021) \\
Germany, since 1977 &  \\
\midrule
Maastrichtsche zinkwit Maatschappij & Five powders of different grades (1907-1989) \\
The Netherlands, 1870-1989\footnote{Then acquired by the \textit{Vieille Montagne}.} & \\
\midrule
Merck & One powder (historical) \\
Germany, since 1668 & \\                                                                                                                                                                                                          \midrule
Sikkens & One powder (historical) \\
The Netherlands, since 1792 &  \\                                                                                                                                                                                               \midrule
Vieille Montagne & Six powders of different grades (1847-1989) \\
Belgium, 1837-1989\footnote{Then Union Minière, today Umicore.} &  \\                                                                                                                                        \midrule
\multicolumn{2}{c}{\textbf{Colour manufacturers}} \\
\midrule
Blockx & Two paint tubes (1976 and 2021) \\
Belgium, since 1865 & One titan-zinc white paint tube (2021) \\
\midrule
Bocour & One paint tube (1933-75) \\
US, since 1932 & One titan-zinc white paint jar (1940-75) \\
\midrule
Charvin & One paint tube (2010) \\
France, since 1830 &  \\                                                                                                                                                                                                            \midrule
Craftint Manufacturing Company & One paint tube (1950s) \\
US, 1929-2018 &  \\                                                                                                                                                                                         \midrule
Fezandie \& Sperrle & One powder (historical) \\
US, until 1979 &  \\                                                                                                                                                                                                  \midrule
Grumbacher & Three paint tubes (1950s and two tubes from1960-75) \\
US, since 1905\footnote{Today in Chartpark, Inc.} &  \\
\midrule
Lefranc & One paint tube (1930s) \\
France, 1720-1964\footnote{Then Lefranc \& Bourgeois.} & one paint sample (1950) \\
 & One powder with a binder (before 1964) \\
\midrule
Lefranc \& Bourgeois & Two paint tubes (after 1964, 2021) \\
France, since 1964 & One pastel (after 1964) \\
\midrule
Maimeri & One paint sample from a color chart (1939-46) \\
Italy, since 1923\footnote{In Fila group since 2014.} & One paint tube (1970s) \\
\midrule
Michael Harding & One paint tube (2021) \\
US, since 1982 &  \\
\midrule
Old Holland & One paint tube (2010) \\
The Netherlands, since 1664 &  \\
\midrule
Permanent Pigments & One powder (1933-55) \\
US, 1933-55 & One paint tube (1933-55) \\
\midrule
Ripolin & One paint sample from a color chart (1900) \\
France, since 1888 &  \\
\midrule
Sennelier & Two powders (after 1887, 2021) \\
France, since 1887 & Two paint tubes (after the 1920s, 2021) \\
\midrule
Talens & Two paint tubes (1930s)\footnote{From the same box: one in good condition, the other yellowed and dried.} \\
The Netherlands, 1889-1969\footnote{Then \textit{Sikkens} group, then \textit{Akzo Nobel}.} &  \\
\midrule
Vilhelm Pacht & One paint tube (1890-1909) \\
Denmark, since 1887 &  \\
\midrule
Winsor \& Newton & One paint tube (2021) \\
UK, since 1832 &  \\
\bottomrule
    \end{xltabular}
\end{document}

在此处输入图片描述

但是,我认为脚注应该是表格的一部分,而不是表格下方。为此,您还应该使用threeparttablelongtblrtabularray

附录:
longtblr这是表格用于包的 示例tabularray,并且脚注是表格的一部分。此外,表格设计略有变化,(对我来说)看起来不错:

\documentclass[10pt,a4paper]{article}
\usepackage{xcolor}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%
\usepackage{lipsum}                              % for dummy text
%---------------------------------------------------------------%
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\NewTableCommand\subtitle[1]{%
\SetCell[c=#1]{c, font=\bfseries\itshape, bg=gray!30,
               }
                            }% end of newtblecommand

\begin{document}
    \begin{longtblr}[
caption = {Overview of the samples in the corpus of artists' materials.},
  label = {table:corpus_artists_materials},
note{a} = {Then acquired by the \textit{Vieille Montagne}.},
note{b} = {Then Union Minière, today Umicore.},
note{c} = {Today in Chartpark, Inc.},
note{d} = {Then Lefranc \& Bourgeois.},
note{e} = {In Fila group since 2014.},
note{d} = {Then \textit{Sikkens} group, then \textit{Akzo Nobel}.}
                    ]{colspec = {*{2}{X[l, h]} @{}},
                      row{1}  = {c, font=\bfseries},
                      rowhead = 1
                      }
% table body
    \toprule
Brand           &   Samples                 \\
    \midrule
\subtitle{2}    Reference samples   
                &                           \\
    \addlinespace
Synthesized ZnO &   ZnO nanosmoke synthesized  
                    as in Zhang et al. (2020) \cite{zhangControlled2020}    \\
    \addlinespace
\textit{Br\"uggemann} 
                & Two powders (2020, indirect and direct method)            \\
    \toprule
\subtitle{2}    ZnO manufacturers             
                &                               \\
    \addlinespace
{KF Chemicals\\    
Japan, since 1951}
                & One powder (historical        \\
    \addlinespace
{Kremer\\           
Germany, since 1977}     
                & Two powders (2010 and 2021)   \\
    \addlinespace
{Maastrichtsche zinkwit Maatschappij\\ The Netherlands, 1870-1989\TblrNote{a}.}      
                & Five powders of different grades (1907-1989)  \\
    \addlinespace
{Merck \\
Germany, since 1668}
                & One powder (historical)   \\                                                                                                                                                                                                        \addlinespace
{Sikkens \\
The Netherlands, since 1792}     
                & One powder (historical)   \\
    \addlinespace
{Vieille Montagne\\  
Belgium, 1837-1989\TblrNote{b}}  
                & Six powders of different grades (1847-1989)   \\
    \addlinespace
\subtitle{2}    Colour manufacturers    &                   \\
    \addlinespace
\SetCell[r=2]{} {Blockx \\  Belgium, since 1865}             
                & Two paint tubes (1976 and 2021)           \\
                & One titan-zinc white paint tube (2021)    \\
    \addlinespace
\SetCell[r=2]{} {Bocour\\ US, since 1932}              
                & One paint tube (1933-75)  \\
                & One titan-zinc white paint jar (1940-75) \\
    \addlinespace
{Charvin\\             
France, since 1830} & One paint tube (2010) \\
    \addlinespace
{Craftint Manufacturing Company\\ 
US, 1929-2018}      & One paint tube (1950s) \\ 
    \addlinespace
{Fezandie \& Sperrle\\
US, until 1979 }    & One powder (historical) \\
    \addlinespace
{Grumbacher\\         
US, since 1905\TblrNote{c}}     
                    & Three paint tubes (1950s and two tubes from1960-75) \\
    \addlinespace
\SetCell[r=3]{} {Lefranc\\   France, 1720-1964\TblrNote{d}}
                    & One paint tube (1930s) \\
                    & one paint sample (1950) \\
                    & One powder with a binder (before 1964)    \\
    \addlinespace
\SetCell[r=2]{} {Lefranc \& Bourgeois\\  France, since 1964}
                    & Two paint tubes (after 1964, 2021)    \\
                    & One pastel (after 1964)               \\
    \addlinespace
\SetCell[r=2]{} {Maimeri\\   Italy, since 1923\TblrNote{e}}             
                    & One paint sample from a color chart (1939-46) \\
                    & One paint tube (1970s)                    \\
    \addlinespace
{Michael Harding\\  US, since 1982}    
                    & One paint tube (2021) \\
    \addlinespace
{Old Holland\\  The Netherlands, since 1664}        
                    & One paint tube (2010)     \\
    \addlinespace
\SetCell[r=2]{} {Permanent Pigments\\US, 1933-55} 
                    & One powder (1933-55)      \\
                    & One paint tube (1933-55)  \\
    \addlinespace
{Ripolin\\  France, since 1888}            
                    & One paint sample from a color chart (1900) \\
    \addlinespace
\SetCell[r=2]{} {Sennelier\\ France, since 1887}           
                    & Two powders (after 1887, 2021) \\
                    & Two paint tubes (after the 1920s, 2021) \\
    \addlinespace
{Talens\\   The Netherlands, 1889-1969\TblrNote{f}}
                    & Two paint tubes (1930s)\footnote{From the same box: one in good condition, the other yellowed and dried.}  \\
    \addlinespace
{Vilhelm Pacht\\    Denmark, since 1887} 
                    & One paint tube (1890-1909)  \\
    \addlinespace
{Winsor \& Newton\\  UK, since 1832}    
                    & One paint tube (2021) \\
    \bottomrule
    \end{longtblr}
\lipsum[1]
\end{document}

在此处输入图片描述

(红线表示页面布局)

相关内容