145

I know about \! which creates a thin negative space but is there any native command for large negative spaces (like quad or qquad for positive spaces) ?

vanna
  • 1,675
  • 1
    Related http://tex.stackexchange.com/questions/41476/lengths-and-when-to-use-them/41484#41484 and http://tex.stackexchange.com/questions/74353/what-commands-are-there-for-horizontal-spacing – texenthusiast Feb 26 '14 at 19:22
  • A simpler method is: bla \rlap{math}path bla. This renders the two words left aligned. For right alignment use \llap. – Stefan Nov 16 '17 at 15:57
  • why not define something like \def\nquad{!!!!!}, ...? – minmax Dec 15 '19 at 14:42

3 Answers3

119

In text mode: \kern-1em equals "minus quad"

In math mode: \mkern-18mu equals "minus quad"

For "minus qquad" use -2em or -36mu respectively.

yo'
  • 51,322
64

For LaTeX, horizontal spacing is achieved using \hspace{<len>} where <len> is a length (either positive or negative); TeX's equivalent to \hskip. Since \quad [\qquad] is equivalent to a horizontal skip of 1em [2em], use \hspace{-1em} [\hspace{-2em}] to obtain a negative space amount.

\kern inserts a space depending on the mode that TeX is in, and could therefore be either vertical or horizontal.

Text-based spacing can be inserted using any of the \phantom-related commands: \phantom{<stuff>}, or \hphantom{<stuff>}, for example.

Werner
  • 603,163
  • 17
    I would also love to use some phantom-like command but for negative space, i.e., going back in an amount given by a forward-written word. Example, I want to write math over path. Then my code should be: math \negphantom{math} path. Is it possible in an easy way? Maybe folding a phantom inside something to rotate/reflect it? But would that provide the same placement for the h's of math and path? – Andrestand Feb 11 '14 at 09:00
  • 1
    Or maybe some way of getting the size in pt of {whichever strange code object} may print in the pdf? (like \fontcharwd..., but not for simple characters, here) – Andrestand Feb 11 '14 at 10:04
  • 2
    My approach for my first comment is: math\begin{rotate}{180}\scalebox{-1}[-1]{p\phantom{ath}}\end{rotate}, which requires the rotating package and also graphicx.

    It would be nice to do with rotatebox what I do with the rotate environment, in order to avoid using both packages, but I haven't be able due to the way it rotates or keeps a fixed center.

    – Andrestand Feb 11 '14 at 13:30
  • 19
    @Andrestand: Use \newcommand{\negphantom}[1]{\settowidth{\dimen0}{#1}\hspace*{-\dimen0}}. – Werner Feb 11 '14 at 15:13
  • that way provides a bad alignment when using math \negphantom{math} path, but the commands \settowidth, \width, etc. were what I was looking for. Reading about them I found I can define \negphantom also like: bla math\makebox[-\width]{path}\makebox[\width]{\phantom{path}} bla. To ask LaTeX to give or print the value of variables I may read this... – Andrestand Feb 13 '14 at 12:00
  • 1
    I do not understand what you need to create the second makebox-command for @Andrestand. bla math\makebox[-\width]{path}\phantom{path} bla renders the exact same for me. Anyway, thanks a lot for the code! – Dominikus K. Dec 04 '15 at 10:07
  • What about: \mbox{\rlap{math}}path – ViToni Feb 08 '21 at 19:29
4

What about simply \!\! or \!\!\! ? It worked for me fine...

Willie Wong
  • 24,733
  • 8
  • 74
  • 106
Willi W
  • 51
  • Welcome to TeX.SE. Please note that outside of code environments the backslash \ is treated as an escape character by MarkDown, this is why none of the backslashes you typed originally showed up. I've wrapped them in code blocks so now they show. – Willie Wong Jul 23 '21 at 03:04