TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use inference from semantic package to describe static semantics of a language.

I would like to separate nonterminals in inference rules with spaces without inserting them by hand.

Is there a way to automatically separate the words SimpleExpr_1 RelOper SimpleExpr_2 from following code with spaces, as if it was written as SimpleExpr_1\ RelOper\ SimpleExpr_2 ?

  {\Gamma \vdash Expr_1 : \textsc{Integer} \quad 
   \Gamma \vdash Expr_2 : \textsc{Integer}}
  {\Gamma \vdash SimpleExpr_1 RelOper SimpleExpr_2 : \textsc{Boolean}}

Edit: I should add, that I tried solution presented here: Making mathmode obey spaces , but for reasons unknown to me it doesn't seem to apply to inference. Any ideas?

share|improve this question
up vote 3 down vote accepted

I see you are already using \quad, the other spacing command in math mode are:

\, thin space

\: medium space

\; thicker space

\quad thicker

\qquad and thicker

\! negative thin space

share|improve this answer

One way is to redefine \predicatebegin to define spaces in math mode as not ignored. A subtle point, though, is that the tokens have already been read, so spaces already have catcode 10. This can be reverted using \scantokens. I thought it would be best to only scan tokens from |- to :, but this can easily be changed.


\begingroup\catcode`\ =\active%
\gdef\mathobeyspaces{\catcode`\ =\active\let =\ }%

  {$#1|-\mathobeyspaces \scantokens{#2}:#3$}%

  {\Gamma |-Expr_1:\textsc{Integer} \quad 
   \Gamma |-Expr_2: \textsc{Integer}}
  {\Gamma |-SimpleExpr_1 RelOper SimpleExpr_2: \textsc{Boolean}}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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