Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How to align the text in middle by specifying the row height could someone help me.

The latex code is as follows..

    \begin{table}[htbp]
    \centering
    \begin{tabular}{|c|l|c|}
    \hline 
    \textbf{\textit{fine/coarse}} & \textbf{Property} & \textbf{\textit{lamellar/equiaxed}} \\ 
    \hline 
    x/x & Elastic Modulus & x/+ \\ 
    \hline 
    +/- & Strength & -/+ \\ 
    \hline 
    +/- & Ductility & -/+ \\ 
    \hline 
    +/- & Fatigue crack initiation & -/+ \\ 
    \hline 
    -/+ & Fatigur crack propagation & +/- \\ 
    \hline 
    +/- & Oxidation Behaviour & +/- \\ 
    \hline 
    \end{tabular} 
    \label{table:eomsomeprops}
    \end{table}

Output is attached.enter image description here I want something similar to this: enter image description here

share|improve this question
    
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  karlkoeller Mar 22 at 10:26

1 Answer 1

up vote 3 down vote accepted

Like this?

enter image description here

Code:

\documentclass{article}

\usepackage{array}

\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}
\newcolumntype{N}{@{}m{0pt}@{}}

\begin{document}

\begin{table}[htbp]
\centering
\begin{tabular}{|C{3cm}|L{4cm}|C{3.5cm}|N}
\hline
\textbf{\textit{fine/coarse}} & \textbf{Property} & \textbf{\textit{lamellar/equiaxed}} &\\[20pt]
\hline
x/x & Elastic Modulus & x/+ &\\[20pt]
\hline
+/- & Strength & -/+ &\\[20pt]
\hline
+/- & Ductility & -/+ &\\[20pt]
\hline
+/- & Fatigue crack initiation & -/+ &\\[20pt]
\hline
-/+ & Fatigur crack propagation & +/- &\\[20pt]
\hline
+/- & Oxidation Behaviour & +/- &\\[20pt]
\hline
\end{tabular}
\label{table:eomsomeprops}
\end{table}

\end{document} 

I've defined two new types of columns (requires the array package)

\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}

which are fixed columns but center their contents vertically.

When you break a row, use something like \\[20pt] instead of simply \\ to have the correct spacing.

Also, a new column of type N so defined

\newcolumntype{N}{@{}m{0pt}@{}}

is needed as the last one to avoid the problem described here: Vertical alignment in table: m-column, row size - problem in last column.

share|improve this answer
    
Exactly what i expected thanks a lot!! –  user48432 Mar 22 at 10:28
    
@user48432 You're welcome. I've added some explanations. –  karlkoeller Mar 22 at 10:31
    
My love to LAteX is growing infinetely. Awesome explanation :) (y) –  user48432 Mar 22 at 10:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.