TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

Writing fractions using different syntax would sometimes be useful, instead of using \frac{ab}{cd}, I would prefer to write something like \frac{ab⌂cd} where the Unicode is the }{.

n.b., I don't want to mess with the \frac definition, but rather something like \newcommand{\myfrac}[2]{#1⌂#2}

Approach-My understanding of TeX is limited, but I think I can use catcode to do this, My understanding is that:

  • \catcode `@=2 is equivalent to }
  • \catcode `@=1 is equivalent to {

However just writing

\def ⌂{ \catcode `@=2 \catcode `@=1 }
share|improve this question
You can do simpler: \def\myfrac#1⌂#2{\frac{#1}{#2}}. – Eddy_Em Jan 23 '13 at 7:05
@Eddy_Em: But then you would still need to introduce grouping braces like \myfrac25⌂{36} because \myfrac25⌂36 would be displayed as (25/3)6. – canaaerus Jan 23 '13 at 7:12
I add an answer, but be careful in choosing of last symbol (apostrophe in this case): it shouldn't be in argument of \myfrac. – Eddy_Em Jan 23 '13 at 7:16
Maybe something like: \catcode`⌂=13 \let⌂\over $ {1⌂2} $ \bye? – morbusg Jan 23 '13 at 8:11
up vote 7 down vote accepted

I have koi8-r locale & don't work with unicode, so instead of I'll use |:

First define a command:


Then use it:

example: $\myfrac{10|20}$
share|improve this answer
Thanks, this works perfectly! However, I am wondering if there is a way to do this along the lines I specified..it would be nice to know my way around catcode – georg Jan 23 '13 at 7:19
@georgraba Catcodes have nothing to do with this: see tex.stackexchange.com/questions/16410/what-are-category-codes for a starter on them. – Joseph Wright Jan 23 '13 at 7:21

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.