Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

space after tilde

433 views
Skip to first unread message

avilella

unread,
Jun 19, 2008, 6:38:17 AM6/19/08
to
Hi,

When using the tilde command \ensuremath{\sim} followed by a number, a
space is left between
the symbol and the number, that makes it look a bit weird. For
example:

The genome size varies from $\ensuremath{\sim}100~Mb$ to $
\ensuremath{\sim}200~Mb$ ...

there will be too much space between ~ and 100. Is that normal?

The only hack I found to get rid of it is this:

The genome size varies from $\ensuremath{\sim}$$100~Mb$ to $
\ensuremath{\sim}$$200~Mb$ ...

Any other more elegant alternative?

José Carlos Santos

unread,
Jun 19, 2008, 7:32:29 AM6/19/08
to

Why are you using the \ensure math command with a math environment?

Anyway, yes, there is a more elegant way: ${\sim}100$.

Best regards,

Jose Carlos Santos

Dan

unread,
Jun 19, 2008, 3:17:25 PM6/19/08
to
On Jun 19, 5:38 am, avilella <avile...@gmail.com> wrote:
> Hi,
>
> When using the tilde command \ensuremath{\sim} followed by a number, a
> space is left between
> the symbol and the number, that makes it look a bit weird. For
> example:
>
> The genome size varies from $\ensuremath{\sim}100~Mb$ to $
> \ensuremath{\sim}200~Mb$ ...

First of all, the subject should probably not say "tilde".
There is a math accent command \tilde, and a \textasciitilde
command, neither of which is related ti \sim.

Secondly, \sim is a math relation (its name is intended to
invoke "is similar to"). That is why there is extra space: it
is the same as the space around other relations such as
"=" and "\le".

What you want could be described as the unary operator
approximately". Other examples of unary operators are
the unary minus (e.g., $-2$) and the logical negation
($\neg P$). TeX treats such things as "ordinary" symbols,
for which no space is added. The command \mathord{...}
Turns any expression into an ordinary symbol. Thus you
could use
$\mathord{\sim}200\,$Mb.
It turns out that simple braces also turn any expression
into an ordinary symbol, so:
${\sim}200\,$Mb.

You might want to check out some packages that deal
with units (in particular the spacing between a number
and its unit). I think that "200~Mb" is far too large, but
some think "\," would be too small. Such packages
include hepunits, siunits, sistyle, siunitx, units, unitsdef
and possibly numprint. It is even possibly some can deal
automatically with an "approximately" symbol.


Dan

0 new messages