I'd like to use a character that looks like $\sim$, but has spacing like $\neg$ (in particular, which doesn't leave a huge gap to its right). I know I could do this by defining a symbol which expands to $\sim\hspace{-1pt}$, with 1pt replaced by some amount that looks about right to me, but is there a better way to do this (for instance, which doesn't rely on my guess about what spacing looks about right)?
Math Mode – Spacing Around a Character
spacing
Related Solutions
For a detailed answer why this is happening you can read this answer of mine (shameless plug indeed): In short, the italic correction of the f
has a great part in this. But the italic correction only explains the spacing after the f
, not before. For this you have to look at the bounding boxes of the letters:
The first f
is a text italic letter in its bounding box, the second one is math italic (in its bounding box together with its italic correction). As you can see, the text letter protrudes a bit to the left (and a lot to the right); the math letter has a tiny bit of white space in the left (and also in the right, because of the italic correction). For a bit more about the bounding boxes see this question of mine (another shameless plug :-)
).
I first noticed the problem when typing $Vf$
, which doesn't yield a nice output. My resort is using $V\hspace{-0.1em}f$
instead (in a macro, of course), which I like much better. You could even use $V\!f$
, but this I find too narrow. Compare these three:
I would not encourage you to follow Caramdir's (now removed) suggestion to use $\mathit{Vf}$
since this uses a different font (text italic, not math italic). You can see quite clearly that the V
is narrower (in other words, the angle at the bottom of the V
is more acute):
If you use a different math font (like Euler), then the difference is even more noticeable.
(For a case where \textit
could be a good solution, see this answer of TH.)
If you want to add a space in an expandable way, which is required for \write18
system calls you can do so using the \space
macro which is defined like \newcommand*{\space}{ }
(actually \def\space{ }
) and therefore expands to a single space.
So you can write your command string like:
bash -c "\myCommand\space -Tpdf #2.dot > #2.pdf"
The explicit space is required because spaces after a macro are removed, because they are taken as separator between the macro name and the text afterwards.
The usual way to add {}
after it would preserve the space behind it, but this is only good for typesetting the text where the braces are ignored. If you want the text in an expandable context, like to write it into an external (auxiliary) file, to the shell (like in this case) or build a macro name from it (advanced topic), then the {}
are unwanted and usually cause trouble.
Best Answer
To avoid this spacing you could define a symbol using
\sym
but as an ordinary math symbol instead of a relation symbol, such as