Take the 2-minute tour ×
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.

In some cases it is common to use the same symbol to refer to a mathematical relation and to instances of the relation. For example, > as the relation of being greater than and x>y for the instance saying that x is greater than y.

You can manipulate relations for example

>' = > \cup \{(x,y)\}

Normally, TeX automatically adds (the right) amount of space around math relations and binary operators. However, the spacing must be adjusted manually in scenarios like the example above, for example:

{>'} = {>} \cup \{(x,y)\}
\mathord{>}' = \mathord{>} \cup \{(x,y)\}

I wonder if there are ways to handle situations like the one above automatically (beside the solutions above or defining commands for the relations, e.g., \newcommand{\greater}{\mathord{>}}, and then

\greater' = \greater \cup \{(x,y)\}
share|improve this question
The only way would be to make the leading character active so as to gauge the following input and construct a symbol accordingly. Just my opinion. –  Werner Sep 19 '12 at 2:54

1 Answer 1

up vote 3 down vote accepted

I can think to $<\subset\le$, where the fact that \le is not to be considered a relation symbol depends on what comes before. So you'd need to define a parser for your expressions, which is not something I would do.

I suggest you to prefix a relation symbol when it's to be considered an ordinary one:


\AtBeginDocument{\mathcode``=\string"8000 }

$`>' = `> \cup \{(x,y)\}$

${>'} = {>} \cup \{(x,y)\}$ % for checking the result

The character ` is free of meaning in formulas (and it's handy to produce on my keyboard); you can also use ?.

enter image description here

Alternatively, you can decide to quote the symbol; again, I'm used to it because of this site:


\AtBeginDocument{\mathcode``=\string"8000 }

$`>'` = `>` \cup \{(x,y)\}$

${>'} = {>} \cup \{(x,y)\}$ % for checking the result

What's in between back quotes is considered an ordinary symbol. This might be more semantically sound, take your pick.

share|improve this answer
Not exactly what I was after, still need to manually signal that a symbol has to be treated differently from its "normal" beahviour. The second one is a nice technical solution, but I would prefer to use {} instead of `. –  Guido Sep 23 '12 at 21:53
As I said, parsing those expressions is not very easy; at least that's my feeling. Without a proper parsing rule, it's very difficult to provide a solution that doesn't rely on additional markup. And writing a proper parser, even if the rules are clearly laid out, might reveal quite difficult. –  egreg Sep 23 '12 at 22:02

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.