2

I want two double columns of letters with arrows between. The headers should be centred above each of the double columns:

Header 1        Header 2
  A  B     <=>    C  D
  E  F     <=>    G  H

I'm using

cc@{$\Leftrightarrow$}cc

for the tabular body template and \multicolumn for the headers. However, when I write \multicolumn{2} the header is centred over the first double column plus the arrow.

    Header 1       Header 2
  A  B     <=>    C  D
  E  F     <=>    G  H

Is there any way to achieve what I want without manually inserting arrows in every row?

\documentclass[11pt]{article}

\begin{document}

\begin{tabular}{cc@{$\Leftrightarrow$}cc}

%Header centred over first double column of letters, then omit arrow, then header centred over second double column of letters.
\multicolumn{2}{c}{Header 1}
    &\multicolumn{2}{c}{Header 2}\\

%double column of letters, then arrow, then double column of letters
A& B& C& D\\
E& F& G& H\\
\end{tabular}
\end{document}
3
  • Welcome! Maybe something like \documentclass[11pt]{article} \usepackage{array} \begin{document} \begin{tabular}{cc>{$\Leftrightarrow$}ccc} \multicolumn{2}{c}{Header 1} & \multicolumn{1}{c}{} &\multicolumn{2}{c}{Header 2}\\ A& B& &C& D\\ E& F& &G& H\\ \end{tabular} \end{document}?
    – user194703
    Commented Feb 4, 2020 at 9:05
  • Thanks, Schrödinger's cat. That additional column works.
    – Jon Hall
    Commented Feb 10, 2020 at 11:51
  • Yes, and the answer below just copied it...
    – user194703
    Commented Feb 10, 2020 at 16:51

1 Answer 1

1

Part of your problem comes from the headers being wider than the sum of the widths of the two columns underneath.

Here is a simple solution with a supplementary column between the two groups:

A simple solution with a supplementary column between the two groups:

\documentclass[11pt]{article}
\usepackage{array}

\begin{document}


\begin{tabular}{cc >{$\Leftrightarrow$}ccc}
%Header centred over first double column of letters, then omit arrow, then header centred over second double column of letters.
\multicolumn{2}{c}{\makebox[0pt]{Header 1}} & \multicolumn{1}{c}{}
    &\multicolumn{2}{c}{\makebox[0pt]{Header 2}}\\
%double column of letters, then arrow, then double column of letters
A& B& & C& D\\
E& F& & G& H
\end{tabular}

\end{document} 

enter image description here

1
  • 1
    Thanks Bernard, that works nicely.
    – Jon Hall
    Commented Feb 10, 2020 at 11:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .