6

I wish to use ~ which has latex symbol: \sim for the negation sign in logic. \sim and \neg are the two most frequent symbols for negation in logic.

However, I get a strange looking result if I use \sim. The spacing with the variables is odd as the \sim is further from the variable. Compare the alternative using \neg and you will see what I mean.

  1. How can I fix the spacing/alignment?
  2. How can I show the results of my LateX code on SE?

Thanks in advance!

  • For showing a typeset result, make a PNG image of it (I use the screen snapshot feature of my OS) and upload it by clicking on the small window icon on top of the editing window. – egreg Aug 25 '13 at 9:19
7

\sim is a relational symbol (like =), the spacing around is quite large (\thickmuskip). In LaTeX it is defined as:

\DeclareMathSymbol{\sim}{\mathrel}{symbols}{"18}

\neg is a \mathord and is defined as:

\DeclareMathSymbol{\neg}{\mathord}{symbols}{"3A}

Thus you can define a \lsim as \mathord:

\DeclareMathSymbol{\lsim}{\mathord}{symbols}{"18}

Or \lsim can be defined using \sim:

\newcommand*{\lsim}{\mathord{\sim}}
  • How would I learn about something like this on my own? Note that I use emacs and there could possibly be documentation or autocompletion available? – CodeKingPlusPlus Aug 25 '13 at 1:12
  • 3
    @CodeKingPlusPlus: "The TeXbook" by Donald E. Knuth, "Chapter 18: Fine Points of Mathematics Typing". Or "TeX by Topic" by Victor Eijkhout, "Chapter 23: Mathematics Typesetting". – Heiko Oberdiek Aug 25 '13 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.