我对 Latex 还很陌生,真的需要帮助。我试图格式化一个长表,以便在标题下插入表格的描述。我尝试使用 \multicolumn,但第一列变得很长,文本不适合页面。有人有这方面的经验吗?谢谢!
\begin{longtable}[c]{p{1cm}p{6cm}p{3.5cm}p{5cm}}
\caption{Overview bank sample \label{Overview sample compilation}}
\hline
\textbf{Rank} & \textbf{Bank name} & \textbf{Home country} & \textbf{Local Index}\\
\hline
\endfirsthead
\hline
\multicolumn{4}{r}{Continuation of Table \ref{Overview sample compilation}}\\
\hline
\textbf{Rank} & \textbf{Bank name} & \textbf{Home country} & \textbf{Local Index} \\
\hline
\endhead
\hline
\endfoot
\endlastfoot
1 & Allied Irish Banks & Ireland & ISEQ20 \\
2 & Banco Bilbao Vizcaya Argentina & Spain & IBEX 35 \\
3 & Banco Santander & Spain & IBEX 35 \\
4 & Bank of America & United States & S\&P 500 \\
5 & Bank of Montreal & Canada & S\&P TSX Composite Index \\
6 & Barclays & United Kingdom & FTSE 100 \\
7 & BNP Paribas & France & CAC 40 \\
8 & Citigroup & United States & S\&P 500 \\
9 & Commerzbank & Germany & DAX 30 \\
10 & Credit Suisse & Switzerland & Swiss Market Index \\
11 & Deutsche Bank & Germany & DAX 30 \\
12 & HSBC & United Kingdom & FTSE 100 \\
13 & ING Groep & Netherlands & AEX \\
14 & JP Morgan Chase & United States & S\&P 500 \\
15 & KBC Groep & Belgium & BEL20 \\
16 & Lehman Brothers & United States & S\&P 500 \\
17 & Merrill Lynch & United States & S\&P 500 \\
18 & Morgan Stanley & United States & S\&P 500 \\
19 & National City Corporation & United States & S\&P 500 \\
20 & PNC Financial Services & United States & S\&P 500 \\
21 & Royal Bank of Scotland & United Kingdom & FTSE 100 \\
22 & Societe Generale & France & CAC 40 \\
23 & SunTrust Bank & United States & S\&P 500 \\
24 & U.S. Bancorp & United States & S\&P 500 \\
25 & UBS & Switzerland & Swiss Market Index \\
26 & UniCredit SPA & Italy & FTSE MIB \\
27 & Washington Mutual & United States & S\&P 500 \\
28 & Wells Fargo & United States & S\&P 500 \\
\hline
\multicolumn{4}{l}{Source: Own depiction based on Bloomberg database.}
\hline
\end{longtable}
答案1
我建议使用基于 的布局,它将的threeparttablex
功能引入,但语法略有不同。具体来说,它允许您在表格中的任何位置插入表格注释,因此我决定将它们插入到标题之后。我不得不到处修改 以使表格适合边距。threeparttable
longtable
\makecell
\documentclass{article}
\usepackage{longtable,booktabs}
\usepackage{threeparttablex, caption}
\usepackage{makecell}
\providecommand\TPTLsourcename{\textit{Source}}
\let\source=\TPTLsourcename
\begin{document}
\begin{ThreePartTable}
\begin{TableNotes}[para, flushleft]
\source: Own depiction based on Bloomberg database. Blah blah blah. Blah blah blah. Blah blah blah. Blah blah blah.
\end{TableNotes}
\centering
\begin{longtable}{@{}c l l l@{}}
\caption{Overview bank sample \label{Overview sample compilation}}\\[-2ex]
\insertTableNotes \\
\addlinespace[2ex]
\toprule
\textbf{Rank} & \textbf{Bank name} & \textbf{Home country} & \textbf{Local Index}\\
\midrule
\endfirsthead
\midrule
\multicolumn{4}{r}{Continuation of Table \ref{Overview sample compilation}}\\
\midrule
\textbf{Rank} & \textbf{Bank name} & \textbf{Home country} & \textbf{Local Index} \\
\midrule
\endhead
\midrule
\endfoot
\bottomrule
\endlastfoot
1 & Allied Irish Banks &
Ireland & ISEQ20 \\
2 & \makecell[tl]{Banco Bilbao Vizcaya\\ Argentina} &
Spain & IBEX 35 \\
3 & Banco Santander &
Spain & IBEX 35 \\
4 & Bank of America & United
States & S\&P 500 \\
5 & Bank of Montreal &
Canada & \makecell[tl]{S\&P TSX \\ Composite Index} \\
6 & Barclays & United
Kingdom & FTSE 100 \\
7 & BNP Paribas &
France & CAC 40 \\
8 & Citigroup & United
States & S\&P 500 \\
9 & Commerzbank &
Germany & DAX 30 \\
10 & Crédit Suisse &
Switzerland & Swiss Market Index \\
11 & Deutsche Bank &
Germany & DAX 30 \\
12 & HSBC & United
Kingdom & FTSE 100 \\
13 & ING Groep &
Netherlands & AEX \\
14 & JP Morgan Chase & United
States & S\&P 500 \\
15 & KBC Groep &
Belgium & BEL20 \\
16 & Lehman Brothers & United
States & S\&P 500 \\
17 & Merrill Lynch & United
States & S\&P 500 \\
18 & Morgan Stanley & United
States & S\&P 500 \\
19 & National City Corporation & United
States & S\&P 500 \\
20 & PNC Financial Services & United
States & S\&P 500 \\
21 & Royal Bank of Scotland & United
Kingdom & FTSE 100 \\
22 & Société Générale &
France & CAC 40 \\
23 & SunTrust Bank & United
States & S\&P 500 \\
24 & U.S. Bancorp & United
States & S\&P 500 \\
25 & UBS &
Switzerland & Swiss Market Index \\
26 & UniCredit SPA &
Italy & FTSE MIB \\
27 & Washington Mutual & United
States & S\&P 500 \\
28 & Wells Fargo & United
States & S\&P 500 \\
\end{longtable}
\end{ThreePartTable}
\end{document}
答案2
\documentclass{article}
\usepackage{longtable,booktabs}
\begin{document}
\begin{longtable}{c l l l}
\caption{Overview bank sample \label{Overview sample compilation}}\\
\toprule
\textbf{Rank} & \textbf{Bank name} & \textbf{Home country} & \textbf{Local Index}\\
\midrule
\endfirsthead
\midrule
\multicolumn{4}{r}{Continuation of Table \ref{Overview sample compilation}}\\
\midrule
\textbf{Rank} & \textbf{Bank name} & \textbf{Home country} & \textbf{Local Index} \\
\midrule
\endhead
\midrule
\endfoot
\midrule
\multicolumn{4}{l}{Source: Own depiction based on Bloomberg database.}\\
\midrule
\endlastfoot
1 & Allied Irish Banks &
Ireland & ISEQ20 \\
2 & Banco Bilbao Vizcaya Argentina &
Spain & IBEX 35 \\
3 & Banco Santander &
Spain & IBEX 35 \\
4 & Bank of America & United
States & S\&P 500 \\
5 & Bank of Montreal &
Canada & S\&P TSX Composite Index \\
6 & Barclays & United
Kingdom & FTSE 100 \\
7 & BNP Paribas &
France & CAC 40 \\
8 & Citigroup & United
States & S\&P 500 \\
9 & Commerzbank &
Germany & DAX 30 \\
10 & Credit Suisse &
Switzerland & Swiss Market Index \\
11 & Deutsche Bank &
Germany & DAX 30 \\
12 & HSBC & United
Kingdom & FTSE 100 \\
13 & ING Groep &
Netherlands & AEX \\
14 & JP Morgan Chase & United
States & S\&P 500 \\
15 & KBC Groep &
Belgium & BEL20 \\
16 & Lehman Brothers & United
States & S\&P 500 \\
17 & Merrill Lynch & United
States & S\&P 500 \\
18 & Morgan Stanley & United
States & S\&P 500 \\
19 & National City Corporation & United
States & S\&P 500 \\
20 & PNC Financial Services & United
States & S\&P 500 \\
21 & Royal Bank of Scotland & United
Kingdom & FTSE 100 \\
22 & Societe Generale &
France & CAC 40 \\
23 & SunTrust Bank & United
States & S\&P 500 \\
24 & U.S. Bancorp & United
States & S\&P 500 \\
25 & UBS &
Switzerland & Swiss Market Index \\
26 & UniCredit SPA &
Italy & FTSE MIB \\
27 & Washington Mutual & United
States & S\&P 500 \\
28 & Wells Fargo & United
States & S\&P 500 \\
\end{longtable}
\end{document}
如果你的描述对于 aline 来说太长,请使用:
\multicolumn{4}{l}{\parbox{\dimexpr\textwidth-2\tabcolsep}{%
Source: Own depiction based on Bloomberg database. ... more text}}
如果你的表格太宽,那么使用包xltabular
和
\begin{xltabular}{\linewidth}{c X l l}
[...]
\multicolumn{4}{p{\dimexpr\textwidth-2\tabcolsep}}{Source: Own depiction based on Bloomberg database.}\\