4

I wrote a simple table with this commands:

\begin{table}[h]
\centering
\begin{tabular}{| c | c |}
\hline\hline
\multicolumn{1}{ |c| }{Parametro} &  \multicolumn{1}{ c| }{Espressione} \\ \hline \hline
$T_{ref}$ & $T_{0}$ \\ \hline
$P_{ref}$ & $P_{0}$ \\ \hline
$M_{ref}$ & $m_{O_{2}}$ \\ \hline
$L_{ref}$ & $\frac{K_{B}T_{ref}}{\sqrt{2}\pi Rc^{2}P_{0}}$ \\ \hline
$V_{ref}$ & $\sqrt{\frac{K_{B}T_{ref}}{m_{ref}}}$ \\ \hline
$t_{ref}$ & $\frac{L_{ref}}{V_{ref}}$ \\ \hline
\end{tabular}
\label{tab:Parametri_Riferimento}
\caption{Parametri di riferimento}% title of Table
\end{table}

and the output looks like this: enter image description here

Here is my problem: as you can see some of my equations inside of the table don't have enough space around them; therefore part of the letters interfere with the separating lines and it doesn't look too clear and nice to see.

Here is my question: is there a way to add some extra space within the same box in order to have more distance between the formulas and the box upper and lower boundaries?

1
  • Add \renewcommand{\arraystretch}{1.2} right after \centering
    – azetina
    Mar 9, 2015 at 16:10

3 Answers 3

3

Here is a little hack using the \rule command. The \rule command in normal use produces a simple black box with the following parameters \rule[depth]{width}{height}

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}
\begin{table}[h]
\centering
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{| c | c |}
\hline\hline
\multicolumn{1}{ |c| }{Parametro} &  \multicolumn{1}{ c| }{Espressione} \\ \hline \hline
$T_{\text{ref}}$ & $T_{0}$ \\ \hline
$P_{\text{ref}}$ & $P_{0}$ \\ \hline
$M_{\text{ref}}$ & $m_{O_{2}}$ \\ \hline
$L_{\text{ref}}$ & $\frac{K_{B}T_{\text{ref}}}{\sqrt{2}\pi Rc^{2}P_{0}}$\rule[-2ex]{0pt}{5ex} \\ \hline
$V_{\text{ref}}$ & $\sqrt{\frac{K_{B}T_{\text{ref}}}{m_{\text{ref}}}}$\rule[-2ex]{0pt}{6ex} \\ \hline
$t_{\text{ref}}$ & $\frac{L_{\text{ref}}}{V_{\text{ref}}}$\rule[-2ex]{0pt}{5ex} \\ \hline
\end{tabular}
\label{tab:Parametri_Riferimento}
\caption{Parametri di riferimento}% title of Table
\end{table}
\end{document}
2
  • The "ref" subscripts ought to be typeset using text rather than math italics.
    – Mico
    Mar 9, 2015 at 16:43
  • @Mico Aye Sir! :)
    – azetina
    Mar 9, 2015 at 16:53
3

Here's a solution with an "open" look, i.e., with no vertical rules and far fewer horizontal rules. The look is achieved by using the line-drawing macros of the booktabs package.

Some additional suggestions:

  • Since all cells in the table (except the two in the header row) should be typeset in math rather than text mode, it's convenient to use an array environment instead of a tabular environment. That way, you can get away with typing far fewer $ symbols.

  • The material in the right-hand column should be typeset in display rather than text style. Rather than having to type \displaystyle repeatedly, it's handy to define the column up front as needing to typeset its contents in display math style.

  • The repeated "ref" subscript should be set in text italics rather than math italics.

  • Since the two columns are of type c, it's not necessary to encase the material in the two header cells inside \multicolumn{1}{c}{...} statements.

enter image description here

\documentclass{article}
\usepackage{amsmath,booktabs,array}
\newcommand\itref{\textit{ref}}
\begin{document}
\begin{table}[h]
\centering
\renewcommand\arraystretch{1.5}
$\begin{array}{ @{} c  >{\displaystyle}c @{} }
\toprule
\text{Parametro} &  \text{Espressione} \\
\midrule
T_{\itref} & T_{0} \\
P_{\itref} & P_{0} \\
M_{\itref} & m_{O_{2}} \\[1ex]
L_{\itref} & \frac{K_{B}T_{\itref}}{\sqrt{2}\pi Rc^{2}P_{0}} \\[2.5ex]
V_{\itref} & \sqrt{\frac{K_{B}T_{\itref}}{m_{\itref}}} \\ [2ex]
t_{\itref} & \frac{L_{\itref}}{V_{\itref}} \\ 
\bottomrule
\end{array}$
\caption{Parametri di riferimento}% title of Table
\label{tab:Parametri_Riferimento}
\end{table}
\end{document} 
2

Either use \renewcommand{\arraystretch}{1.5} (as azetina already suggested) or booktabs package and the \toprule, \midrule, \bottomrule which provide some better vertical spacings

\documentclass{article}

\usepackage{booktabs}

\begin{document}

\begin{table}[h]
\centering
\begin{tabular}{| c | c |}
\toprule
\multicolumn{1}{ |c| }{Parametro} &  \multicolumn{1}{ c| }{Espressione} \tabularnewline 
\midrule \midrule
$T_{ref}$ & $T_{0}$ \tabularnewline
 \midrule
$P_{ref}$ & $P_{0}$ \tabularnewline 
\midrule
$M_{ref}$ & $m_{O_{2}}$ \tabularnewline 
\midrule
$L_{ref}$ & $\frac{K_{B}T_{ref}}{\sqrt{2}\pi Rc^{2}P_{0}}$ \tabularnewline 
\midrule
$V_{ref}$ & $\sqrt{\frac{K_{B}T_{ref}}{m_{ref}}}$ \tabularnewline 
\midrule
$t_{ref}$ & $\frac{L_{ref}}{V_{ref}}$ \tabularnewline 
\bottomrule
\end{tabular}
\label{tab:Parametri_Riferimento}
\caption{Parametri di riferimento}% title of Table
\end{table}


\begin{table}[h]
\centering
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{| c | c |}
\hline
\multicolumn{1}{ |c| }{Parametro} &  \multicolumn{1}{ c| }{Espressione} \tabularnewline 
\hline \hline
$T_{ref}$ & $T_{0}$ \tabularnewline
 \hline
$P_{ref}$ & $P_{0}$ \tabularnewline 
\hline
$M_{ref}$ & $m_{O_{2}}$ \tabularnewline 
\hline
$L_{ref}$ & $\frac{K_{B}T_{ref}}{\sqrt{2}\pi Rc^{2}P_{0}}$ \tabularnewline 
\hline
$V_{ref}$ & $\sqrt{\frac{K_{B}T_{ref}}{m_{ref}}}$ \tabularnewline 
\hline
$t_{ref}$ & $\frac{L_{ref}}{V_{ref}}$ \tabularnewline 
\hline
\end{tabular}
\label{tab:Parametri_Riferimento::arraystretch}
\caption{Parametri di riferimento}% title of Table
\end{table}


\end{document}

enter image description here

As you can see (from the second table), that even the rather large value of 1.5 does not look very nice.

Perhaps, it's even better to omit the horizontal lines

6
  • 1
    The first one looks awful with those broken vertical rules. Mar 9, 2015 at 16:24
  • @GonzaloMedina: Yes, I'll try to remove the problem
    – user31729
    Mar 9, 2015 at 16:25
  • If you remove all those vertical rules and all but three (at the top, below headers, at the bottom) horizontal rules, I think the table looks better. Mar 9, 2015 at 16:27
  • @GonzaloMedina: I am no friend of those lines at all, but I don't want to change the complete look. If the OP wants to have lines, he should get them ;-) Oh, I just saw, the other answer was accepted.
    – user31729
    Mar 9, 2015 at 16:28
  • @SoundsOfSilence My answer is just a quick hack. I invite you to update your answer in the event it best answers the question.
    – azetina
    Mar 9, 2015 at 16:33

You must log in to answer this question.

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