13

It seems that \em and \emph do not alternate between itshape and normal shape. How can this be restored?

Test case:

\documentclass{beamer}
\begin{document}
\frame{\em abc \emph{def \emph{ghi} jkl} mno}
\end{document}

With "article" it works as expected.

This is beamer 2011/09/12 development version 3.20.

akim
  • 407
  • 2
    Almost certainly this is one of the many things that Till didn't allow for when writing beamer, I guess here as it likely use cases are pretty rare. – Joseph Wright Jan 05 '13 at 09:47
  • Before anything else, remember that a change between rm and it shapes isn't as visible on a presentation as on a paper, that's why beamer defines the command \alert. About your problem, nesting emph commands should be used to over-emphasize a part of text, not to make the text back to its default level of emphasization, so defining a second emphasize command for that purpose would be a solution. In case what you want is simply to come back to the default level, the natural way of doing so is to close the macro and open a second one. – T. Verron Jan 05 '13 at 10:00
  • The problem is not on the use of \em and \emph. It is just for nested \emphs. – Guido Jan 05 '13 at 10:02
  • @JosephWright I frequently rely on nested \emphs. –  Jan 05 '13 at 10:49
  • @T.Verron Creating a second command defeats the purpose. If, for some reason, you decide to remove the top-level emphasis command, you have to change the status of the second-level command to top-level command. If the second-level command is visible, this may not be a problem and you may spot it. However, if it's the result of a macro call, you may very well not notice it. –  Jan 05 '13 at 10:51
  • @MarcvanDongen : That may be true, but not necessarily. If the point was to over-emphasize the second-level, removing the emphasize on the top-level sentence doesn't need to "demote" the second-level sentence. – T. Verron Jan 05 '13 at 12:08
  • @MarcvanDongen My point was that in a presentation it's rare to need this, plus Till is pretty clear about his view on emphasis in presentations in the manual (as T. Verron notes). That said, I don't necessarily find some of Till's decisions all that helpful, but I have to work with the situation that beamer is widely-used and I don't want to break things for users. (Also, it's not clear whether this was a deliberate decision or an oversight!) – Joseph Wright Jan 05 '13 at 12:56
  • I am well aware of the problems of using \em in a presentation, yet, that's my choice :) Besides, the initial problem is that I am quoting an author who is using emphasis in his text, and that does not deserve \alert either. Both {quote} and \emph where not behaving properly (accordingly to my expectations, agreed), I fixed the first one, but missed the second. Thanks to all! – akim Jan 06 '13 at 11:12

1 Answers1

13

beamerbaseoverlay.sty contains

\newcommand<>{\emph}[1]{{\only#2{\itshape}#1}}

so \emph only produces italic shape. However, \em is not changed and you can write

\documentclass{beamer}

\begin{document}
\frame{\em abc {\em def {\em ghi} jkl} mno}
\end{document}

giving

Sample output

which produces the shapes you expect, but is not overloaded with the overlay options beamer provides in its modified \emph. The overlay options mean that you can write \emph<3>{text} to print the text on all slides but italise it only on slide 3. If you are willing to forego this functionality and just want \emph to behave like {\em ...} then you can put

\renewcommand<>{\emph}[1]{{\em #1}}

in your preamble. Added: As you comment, the above may be combined to get the overlay behaviour via:

\renewcommand<>{\emph}[1]{{\only#2{\em}#1}}

As other posters note, often one would prefer to use beamer commands such as \alert for extra contrast in presentations.

Andrew Swann
  • 95,762
  • Thanks, I have chosen to reimplement \emph with \renewcommand<>{\emph}[1]{{\only#2{\em}#1}} because (i) I want \emph and I consider it a bug that Beamer turns the feature off without saying, and (ii), yet I want to use the <> features. – akim Jan 06 '13 at 11:09