1

I want to align two text columns centered around one symbol. The following code is close to the solution, but still has a linebreak problem:

\newcommand{\correspondsto}{\overset{\scriptscriptstyle\wedge}{=}}
\begin{document}

    \begin{equation*}
    \begin{array}{@{} @{\qquad} r @{} >{{}}l @{}}
      \text{this is the first part and could be longer than one line}     &\correspondsto \text{the same holds for the second cell} \\
      \text{Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, }         &\correspondsto \text{ Lorem Ipsum has been the industry} \\
    \end{array}
    \end{equation*}

\end{document}

which yields: enter image description here

While this attempt works with short texts, it doesn't work with longer ones. I need a line break (possibly manually) but the centered symbol should still be centered between the lines forming a block, i.e.: isn't o.k. as the correspondsto symbol should be centered between the second and third line, as those form a "block". Is there a way to do this in latex? enter image description here

  • Should the correspondsto sign be exactly in the horizontal center of the page? – leandriis Mar 29 at 10:01
  • Not necessarily, one side could be shorter if there is less next. – black Mar 29 at 10:03
1

Here is my suggestion using tabularx:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{booktabs}

\newcommand{\correspondsto}{$\overset{\scriptscriptstyle\wedge}{=}$}

\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{document}


    \begin{tabularx}{\textwidth}{@{} >{\raggedleft\arraybackslash}X@{\quad\correspondsto\quad} >{\raggedright\arraybackslash}X @{}}
     this is the first part and could be longer than one line     & the same holds for the second cell \\ \addlinespace
      Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,          &  Lorem Ipsum has been the industry \\
    \end{tabularx}

    \bigskip

        \begin{tabularx}{\textwidth}{@{} >{\raggedleft\arraybackslash\hsize=1.25\hsize}X@{\quad\correspondsto\quad}>{\raggedright\arraybackslash\hsize=0.75\hsize}X @{}}
     this is the first part and could be longer than one line     & the same holds for the second cell \\ \addlinespace
      Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,          &  Lorem Ipsum has been the industry \\
    \end{tabularx}


\end{document}
| improve this answer | |
1

Something like this? I also changed the wedge to a \widehat. Replace the definition if you prefer.

\documentclass{article}
\usepackage{amsmath}

%\newcommand{\correspondsto}{\overset{\scriptscriptstyle\wedge}{=}}
\newcommand{\correspondsto}{\mathrel{\widehat{=}}}

\newcommand{\correspondence}[2]{%
  \parbox{0.4\displaywidth}{\raggedleft\strut\ignorespaces#1\unskip\strut}%
  &\correspondsto
  \parbox{0.4\displaywidth}{\raggedright\strut\ignorespaces#2\unskip\strut}%
}

\begin{document}

\begin{align*}
\correspondence{Short text}{Short text} \\
\correspondence{
  this is the first part and could be longer than one line
}{
  the same holds for the second cell
} \\
\correspondence{
  Lorem Ipsum has been the industry's standard 
  dummy text ever since the 1500s,
}{
  Lorem Ipsum has been the industry
} \\
\correspondence{
  Lorem Ipsum has been the industry's standard 
  dummy text ever since the 1500s,
}{
  Lorem Ipsum
}
\end{align*}

\end{document}

enter image description here

| improve this answer | |
  • You need a strut after "cell". If the number of lines is the same on both sides, or differs by two, the heights of the first lines and the depths of the last lines need to be the same or the baselines won't match. – barbara beeton Mar 29 at 16:48
  • @barbarabeeton Thanks, added struts both at the beginning and end. – egreg Mar 29 at 17:07

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.