8

I'm trying to create symbols, like the Interrobang (basically the ? and ! combined into one punctuation mark), that are the result of two overlapping symbols. Something like this can be produced with two negative spaces, but it isn't anywhere near perfect.

I've seen this and have tried using \mkern{} and \kern{}, but they aren't working for the width of the text.

Basically, I need a command that will operate like: ? \negspace{?} !. This will essentially type a ?, go back the width of a ?, and type a !. (sort of like the ← key on a typewriter.) Is this possible?

Thanks!

1 Answers1

11

What you're asking for is an overlapping macro. Either use \rlap (which produces a right overlap):

\rlap{?}!

or \llap (which produces a left overlap):

?\llap{!}

The order of the punctuation ? and ! doesn't really matter, although they have different widths (and therefore may set slightly differently when switched around). The LaTeX2e equivalent is \makebox[0pt][l]{?}! (?\makebox[0pt][r]{!}) which sets ? in a zero-width box that is left-aligned, followed by a now-overwriting !. adjustbox provides similar functionality in a host of user-friendly interface macros.

Instead of fiddling with the spacing using a "back-spacing" technique, overlay symbols using \ooalign. However, textcomp already provides \textinterrobang:

enter image description here

\documentclass{article}
\usepackage{textcomp}
\newcommand{\interrobang}{{\ooalign{?\cr\hss!\kern .025em\hss}}}
\begin{document}

I came! I saw? I conquered\textinterrobang{} And now I'm leaving.

I came! I saw? I conquered\interrobang{} And now I'm leaving.

\end{document}

See \subseteq + \circ as a single symbol (“open subset”) for a quick course in \ooalign.

Werner
  • 603,163
  • Could you explain to me the little commands (\cr,\hss,etc.)? – Conor O'Brien Dec 04 '14 at 00:07
  • Hmm, I'd much prefer having additional braces around \ooalign. Try putting \the\lineskiplimit just after \begin{document} and immediately before \end{document}. Then you'll know why! – egreg Dec 04 '14 at 00:07
  • Did you enjoy seeing the value of \lineskiplimit? ;-) – egreg Dec 04 '14 at 00:09
  • 1
    @ConorO'Brien: \cr literally means carraige return, like inserting a line break or using \\ in a tabular or array. \hss means horizontal stretch or shrink, which inserts "glue" that is "infinitely shrinkable as well as infinitely stretchable" (taken from the TeXbook). Using \hss<stuff>\hss is typically used to center content). – Werner Dec 04 '14 at 00:12
  • @egreg: Yes and no. :) – Werner Dec 04 '14 at 00:13