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

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.

  • 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 at 15:29

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.