1

I have this table:

\documentclass[a4paper,12pt]{article}
\usepackage[margin=0.65in]{geometry}
\usepackage{tabularx}
\renewcommand{\arraystretch}{1.5}
\usepackage{booktabs}
\usepackage{float}
\title{}
\author{}
\date{}
\begin{document}
\begin{table}[H]
\centering
\caption{Thin Rod Simulation Results for 2 Material Forwards Euler}
\label{tbl:2}
 \begin{tabularx}{\textwidth}{XXXXX}
 \toprule
  & x & T = 0.01 & T = 0.015 & T = 0.02 \\
 \midrule
 c2 = 1 & 1/11 & 0.255 & 0.243 & 0.232 \\
 & 3/11 & 0.685 & 0.652 & 0.621 \\
 & 5/11 & 0.897 & 0.854 & 0.813 \\
 & 7/11 & 0.825 & 0.785 & 0.748 \\
 & 9/11 & 0.490 & 0.467 & 0.444 \\
 \midrule
 c2 = 5 & 1/11 & 0.255 & 0.242 & 0.228 \\
 & 3/11 & 0.680 & 0.635 & 0.585 \\
 & 5/11 & 0.806 & 0.699 & 0.604 \\
 & 7/11 & 0.624 & 0.535 & 0.460 \\
 & 9/11 & 0.351 & 0.298 & 0.255 \\
\midrule
 c2 = 10 & 1/11 & 0.255 & 0.240 & 0.221 \\
 & 3/11 & 0.667 & 0.596 & 0.510 \\
 & 5/11 & 0.610 & 0.383 & 0.185 \\
 & 7/11 & 0.472 & 0.324 & 0.192 \\
 & 9/11 & 0.262 & 0.186 & 0.117 \\
 \bottomrule
 \end{tabularx}
\end{table}
\end{document}

But the problem is that it is too big and I need it much smaller. Something like this:

enter image description here

I got that image I screenshoting the original table and making it smaller. But that's sort of cheating. So how can I make it really small like I have in the image? I tried 0.5\textwidth, but that doesn't look good. Maybe multirow for first column?

  • Like that? i.stack.imgur.com/cO2PA.png – leandriis Apr 19 at 14:36
  • How much smaller and what should be smaller? The vertical distance between rows? The font size...? And what do you want to use \multirow for? – leandriis Apr 19 at 14:41
  • Do you want to vertically center the "c=..." with respect to the five rows that it corresponds to? If you want to keep it vertically aligned with "1/11" there is no need fow \multirow. – leandriis Apr 19 at 14:45
  • 1
    why are you forcing the table to be taller with \renewcommand{\arraystretch}{1.5} and wider with \begin{tabularx}{\textwidth} if you want it smaller? – David Carlisle Apr 19 at 14:48
  • that is, simply removing those is an answer as Zarko showed, but I wonder what was the intention, perhaps there is some other way to achieve whatever these were intended to do, presumably they were added for a reason? – David Carlisle Apr 19 at 15:02
1

Here are two versions of your table: I have used a regular tabular since there is no need for automatic linebreaks in table columns. In order to improve the alignment of the numbers, I have used siunitx. In the second example, I have additionally reduced the font size to \small and the \arraystretch to 1.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage[margin=0.65in]{geometry}
\renewcommand{\arraystretch}{1.5}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{caption}
\begin{document}

\begin{table}
\centering
\caption{Thin Rod Simulation Results for 2 Material Forwards Euler}
\label{tbl:2}
 \begin{tabular}{lcc*{3}{S[table-format=1.3]}}
 \toprule
  & x & {T = 0.01} & {T = 0.015} & {T = 0.02} \\
 \midrule
 c2 = 1 & 1/11 & 0.255 & 0.243 & 0.232 \\
 & 3/11 & 0.685 & 0.652 & 0.621 \\
 & 5/11 & 0.897 & 0.854 & 0.813 \\
 & 7/11 & 0.825 & 0.785 & 0.748 \\
 & 9/11 & 0.490 & 0.467 & 0.444 \\
 \midrule
 c2 = 5 & 1/11 & 0.255 & 0.242 & 0.228 \\
 & 3/11 & 0.680 & 0.635 & 0.585 \\
 & 5/11 & 0.806 & 0.699 & 0.604 \\
 & 7/11 & 0.624 & 0.535 & 0.460 \\
 & 9/11 & 0.351 & 0.298 & 0.255 \\
\midrule
 c2 = 10 & 1/11 & 0.255 & 0.240 & 0.221 \\
 & 3/11 & 0.667 & 0.596 & 0.510 \\
 & 5/11 & 0.610 & 0.383 & 0.185 \\
 & 7/11 & 0.472 & 0.324 & 0.192 \\
 & 9/11 & 0.262 & 0.186 & 0.117 \\
 \bottomrule
 \end{tabular}
\end{table}

\begin{table}
\centering
\renewcommand{\arraystretch}{1}
\small
\caption{Thin Rod Simulation Results for 2 Material Forwards Euler}
\label{tbl:2}
 \begin{tabular}{lcc*{3}{S[table-format=1.3]}}
 \toprule
  & x & {T = 0.01} & {T = 0.015} & {T = 0.02} \\
 \midrule
 c2 = 1 & 1/11 & 0.255 & 0.243 & 0.232 \\
 & 3/11 & 0.685 & 0.652 & 0.621 \\
 & 5/11 & 0.897 & 0.854 & 0.813 \\
 & 7/11 & 0.825 & 0.785 & 0.748 \\
 & 9/11 & 0.490 & 0.467 & 0.444 \\
 \midrule
 c2 = 5 & 1/11 & 0.255 & 0.242 & 0.228 \\
 & 3/11 & 0.680 & 0.635 & 0.585 \\
 & 5/11 & 0.806 & 0.699 & 0.604 \\
 & 7/11 & 0.624 & 0.535 & 0.460 \\
 & 9/11 & 0.351 & 0.298 & 0.255 \\
\midrule
 c2 = 10 & 1/11 & 0.255 & 0.240 & 0.221 \\
 & 3/11 & 0.667 & 0.596 & 0.510 \\
 & 5/11 & 0.610 & 0.383 & 0.185 \\
 & 7/11 & 0.472 & 0.324 & 0.192 \\
 & 9/11 & 0.262 & 0.186 & 0.117 \\
 \bottomrule
 \end{tabular}
\end{table}
\end{document}
| improve this answer | |
  • 1
    Use tabularx if you have a regular tabular that would otherwise be wider than the textwidth. Use it only if that tabular contains a column with text, not with numbers. Use the X type column for columns in which you want to allow linebreaks to make the overall table narrower. Your table is already narrower than the textwidth and you aparantly don't want the table to be as wide as the textwidth --> no need for tabularx for this spwcific table. – leandriis Apr 19 at 15:00
2

Just for completeness ... using standard c columns and tabular table environment:

\documentclass[a4paper,12pt]{article}
\usepackage[margin=0.65in]{geometry}
%\usepackage{tabularx}
%\renewcommand{\arraystretch}{1.5}
\usepackage{booktabs, multirow}
\usepackage[skip=1ex]{caption}
%\usepackage{float}
\title{}
\author{}
\date{}
\begin{document}
\begin{table}[ht]
\centering
\caption{Thin Rod Simulation Results for 2 Material Forwards Euler}
\label{tbl:2}
\begin{tabular}{*{5}{c}}
    \toprule
        & \multirow{2.4}{*}{x}
                & \multicolumn{3}{c}{T} \\
    \cmidrule{3-5}
        &       & 0.01  & 0.015 & 0.02  \\
    \midrule
 c2 = 1 & 1/11  & 0.255 & 0.243 & 0.232 \\
        & 3/11  & 0.685 & 0.652 & 0.621 \\
        & 5/11  & 0.897 & 0.854 & 0.813 \\
        & 7/11  & 0.825 & 0.785 & 0.748 \\
        & 9/11  & 0.490 & 0.467 & 0.444 \\
    \midrule
 c2 = 5 & 1/11  & 0.255 & 0.242 & 0.228 \\
        & 3/11  & 0.680 & 0.635 & 0.585 \\
        & 5/11  & 0.806 & 0.699 & 0.604 \\
        & 7/11  & 0.624 & 0.535 & 0.460 \\
        & 9/11  & 0.351 & 0.298 & 0.255 \\
    \midrule
 c2 = 10 & 1/11 & 0.255 & 0.240 & 0.221 \\
         & 3/11 & 0.667 & 0.596 & 0.510 \\
         & 5/11 & 0.610 & 0.383 & 0.185 \\
         & 7/11 & 0.472 & 0.324 & 0.192 \\
         & 9/11 & 0.262 & 0.186 & 0.117 \\
    \bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here

| improve this answer | |
  • @dave, only if you have installed old multirow package. Try to update your LaTeX instalation. With old multirow package you can write \multirow{2}{*}[-0.5ex]{x}. – Zarko Apr 19 at 15:04

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.