0

I have a table that looks like this:

| COLUMN A | COLUMN B | COLUMN C | COLUMN D |
|-------------------------------------------|
|    0     |    A     |   100    |   150    |
|    1     |    B     |   100    |   150    |
|    2     |    C     |   200    |   250    |
|    3     |    D     |   200    |   250    |

As you can see, the values in columns A and B are different each row, but columns C and D only change every other row. It would be useful to merge only columns C and D so that they are "shared" between two rows, while columns A and B work as normal. Something like this, but without the blank cells in A and B:

| COLUMN A | COLUMN B | COLUMN C | COLUMN D |
|-------------------------------------------|
|    0     |    A     |          |          |
|          |          |   100    |   150    |
|    1     |    B     |          |          |
|    2     |    C     |          |          |
|          |          |   200    |   250    |
|    3     |    D     |          |          |

Essentially, it would be the inverse of this answer, which merges the first column in the table and splits subsequent columns.

  • The solution is the same, simply use \multirow in the column you wish. – Sigur Jan 16 at 23:48
  • the multirow package is your friend :-). – Zarko Jan 16 at 23:48
  • 1
    Also, please, post a minimal code so we don't need to type everything for you. – Sigur Jan 16 at 23:48
0

enter image description here

\documentclass{article}
\usepackage{multirow}

\begin{document}
\begin{tabular}{|*{4}{c|}}
    \hline
A   &   B   &   C   &   D   \\
    \hline
0   &   A   & \multirow{2}{*}{100}  &   \multirow{2}{*}{150}  \\
1   &   B   &                       &                       \\
0   &   A   & \multirow{2}{*}{100}  &   \multirow{2}{*}{150}  \\
1   &   B   &                       &                       \\
    \hline
\end{tabular}
\end{document}
  • Thank you, this works perfectly! May I ask why you put braces around the asterisk in the first multirow but not the second? – klasdfjasdf Jan 17 at 0:17
  • @klasdfjasdf, i simply forgot. it works with curly braces and without them. however. it is better to use them. i will corrected asap. – Zarko Jan 17 at 0:24

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.