Graphics, Figures & TablesText in Last Table Column not centered vertically

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
caro012984
Posts: 2
Joined: Tue Mar 06, 2012 5:43 pm

Text in Last Table Column not centered vertically

Post by caro012984 »

Here is my code. I can't figure out how to make the last cell centered vertically like the other cells. Thanks in advance!

Code: Select all

\documentclass[12pt]{article}
\usepackage{array}

\newcolumntype{x}[1]{>{\centering\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}
\begin{table}[!ht]
\begin{tabular}{|>{\centering}m{1in}|>{\centering}m{1in}|>{\centering}m{1in}|>{\centering}m{1in}|>{\centering\arraybackslash}m{1in}|}
\hline text & text  & text  & text  & text  \\[.5in]
\hline & & & &  \\[.5in]
\hline
\end{tabular}
\end{table}
\end{document}
Last edited by localghost on Tue Mar 06, 2012 6:10 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Text in Last Table Column not centered vertically

Post by Stefan Kottwitz »

Hi Caro,

welcome to the board!

It seems that [.5in] after the row break is the cause, since it affects the last column. Try it without, possibly redefine \arraystretch instead or use \parbox with specified height and vertical centering.

Stefan
LaTeX.org admin
caro012984
Posts: 2
Joined: Tue Mar 06, 2012 5:43 pm

Text in Last Table Column not centered vertically

Post by caro012984 »

Stefan,

Since I wanted some extra white space above the text, I opted for adjusting \arraystretch. I've included my code for anyone else who might be having the same troubles.

Thanks for the help and the welcome!

- Caroline

Code: Select all

\documentclass[12pt]{article}
\usepackage{array}

\begin{document}

\begin{center}
	\renewcommand{\arraystretch}{2}
 	\begin{tabular}{|>{\centering}m{1in}|>{\centering}m{1in}|>{\centering}m{1in}|>{\centering}m{1in}|>{\centering\arraybackslash}m{1in}|}
   	  	\hline text & text  & text  & text  & text  \\
    		\hline & & & &  \\[.5in]
    		\hline
   	 \end{tabular}
\end{center}

\end{document}
Post Reply