1

I want to put the "iii" in the middle of the cell. So I turn to the \multicolumn to modify a single cell.

My initial code is

\documentclass{article}
\begin{document}

\begin{tabular}{|r | l | p{5cm}  }
\hline
aaa & \multicolumn{2}{c|}{bbb ccc} \\
\cline{1-1}
ddd & \multicolumn{2}{c|}{eee f\mbox{}f\mbox{}f\mbox{} }\\
\hline
ggg & hhh                    & \multicolumn{1}{c|}{iii} \\
\hline
\end{tabular}

\end{document}

But the column 2&3 become narrow. So I change line 4 and 6 and the whole code went into:

\documentclass{article}
\begin{document}

\begin{tabular}{|r | l | p{5cm}  }
\hline
aaa & \multicolumn{2}{c|}{bbb ccc} \\
\cline{1-1}
ddd & \multicolumn{2}{c|}{eee f\mbox{}f\mbox{}f\mbox{} }\\
\hline
ggg & hhh                    & \multicolumn{1}{p(5cm)}{iii} \\
\hline
\end{tabular}

\end{document}

But the whole table becomes narrow. What should I do to change such situation?

1 Answers1

1

With the help of makecell (and microtype to deactivate the ligatures, see here: https://tex.stackexchange.com/a/439652/134144) you can get the following MWE:

enter image description here

\documentclass{article}
\usepackage{makecell}

\usepackage{microtype}
\DisableLigatures[f]{encoding = *, family = *}
\begin{document}

\begin{tabular}{|r | l | p{5cm}  |}
\hline
aaa & \multicolumn{2}{l|}{bbb ccc} \\
\cline{1-1}
ddd & \multicolumn{2}{l|}{eee fff }\\
\hline
ggg & hhh                    & \makecell[cc]{iii} \\
\hline
\end{tabular}
\end{document}

Since horizontally and vertically centered alignment ([cc]) is the default of makecell this option can also be omitted (\makecell{iii}) without changing the above whown output.

leandriis
  • 62,593
  • Thank you so much for your help! The problem had troubled me for several hours . Also, thank you so much for introducing me to the makecell package. I really appreciate your help! – Harkthesolver Aug 12 '19 at 15:29