Question & exclamation marks

The question mark ? and the exclamation mark ! are among the very few punctuation marks that come with an upside-down partner: the Spanish ¿ and ¡. In LaTeX you can produce them with a ligature — just type a backtick after the mark — and, less widely known, that ligature works identically in Knuth’s original OT1 encoding and in T1. The price OT1 pays for it is that typing < in ordinary text there gives you ¡. This page works through, with measurements, how to enter ¿ and ¡, why < and > come out wrong, how ? and ! widen the space that follows, the space French puts before them, and the fact that ! in math mode is a factorial (\! is not an exclamation mark at all).

Getting the Spanish ¿ and ¡: the backtick ligature and \textquestiondown

Type a backtick right after ? and you get ¿; right after ! and you get ¡. It is a font ligature, so no package and no command are involved. Write it as in the code example below and “¿Como estas?” comes out, with the backtick nowhere in the output. If you prefer to be explicit, \textquestiondown and \textexclamdown exist and measure exactly the same as the ligature — in T1, 4.72107pt for ¿ and 2.7771pt for ¡. The inverted marks themselves were proposed by the Royal Spanish Academy in the eighteenth century, so that a reader would know where a long question begins before reaching the end of it. That is why a closing mark alone is incomplete: a missing opening mark is treated less as a typographic slip than as a spelling error.

The relationship between the ligature and the command runs in opposite directions in the two encodings. In OT1, ot1enc.def defines \textquestiondown as the ligature itself (see the code below) — that is, the command invokes the ligature. The ligature is the primitive and the command is an alias. In T1 it is the other way round: t1enc.def declares \DeclareTextSymbol{\textquestiondown}{T1}{190} and puts \textexclamdown at 189, pointing straight at real slots in the font. The result is identical either way, so use whichever you prefer; but \textquestiondown is easier to search and replace, and a reader sees the intent at a glance. Typing ¿ and ¡ directly into a UTF-8 source is fine too — modern LaTeX defaults to UTF-8 input, and it passes through under T1 unchanged.

latex
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
% ...
?`Como estas?  !`Que bien!
\textquestiondown Como estas?  \textexclamdown Que bien!
¿Como estas?  ¡Que bien!   % direct UTF-8 also works
latex
% ot1enc.def -- in OT1 the COMMAND is defined as the ligature
\DeclareTextCommand{\textexclamdown}{OT1}{!`}
\DeclareTextCommand{\textquestiondown}{OT1}{?`}

% t1enc.def -- in T1 they are real slots in the font
\DeclareTextSymbol{\textexclamdown}{T1}{189}
\DeclareTextSymbol{\textquestiondown}{T1}{190}

In OT1, < and > come out as ¡ and ¿: where the inverted marks live

Because OT1 fonts have no < and > glyphs at all, and ¡ and ¿ occupy those code positions. Compile OT1 angle: <a> and 2<3 and x>y. without \usepackage[T1]{fontenc}, run pdftotext on the result, and back comes OT1 angle: ¡a¿ and 2¡3 and x¿y. — with no error and no warning anywhere. Load T1 into the same source and <a> stays <a>. This is the kind of accident that never fails loudly: the moment you write a comparison operator or an angle bracket in running text, it silently turns into another character.

There are three fixes, and this is the order to try them. First, add \usepackage[T1]{fontenc} — T1 has real < and > glyphs, and it also gets hyphenation right in words with accented letters, so any Western-language document ends up wanting it anyway. Second, write $<$ and $>$ in math mode — which is also semantically right for a comparison operator. Third, use \textless and \textgreater — appropriate when you want the symbol stated explicitly. Read the other way, this behaviour is a useful signal about whether staying on OT1 is acceptable: if angle brackets appear in your running text, you have one more reason to load T1.

The space after ? and ! gets wider: how they are judged sentence ends

? and ! carry the same space factor of 3000 as a period, so they switch the following space to a sentence space. Measured, wow! Next is 47.2107pt while wow!\ Next, with the interword space written out, is 46.09985pt; the 1.11085pt difference is the extra sentence space. End a sentence with ? or ! and you get exactly the same width as a period, with no effort. The flip side is that the same gap appears when an exclamation mark sits mid-sentence. After a construction like Wow! he said, or a proper name such as Yahoo!, either write the space explicitly — Yahoo!\ Inc. — or switch the sentence space off entirely with \frenchspacing.

French puts a space before ? and ! — babel inserts a measured 1.66626pt

French orthography puts a space before ? ! ; :, and loading babel with [french] inserts it for you whether or not you typed one. The amount is spelled out in french.ldf: \FBthinspace is \hskip .5\fontdimen2\fonthalf an interword space, which is 1.66626pt at 10pt. Measured, Quoi is 21.10596pt and Quoi! is 25.54932pt, a difference of 4.44336pt; subtract the 2.7771pt width of the T1 ! and exactly 1.66626pt remains. The colon is the exception: \FBcolonspace is \space, a full interword space of 3.33252pt. Measured, Non is 18.05115pt and Non: is 24.16077pt, and subtracting the width of : leaves precisely 3.33252pt.

The practical conclusion is clean. In a French manuscript, do not type the space before the mark yourself. babel inserts it, and the space it inserts is non-breaking, which also prevents a lone ? from falling to the start of the next line. Typing a space by hand doubles the gap and additionally creates a place where the line may break. Conversely, no other language puts a space before ? or ! — English, German and Spanish set them tight against the preceding word. In a multilingual document, the safest course is to let babel’s language switching handle the difference.

latex
\usepackage[french]{babel}
% ...
% babel adds the space itself; typing one is unnecessary
Vraiment? Voici: ceci; cela!   % prints as: Vraiment ? Voici : ceci ; cela !

In math, ! is a factorial — and \! is not an exclamation mark

In math mode ! inserts no space on either side at all. fontmath.ltx declares \DeclareMathSymbol{!}{\mathclose}{operators}{"21}, which makes ! a closing symbol (\mathclose) that glues itself to whatever precedes it. Measured, $ab$ is 9.57755pt while $a!b$ is 12.35533pt — a difference of 2.77778pt, which is precisely the width of the ! glyph. Not one scaled point of space on either side. That is why a factorial n! sets tight, and $n!!$ simply adds another glyph (11.55792pt), so the double factorial needs nothing special either. ? is declared \mathclose in exactly the same way.

And here is a trap the name sets for you. \! is not an exclamation mark; it is a negative thin space. Measured, the 9.57755pt of $ab$ becomes 7.91092pt in $a\!b$ — it shrinks by 1.66663pt. It is the exact opposite of \, (a positive thin space), a tuning command for pulling symbols together. If you simply want an exclamation mark in a formula, type ! with no backslash. Since \! mostly shows up in constructions like \int\!\int for tightening integral signs, typing it when you meant a factorial breaks things in a confusing way: the mark disappears and the neighbouring symbols close up.

latex
\[
  \binom{n}{k} = \frac{n!}{k!\,(n-k)!}, \qquad (2n)!! = 2^n n!
\]
% \! is a NEGATIVE thin space, not an exclamation mark:
\[ \int\!\!\int_D f(x,y)\,dx\,dy \]

The interrobang ‽ and doubled !! ??: when you want to pile marks up

You can type !! and ?? just as they are: no command needed, and no ligature fires. And the single character meaning “question and astonishment at once” — the interrobang ‽ — is, surprisingly, part of standard LaTeX machinery. It is \textinterrobang in the TS1 encoding, available once textcomp is loaded, declared at slot 148 in ts1enc.def (the inverted \textinterrobangdown sits at 149). Compile it and run pdftotext over the result and a genuine ‽ comes out. It measures 4.72107pt, the same as a ?.

The interrobang was devised in 1962 by Martin K. Speckter, who ran an American advertising agency; it grew out of a copywriter’s wish to write “a question asked in astonishment” as a single character, and for a while it was even cut as type and made as a typewriter element. It never settled in as ordinary punctuation, but it lives on in Unicode as U+203D and in LaTeX through TS1. Honestly, there is almost no occasion to use it in practice — and the same goes for stacking !! or ?? in academic prose, where the standard advice is to strengthen the sentence rather than the mark. Still, it is worth knowing that a dedicated command exists for the day you need it.

Input lookup: what you type and what comes out

InputOutputNotes
??Western question mark; sfcode 3000, so the following space becomes a sentence space
?`¿ligature; works in OT1 and T1 alike, and the backtick is not printed
!`¡ligature; output identical to \textexclamdown
\textquestiondown¿explicit command; a real glyph at slot 190 in T1
\textexclamdown¡explicit command; a real glyph at slot 189 in T1
\textinterrobangneeds textcomp (TS1); slot 148
$n!$n!factorial; ! is \mathclose, so no space is added on either side
\!(negative space)not an exclamation mark; a tuning command that closes 1.66663pt in math
? !? !full-width Japanese marks; do not type a full-width space after them

Japanese ? and ! are full-width: type no space after them

Japanese uses the full-width ? and !, and you type no full-width space after them. Japanese-capable engines such as upLaTeX, or LuaLaTeX with luatexja, treat these as punctuation glyphs and reserve the trailing space automatically. The W3C “Requirements for Japanese Text Layout (JLReq)” likewise specifies that a sentence-ending question or exclamation mark occupies a full-width em and is followed by a full-width space — except that it is set solid when a closing bracket comes next. Add a full-width space of your own here and it lands on top of the automatic one, doubling the gap. Most classes and packages also handle the leftover space when a ? falls at the end of a line. Leave punctuation spacing to the engine — that is the rule on the Japanese side.

latex
\documentclass{ltjsarticle}
\begin{document}
本当ですか? はい、できました! 次に進みましょう。
\end{document}
  • In Japanese-led manuscripts, standardise on full-width and . A stray half-width ? or ! changes line-end and spacing behaviour even when the tone of the sentence is identical.
  • Leave Western quotations, code and proper names half-width. Marks quoted from a source are handled separately from the Japanese body policy.
  • In Spanish, check the opening marks. Writing only the closing ? or ! and forgetting ¿ or ¡ is a linguistic error, not a cosmetic one.
  • In French, never insert the space by hand. Leave it to babel with [french], and make “no space typed before the mark” a team rule.
  • On an OT1 document, suspect the angle brackets. A < or > in running text silently becomes ¡ or ¿, so check first whether \usepackage[T1]{fontenc} is present.