Insert \thinspace only if not followed by certain characters
- From: "Joel C. Salomon" <joelcsalomon@xxxxxxxxx>
- Date: Mon, 11 Jun 2012 21:32:13 -0400
(Cross-posted from <http://tex.stackexchange.com/q/59482/2966>.)
Following a tip I'd seen, I’ve defined a \spaceddash command and
assigned it to the Unicode em-dash character U+2014 “—”:
\documentclass{minimal}
\usepackage[utf8]{inputenc}
\DeclareRobustCommand{\spaceddash}%
{\unskip\nobreak\thinspace\textemdash\thinspace\ignorespaces}
\DeclareUnicodeCharacter{2014}{\spaceddash}
\begin{document}
meow — meow
meow—meow
— meow
meow —.
\end{document}
The last line before \end{document} shows a problem with this: there's a
\thinspace between the em-dash and the period afterward, and I'd rather
not have it there.
Following the example of xspace & xpunctuate, I'm trying to define a
sort of \xthinspace command, one that will insert the \thinspace except
if the dash is followed by certain punctuation marks (e.g., period,
comma, close-parenthesis, close-quote).
How do I go about this?
--Joel
.
- Follow-Ups:
- Prev by Date: Re: Tucking citation into the last line of quotation
- Next by Date: Re: Tucking citation into the last line of quotation
- Previous by thread: Tucking citation into the last line of quotation
- Next by thread: Re: Insert \thinspace only if not followed by certain characters
- Index(es):