2

I have this code

% !TeX encoding = UTF-8

\documentclass[utf8]{article}
\usepackage{multirow}

\begin{document}
    \begin{table}[htp]
        \centering
        \begin{tabular}{|l|c|c|}
            \hline
            & Weighting & Cost (\$)         \\ \hline
            \multirow{5}{*}{Material costs}       & 0           & $[10000,\,\infty[$  \\ \cline{2-3}
            & 1.25 & $[7500,\,10000[$ \\ \cline{2-3}
            & 2.5 & $[5000,\,7500[$ \\ \cline{2-3}
            & 3.75 & $[2500,\,5000[$ \\ \cline{2-3}
            & 5 & $[0,2500[$ \\ \hline
            \multirow{5}{*}{Labor costs} & 0           & $[40000,\,\infty[$  \\ \cline{2-3}
            & 1.25 & $[30000,\,40000[$ \\ \cline{2-3}
            & 2.5 & $[20000,\,30000[$ \\ \cline{2-3}
            & 3.75 & $[10000,\,20000[$ \\ \cline{2-3}
            & 5 & $[0,10000[$ \\
            \hline
        \end{tabular}
        \caption{Scale for the cost of the project}
        \label{tab:project_cost}
    \end{table}

\end{document}

It produces this:

As you can see, the margins in the cells are way too small. We can even say it's non existent, so it's really hard to see the brackets ([)

How can I increase the margins?

2

In this case a simple \arraystretch redefinition suffices.

% !TeX encoding = UTF-8

\documentclass[utf8]{article}
\usepackage{multirow}
\begin{document}
    \begin{table}[htp]
        \renewcommand\arraystretch{1.3}
        \centering
        \begin{tabular}{|l|c|c|}
            \hline
            & Weighting & Cost (\$)         \\ \hline
            \multirow{5}{*}{Material costs}       & 0           & $[10000,\,\infty[$  \\ \cline{2-3}
            & 1.25 & $[7500,\,10000[$ \\ \cline{2-3}
            & 2.5 & $[5000,\,7500[$ \\ \cline{2-3}
            & 3.75 & $[2500,\,5000[$ \\ \cline{2-3}
            & 5 & $[0,2500[$ \\ \hline
            \multirow{5}{*}{Labor costs} & 0           & $[40000,\,\infty[$  \\ \cline{2-3}
            & 1.25 & $[30000,\,40000[$ \\ \cline{2-3}
            & 2.5 & $[20000,\,30000[$ \\ \cline{2-3}
            & 3.75 & $[10000,\,20000[$ \\ \cline{2-3}
            & 5 & $[0,10000[$ \\
            \hline
        \end{tabular}
        \caption{Scale for the cost of the project}
        \label{tab:project_cost}
    \end{table}

\end{document}

enter image description here

ORIGINAL APPROACH

I just added a >{} directive to a column that adds a \strut that has been padded by 2pt above and below. Requires array package for the >-directive functionality, and stackengine to pad the \strut by 2pt.

However, the OP noted that this approach combined with the \multirow causes the first column to not be vertically centered.

% !TeX encoding = UTF-8

\documentclass[utf8]{article}
\usepackage{array,multirow,stackengine}

\begin{document}
    \begin{table}[htp]
        \centering
        \begin{tabular}{|>{\addstackgap[2pt]{\strut}}l|c|c|}
            \hline
            & Weighting & Cost (\$)         \\ \hline
            \multirow{5}{*}{Material costs}       & 0           & $[10000,\,\infty[$  \\ \cline{2-3}
            & 1.25 & $[7500,\,10000[$ \\ \cline{2-3}
            & 2.5 & $[5000,\,7500[$ \\ \cline{2-3}
            & 3.75 & $[2500,\,5000[$ \\ \cline{2-3}
            & 5 & $[0,2500[$ \\ \hline
            \multirow{5}{*}{Labor costs} & 0           & $[40000,\,\infty[$  \\ \cline{2-3}
            & 1.25 & $[30000,\,40000[$ \\ \cline{2-3}
            & 2.5 & $[20000,\,30000[$ \\ \cline{2-3}
            & 3.75 & $[10000,\,20000[$ \\ \cline{2-3}
            & 5 & $[0,10000[$ \\
            \hline
        \end{tabular}
        \caption{Scale for the cost of the project}
        \label{tab:project_cost}
    \end{table}

\end{document}

enter image description here

  • The "Material costs" and "Labor costs" aren't centered anymore. – Vinccool96 Mar 15 at 14:38
  • @Vinccool96 You are right. Let me think on this one (I don't use a lot of multirow) – Steven B. Segletes Mar 15 at 14:41
  • @Vinccool96 See revision – Steven B. Segletes Mar 15 at 14:44
2

Another possibility with cellspace, which defines a minimal vertical padding for cells in columns with specifier prefixed with the letter S (or C if you load siunitx):

\documentclass[utf8]{article}
\usepackage{multirow}
\usepackage{amsmath} 
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{3pt}

\begin{document}
    \begin{table}[htp]
        \centering
        \begin{tabular}{|l|>{$}Sc<{$}|>{$}Sc<{$}|}
            \hline
            & \text{Weighting} & \text{Cost (\$)} \\ \hline
            \multirow{5}{*}[-12pt]{Material costs} & 0 & [10000, \infty[ \\ \cline{2-3}
            & 1.25 & [7500, 10000[ \\ \cline{2-3}
            & 2.5 & [5000, 7500[ \\ \cline{2-3}
            & 3.75 & [2500, 5000[ \\ \cline{2-3}
            & 5 & [0,2500[ \\ \hline
            \multirow{5}{*}[-12pt]{Labor costs} & 0 & [40000, \infty[ \\ \cline{2-3}
            & 1.25 & [30000, 40000[ \\ \cline{2-3}
            & 2.5 & [20000, 30000[ \\ \cline{2-3}
            & 3.75 & [10000, 20000[ \\ \cline{2-3}
            & 5 & [0,10000[ \\
            \hline
        \end{tabular}
        \caption{Scale for the cost of the project}
        \label{tab:project_cost}
    \end{table}

\end{document} 

enter image description here

  • Another clipboard manager accident… Fixed. Thank you so much! – Bernard Mar 15 at 18:01

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.