4

I have a table in landscape mode, and there is extra space on the right-hand side of my table (see yellow circle). What changes need to be made so that the text is spread evenly across the table?

enter image description here

\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} 
  • Because you have asked for the table to fill \columnwidth but the contents are narrower than that. egreg's answer below provides a much simpler way to set your table. – Andrew Swann Oct 19 '14 at 10:37
3

Your input is way too complicated. The problem is that you never let LaTeX add the extracolsep, because you're always overriding the template with \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} 

enter image description here

| improve this answer | |
  • The table is set up explicitly to occupy the full width of the textblock. Is the \centering instruction even needed? If anything, what's needed is \noindent. – Mico Oct 19 '14 at 10:41
  • @Mico If the pseudocaption is wanted… – egreg Oct 19 '14 at 10:42
  • Did you deliberately omit the pseudocaption? (The OP didn't have the pseudocaption inside the center environment -- can't tell if that was by design or not...) – Mico Oct 19 '14 at 10:43
  • I understand the problem after reading your answer. Thanks for your help. – philq Oct 19 '14 at 11:00
1

You can have a simpler code using   tabularx. To improve the table, I use the S qualifier from the siunitx package for the Code columns, booktabs to have a better vertical spacing around horizontal rules and makecell for a common formatting of column heads. Also, it's better to have the Industry columns left-aligned, but that may be changed if you prefer centred columns.

\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} 

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.