3

My MWE is as follows:

\documentclass[conference]{IEEEtran}
% correct bad hyphenation here
\hyphenation{}


\usepackage{array}
\usepackage{tabularx}
\usepackage{subcaption,siunitx,booktabs}
\usepackage[margin=1in]{geometry}
\usepackage{multirow, makecell}
\usepackage{array}
\setlength\extrarowheight{2pt}

\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%

\begin{document}

\begin{table*}
    \begin{subtable}{1\textwidth}
        \centering
        \begin{tabular}{|c|c|c|c|c|c|c|c|p{4cm}|}%{cclcccccc}
            \hline
            \multirow{2}{*}{\shortstack[c]{\textbf{Column}\\ \textbf{one}}} &
            \multirow{2}{*}{\shortstack[c]{\textbf{Column}\\ \textbf{two}}} &
            \multirow{2}{*}{\textbf{Column 3}} &
            \multirow{2}{*}{\textbf{Column 4}} &
            \multirow{2}{*}{\textbf{Column 5}} &
            \multicolumn{3}{c|}{\textbf{Column 6}} & \multirow{2}{*}{\textbf{Column 7}} \\ \cline{6-8}
            & & & & & {\textbf{A}} & {\textbf{B}} & {\textbf{C}}
            & \\
            \hline
             \multirow{3}{*}{aaaaa} & \multirow{3}{*}{\shortstack[l]{Type\\ one}} 
                        & A1       & \cmark & \xmark & CRM1 & FF1 & SFR1 & Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. \\ \cline{3-9}
                    &   & A2& \cmark & \cmark & CRM2 & FiF2 & SiFR2 & Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. \\ \cline{3-9}
                    &   & A3          & \cmark & \xmark & CRM3 & FiF3 & SiFR3 & Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. \\ \cline{3-9}
           \hline
        \end{tabular}
        \caption{First subtable1}\label{tab:sub_first1}
    \end{subtable}
    \caption{Three simple tables} \label{tab:three_tables}
\end{table*}

\end{document}

The resulting table is as follows:

enter image description here

Since I wanted the column 7 to be wider, I used p{<width>} argument. However, all the text in rest of the cells are now vertically top-aligned now.

So,

  1. Is it possible to vertically center-align them?

  2. The column header "Column 7" should be horizontally center-aligned. Is there a way to apply only to that cell?

6
  1. using m{...} instead of p{} will centre align your cells

  2. to center align the last column header: \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Column 7}}}


\documentclass[conference]{IEEEtran}
% correct bad hyphenation here
\hyphenation{}



\usepackage{array}
\usepackage{tabularx}
\usepackage{subcaption,siunitx,booktabs}
\usepackage[margin=1in]{geometry}
\usepackage{multirow, makecell}
\usepackage{array}
\setlength\extrarowheight{2pt}

\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%

\begin{document}

\begin{table*}
    \begin{subtable}{1\textwidth}
        \centering
        \begin{tabular}{|c|c|c|c|c|c|c|c|m{4cm}|}%{cclcccccc}
            \hline
            \multirow[b]{2}{*}{\shortstack[t]{\textbf{Column}\\ \textbf{one}}} &
            \multirow[b]{2}{*}{\shortstack[t]{\textbf{Column}\\ \textbf{two}}} &
            \multirow{2}{*}{\textbf{Column 3}} &
            \multirow{2}{*}{\textbf{Column 4}} &
            \multirow{2}{*}{\textbf{Column 5}} &
            \multicolumn{3}{c|}{\textbf{Column 6}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Column 7}}} \\ \cline{6-8}
            & & & & & {\textbf{A}} & {\textbf{B}} & {\textbf{C}}
            & \\
            \hline
             \multirow{10}{*}{aaaaa} & \multirow{10}{*}{\shortstack[lb]{Type\\ one}} 
                        & A1       & \cmark & \xmark & CRM1 & FF1 & SFR1 & Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. \\ \cline{3-9}
                    &   & A2& \cmark & \cmark & CRM2 & FiF2 & SiFR2 & Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. \\ \cline{3-9}
                    &   & A3          & \cmark & \xmark & CRM3 & FiF3 & SiFR3 & Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. \\ \cline{3-9}
           \hline
        \end{tabular}
        \caption{First subtable1}\label{tab:sub_first1}
    \end{subtable}
    \caption{Three simple tables} \label{tab:three_tables}
\end{table*}

\end{document}

enter image description here

  • m{...} didn't center align the column one and column2 I believe. They should be close to 2nd row if I am right. – kingmakerking Oct 23 '17 at 12:03
  • @kingmakerking Please have a look at my edited answer - column one and two are not perfectly centred but a bit better then previously. – user36296 Oct 23 '17 at 12:17
  • @kingmakerking that is because multirow is guessing the row heights of the rows which should be covered (and let's just say the guessing isn't innovative) – Skillmon Oct 23 '17 at 14:53
3

Just use m instead of p:

\documentclass[conference]{IEEEtran}
% correct bad hyphenation here
\hyphenation{}

\usepackage{array}
\usepackage{tabularx}
\usepackage{subcaption,siunitx,booktabs}
\usepackage[margin=1in]{geometry}
\usepackage{multirow, makecell}
\usepackage{array}
    \setlength\extrarowheight{2pt}

\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
    \newcommand{\cmark}{\ding{51}}%
    \newcommand{\xmark}{\ding{55}}%

\begin{document}
\begin{table*}
    \begin{subtable}{1\textwidth}
        \centering
        \begin{tabular}{|c|c|c|c|c|c|c|c|m{4cm}|}%{cclcccccc}
            \hline
            \multirow{2}{*}{\shortstack[c]{\textbf{Column}\\ \textbf{one}}} &
            \multirow{2}{*}{\shortstack[c]{\textbf{Column}\\ \textbf{two}}} &
            \multirow{2}{*}{\textbf{Column 3}} &
            \multirow{2}{*}{\textbf{Column 4}} &
            \multirow{2}{*}{\textbf{Column 5}} &
            \multicolumn{3}{c|}{\textbf{Column 6}} & \multirow{2}{*}{\textbf{Column 7}} \\ \cline{6-8}
            & & & & & {\textbf{A}} & {\textbf{B}} & {\textbf{C}}
            & \\
            \hline
             \multirow{3}{*}{aaaaa} & \multirow{3}{*}{\shortstack[l]{Type\\ one}} 
                        & A1       & \cmark & \xmark & CRM1 & FF1 & SFR1 & Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. \\ \cline{3-9}
                    &   & A2& \cmark & \cmark & CRM2 & FiF2 & SiFR2 & Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. \\ \cline{3-9}
                    &   & A3          & \cmark & \xmark & CRM3 & FiF3 & SiFR3 & Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. \\ \cline{3-9}
           \hline
        \end{tabular}
        \caption{First subtable1}\label{tab:sub_first1}
    \end{subtable}
    \caption{Three simple tables} \label{tab:three_tables}
\end{table*}
\end{document}

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.