1

I am struggling to align vertically the text inside the column of the table below. I would like to obtain this vertical align to improve the table readability... I tried to add a color on alternating rows but it cancel the left and right board of the row. If you know how to solve that problem please add also that.

Thanks

\documentclass[margin=5pt]{article}

\usepackage{float}
\usepackage{caption}
\usepackage{tabularx,ragged2e,booktabs}
\usepackage{array}
\usepackage[table,x11names]{xcolor}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\xmark}{\ding{53}}%

\begin{document}

\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{f}[1]{>{\raggedright\arraybackslash}p{#1}}
\begin{table}
\caption[AM process/material matrix.]{AM processes comparison based on materials processable. }
\label{tab:AM_material_matrix}
\centering
\begin{tabular}{|f{3cm}|P{1.5cm}|P{1.5cm}|P{1.5cm}|P{1.5cm}|P{1.5cm}|P{1.5cm}|P{1.5cm}|}
\hline
                             & Material extrusion & Material jetting & Binder jetting & Vat photopolymerization & Sheet lamination & Powder bed fusion & Directed energy depositon \\
                             \hline 
Polymers, polymer blends     & \xmark                  & \xmark                & \xmark              & \xmark                       & \xmark                & \xmark                 &                           \\
Composites                   & \xmark                  & \xmark                & \xmark              & \xmark                       &                  & \xmark                 &                           \\
Metals                       &                    &                  & \xmark              &                         & \xmark                & \xmark                 & \xmark                         \\
Graded/hybrid metals         &                    &                  &                &                         & \xmark                &                   & \xmark                         \\
Ceramics                     &                    &                  & \xmark              & \xmark                       &                  & \xmark                 &                           \\
Investement casting patterns &                    & \xmark                & \xmark              & \xmark                       &                  & \xmark                 &                           \\
Sand molds and cores         & \xmark                  &                  & \xmark              &                         &                  & \xmark                 &                           \\
Paper                        &                    &                  &                &                         & \xmark                &                   &    \\                      
\hline
\end{tabular}
\end{table}


\end{document}
  • 1
    By "board", do you mean the vertical lines? That is likely just a viewer issue, try zooming in the PDF, or printing. For the vertical centering, try m instead of p in the definitions of the P and f column types. – Torbjørn T. Oct 11 '16 at 12:30
1

As you said "align vertically", if you mean the column names and row names such as "Polymers, polymer blends" in your example, an alternative approach is:

\newcommand\minitab[2][c]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
\begin{tabular}{|c|l|c|r|}
  \hline
  & \minitab[l]{Column\\ 1} & \minitab{Column\\ 2} & \minitab[r]{Column\\ 3}\\
  \hline
  \minitab{Multiple\\ line} & 2 & 2 & 2\\
  \hline
  Single & 1 & 1 & 1\\
  \hline
\end{tabular}

enter image description here

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.