Vertical spacing in tabular environment

https://en.wikibooks.org/wiki/LaTeX/Tables#Text_wrapping_in_tables

In the link above, they give a description of a tabular environment and I need to have something similar. However, I would like the first and second column to be vertically centered. I've tried the array package and using m{...} but this doesn't seem to work. Can anyone help me with this? Thanks!

For example, this

\documentclass{article}

\usepackage[english]{babel}
\usepackage{array}

\begin{document}

\begin{center}
\begin{tabular}{ | m{2cm} | l | l | p{5cm} |}
\hline
Day & Min Temp & Max Temp & Summary \\ \hline
Monday & 11C & 22C & A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures. \\ \hline
Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells
across most of Scotland and Northern Ireland,
but rain reaching the far northwest. \\ \hline
Wednesday & 10C & 21C & Rain will still linger for the morning.
Conditions will improve by early afternoon and continue
throughout the evening. \\
\hline
\end{tabular}
\end{center}

\end{document}


The result, is almost the same as the image on wikibooks, there is no vertical centering whatsoever.

• Welcome to TeX SX! Would you mind showing us what you've tried? – Bernard Oct 29 '17 at 18:56
• You should always/where possible include a MWE in your questions, which begins at \documentclass and ends at \end{document}, displaying what you've got so far and the issues you face, it should include all necessary \usepackages which are required to get to that point, but none more. – Skillmon Oct 29 '17 at 18:58
• Why only the first and second column? What about the third column: Should the cells in that column by centered vertically as well? – Mico Oct 29 '17 at 19:03
• Yeah, sorry, the third as well! – user353840 Oct 29 '17 at 19:05
• please provide minimal work example (mwe) and with it show what you try so far. – Zarko Oct 29 '17 at 19:05

I've tried the array package and using m{...} but this doesn't seem to work.

Changing p{5cm} to m{5cm}, i.e., changing

\begin{tabular}{ | l | l | l | p{5cm} |}


to

\begin{tabular}{ | l | l | l | m{5cm} |}


should achieve what you're looking for.

\documentclass{article}
\usepackage{array} % for 'm' column type
\begin{document}
With width specified:
\begin{center}
\begin{tabular}{ | l | l | l | m{5cm} |}
\hline
Day & Min Temp & Max Temp & Summary \\ \hline
Monday & 11C & 22C & A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures. \\ \hline
Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells
across most of Scotland and Northern Ireland,
but rain reaching the far northwest. \\ \hline
Wednesday & 10C & 21C & Rain will still linger for the morning.
Conditions will improve by early afternoon and continue
throughout the evening. \\
\hline
\end{tabular}
\end{center}
\end{document}

• omg, I feel stupid now. Thank you very much! – user353840 Oct 29 '17 at 19:08

You could also use booktabs to improve the look of the table:

\documentclass{article}

\usepackage[english]{babel}
\usepackage{array}
\renewcommand*{\arraystretch}{1.2}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage{makecell}
\usepackage{siunitx}

\begin{document}

\begin{center}
\begin{tabular}{m{1.8cm}*2{S[table-format=2.0]}m{5cm}}
\toprule
Day & {\makecell[c]{Min Temp\\(\textdegree C)}} & {\makecell[c]{Max Temp\\(\textdegree C)}} & Summary \\
\midrule
Monday & 11 & 22 & A clear day with lots of sunshine.\newline
However, the strong breeze will bring down the temperatures. \\ \midrule
Tuesday & 9 & 19 & Cloudy with rain, across many northern regions.\newline Clear spells
across most of Scotland and Northern Ireland,
but rain reaching the far northwest. \\
\midrule
Wednesday & 10 & 21 & Rain will still linger for the morning.\newline
Conditions will improve by early afternoon and continue
throughout the evening. \\
\bottomrule
\end{tabular}
\end{center}

\end{document}