2

First of all I am a bit surprised to find a greater distance above the equation than below it. But that is not my question, just a remark.

My main point is that I want to have a horizontal line at the bottom of the upper left column and likewise a horizontal line at the top of the lower right column, i.e. directly above the equation on the left side and below the equation on the right side.

I saw this in the Physical Review Letters and I thought whether this is possible (with reasonable effort) with LaTeX. Do you have any idea how to realize it?

I am sorry but I can't upload a graph on this computer, but I will try it later, if required.

\documentclass{scrartcl}
\usepackage{multicol}
\usepackage{blindtext}
\begin{document}
\begin{multicols}{2}
 \blindtext
\end{multicols}

\begin{equation}
 E = m c^2
\end{equation}

\begin{multicols}{2}
 \blindtext
\end{multicols}
\end{document}
  • 3
    If you start a paragraph with display math (by leaving a blank line above it, or ending or starting multicols above it, tex will always do the wrong thing. – David Carlisle Aug 15 '16 at 13:31
  • Ack. I do not have problems with inserting something like \vspace{-\baselineskip} to correct the distance. – Jürgen Aug 15 '16 at 13:38
  • @Jürgen But you shouldn't need to insert such commands of you play nicely with latex. – samcarter_is_at_topanswers.xyz Aug 15 '16 at 14:04
  • 1
    PRL uses journals.aps.org/revtex, maybe just have a look how they do it? – samcarter_is_at_topanswers.xyz Aug 15 '16 at 14:06
  • Well, sounds like a pretty good idea. I had a look at the 7500+ lines of revtex4-1.cls and must admit that I have not the faintest clue where this miracle might be. Even a look into the docs does not really help me. Sigh! – Jürgen Aug 15 '16 at 14:25
2

There is an automatic \par before and after the multicol, so the blank lines have no effect. Note: \multicolsep is the space added before and after multicol.

\documentclass{scrartcl}
\usepackage{multicol}
\usepackage{blindtext}

\newcommand{\abovedisplayline}{\vspace{-\multicolsep}\noindent
  \rlap{\rule[.6\baselineskip]{\dimexpr 0.5\textwidth-0.5\columnsep}{.5pt}}}

\newcommand{\belowdisplayline}{\hspace{\textwidth}%
  \llap{\rule{\dimexpr 0.5\textwidth-0.5\columnsep}{.5pt}}%
  \vspace{-0.2\baselineskip}\par\vspace{-\multicolsep}}

\begin{document}
\begin{multicols}{2}
 \blindtext
\global\columnwidth=\columnwidth
\end{multicols}

\abovedisplayline
\begin{equation}
 E = m c^2
\end{equation}
\belowdisplayline

\begin{multicols}{2}
 \blindtext
\end{multicols}
\end{document}

demo


Modified solution to match tikz version.

\newcommand{\abovedisplayline}{\vspace{-\multicolsep}\noindent
  \rlap{\rule[.6\baselineskip]{0.5\textwidth}{.7pt}\smash{\rule[.6\baselineskip]{.7pt}{.5\baselineskip}}}}

\newcommand{\belowdisplayline}{\hspace{\textwidth}%
  \llap{\smash{\rule[\dimexpr 0.7pt-.5\baselineskip]{0.7pt}{.5\baselineskip}}%
    \rule{0.5\textwidth}{.7pt}}%
  \vspace{-0.2\baselineskip}\par\vspace{-\multicolsep}}
|improve this answer|||||
  • Oh, this easy? Thanks a lot for your help. – Jürgen Aug 16 '16 at 6:25
0

Just to close this topic.

I modified John's answer (thanks!) to my taste and it finally looks like this:

Admittedly it is a bit over the top to use tikz at this point, but I am using it a lot in the rest of the text and I am far more fluent with it than with other measures.

\documentclass{scrartcl}
\usepackage{multicol}
\usepackage{blindtext}
\usepackage{tikz}

\newcommand{\abovedisplayline}{\vspace{-\multicolsep}\noindent
   \rlap{\raisebox{.6\baselineskip}{\tikz{\begin{pgfinterruptboundingbox}\draw[line width=0.7pt] (0,0) -| (0.5\textwidth,6pt);\end{pgfinterruptboundingbox}}}}}

\newcommand{\belowdisplayline}{\hspace{\textwidth}%
  \llap{\tikz{\begin{pgfinterruptboundingbox}\draw[line width=0.7pt] (-0.5\textwidth,-6pt) |- (0,0);\end{pgfinterruptboundingbox}}}%
  \vspace{-0.2\baselineskip}\par\vspace{-\multicolsep}}

\begin{document}
\begin{multicols}{2}
 \blindtext
\global\columnwidth=\columnwidth
\end{multicols}

\abovedisplayline
\begin{equation}
 E = m c^2
\end{equation}
\belowdisplayline

\begin{multicols}{2}
 \blindtext
\end{multicols}
\end{docum
|improve this answer|||||

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.