GeneralForcing LaTeX to "single space" exclamation point

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
string beans theory
Posts: 1
Joined: Sat Jun 19, 2010 1:18 am

Forcing LaTeX to "single space" exclamation point

Post by string beans theory »

I'm typesetting stories where there are, among other things, a lot of non-terminal exclamation points (e.g. "No! No! No! he shouted angrily.") I know how to fix the problem manually via the special spacing commands. However, I want this done automatically the way (La)TeX already "single spaces" commas (and periods in certain special cases). In other words, I want single space to be the default for exclamation points, while retaining the usual sentence spacing defaults for periods, question marks, etc. (\frenchspacing is therefore not an option.)

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Forcing LaTeX to "single space" exclamation point

Post by gmedina »

Hi,

you can use some of the features provided by the babel package to define and manage user-defined shorthands:

Code: Select all

\documentclass[english]{article}
\usepackage{babel}
\defineshorthand{!}{!\negthinspace}% define the shorthand
\useshorthands{!}% activate the user-defined shorthand(s)

\begin{document}

No! No! No!

\shorthandoff{!}% deactivate some shorthand(s)
No! No! No!

\shorthandon{!}% activate some shorthand(s)
No! No! No!

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply