# Stretching table

I defined a custom command to produce a table I have to do for various experiments:

\newcommand{\exptable}[3]{
\begin{center}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{ccc}
\hline
Particle & Voltage & Flow rate \\
\hline
#1&\SI{#2}{\volt}&\SI{#3}{\micro\liter\per\minute}  \\
\hline
\end{tabular}
\end{center}
}


This works great but the tables have different widths for different inputs. I would like to change it so that it has a minimum width larger than my inputs so it always has the same width (for example 7cm or something I can set).

• You can simply change the c column type in the table preamble to >{\centering\arraybackslash}p{some width}. – Bernard Mar 8 '19 at 19:35
• Please make your code snippet -- as always here -- compilable! – Mensch Mar 8 '19 at 19:49

Something like this?

\documentclass{article}
\usepackage{array,siunitx}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcommand{\exptable}[4]{%
\begin{center}
\sisetup{per-mode=symbol}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{@{}l*{2}{C{#4}}}
\hline
Particle & Voltage & Flow rate \\
\hline
#1&\SI{#2}{\volt}&\SI{#3}{\micro\liter\per\minute}  \\
\hline
\end{tabular}
\end{center}
}

\begin{document}
\exptable{Stuff}{4.5}{1.2345}{3cm}
\end{document}

• Yes! Is it possible to have some space in the beginning of the table? (i.e. before the P of "Particle" and S of "Stuff") – Superuser27 Mar 8 '19 at 19:57
• @Superuser27 - Sure! Just remove the @{} particle in \begin{tabular}{@{}l*{2}{C{#4}}}. – Mico Mar 8 '19 at 20:07
• Off topic: why did you add \sisetup{per-mode=symbol} ? Personal preference? :) – Superuser27 Mar 13 '19 at 8:39
• @Superuser27 - You got me pegged. :-) To my eyes L/min looks a tad more pleasing than L min^{-1} does... – Mico Mar 13 '19 at 17:18