Abstract Package – Adding \paragraph Sections Inside Onecolabstract Environment

abstractsections-paragraphs

I am having trouble using \paragraph{} inside the onecolabstract environment. The desired goal would look something like this:

\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage{abstract}
\title{Minimal Example}
\author{DocBuckets}
\begin{document}
\twocolumn[
    \maketitle
    \begin{onecolabstract}
        \textbf{Background} Abstract background text...

        \textbf{Methods and Results} Abstract methods text...

        \textbf{Conclusions} Abstract conclusions text...
    \end{onecolabstract}
]
\section{Introduction}
\lipsum[1]
\section{Methods}
\lipsum[2]
\end{document}

But I want to use \paragraph{Background}, \paragraph{Methods and Results}, etc. instead of the \textbf{} alternatives I use in the minimal example. When I try this, I get all sorts of errors.

Perhaps relatedly, I also got errors when trying to use the \lipsum[1] method to generate abstract paragraphs in the minimal example I give. I suspect the problem is the same for \lipsum and \paragraph in onecolabstract. Is there something I can do to make this work?

Best Answer

The onecolabstract is a list type environment so is not expecting to see sectional headings etc. as produced by the \paragraph command. Instead you can box the material up in a minipage:

Sample output

\documentclass[twocolumn]{article}

\usepackage{lipsum}
\usepackage{abstract}

\title{Minimal Example}
\author{DocBuckets}

\begin{document}


\twocolumn[
    \maketitle
    \begin{onecolabstract}
      \begin{minipage}{1.0\linewidth}
        \paragraph{Background} Abstract background text describing
        enough to place this in context and make the reader
        sufficiently curious to indulge their time in this wonderful work\dots

        \paragraph{Methods and Results} Abstract methods text and some
        extraordinary results\dots

        \paragraph{Conclusions} Abstract conclusions text.

      \end{minipage}
    \end{onecolabstract}
]
\section{Introduction}
\lipsum[1]

\section{Methods}
\lipsum[2]

\end{document}

I presume your abstract is not too long, so that it fits on the current page. You may want to adjust some of the paraments set by the abstract package to improve the vertical spacing in the onecolabstract.