I'm trying to build a comparison table, I want to center the symbols vertically on the cells and I tried a lot of methods that I found here unsuccessfully.
This is the last code:
\documentclass{report}
\usepackage{color}
\usepackage{array}
\usepackage{rotating}
\usepackage{diagbox}
\begin{document}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\newcommand{\myRed}[1]{{\color[RGB]{237,27,35}#1}}
\newcommand{\myGreen}[1]{{\color[RGB]{0,166,79}#1}}
\newcommand{\myBlue}[1]{{\color[RGB]{0,157,220}#1}}
\newcommand{\amark}{\multicolumn{1}{c|}{\myBlue{\text{\sffamily *}}}}
\newcommand{\cmark}{\multicolumn{1}{c|}{\myGreen{\text{\sffamily O}}}}
\newcommand{\xmark}{\multicolumn{1}{c|}{\myRed{\text{\sffamily X}}}}
\newcommand*\rot{\rotatebox{270}}
\begin{sidewaystable}[ht]
\caption{Project comparison.}
\label{table:pComparison}
\centering
\scalebox{0.7}{
\begin{tabular}{| C{50mm} | C{15mm} | C{15mm} | C{15mm} | C{15mm} | C{15mm} |}
\hline
\diagbox[width=54mm, height=80mm]{\raisebox{20pt}{\hspace*{15mm}Projects}}{\raisebox{-87pt}{\rot{Features}}} & \rot{Feature 1} & \rot{Feature 2} & \rot{Feature 3} & \rot{Feature 4} & \rot{Feature 5} \\
\hline
Project 1 & \xmark & \cmark & \xmark & \cmark & \cmark \\[5ex]
\hline
Project 2 & \cmark & \cmark & \cmark & \cmark & \xmark \\[5ex]
\hline
Project 3 & \xmark & \cmark & \amark & \cmark & \xmark \\[5ex]
\hline
Project 4 & \xmark & \cmark & \amark & \cmark & \xmark \\[5ex]
\hline
Project 5 & \xmark & \cmark & \xmark & \xmark & \cmark \\[5ex]
\hline
\hline
My project & \cmark & \cmark & \cmark & \cmark & \cmark \\[5ex]
\hline
\end{tabular}
}
\end{sidewaystable}
\end{document}
And this is the result:
Everything in the table is perfect, except that I need the symbols centered in the cells vertically and horizontally, also I would like to center the names of the projects at the first column.
Could you help me? Thanks in advance.
**EDIT: ** Sorry for not including the full code, I'm using a special template. I'm using MacTex and I'm compiling the latex using the command pdflatex table.tex
Best Answer
Use
\newcommand*\rot{\rotatebox[origin=c]{270}}
:I have changed the
\amark
,\cmark
and\xmark
commands and added an additional (empty) column at the end to cure the bug withm
column type.