5

When I run the following code, I get the paragraph title "Some title.". How do I get the compiler to suppress the period (".") in the paragraph title?

\documentclass[3p,12pt,authoryear]{elsarticle}

\begin{document} 

\paragraph{Some title}

\end{document}
  • That seems to be a feature of the elsarticle class, you're using. If you're going to submit with Elsevier, let them take care of the style questions. They will overrule custom formatting anyway. Or you just pick another template. – engineer Oct 14 '15 at 8:37
  • 2
    It is in any case wrong to use \paragraph at that point : \paragraph is the 4th level section heading so should be used below \subsubsection. – David Carlisle Oct 14 '15 at 8:39
  • Yeah, but I want to make a question mark instead of a period. The question mark is easy to make so I did not ask concerning it. – Marcus Oct 14 '15 at 8:40
  • 4
    @Marcus: Why wasn't this ? addition in your post from the beginning, leaving my answer effectively useless now, being accepted and then unaccepted? :-( – user31729 Oct 14 '15 at 10:44
  • 5
    @Marcus The fact that you want a question mark is a very important detail that should have been in the question to begin with. – egreg Oct 14 '15 at 10:52
16

The definition in elsarticle is badly written, because it unconditionally adds a period.

You can change it in a way that will add the period only if no punctuation follows the title with the help of amsthm and its \@addpunct feature.

\documentclass[3p,12pt,authoryear]{elsarticle}

\usepackage{amsthm}% for \@addpunct
\makeatletter
\def\els@aparagraph[#1]#2{\elsparagraph[#1]{#2\@addpunct{.}}}
\def\els@bparagraph#1{\elsparagraph*{#1\@addpunct{.}}}
\makeatother

\begin{document}

\paragraph{A title without period}

\paragraph{A title with period.}

\paragraph{Will it work with a question mark?}

\end{document}

There should be no problem in loading amsthm with elsarticle, because the class supports AMS packages.

Note that the period is added also to the first paragraph title, as required by the style, but no additional one follows the second title, nor one follows the question mark.

enter image description here

|improve this answer|||||
  • 2
    Although you stole the tick (:-( ): +1 – user31729 Oct 14 '15 at 11:00
14

Edit Since the question mark 'issue' wasn't in the question at the time I answered I could not address this. It's useless to append this to my solution since there's another answer already.

The dot is explicitly set in \els@aparagraph as #2.

\def\els@aparagraph[#1]#2{\elsparagraph[#1]{#2.}}

A similar definition holds for \els@bparagraph.

Here is the working code -- but the publisher will perhaps reject this. In addition, what @DavidCarlisle said: The command \paragraph is used in the wrong hierarchy of sectioning commands.

\documentclass[3p,12pt,authoryear]{elsarticle}


\makeatletter
\def\els@aparagraph[#1]#2{\elsparagraph[#1]{#2}}
\def\els@bparagraph#1{\elsparagraph*{#1}}
\makeatother

\begin{document} 

\paragraph{Some title}

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

And for the case that the puplisher complains that you did redefine internal commands here an add-hoc solution:

\documentclass{elsarticle}
\newcommand\eatpunct[1]{}
\begin{document}
\paragraph[Bla?]{Bla?\eatpunct} Yes!
\end{document}

enter image description here

|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.