31

In HTML, there's the distinction between <em> as semantic markup and <i> as its pure-formatting equivalent. LaTeX has the same distinction: \emph is semantic markup, rendered using \textit.

HTML also includes an analogous distinction between <strong> and <b>. Does LaTeX define a semantic command (e.g. \strong{...}, but that doesn't exist) that gets rendered using \textbf?

EDIT: on very similar lines, does LaTeX define a semantic command like \quote{...} that will render using quotation marks (of some preferred type)? (HTML has <q>.)

1
  • 2
    For the quote macro see the csquotes package. Feb 2, 2013 at 10:13

7 Answers 7

30

You can define your own \strong command which switches between strong and normal text like \emph does with italic:

\documentclass{article}

\makeatletter
\newcommand{\strong}[1]{\@strong{#1}}
\newcommand{\@@strong}[1]{\textbf{\let\@strong\@@@strong#1}}
\newcommand{\@@@strong}[1]{\textnormal{\let\@strong\@@strong#1}}
\let\@strong\@@strong
\makeatother

\begin{document}

Text \strong{strong text \strong{strong2 \strong{st-\strong{st}-st}  yyy } xxxx} after

\end{document}

Result1


Or you can define different levels of "strong" using a counter:

\documentclass{article}
\usepackage{xcolor}

\newcounter{stronglevel}
\setcounter{stronglevel}{1}
\newcommand{\strong}[1]{%
    \csname strong\roman{stronglevel}\endcsname{{%
        \advance\value{stronglevel} by 1\relax
        #1%
    }}%
}
\newcommand{\strongi}[1]{\textbf{#1}}
\newcommand{\strongii}[1]{{\blendcolors*{!50!red}\color{.}#1}}
\newcommand{\strongiii}[1]{\textsf{#1}}
\newcommand{\strongiv}[1]{{\blendcolors*{!50!red}\color{.}#1}}

\begin{document}

Text \strong{strong text \strong{strong2 \strong{st-\strong{st}-st}  yyy } xxxx} after \strong{next}.

\end{document}

Result2

2
  • 15
    Now you're just showing off... :-) Mar 31, 2011 at 16:23
  • 4
    @Matthew: Originally I had \strongiv which included \blink and a \strongv which used \smellbad. :-) Both require of course ePaper. Apr 2, 2011 at 10:25
14

\emph doesn't render always as \textit. It switches between upright and italic as you can see if you nest \emphcommands:

\documentclass{article}
\begin{document}
abc \emph{some text \emph{emph} some text}
\end{document}

And there is no similar command which switches between bold and normal, but it would be easy to define. Simply copy the definition of \em and \emph from latex.ltx.

5
  • How would that definition work for strong? What would be the conditional you would check? Something like \iftextisbold? \em checks for positive \fontdimen1 What would be the analogue for bold?
    – Seamus
    Mar 31, 2011 at 11:56
  • 5
    I would check if \f@series is equal to \bfdefault. Mar 31, 2011 at 12:05
  • 3
    Should strong within strong be normal? Or maybe it should be more strong!!!: coloured text, or rendered in a caligraphic font or both. Or increased text size... The possibilities are endless...
    – Seamus
    Mar 31, 2011 at 12:16
  • 8
    strong is not semantic in the same way that emph is: there is no typographical convention on using boldface in the way that there is for using italics. So the lack of a \strong command isn't surprising.
    – Alan Munn
    Mar 31, 2011 at 12:49
  • A good point WRT to switching in nesting. It turns out that standard HTML rendering doesn't do any switching in <em>, <strong>, <i> or <em>. Apr 2, 2011 at 10:35
13

The answer to your first question is "no, but it's easy to do it". Just add \let\strong\textbf to your preamble.

The second question's answer is "no, but there's a package that does it in a very clever way". The csquotes defines \enquote which does what you want.

10

I believe the absence of \strong (or the decision to use italic font for \emph) is a conscious one to discourage writers from using bold font in running text. The reason for this is that LaTeX tries to set paragraphs in such a way to obtain an equal level of 'grey', which looks better, and is easier on the eyes. For the same reason, underlining and letterspacing are not implemented by default, since they too affect text greyness.

Note that this of course raises a somewhat philosophical point: should a typesetting engine 'protect' its users from making a (typographically speaking) bad decision, or should they allow the user to do most anything they would want, up to the typographical equivalent of shooting oneself in the foot? I have the feeling that LaTeX mostly adheres to the philosophy of protecting the user---just look at how difficult it is (by default) to change all the typographical settings.

Of course this is essentially a non-answer ;) but I still wanted to make the point.

3
  • 6
    Another thing LaTeX does in this vein is to make changing font face a little tricky: good typography practice suggests using the same font throughout.
    – Seamus
    Mar 31, 2011 at 13:31
  • 2
    @Seamus: it would be best if it was easy to set any font at the start of the document, and then hard to change. Right now, my impression is that it is hard to do anything else than the standard fonts :). Mar 31, 2011 at 23:56
  • 1
    @BrunoLeFloch Changing fonts is made significantly easier with the fontspec package, which works well with XeTeX and LuaTeX, at the very least. Adding arbitrary TTF or OTF fonts becomes a one-liner per font with fontspec. Aug 30, 2012 at 4:46
4

As Seamus and Ulrike have pointed out, the LaTeX core does not define \strong or another semantic command that uses \textbf. The beamer class, however, does something that comes close: In addition to \emph, it defines \alert which displays its argument in red color.

2

Use the semantic-markup package! It defines \strong, \quoted, \term, and other commands of this type.

0

To add to Seamus’ answer: LaTeX by itself does not define such semantic commands, but

  • The fontspec package defines \strong, which is essentially the same as \textbf:

    \documentclass{scrartcl}
    \usepackage{fontspec}
    \begin{document}
       Using \strong{strong \strong{in fontspec}}
    \end{document}
    
  • The csquotes package defines \enquote, which behaves similarly to <q> in HTML.

You must log in to answer this question.

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