表格右侧有额外空间

表格右侧有额外空间

我有一个横向模式的表格,表格右侧有多余的空间(见黄色圆圈)。需要进行哪些更改才能使文本均匀分布在表格上?

在此处输入图片描述

\documentclass[twoside,12pt]{article}
\usepackage{lscape}
\usepackage{pgfplots}
\begin{document}
\begin{landscape}
\footnotesize
\begin{center}
\begin{tabular*}
{\columnwidth}
{@{\extracolsep{\fill}}l@{\extracolsep{\fill}}
r@{\extracolsep{0in}}@{.}
l@{\extracolsep{\fill}}
r@{\extracolsep{0in}}@{.}
l@{\extracolsep{\fill}}
r@{\extracolsep{0in}}@{.}
l@{\extracolsep{\fill}}
r@{\extracolsep{0in}}@{.}
l@{\extracolsep{\fill}}
r@{\extracolsep{0in}}@{.}
l@{\extracolsep{\fill}}
r@{\extracolsep{0in}}@{.}l}

\hline
\multicolumn{2}{c}{Code} & \multicolumn{2}{c}{Industry} & \multicolumn{2}{c}{Code} & \multicolumn{2}{c}{Industry} & \multicolumn{2}{c}{Code} & \multicolumn{2}{c}{Industry}\\
\hline
\multicolumn{2}{c}{1} & \multicolumn{2}{c}{Agriculture} & \multicolumn{2}{c}{17} & \multicolumn{2}{c}{Construction Materials} & \multicolumn{2}{c}{33} & \multicolumn{2}{c}{Personal Services}\\


\multicolumn{2}{c}{2} & \multicolumn{2}{c}{Food Products} & \multicolumn{2}{c}{18} & \multicolumn{2}{c}{Construction} & \multicolumn{2}{c}{34} & \multicolumn{2}{c}{Business Services}\\


\multicolumn{2}{c}{3} & \multicolumn{2}{c}{Candy \& Soda} & \multicolumn{2}{c}{19} & \multicolumn{2}{c}{Steel Works Etc} & \multicolumn{2}{c}{35} & \multicolumn{2}{c}{Computers}\\


\multicolumn{2}{c}{4} & \multicolumn{2}{c}{Beer \& Liquor} & \multicolumn{2}{c}{20} & \multicolumn{2}{c}{Fabricated Products} & \multicolumn{2}{c}{36} & \multicolumn{2}{c}{Electronic Equipment}\\


\multicolumn{2}{c}{5} & \multicolumn{2}{c}{Tobacco Products} & \multicolumn{2}{c}{21} & \multicolumn{2}{c}{Machinery} & \multicolumn{2}{c}{37} & \multicolumn{2}{c}{Measuring \& Control Equipment}\\


\multicolumn{2}{c}{6} & \multicolumn{2}{c}{Recreation} & \multicolumn{2}{c}{22} & \multicolumn{2}{c}{Electrical Equipment} & \multicolumn{2}{c}{38} & \multicolumn{2}{c}{Business Supplies}\\


\multicolumn{2}{c}{7} & \multicolumn{2}{c}{Entertainment} & \multicolumn{2}{c}{23} & \multicolumn{2}{c}{Automobiles \& Trucks} & \multicolumn{2}{c}{39} & \multicolumn{2}{c}{Shipping Containers}\\


\multicolumn{2}{c}{8} & \multicolumn{2}{c}{Printing \& Publishing} & \multicolumn{2}{c}{24} & \multicolumn{2}{c}{Aircraft}& \multicolumn{2}{c}{40} & \multicolumn{2}{c}{Transportation}\\


\multicolumn{2}{c}{9} & \multicolumn{2}{c}{Consumer Goods} & \multicolumn{2}{c}{25} & \multicolumn{2}{c}{Shipbuilding, Railroad Eq.} & \multicolumn{2}{c}{41} & \multicolumn{2}{c}{Wholesale}\\


\multicolumn{2}{c}{10} & \multicolumn{2}{c}{Apparel} & \multicolumn{2}{c}{26} & \multicolumn{2}{c}{Defense} & \multicolumn{2}{c}{42} & \multicolumn{2}{c}{Retail}\\


\multicolumn{2}{c}{11} & \multicolumn{2}{c}{Healthcare} & \multicolumn{2}{c}{27} & \multicolumn{2}{c}{Precious Metals} & \multicolumn{2}{c}{43} & \multicolumn{2}{c}{Restaurants, Hotels, Motels}\\


\multicolumn{2}{c}{12} & \multicolumn{2}{c}{Medical Equipment} & \multicolumn{2}{c}{28} & \multicolumn{2}{c}{Mining} & \multicolumn{2}{c}{44} & \multicolumn{2}{c}{Banking}\\


\multicolumn{2}{c}{13} & \multicolumn{2}{c}{Pharmaceutical Products} & \multicolumn{2}{c}{29} & \multicolumn{2}{c}{Coal} & \multicolumn{2}{c}{45} & \multicolumn{2}{c}{Insurance}\\


\multicolumn{2}{c}{14} & \multicolumn{2}{c}{Chemicals} & \multicolumn{2}{c}{30} & \multicolumn{2}{c}{Petroleum \& Natural Gas} & \multicolumn{2}{c}{46} & \multicolumn{2}{c}{Real Estate}\\


\multicolumn{2}{c}{15} & \multicolumn{2}{c}{Rubber \& Plastics} & \multicolumn{2}{c}{31} & \multicolumn{2}{c}{Utilities} & \multicolumn{2}{c}{47} & \multicolumn{2}{c}{Trading}\\


\multicolumn{2}{c}{16} & \multicolumn{2}{c}{Textiles} & \multicolumn{2}{c}{32} & \multicolumn{2}{c}{Communication} & \multicolumn{2}{c}{48} & \multicolumn{2}{c}{Other}\\

\hline
\end{tabular*}
\end{center}
Figure 1 provides descriptive statistics on adoptions by Fama-French 48 industry classification.
\end{landscape}
\end{document} 

答案1

您的输入太复杂了。问题是您从不让 LaTeX 添加 extracolsep,因为您总是用 覆盖模板\multicolumn

\documentclass[twoside,12pt]{article}
\usepackage{lscape}

\begin{document}
\begin{landscape}
\footnotesize\centering
\begin{tabular*}{\columnwidth}{
  @{\extracolsep{\fill}}
  *{3}{c@{\extracolsep{0pt}\hspace{.5em}}c@{\extracolsep{\fill}}}
}
\hline
Code & Industry & Code & Industry & Code & Industry \\
\hline
1 & Agriculture & 17 & Construction Materials & 33 & Personal Services \\
2 & Food Products & 18 & Construction & 34 & Business Services \\
3 & Candy \& Soda & 19 & Steel Works Etc & 35 & Computers \\
4 & Beer \& Liquor & 20 & Fabricated Products & 36 & Electronic Equipment \\
5 & Tobacco Products & 21 & Machinery & 37 & Measuring \& Control Equipment \\
6 & Recreation & 22 & Electrical Equipment & 38 & Business Supplies \\
7 & Entertainment & 23 & Automobiles \& Trucks & 39 & Shipping Containers \\
8 & Printing \& Publishing & 24 & Aircraft & 40 & Transportation \\
9 & Consumer Goods & 25 & Shipbuilding, Railroad Eq. & 41 & Wholesale \\
10 & Apparel & 26 & Defense & 42 & Retail \\
11 & Healthcare & 27 & Precious Metals & 43 & Restaurants, Hotels, Motels \\
12 & Medical Equipment & 28 & Mining & 44 & Banking \\
13 & Pharmaceutical Products & 29 & Coal & 45 & Insurance \\
14 & Chemicals & 30 & Petroleum \& Natural Gas & 46 & Real Estate \\
15 & Rubber \& Plastics & 31 & Utilities & 47 & Trading \\
16 & Textiles & 32 & Communication & 48 & Other \\
\hline
\end{tabular*}
\end{landscape}
\end{document} 

在此处输入图片描述

答案2

您可以使用 获得更简单的代码   tabularx。为了改进表格,我使用包S中的限定符siunitx来表示代码列,booktabs以便在水平规则周围有更好的垂直间距,并makecell为列标题设置通用格式。此外,最好将列Industry左对齐,但如果您更喜欢居中列,则可以更改。

\documentclass[twoside,12pt]{article}
\usepackage{lscape}
\usepackage{array, booktabs, tabularx, makecell}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadalign{lc}
\renewcommand\theadset{\hspace*{2em}}

\usepackage{siunitx}

\begin{document}

\begin{landscape}
\footnotesize
\centering
\begin{tabularx}{\columnwidth}{*{3}{S[table-format=2.0]X@{}}}
\toprule
{Code} & \thead{Industry} & {Code} & \thead{Industry} & {Code} &\thead{Industry} \\
\midrule
\addlinespace
1 & Agriculture & 17 & Construction Materials & 33 & Personal Services\\

2 & Food Products & 18 & Construction & 34 & Business Services\\

3 & Candy \& Soda & 19 & Steel Works Etc & 35 & Computers\\

4 & Beer \& Liquor & 20 & Fabricated Products & 36 & Electronic Equipment\\

5 & Tobacco Products & 21 & Machinery & 37 & Measuring \& Control Equipment\\

6 & Recreation & 22 & Electrical Equipment & 38 & Business Supplies\\

7 & Entertainment & 23 & Automobiles \& Trucks & 39 & Shipping Containers\\

8 & Printing \& Publishing & 24 & Aircraft& 40 & Transportation\\

9 & Consumer Goods & 25 & Shipbuilding, Railroad Eq. & 41 & Wholesale\\

10 & Apparel & 26 & Defense & 42 & Retail\\

11 & Healthcare & 27 & Precious Metals & 43 & Restaurants, Hotels, Motels\\

12 & Medical Equipment & 28 & Mining & 44 & Banking\\

13 & Pharmaceutical Products & 29 & Coal & 45 & Insurance\\

14 & Chemicals & 30 & Petroleum \& Natural Gas & 46 & Real Estate\\

15 & Rubber \& Plastics & 31 & Utilities & 47 & Trading\\

16 & Textiles & 32 & Communication & 48 & Other\\
\addlinespace
\bottomrule
\addlinespace[3ex]
\multicolumn{6}{@{}l}{Figure 1 provides descriptive statistics on adoptions by Fama-French 48 industry classification.}
\end{tabularx}
\end{landscape}

\end{document} 

在此处输入图片描述

相关内容