3

I have noticed that I can start some LaTex environment in two ways.

For the frame environment in Beamer, for example,

\begin{frame}
% .. frame content ..
\end{frame}

is equivalent to

\frame
{
% .. frame content ..
}

Questions:

  • Is this true for all environments? e.g. could I start \equation{%..} or \table{%..} ?
  • Are they, in fact, equivalent? Some of these env. takes argument either in curly or square brackets, is it possible to supply such arguments when using braces rather then the \begin{}[arg] %.. \end{} format.

On the why: I much prefer the braces formatted as above, because editing from terminal I can indent and see more easily where environments begin and end.

0

1 Answer 1

6

It's a specific feature of the specific frame construction of beamer.

In no other case you can hope that

\env{...}

is equivalent to

\begin{env}
...
\end{env}

Why is it allowed for frame? For historical reasons. Till Tantau started using \frame{...}, but then realized that the environment form is better. The manual still has several examples with the “command form”, but I'd discourage from using it except for simple cases, such as \frame{\titlepage}.

I disagree with your opinion: the environment form

\begin{frame}
...
\end{frame}

is much clearer in the typescript (and you can indent the contents as much as you like). Moreover, \end{<envname>} is much more prominent than a simple }.

4
  • Would you mind elaborating on why the `\begin{<env>}' is better? As for the prominence, this is personal taste. I find one closing character to be much more elegant and less cluttering, making the code more readable (especially if one is using an editor that matches/highlight braces or allows navigation of braces ;) )
    – Three Diag
    Sep 23, 2015 at 10:46
  • @ThreeDiag It's just my opinion; I find that this is good markup and the command form isn't. You're free to think differently, of course.
    – egreg
    Sep 23, 2015 at 10:52
  • 2
    @ThreeDiag - For sure, some environments are set up to do nontrivial stuff when LaTeX encounters \end{env}. \env{...} will likely fail to execute that "stuff". At the very least, you'll need to execute \endenv -- at which point there are no gains whatsoever, in terms of elegance of lack of clutter -- over typing \end{env}.
    – Mico
    Sep 23, 2015 at 10:55
  • 1
    @ThreeDiag Additionally, with \begin{env}...\end{env} verbatim material is smoothly allowed but not with \env{...}. Sep 23, 2015 at 14:45

You must log in to answer this question.

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