4

I'm trying to make a table using the tabular environment containing many columns but the resulting table appears very small and unreadable (the font is way too small as well). I'm pretty new to LaTeX, any help would be greatly appreciated! My code is below.

\documentclass[12pt]{article}
\usepackage{setspace}
\doublespacing
\usepackage[utf8]{inputenc}
\usepackage [english]{babel}
\usepackage [autostyle, english = american]{csquotes}
\usepackage{multirow}
\usepackage[tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in]{geometry}
\usepackage[labelsep=period]{caption}
\captionsetup[table]{name=Table}
\renewcommand{\thetable}{\Roman{table}}

\begin{table}[!h]
\centering
\caption{Sampling Conditions for each run.}
\resizebox{\columnwidth}{!}{
\begin{tabular}{ |c|c|c|c|c|c|c|c| } 
    \hline
    Run & Position (in) & Burst Threshold (mV) & Bandpass Filter (MHz) & Downmix Frequency (MHz) & Transceiver Orientation & Freestream Seeder Condition & Jet Seeder Condition \\
    \hline
    1 & 0 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    2 & 0 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    3 & 0.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    4 & 1.0 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    5,6,7 & 1.25 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    8 & 1.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    9,10,11 & 1.75 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    12 & 2 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    13 & 2.25 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    14,15,16 & 2.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    17 & 2.75 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    18 & 3.0 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    19 & 3.25 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    20 & 3.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    21 & 3.75 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    22 & 4.0 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    23,24,25 & 4.25 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    26 & 4.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    27 & 4.75 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    28 & 5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    29 & 5.25 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    30 & 5.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    31 & 1.25 & 30 & 0.3-3 & 40 & 90$^\circ$ & On & On\\
    \hline
    32 & 4.5 & 30 & 0.3-3 & 40 & 90$^\circ$ & On & On\\
    \hline
    33 & 4.5 & 150 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    34 & 4.5 & 30 & ?? & ?? & 90$^\circ$ & Off & On\\
    \hline
    35 & 4.5 & 30 & ?? & ?? & 90$^\circ$ & On & Off\\
    \hline
    36 & 4.5 & ?? & ?? & ?? & 0$^\circ$ & On & On\\
    \hline
\end{tabular}
}
\end{table}
4
  • 2
    Welcome to TeX.SX! Resizing a table is seldom a solution, as you discovered.
    – egreg
    Oct 27, 2018 at 15:53
  • 3
    never use \resizebox on tables, as you see it makes wildly inconsistemt and in this case unusable font sizes. Oct 27, 2018 at 15:53
  • 3
    also don't use [!h] latex usually warns about that and changes it to [!ht] but [htp] is better Oct 27, 2018 at 15:55
  • 1
    Ok gotcha. How can I fit the table properly within the page without \resizebox then? Oct 27, 2018 at 16:05

2 Answers 2

5
\documentclass[12pt]{article}
\usepackage{setspace}
\doublespacing
\usepackage[utf8]{inputenc}
\usepackage [english]{babel}
\usepackage [autostyle, english = american]{csquotes}
\usepackage{multirow}
\usepackage[tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in]{geometry}
\usepackage[labelsep=period]{caption}
\captionsetup[table]{name=Table}
\renewcommand{\thetable}{\Roman{table}}

\newcommand\hd[1]{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}
\begin{document}
\begin{table}[htp]
\centering
\caption{Sampling Conditions for each run.}
\small
\setlength\tabcolsep{5pt}
\begin{tabular}{@{}|c|c|c|c|c|c|c|c|@{}} 
    \hline
\hd{Run} &
\hd{Position\\(in)} &
\hd{Burst\\Threshold\\ (mV)} &
\hd{Bandpass\\Filter\\ (MHz)}&
\hd{Downmix\\Frequency\\ (MHz)} &
\hd{Transceiver\\ Orientation} &
\hd{Freestream\\ Seeder\\ Condition} &
\hd{Jet\\ Seeder\\Condition} \\
    \hline
    1 & 0 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    2 & 0 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    3 & 0.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    4 & 1.0 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    5,6,7 & 1.25 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    8 & 1.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    9,10,11 & 1.75 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    12 & 2 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    13 & 2.25 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    14,15,16 & 2.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    17 & 2.75 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    18 & 3.0 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    19 & 3.25 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    20 & 3.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    21 & 3.75 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    22 & 4.0 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    23,24,25 & 4.25 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    26 & 4.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    27 & 4.75 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    28 & 5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    29 & 5.25 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    30 & 5.5 & 30 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    31 & 1.25 & 30 & 0.3-3 & 40 & 90$^\circ$ & On & On\\
    \hline
    32 & 4.5 & 30 & 0.3-3 & 40 & 90$^\circ$ & On & On\\
    \hline
    33 & 4.5 & 150 & 1-10 & 38 & 90$^\circ$ & On & On\\
    \hline
    34 & 4.5 & 30 & ?? & ?? & 90$^\circ$ & Off & On\\
    \hline
    35 & 4.5 & 30 & ?? & ?? & 90$^\circ$ & On & Off\\
    \hline
    36 & 4.5 & ?? & ?? & ?? & 0$^\circ$ & On & On\\
    \hline
\end{tabular}

\end{table}

\end{document}
2
  • Thank you! Just to clarify, what was the purpose of the new command that you made? Oct 27, 2018 at 16:25
  • it's a nested tabular useful for making multi-line headings \hd short for heading here. @JoshPilipovsky Oct 27, 2018 at 16:26
2

The worst problem you have is with the very long headers, that take the most space. I propose to set them in abbreviated form with a legend beneath the table.

Also I remove most of the rules, especially the vertical ones that take up valuable space for no purpose.

I'd recommend siunitx for any table with numeric data.

\documentclass[12pt]{article}
\usepackage{siunitx,booktabs,threeparttable}

\newcommand{\splitcell}[1]{{%
  \begin{tabular}[t]{@{}c@{}}#1\end{tabular}%
}}

\begin{document}

\begin{table}[!htp]

\caption{Sampling Conditions for each run.}

\setlength{\tabcolsep}{0pt} % let TeX compute the spacing
\begin{tabular*}{\textwidth}{
 @{\extracolsep{\fill}}
 c
 S[table-format=1.2]
 S[table-format=3.0]
 c
 S[table-format=2.0]
 S[table-format=2.0]
 c
 c
 @{}
} 
\toprule
Run &
\splitcell{P  \\ (\si{in})} &
\splitcell{BT \\ (\si{mV})} &
\splitcell{BF \\ (\si{MHz})} &
\splitcell{DF \\ (\si{MHz})} &
\splitcell{TO \\ (\si{\degree})} &
FSC &
JSC \\
\midrule
1 & 0 & 30 & 1-10 & 38 & 90 & On & On\\
2 & 0 & 30 & 1-10 & 38 & 90 & On & On\\
3 & 0.5 & 30 & 1-10 & 38 & 90 & On & On\\
4 & 1.0 & 30 & 1-10 & 38 & 90 & On & On\\
5,6,7 & 1.25 & 30 & 1-10 & 38 & 90 & On & On\\
8 & 1.5 & 30 & 1-10 & 38 & 90 & On & On\\
9,10,11 & 1.75 & 30 & 1-10 & 38 & 90 & On & On\\
12 & 2 & 30 & 1-10 & 38 & 90 & On & On\\
13 & 2.25 & 30 & 1-10 & 38 & 90 & On & On\\
14,15,16 & 2.5 & 30 & 1-10 & 38 & 90 & On & On\\
17 & 2.75 & 30 & 1-10 & 38 & 90 & On & On\\
18 & 3.0 & 30 & 1-10 & 38 & 90 & On & On\\
19 & 3.25 & 30 & 1-10 & 38 & 90 & On & On\\
20 & 3.5 & 30 & 1-10 & 38 & 90 & On & On\\
21 & 3.75 & 30 & 1-10 & 38 & 90 & On & On\\
22 & 4.0 & 30 & 1-10 & 38 & 90 & On & On\\
23,24,25 & 4.25 & 30 & 1-10 & 38 & 90 & On & On\\
26 & 4.5 & 30 & 1-10 & 38 & 90 & On & On\\
27 & 4.75 & 30 & 1-10 & 38 & 90 & On & On\\
28 & 5 & 30 & 1-10 & 38 & 90 & On & On\\
29 & 5.25 & 30 & 1-10 & 38 & 90 & On & On\\
30 & 5.5 & 30 & 1-10 & 38 & 90 & On & On\\
31 & 1.25 & 30 & 0.3-3 & 40 & 90 & On & On\\
32 & 4.5 & 30 & 0.3-3 & 40 & 90 & On & On\\
33 & 4.5 & 150 & 1-10 & 38 & 90 & On & On\\
34 & 4.5 & 30 & {??} & {??} & 90 & Off & On\\
35 & 4.5 & 30 & {??} & {??} & 90 & On & Off\\
36 & 4.5 & {??} & {??} & {??} & 0 & On & On\\
\midrule[\heavyrulewidth]
\end{tabular*}
\raggedright
  P: Position; BT: Burst~Threshold; BF:~Bandpass~Filter;
  DF:~Downmix~Frequency; TO:~Transceiver~Orientation;
  FSC:~Freestream~Seeder~Condition; JSC:~Jet~Seeder~Condition.

\end{table}

\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .