# Tag Info

95

\emph is like e.g. \textit a command with an argument. \em is the "switch" variant, comparable to \itshape. \em is not an outdated TeX or LaTeX2.09 command but a real LaTeX2e command. Actually \emph is defined through em: \DeclareTextFontCommand{\emph}{\em} \em is useful for long texts (\emph e.g. doesn't allow the argument to contain a \par). The commands ...

31

You can use the features provided by the listings package. \documentclass{article} \usepackage{listings} \begin{document} \noindent See the following command : \begin{lstlisting}[language=bash] $wget http://tex.stackexchange.com \end{lstlisting} \end{document} 28 Declare \normalem at the appropriate point in the document body. (The correspondent macro to switch to "underlined" emphasis is \ULforem.) \documentclass{article} \usepackage{ulem} \begin{document} Some \emph{emphasised} text. \normalem Some \emph{emphasised} text. \ULforem Some \emph{emphasised} text. \end{document} 25 You could just go: \catcode\|=\active \def|#1|{\emph{#1}} Then you can use |text| as if it were \emph{text}. 20 Rather than redefining \emph in terms of a copy of itself, it's better redefining it from scratch, using the standard definition as model; the standard definition is surprisingly simple: % latex.ltx, line 3744: \DeclareTextFontCommand{\emph}{\em} because it's \em that does the hard work. So we can simply do \documentclass[11pt]{article} \let\emph\relax % ... 19 You can also use the minted package: \documentclass{article} \usepackage{minted} \begin{document} \noindent See the following command : \begin{minted}{bash}$ wget http://tex.stackexchange.com \end{minted} \end{document} You need Pygments and the --shell-escape flag when you compile.

18

This is now fixed in the version on ctan and in texlive. This is a hopefully temporary issue in the latest fontspec release, it has been raised this morning as https://github.com/wspr/fontspec/issues/254 In the meantime if you add \let\emph\textit to your preamble the document will work in the common cases where \emph is italic, and then just look out ...

17

The idea behind \emph is that it provides a high level way for giving emphasis to a part of the text. High level in the sense it is “independent” of the actual implementation. The default behavior of \emph is to use italics when in an upright context and upright when in an italics context, but this can be modified on a document’s basis (or by a package ...

15

I recommend don't use font commands such as \textsl for such a repeated purpose in the text. Instead, define a macro for example \keyword for a different emphasis. There you could use \textbf or \textsl. So it's consistent and can easily be changed later. And you could keep using \emph for emphasizing.

15

I would not recommend changing the font style, I would rather add some redundant information, such as the definition of exp, or set it in quotes. \documentclass{article} \begin{document} $y = \exp(x)$, where $\exp\colon x \mapsto \mathrm{e}^x$ is the exponential function. $y = \exp(x)$, where $\exp$'' is the exponential function. \end{document}

13

On the method for creatîng emphasis: It's better to use \emph than \textit, for two reasons. First, \emph -- in keeping with LaTeX's philosophy of separating logical markup from content -- stresses the logic behind the emphasis-creating command, whereas \textit mixes it up with a reference to the actual font shape (italics) used to create the emphasis. ...

13

@ 1, yes it does work in LuaTeX. Here's how. Note that this also works in plain pdfLaTeX if you throw out lines 2 and 3. \documentclass[20pt, a4paper, DIV=calc]{scrbook} \usepackage{fontspec} \setmainfont{Times New Roman} \renewcommand{\textbf}[1]{% \pdfliteral direct {2 Tr 1.5 w} %the second factor is the boldness #1% \pdfliteral direct {0 ...

13

this has nothing to do with \emph. the string that isn't broken has no spaces in it, and it's full of punctuation, so tex has no idea where to break it -- the hyphenation routine simply doesn't work in this situation. the easiest way to get this to break is to use the url package, and use the command \url{xxx.xxx.xxx} to apply a different set of breaking ...

12

Most style guides recommend that you use Italics for emphasis sparingly. Many other languages and styles can emphasize text in other ways. For instance, there is no italic in German Fraktur type, Russian, Greek, or Bernard Shaw's letters or plays; instead, words are set letterspaced. You also need to make the distinction between emphasis and highlighting. ...

11

All the answers given so far capture an argument, fixing the category codes of the argument tokens forever. That will not work if you want verbatim text mixed with your emphasized text. They are also not \protected, so they won't work in a caption or footnote. The below uses |+ ...text... +| to delimit emphasized text and works in the cases I just ...

11

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 which produces the shapes you expect, but is not overloaded with the overlay ...

11

The problem is that the italics (or slant) lean the text to the right, and when you reflect it, the lean is to the left. But you already figured this out. Bruno Le Floch devised a neat \slantbox command that applies a shear transform to a given object, so you can make a "reverse italics" then reflect the irony mark: \documentclass{article} \usepackage{...

11

With TikZ you have engine independence. \documentclass{article} \usepackage{fontspec} \usepackage{newunicodechar} \usepackage{graphicx} \usepackage{tikz} \setmainfont{CMU Serif} \newfontfamily{\dejavu}{DejaVu Serif} \makeatletter \newunicodechar{⸮}{% \iffontchar\font⸮ ⸮% \else \ifdim\fontdimen1\font=\z@ \tikz[baseline=(?.base),inner sep=...

10

adding \show\mkbibemph \show\mkbibquote produces > \mkbibemph=\protected macro: ->\emph . l.6 \show\mkbibemph ? > \mkbibquote=\protected macro: ->\enquote . l.10 \show\mkbibquote so the biblatex ones are defined to expand to the normal ones by default.

10

Another solution found in the manual is to use the \usepackage option [normalem]. This is probably a better solution if you are using the package ulem just for line struck through word or some other feature, but want you use \emph as italics. I know this is not exactly your case, but may be useful for someone else.

10

It would be more normal to use \textit rather than \emph in a table cell, as it isn't normally free text that requires emphasis, You can make commands as short as you like, also the table cell automatically scopes the font change so you can use the declaration form rather than the form that takes an argument. After \newcommand\z{\bfseries\itshape} You ...

10

There may be some confusion as to how \emph and \em are defined. From the latex kernel (cf latex.ltx): \DeclareTextFontCommand{\emph}{\em} \DeclareRobustCommand\em {\@nomath\em \ifdim \fontdimen\@ne\font >\z@ \eminnershape \else \itshape \fi}% \def\eminnershape{\upshape}% Basically, \emph (via \em) checks if it's already ...

9

You can just redefine \em (defined in latex.ltx) to use \slshape instead of \itshape. Note that this will affect \emph also since it uses \em internally. \documentclass{article} \makeatletter \DeclareRobustCommand\em {\@nomath\em \ifdim \fontdimen\@ne\font >\z@ \eminnershape \else \slshape \fi}% \makeatother \begin{document} {\em slanted {\em ...

8

As mentioned by Stefan, you should use two different macros, so that you can change them easily and they will be more meaningful. I would however warn you against over emphasising things: the reader will get lost if a word out of two is emphasised, and he will get even more lost if you have several emphasis styles and the semantic difference between them is ...

8

Please always make full documents when asking questions, it makes things a lot easier. It seems that like a lot of environments that grab the environment body you need to use this form when wrapping in environment definitions (AMS display environments have the same feature): \documentclass{article} \usepackage{color,empheq} \newcommand*\mybox[1]{% \...

8

l2tabu (a guide to obsolete commands and packages, available in English and, more up-to-date, in German) comments on \em as follows: May be useful when defining macros. In continuous text \emph{...} should be preferred to \em. (Table 1, p. 8 [en] / 10 [de])

8

\emph is a LaTeX2e command and \em is a LaTeX 2.09 declaration, see e.g. http://www.public.asu.edu/~rjansen/latexdoc/emph.html . Since you're probably using LaTeX2e you should use \emph. \emph is a command and is used like \emph{text}. \em is a declaration and is used like \em text or {\em text}. Their differences may be demonstrated by the following: \...

8

I guess you want it to be italic and boldshape. By using \itshape and \bfseries instead it works. \documentclass{article} \usepackage{listings} \begin{document} \begin{lstlisting}[emph={if,for},emphstyle={\bfseries\itshape}] if something end if \end{lstlisting} \end{document}

8

Semantically, the emphasis should be on cis only. The cis is italicised because it's a latin abbreviation. You are using the hyphen to indicate a compound name, and the hyphen is not part of the latin word, so it should not be emphasised.

Only top voted, non community-wiki answers of a minimum length are eligible