4

Aware abbreviating those commands need not always be helpful, I would like to know how to abbreviate them? The following is what I tried, which does not work:

\documentclass[11pt,handout]{beamer}
\newcommand{\bframe}{\begin{frame}}
\newcommand{\eframe}{\end{frame}}
\newcommand{\ftitle}{\frametitle}


\author{Author}
\title{Title}


\begin{document}
\maketitle

\begin{frame}
\frametitle{Outline}

\end{frame}


\bframe
\ftitle{Introduction}

\eframe



\end{document}

At first I thought it might be the case that commands such as \bframe was already defined. But using \def instead still gives no desired result.

7
  • 3
    Quick advise: Just don't do it ;-)
    – user31729
    Commented Jul 6, 2015 at 8:31
  • Thanks. I would like to know, and I can comment them off, right?
    – Yes
    Commented Jul 6, 2015 at 8:31
  • 3
    In general it's a bad idea to abbreviate latex environment syntax, sometimes it works but for many enviroments (frame, ams align, verbatim, etc) it does not work, and even when it works for latex it usually confuses syntax highlighting etc. Environments are the main syntactic structure of the latex language, they shouldn't be hidden, they should be used. Commented Jul 6, 2015 at 8:32
  • 2
    I am afraid I am not asking "Is it wise to abbreviate so and so?" :)
    – Yes
    Commented Jul 6, 2015 at 8:36
  • 1
    Isn't the official \begin{frame}{My frame title}...\end{frame} short enough?
    – AlexG
    Commented Jul 6, 2015 at 8:47

2 Answers 2

6

You can obtain a result similar to \begin{frame}...\end{frame} by

\def\bframe#1\eframe{\begin{frame}#1\end{frame}}

but I can't see any improvement both in typing speed and in clarity of the typescript.

With the above definition you can do

\bframe
<contents>
\eframe

but don't even try adding arguments such as [fragile] because it won't definitely work.

There is no problem into doing

\newcommand{\ftitle}{\frametitle}

but, again, I see no advantage in typing

\ftitle{Gnus and gnats}

instead of

\frametitle{Gnus and gnats}
2

For lazy writers, already there is a shortcut:

\frame{{<frametitle>}<contents>}

MME:

\documentclass{beamer}
\begin{document}
\frame{{Hello} Hello,Moon}
\end{document}

However, if you need frame arguments ...

4
  • 2
    This is old syntax supported for historical reasons: please avoid in new code.
    – Joseph Wright
    Commented Jul 6, 2015 at 9:28
  • And though your time is appreciated, I would say it is about efficiency rather than laziness. But, yes, there may exist somebody who would like to write 3.14159... instead of $\pi$.
    – Yes
    Commented Jul 6, 2015 at 9:42
  • @JosephWright, I have no doubt you're right. For me is enough bad that [fragile] does not work ... but using \frame is discouraged somewhere in the manual? Why you keep around 50 examples using \frame?
    – Fran
    Commented Jul 6, 2015 at 10:03
  • @Chou Surely you search for shorcuts for efficiency in mind, but in my case is only lazyness ;)
    – Fran
    Commented Jul 6, 2015 at 10:28

You must log in to answer this question.

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