I'd like to write a word in bold followed by a comma and a non-bold word, like this:

\textbf{why}, blah

If I just write why, TeX inserts a kern to shift the comma a little closer to the "y". But when I write {why}, (even without the \textbf), TeX doesn't insert the kern; apparently kerning doesn't happen across a group boundary. If I write {why,} then I get the kern, but I also get a bold comma.

What I'd like to know is:

  • Is there a way to make TeX recognize that a pair of letters should be kerned even when there's a group boundary in between?
  • Stylistically, should that comma be bold?
  • 11
    From Bringhurst Elements of Typographic Style p. 60: "When boldface is used to emphasize words, it is usually best to leave the punctuation in the background, which is to say, in the basic text font. It is the words, not the punctuation that merit emphasis ..."
    – Alan Munn
    Commented Oct 10, 2011 at 3:46
  • @Alan: I suggest adding this as an answer, even though it may only be partial, since it provides an additional source in answer to the question.
    – Werner
    Commented Oct 10, 2011 at 4:06
  • 3
    While, in principle, a kerning in your situation should be applied, the problem of kerning characters belonging to two different fonts is rather difficult: what kerning should be applied? That prescribed by the first font, the second or an average of the two? Take also into account that some letters change shape quite dramatically in different fonts even of the same family (think to an italic "f" or also to a "g"). No universal rule can cover all possible variations.
    – egreg
    Commented Oct 10, 2011 at 10:25

4 Answers 4


If you want to add a kerning based on the "outer" font, you can define




will add the kerning and the comma (also ignoring the italic correction). The usual meaning of \nocorrlist is ,.; with the first line we add \? to the list without the need to know the current meaning.

A different approach (the hint was in Wyzard's comment) is to define a new command:


that possibly applies the kerning only if the character following \highlight{word} is a space.

  • I took the basic approach you demonstrated (comparing the width of boxes with and without the kern) and made a \highlight command that sets its argument in bold, but uses \futurelet to peek at the next token and insert an appropriate kern for it. So I can just write \highlight{why}, blah and I get a properly-kerned comma.
    – Wyzard
    Commented Oct 11, 2011 at 5:18
  • I also found that it looks better if I use \bfseries in the two boxes, so I get the (larger) kern from the bold font.
    – Wyzard
    Commented Oct 11, 2011 at 5:20
  • In your \highlight, why the special case to check whether the next character is a space? The box width comparison seems to work fine on spaces; you just get a difference of zero. (In my implementation I calculate the width difference using \@tempdima, and use \ifdim to skip inserting the kern if its size would be zero.) Am I overlooking something?
    – Wyzard
    Commented Oct 11, 2011 at 12:53
  • @Wyzard You're right; the space doesn't need to be treated differently. I wouldn't bother avoiding inserting a zero kern, as it doesn't make any substantial difference (words can't be hyphenated past explicit kerns).
    – egreg
    Commented Oct 11, 2011 at 13:06
  • One other issue I encountered in my version (and probably in yours, though I haven't tested it) is that when \textbf looks ahead to decide whether to add italic correction, it sees macro stuff instead of the "real" next character, so it adds the correction even when it shouldn't. I ended up using \unkern to remove that, then doing another box-width comparison to decide whether to add it back. (It'd be more straightforward to just check \hl@next against \nocorrlist to decide whether to \unkern, but I'm not sure how to do that and haven't researched it yet.)
    – Wyzard
    Commented Oct 11, 2011 at 15:08
  1. TeX does not kern between two different fonts. The bold and plain variants are from a different font (cmr10, cmb10).
  2. LuaTeX kerns across { and }, so {why}, gets its kerning, but not (see point 1) {\bf why},. PDFTeX (and older) behave as Knuth's TeX which does not kern across groups.
  • Re 1. nothing I know of can kern between different fonts, unless (hypothetically at least) using some sort of generated on-fly "optical" kerning. Commented Oct 11, 2011 at 0:20
  • Right, I just wanted to explain that this is not only due to the braces.
    – topskip
    Commented Oct 11, 2011 at 4:42

Since now I've cooked up a potential solution, I'll requote Bringhurst from my comment:

From Bringhurst Elements of Typographic Style p. 60:

"When boldface is used to emphasize words, it is usually best to leave the punctuation in the background, which is to say, in the basic text font. It is the words, not the punctuation that merit emphasis ..."

So if you follow this, then your problem persists. Here's a solution using the xspace package. As egreg notes in the comments, each character requires a different kern, so the solution below is a compromise. As you can see from the comparisons below, you don't gain much by doing this, but if you make the kern bigger (to make the 'y,' or 'w,' case look nice) the comma will appear too close to most of the other characters.

As an actual solution to the problem, I would probably insert a manual kern in the few cases where this arises in your document. (Not to mention that the vast majority of people won't notice it.)


\def\@xspace@check@token #1{%
       \def\mykern{\kern-.04em}% this is a compromise value
  \expandafter\ifx\csname @let@token\endcsname#1%

% Not part of the solution, just a quick way to generate output
\newcommand{\textbfk}[1]{\def\tmparg{#1}\textbf{\tmparg}\xspace, with kern\par\textbf{\tmparg}, without kern\par}



enter image description here


In answer to your second question, here's an extract from the Chicago Manual of Style (CMS) regarding the shape of punctuation (italics or bold) following text that has that particular shape:


All punctuation marks should appear in the same font--roman or italic--as the main or surrounding text, except for punctuation that belongs to a title in a different font (usually italics). So, for example, the word and, which in this sentence is in italics, is followed by a comma in roman type; the comma, strictly speaking, does not belong to and, which is italicized because it is a word used as a word [...]. Of course, it may be difficult to tell whether a comma is in italics or not (to say nothing of periods); for other marks it will be more evident. [...] In the first four examples that follow, the punctuation marks next to italic text belong with the surrounding sentence and are therefore presented in roman. In the last two examples, the two punctuation marks that belong with the italic titles--the exclamation mark following "Help" and the comma following "Eats"--are in italics (the comma following "Leaves" is in roman).

  • For light amusement he turns to the Principia Mathematica!
  • How can they be sure that the temperature was in fact rising?
  • The letters a, b, and c are often invoked as being fundamental.
  • I had yet to consider the central thesis of Malthus's Essay: the imperfectibility of humankind.


  • The Beatles' Help! was released long before the heyday of the music video.
  • I love Eats, Shoots & Leaves, [...]


The choice of boldface (or, by extension, type in a different color), unlike that of italics (see 6.2), is more often an aesthetic than a purely logical decision. Punctuation marks following boldface or color should be dealt with case by case, depending on how the boldface is used. In the first example, the period following "line spacing" belongs with the boldface glossary term and is therefore set in bold; the period following "leading" is part of the surrounding sentence and is therefore not set in bold. In the middle two examples, the punctuation next to the boldface terms belongs with them, like the first period in the first example. In the final example, the question mark belongs to the surrounding sentence and not to the boldface word.

  • line spacing. See leading.
  • Figure 6. Title page from an apocryphal Second Poetics.
  • For sale: three ten-year-old CPUs and five refurbished monitors.
  • Will the installation remain stalled until I choose I accept?


According to a more traditional system, periods, commas, colons, and semicolons should appear in the same font as the word, letter, character, or symbol immediately preceding them if different from that of the main or surrounding text. In the third and fourth examples in 6.2, the commas following a and b and the colon following the Malthus title would be italic, as would the comma following the book title (Eats, Shoots & Leaves) in the last example. A question mark or exclamation point, however, would appear in the same font as the immediately preceding word only if it belonged to that word, as in the title Help! in 6.2. This system, once preferred by Chicago and still preferred by some as more aesthetically pleasing, should be reserved--if it must be used--for publications destined for print only. In electronic publications, where typeface may be determined by content as well as appearance (e.g., a book title might be tagged as such, separate from any surrounding punctuation), the more logical system described in 6.2 should be preferred.

It seems like both are valid, at least according to CMS. I would opt for the CMS' preferred option in both cases (bold and italics). That is, to keep punctuation formatting separate from text typesetting.

In agreeance with this, Wikipedia's Manual of Style (MoS) also suggests separating the shape of the text and succeeding punctuation.

  • Hmm. I think my situation is most similar to the first three examples in section 6.3, which do put the punctuation in bold. I used simplified dummy text in the question because I wanted to focus on the technical issue, but it's actually a bullet point in a resumé: Foobar University, Anytown, USA.
    – Wyzard
    Commented Oct 10, 2011 at 4:20

You must log in to answer this question.

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