5

I am trying to create a structured abstract using \paragraph{} for headings.

The first one works but from there on, I get LaTeX Error: Something's wrong--perhaps a missing \item.

I cut this to a MWE:

\documentclass{article}
\title{Test}
\author{Me}
\begin{document}
\maketitle
\begin{abstract}
\paragraph{Background}
There has been a massive social media campaign \dots

\paragraph{Methods}
I review the papers \dots

\end{abstract}

Enough to test.
\end{document}

And this correctly does Background in this style:

Background There has been a massive social media campaign

But Methods triggers the error. What is puzzling is that \section* works (but adds more vertical space than I want). Why should \paragraph behave like itemising markup but \section* doesn’t?

1

2 Answers 2

7

Abstract uses internally a list (quotation) to change the margins. Lists have a switch which lets them detect if a list has just started (it is reset at the begin of the first paragraph). The problem is that \paragraph overwrites the code that does this resetting. You can see that in the following example. In the first quotation the start of the paragraph resets the switch and so the second test is false. With \paragraph this fails and following code gets confused.

So one work-around in your case is to manually reset the switch with

\makeatletter \global\@newlistfalse\makeatother 
\documentclass{article}

\begin{document}
\makeatletter
\begin{quotation}
\if@newlist true \else false \fi \if@newlist true \else false \fi
\end{quotation}

\begin{quotation}
\paragraph{para}
\if@newlist true \else false \fi \if@newlist true \else false \fi

\global\@newlistfalse
\end{quotation}
\makeatother

\end{document}

enter image description here

2
  • Thanks; my minipage solution looks easier, though it is good to have some idea why it behaves the way it does.
    – PhilipM
    Apr 28, 2021 at 13:07
  • what is complicated at issuing \makeatletter \global\@newlistfalse\makeatother ? It is not longer than your minipage, and it won't prevent page breaking. Apr 28, 2021 at 13:29
1

This looks like the same issue.

And sure enough, if I enclose the abstract contents in a minipage environment, the problem goes away:

\documentclass{article}
\title{Test}
\author{Me}
\begin{document}
\maketitle
\begin{abstract}
\begin{minipage}{1.0\linewidth}
\paragraph{Background}
There has been a massive social media campaign \dots

\paragraph{Methods}
I review the papers \dots

\end{minipage}
\end{abstract}

Enough to test.
\end{document}

The explanation there:

The onecolabstract is a list type environment so is not expecting to see sectional headings etc. as produced by the \paragraph command.

That still does not explain to me why this is a problem in a regular abstract environment, why it works the first time and not subsequent times or why a regular section heading works.

So only a partial answer. Any help?

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.