8

So I've seen there's an \abstract{...} command (through TeXlipse's suggestions), however most examples I find online use an environment structure like this:

\begin{abstract}
something like \lipsum or \blindtext
\end{abstract}

Since I would assume \abstract{...} functions like \section{...}, that got me wondering. Is there any difference between these two options? In particular, is there any advantage or disadvantage of using one over the other?

5
  • It depends on the class. Some (most?) define abstract as environment, but I've seen some journal template defining it as macro with one argument.
    – campa
    Commented Nov 12, 2019 at 8:03
  • 3
    every environment foo is implemented by defining \foo and \end{foo} so typically \abstract is like \begin{abstract} with no close, and not a good idea. Commented Nov 12, 2019 at 8:08
  • @DavidCarlisle So basically, \abstract should be avoided?
    – Egor Hans
    Commented Nov 12, 2019 at 8:12
  • 1
    Again it depends on the document class. As campa mentions some Journal require the abstract to be written as \abstract{...}, which then confuses users when they come to a class that use abstract as an environment (symptoms are wondering why their margins are so large).
    – daleif
    Commented Nov 12, 2019 at 8:22
  • 1
    Some classes define \abstract to be used as a command with an argument, some as an environment (in which if you use the command form it will do the wrong thing)and some do not define it at all. By default it is not defined, and you have not said which class you are using..... Commented Nov 12, 2019 at 8:56

1 Answer 1

11

Simplifying, \begin{foo} does four things:

  1. check that the environment foo (more exactly the macro \foo) exists;
  2. open a group (\begingroup);
  3. set the name of the current environment (\@currenvir) to foo;
  4. execute \foo (actually \csname foo\endcsname).

Similarly, \end{foo} does

  1. execute \endfoo (more exactly \csname endfoo\endcsname);
  2. check that the environment being closed is the same one which was opened before (by comparing foo with the previously saved \@currenvir);
  3. close the group (\endgroup).

The standard classes, the KoMa classes, and memoir all define abstract as environment. In this case, just calling \abstract{...} (I tested only with article) gives no errors but the result will be puzzling: with the article class the font size and the margins are reduced, and without \end{abstract} this extends to the following text. This happens because the steps 1 to 3 are skipped, in particular \begingroup; and since there is no \end{abstract} the group (which was never opened) won't be closed, and whatever font and/or margin and/or whatever changes \abstract does won't be limited to the abstract.

There are classes (mostly journals, I guess; I can mention webofc.cls and PoS.cls, because I had to use them) which define \abstract as a macro taking one argument. Writing

\begin{abstract}
Some text.
\end{abstract}

will often also produce no errors, but again the result won't be the intended output: only the letter S will be taken as argument of \abstract (whatever it does), the rest ("ome text.") will be typeset somehow, and \end{abstract} will probably raise no error, because even if \endabstract hasn't been defined, the construction \csname...\endcsname will expand to \relax.

So back to your question:

In particular, is there any advantage or disadvantage of using one over the other?

The bottom line is: it has nothing to do with advantage or disadvantage: You must use \begin{abstract}...\end{abstract} if the class defines the abstract as environment, and \abstract{...} if the class defines the abstract as macro.

1
  • 3
    This answers everything I could imagine needing in this or a similar context.
    – Egor Hans
    Commented Nov 12, 2019 at 10:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .