创建可以修改列大小并使用多页的表格

创建可以修改列大小并使用多页的表格

我目前正在尝试创建一个包含大量内容的表格。我尝试了两种方法,但要么表格超出页面末尾,要么超出页面侧面,格式也会发生变化。我无法将这两种方法结合起来使其正常工作。

方法 1:表格格式看起来不错,但不支持多页。

\begin{longtable}

\renewcommand{\arraystretch}{1.5}
\centering
    \begin{tabularx}{\textwidth}{ |c||c|X|c| } 
    \hline 
    \multicolumn{1}{|c|}{\textbf{Event}} & \multicolumn{1}{c|}{\textbf{Panellist}} & \multicolumn{1}{c|}{\textbf{Role}} & \multicolumn{1}{c|}{\textbf{Organization}}       \tabularnewline \hline
    
    \multirow{4}{6em}{Ecosystem Partner Marketing Roundtable} 
    & Mark Lafrate & Product marketing manager for Apps \& partnerships & Intercom \\\cline{2-4} 
    & Katie Rubak & Sr. manager of partner marketing & Talkdesk \\\cline{2-4} 
    & Briarley Laban & Global Director of partner marketing & Trustpilot \\\cline{2-4} 
    & Morgan Rochofski & Product and partner marketing & Salesloft                        \tabularnewline \hline
   
    \multirow{4}{6em}{Leaders of Larger Ecosystems Roundtable} 
    & Scott Brinker & VP of platform ecosystem & HubSpot \\\cline{2-4} 
    & Bader Hamdan & Head of platform partnerships & Twilio \\\cline{2-4}  
    & Shay Howe & SVP of platform strategy & ActiveCampaign \\\cline{2-4}  
    & Heidi Williams & Head of platform engineering & Grammarly                           \tabularnewline \hline
  
    \multirow{4}{6em}{How to Prioritize SaaS Product Integrations Roundtable} 
    & Richard O'Connell & Director of product partnerships & Atlassian \\\cline{2-4} 
    & Amanda Groves & Director of product marketing & Crossbeam \\\cline{2-4}  
    & Chris Lavoie & Sr. technology partner manager & Gorgias \\\cline{2-4}  
    & Kabir Mathur & Head of product partnerships & Typeform                              \tabularnewline \hline
    
    \multirow{4}{6em}{How to Build a API and Integrations Roadmap} 
    & Chloe Wu & Product manager & Gusto \\\cline{2-4} 
    & India Anderson & Sr. manager, product management integrations & Avalara \\\cline{2-4}  
    & Deven Ravel & Head of technology partnerships & Reputation \\\cline{2-4}  
    & Matt Marum & Director of ISV alliances & SugarCRM                                     \tabularnewline \hline
    
    \multirow{4}{6em}{Cross-functional collaboration in tech partnerships} 
    & Roger Haas & Sr. manager of technology partnerships & Pantheon.io \\\cline{2-4} 
    & Jamie Boardman & Director of partnerships, product & Mailchimp \\\cline{2-4}  
    & Kenneth Marks & Associate Director of product management & Olo \\\cline{2-4}  
    & John Greene & Director of engineering, integrations & Airship                           \tabularnewline \hline
    
    \multirow{4}{6em}{Advice for Building a Tech Partner Program} 
    & Jaimie Fucillo & VP of Partnerships & Mindbody \\\cline{2-4} 
    & Daniel O'Leary & Director of Partnerships & Box \\\cline{2-4}  
    & Jake Wallace & Head of global technology partnerships & Trustpilot \\\cline{2-4}  
    & Elliot Smith & Head of partnerships & 6sense                                        \tabularnewline \hline
        
    \multirow{4}{6em}{How to Tackle Tech Partner Operations} 
    & Megha Bhatt & Partnerships lead of operations \& strategy operations & Shopify \\\cline{2-4} 
    & Greg Mitchell & Partner programs and operations & Starburst \\\cline{2-4}  
    & Matt Irving & Sr. Manager of global partner programs \& strategy & WP Engine \\\cline{2-4}  
    & Manishi Singh & SVP of app orchestration & Spryker Systems                          \tabularnewline \hline
    
    \multirow{4}{6em}{How to Build a Platform UX Partners and Customers Love} 
    & Richard Fortune & Product manager of platform experience & Xero \\\cline{2-4} 
    & Courtney George & Head of design for data & Amplitude \\\cline{2-4}  
    & Kirby Montgomery & VP of product leadership & C2FO \\\cline{2-4}  
    & Ashwini Sriram & Group product manager & Twilio                                     \tabularnewline \hline
    
    \end{tabularx}
\caption{SaaS Ecosystem Alliance Events}
\label{SaaSEA}
\end{longtable}

结果是: 在此处输入图片描述

方法 2:表格适合多页,但格式不正确,因为它超出了页面的右侧

\begin{longtable}{|c|c|c|c|}

\caption{SaaS Ecosystem Alliance Events}\\
\hline
\textbf{Event} & \textbf{Panellist} & \textbf{Role} & \textbf{Organization} \\
\hline
\endfirsthead
\multicolumn{4}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
\textbf{Event} & \textbf{Panellist} & \textbf{Role} & \textbf{Organization} \\
\hline
\endhead
\hline \multicolumn{4}{r}{\textit{Continued on next page}} \\
\endfoot
\hline
\endlastfoot

    \multirow{4}{6em}{Ecosystem Partner Marketing Roundtable} 
    & Mark Lafrate & Product marketing manager for Apps \& partnerships & Intercom \\\cline{2-4} 
    & Katie Rubak & Sr. manager of partner marketing & Talkdesk \\\cline{2-4} 
    & Briarley Laban & Global Director of partner marketing & Trustpilot \\\cline{2-4} 
    & Morgan Rochofski & Product and partner marketing & Salesloft                        \tabularnewline \hline
   
    \multirow{4}{6em}{Leaders of Larger Ecosystems Roundtable} 
    & Scott Brinker & VP of platform ecosystem & HubSpot \\\cline{2-4} 
    & Bader Hamdan & Head of platform partnerships & Twilio \\\cline{2-4}  
    & Shay Howe & SVP of platform strategy & ActiveCampaign \\\cline{2-4}  
    & Heidi Williams & Head of platform engineering & Grammarly                           \tabularnewline \hline
  
    \multirow{4}{6em}{How to Prioritize SaaS Product Integrations Roundtable} 
    & Richard O'Connell & Director of product partnerships & Atlassian \\\cline{2-4} 
    & Amanda Groves & Director of product marketing & Crossbeam \\\cline{2-4}  
    & Chris Lavoie & Sr. technology partner manager & Gorgias \\\cline{2-4}  
    & Kabir Mathur & Head of product partnerships & Typeform                              \tabularnewline \hline
    
    \multirow{4}{6em}{How to Build a API and Integrations Roadmap} 
    & Chloe Wu & Product manager & Gusto \\\cline{2-4} 
    & India Anderson & Sr. manager, product management integrations & Avalara \\\cline{2-4}  
    & Deven Ravel & Head of technology partnerships & Reputation \\\cline{2-4}  
    & Matt Marum & Director of ISV alliances & SugarCRM                                     \tabularnewline \hline
    
    \multirow{4}{6em}{Cross-functional collaboration in tech partnerships} 
    & Roger Haas & Sr. manager of technology partnerships & Pantheon.io \\\cline{2-4} 
    & Jamie Boardman & Director of partnerships, product & Mailchimp \\\cline{2-4}  
    & Kenneth Marks & Associate Director of product management & Olo \\\cline{2-4}  
    & John Greene & Director of engineering, integrations & Airship                           \tabularnewline \hline
    
    \multirow{4}{6em}{Advice for Building a Tech Partner Program} 
    & Jaimie Fucillo & VP of Partnerships & Mindbody \\\cline{2-4} 
    & Daniel O'Leary & Director of Partnerships & Box \\\cline{2-4}  
    & Jake Wallace & Head of global technology partnerships & Trustpilot \\\cline{2-4}  
    & Elliot Smith & Head of partnerships & 6sense                                        \tabularnewline \hline
        
    \multirow{4}{6em}{How to Tackle Tech Partner Operations} 
    & Megha Bhatt & Partnerships lead of operations \& strategy operations & Shopify \\\cline{2-4} 
    & Greg Mitchell & Partner programs and operations & Starburst \\\cline{2-4}  
    & Matt Irving & Sr. Manager of global partner programs \& strategy & WP Engine \\\cline{2-4}  
    & Manishi Singh & SVP of app orchestration & Spryker Systems                          \tabularnewline \hline
    
    \multirow{4}{6em}{How to Build a Platform UX Partners and Customers Love} 
    & Richard Fortune & Product manager of platform experience & Xero \\\cline{2-4} 
    & Courtney George & Head of design for data & Amplitude \\\cline{2-4}  
    & Kirby Montgomery & VP of product leadership & C2FO \\\cline{2-4}  
    & Ashwini Sriram & Group product manager & Twilio                                     \tabularnewline \hline
    
\caption{SaaS Ecosystem Alliance Events}
\label{SaaSEA}
\end{longtable}

显示为: 在此处输入图片描述

非常感谢您的帮助/提示!

答案1

有几个选项,但在 2022 年,我建议尝试 tabularray 包的longtblr环境,它非常强大且可定制。

查看包装详尽的文献资料了解更多信息。

\documentclass{article}
\usepackage{tabularray}
\begin{document}

\centering
\begin{longtblr}[
        caption={SaaS Ecosystem Alliance Events},
        label={SaaSEA}
    ]{
    colspec={|Q[wd=6em,halign=l]||c|X[halign=l]|c| },
    row{1}={font=\bfseries,halign=c},
    rowhead=1,
    stretch=1.5,
    }
    \hline
    Event & Panellist & Role & Organization \\ \hline
    
    \SetCell[r=4]{}{Ecosystem Partner Marketing Roundtable} 
    & Mark Lafrate & Product marketing manager for Apps \& partnerships & Intercom \\\cline{2-4} 
    & Katie Rubak & Sr. manager of partner marketing & Talkdesk \\\cline{2-4} 
    & Briarley Laban & Global Director of partner marketing & Trustpilot \\\cline{2-4} 
    & Morgan Rochofski & Product and partner marketing & Salesloft \\ \hline
   
   \SetCell[r=4]{}{Leaders of Larger Ecosystems Roundtable} 
    & Scott Brinker & VP of platform ecosystem & HubSpot \\\cline{2-4} 
    & Bader Hamdan & Head of platform partnerships & Twilio \\\cline{2-4}  
    & Shay Howe & SVP of platform strategy & ActiveCampaign \\\cline{2-4}  
    & Heidi Williams & Head of platform engineering & Grammarly \\ \hline
  
    \SetCell[r=4]{}{How to Prioritize SaaS Product Integrations Roundtable} 
    & Richard O'Connell & Director of product partnerships & Atlassian \\\cline{2-4} 
    & Amanda Groves & Director of product marketing & Crossbeam \\\cline{2-4}  
    & Chris Lavoie & Sr. technology partner manager & Gorgias \\\cline{2-4}  
    & Kabir Mathur & Head of product partnerships & Typeform \\ \hline
    
    \SetCell[r=4]{}{How to Build a API and Integrations Roadmap} 
    & Chloe Wu & Product manager & Gusto \\\cline{2-4} 
    & India Anderson & Sr. manager, product management integrations & Avalara \\\cline{2-4}  
    & Deven Ravel & Head of technology partnerships & Reputation \\\cline{2-4}  
    & Matt Marum & Director of ISV alliances & SugarCRM \\ \hline
    
    \SetCell[r=4]{}{Cross-functional collaboration in tech partnerships} 
    & Roger Haas & Sr. manager of technology partnerships & Pantheon.io \\\cline{2-4} 
    & Jamie Boardman & Director of partnerships, product & Mailchimp \\\cline{2-4}  
    & Kenneth Marks & Associate Director of product management & Olo \\\cline{2-4}  
    & John Greene & Director of engineering, integrations & Airship \\ \hline
    
    \SetCell[r=4]{}{Advice for Building a Tech Partner Program} 
    & Jaimie Fucillo & VP of Partnerships & Mindbody \\\cline{2-4} 
    & Daniel O'Leary & Director of Partnerships & Box \\\cline{2-4}  
    & Jake Wallace & Head of global technology partnerships & Trustpilot \\\cline{2-4}  
    & Elliot Smith & Head of partnerships & 6sense \\ \hline
        
    \SetCell[r=4]{}{How to Tackle Tech Partner Operations} 
    & Megha Bhatt & Partnerships lead of operations \& strategy operations & Shopify \\\cline{2-4} 
    & Greg Mitchell & Partner programs and operations & Starburst \\\cline{2-4}  
    & Matt Irving & Sr. Manager of global partner programs \& strategy & WP Engine \\\cline{2-4}  
    & Manishi Singh & SVP of app orchestration & Spryker Systems \\ \hline
    
    \SetCell[r=4]{}{How to Build a Platform UX Partners and Customers Love} 
    & Richard Fortune & Product manager of platform experience & Xero \\\cline{2-4} 
    & Courtney George & Head of design for data & Amplitude \\\cline{2-4}  
    & Kirby Montgomery & VP of product leadership & C2FO \\\cline{2-4}  
    & Ashwini Sriram & Group product manager & Twilio \\ \hline
    
\end{longtblr}
\end{document}

longtblr 示例

答案2

我建议您使用xltabular环境。 与xltabular非常相似longtable,只是可以使用环境X定义的列类型tabularx

我还想鼓励您删除表格中的所有垂直线,并用空白替换水平线,以使表格看起来更加开放和吸引人。

进行这些更改后,表格应该可以容纳两页。

在此处输入图片描述

\documentclass{article}

\usepackage{xltabular,ragged2e,booktabs}
\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}\hsize=#1\hsize}X}
\newcolumntype{M}[1]{>{\raggedright\hsize=#1\hsize}X}
\newcommand\mycell[1]{%
   \smash{\begin{tabular}[t]{@{}p{\hsize}@{}} #1 \end{tabular}}}

\begin{document}
% note that 1+0.8+1.45+0.75=4= no. of X-type columns:
\begin{xltabular}{\textwidth}{@{} L{1}M{0.8}L{1.45}L{0.75} @{}} 


%% headers and footers

\caption{SaaS Ecosystem Alliance Events}\label{SaaSEA} \\
\toprule
Event & Panelist & Role & Organization \\  
\midrule
\endfirsthead

\multicolumn{4}{@{}l}{Table \thetable, continued}\\
\addlinespace\toprule 
Event & Panelist & Role & Organization \\  
\midrule
\endhead

\midrule
\multicolumn{4}{r@{}}{\small\itshape Continued on next page}\\
\endfoot

\bottomrule
\endlastfoot


% body of table

    \mycell{Ecosystem Partner Marketing Roundtable}
    & Mark Lafrate & Product marketing manager for  apps \& partnerships & Intercom \\ 
    \addlinespace 
    & Katie Rubak & Sr.\ manager of partner marketing & Talkdesk \\ 
    \addlinespace 
    & Briarley Laban & Global Director of partner marketing & Trustpilot \\ 
    \addlinespace 
    & Morgan Rochofski & Product and partner marketing & Salesloft \\  
    \addlinespace[2.5ex] %\midrule
   
    \mycell{Leaders of Larger Ecosystems Roundtable}
    & Scott Brinker & VP of platform ecosystem & HubSpot \\ 
    \addlinespace 
    & Bader Hamdan & Head of platform partnerships & Twilio \\ 
    \addlinespace  
    & Shay Howe & SVP of platform strategy & Active\-Campaign \\ 
    \addlinespace  
    & Heidi Williams & Head of platform engineering & Grammarly \\  
    \addlinespace[2.5ex] %\midrule
  
    \mycell{How to Prioritize SaaS Product Integrations Roundtable}
    & Richard O'Connell & Director of product partnerships & Atlassian \\ 
    \addlinespace 
    & Amanda Groves & Director of product marketing & Crossbeam \\ 
    \addlinespace  
    & Chris Lavoie & Sr.\ technology partner manager & Gorgias \\ 
    \addlinespace  
    & Kabir Mathur & Head of product partnerships & Typeform  \\  
    \addlinespace[2.5ex] %\midrule
    
    \mycell{How to Build a API and Integrations Roadmap}
    & Chloe Wu & Product manager & Gusto \\ \addlinespace 
    & India Anderson & Sr.\ manager, product management integrations & Avalara \\ 
    \addlinespace  
    & Deven Ravel & Head of technology partnerships & Reputation \\ 
    \addlinespace  
    & Matt Marum & Director of ISV alliances & SugarCRM \\  
    %\addlinespace[2.5ex] %\midrule
    
   \mycell{Cross-functional collaboration in tech partnerships}
    & Roger Haas & Sr.\ manager of technology partnerships & Pantheon.io \\* 
    \addlinespace 
    & Jamie Boardman & Director of partnerships, product & Mailchimp \\ 
    \addlinespace  
    & Kenneth Marks & Associate Director of product management & Olo \\ 
    \addlinespace  
    & John Greene & Director of engineering, integrations & Airship  \\  
    \addlinespace[2.5ex] %\midrule
    
    \mycell{Advice for Building a Tech Partner Program}
    & Jaimie Fucillo & VP of Partnerships & Mindbody \\ 
    \addlinespace 
    & Daniel O'Leary & Director of Partnerships & Box \\ 
    \addlinespace  
    & Jake Wallace & Head of global technology partnerships & Trustpilot \\ 
    \addlinespace  
    & Elliot Smith & Head of partnerships & 6sense \\  
    \addlinespace[2.5ex] %\midrule
        
    \mycell{How to Tackle Tech Partner Operations}
    & Megha Bhatt & Partnerships lead of operations \& strategy operations & Shopify \\ 
    \addlinespace 
    & Greg Mitchell & Partner programs and operations & Starburst \\ 
    \addlinespace  
    & Matt Irving & Sr.\ Manager of global partner programs \& strategy & WP Engine \\ 
    \addlinespace  
    & Manishi Singh & SVP of app orchestration & Spryker Systems \\  
    \addlinespace[2.5ex] %\midrule
    
    \mycell{How to Build a Platform UX Partners and Customers Love}
    & Richard Fortune & Product manager of platform experience & Xero \\ 
    \addlinespace 
    & Courtney George & Head of design for data & Amplitude \\ 
    \addlinespace  
    & Kirby Montgomery & VP of product leadership & C2FO \\ 
    \addlinespace  
    & Ashwini Sriram & Group product manager & Twilio  \\  
    
\end{xltabular}

\end{document}

相关内容