3

Do you know how can I merge 4 cells from two different collums and two rows? Can I use both multicol and multi row? Thanks

\multicolumn{2}{|c|}{Population to serve}\multirow{2}{6cm}{Population to serve} 
5
  • Welcome to TeX.SE. I'm afraid your writeup isn't very clear. Please elaborate on what you mean by "merging 4 cells". Commented Jan 23, 2024 at 11:06
  • For example, merge cells A1+A2+B1+B2 Commented Jan 23, 2024 at 11:11
  • @CarolinaCastro Have a look at the tabularray package. It make merging cells very easy. Commented Jan 23, 2024 at 11:40
  • 1
    It'd be clearer if you could include an image of what you're trying to accomplish Commented Jan 23, 2024 at 11:59
  • @CarolinaCastro please upvote and accept with a green tick if the answer met your expectations Commented Jan 24, 2024 at 10:01

2 Answers 2

3

Something like this?

enter image description here

\documentclass{article} \usepackage{array,multirow} \setlength\extrarowheight{2pt} % optional \begin{document} \begin{tabular}{|c|c|c|} \hline a & b & c \\ \hline d & \multicolumn{2}{c|}{\multirow{2.2}{*}{efhi}} \\ \cline{1-1} g & \multicolumn{2}{c|}{} \\ \hline \end{tabular} \end{document} 
2
  • Thank you that's it. But what do you mean with \multirow{2.2}? 2 columns+2 lines? Commented Jan 25, 2024 at 10:05
  • @CarolinaCastro - The first argument of \multirow needn't be an integer. Since I've also set \setlength\extrarowheight{2pt}, it seemed appropriate to use 2.2 instead of just 2. Commented Jan 25, 2024 at 11:27
4

With package NiceMatrix / NiceTabular

enter image description here

\documentclass{article} \usepackage{nicematrix,booktabs} \begin{document} \begin{table} \begin{NiceTabular}[]{cccc} \CodeBefore \rectanglecolor{blue!20}{2-1}{3-2} \Body \toprule Column1&Column2&Column3&Column4\\ \midrule \Block{2-2}{R2*C2}& &Row2 &Row2 \\ &&Row3&Row3\\ \bottomrule \end{NiceTabular} \end{table} \end{document} 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.