1

I would like to set a part of the LaTeX document in italics but with using \emph{...} for emphasizing inside. This is easy to do within single paragraph where \emph can be easily nested. But since \text@command is not \long, it does not extend to multiple paragraphs.

If there is no standard way of doing that, I can always use \bgroup\itshape ... \egroup but I need to trick \emph into knowing it already is in italicized text so that it will change back to upright.

I don't find my current solution \bgroup\itshape\def\emph#1{{\rm #1}} ... \egroup is particularly elegant. Something better would be appreciated.

EDIT: While \emph does switch correctly inside \itshape, the problem was found to be caused by \usepackage{fontspec}:

\documentclass{minimal}
\usepackage{fontspec}
% \usepackage{libertine}
\begin{document}
\itshape This is an \emph{emphasized} word.
\end{document}

enter image description here

5
  • You don't have to use \def\emph inside \bgroup\itshape ... \egroup. \emph de-italicizes the emphasis and is nestable.
    – Skillmon
    Apr 24, 2017 at 8:12
  • @Skillmon \emph is not used in emphasis context & does not know the text is already italicized by \itshape. So it only switches to italics, producing no visible effect at all.
    – eudoxos
    Apr 24, 2017 at 8:17
  • I just tried and \emph works on my machine inside a \itshape group.
    – Skillmon
    Apr 24, 2017 at 8:24
  • 1
    OK, now it's clear. What version of fontspec do you have? There was a similar issue before.
    – campa
    Apr 24, 2017 at 8:53
  • @campa: 2.5a (packaged in Ubuntu 16.04). That looks like the cause. Thanks for finding out! (Please mark as duplicate and close.)
    – eudoxos
    Apr 24, 2017 at 8:57

0

Browse other questions tagged .