In the last month, the way I typeset math has changed dramatically. It’s a result of a combination of several tools that I’ve discovered.
The first is XCompose. If you’re on a Unixy OS (Linux/Mac/etc) you can easily typeset in unicode using XCompose. You set a key to be your XCompose key (for me it is Caps Lock) and then you can hit it and enter a series of symbols that map to a unicode character; you choose the codes that map to characters with the file ~/.XCompose. It’s a little bit like how backslash works in LaTeX, but at the input level.
Using this awesome XCompose file you get nice things like the following:
- <compose> * a → α
- <compose> * b → β
- <compose> | R → ℝ
- <compose> | Q → ℚ
- <compose> ^ 1 → ¹
- <compose> ^ 2 → ²
- <compose> _ 1 → ₁
- <compose> _ 2 → ₂
- <compose> i n → ∈
- <compose> n i → ∋
- <compose> & i n t → ∫
- <compose> & o i i n t → ∯
As you can see, it’s inspired by LaTeX. If you know LaTeX, you’ll pick it up very fast.
By itself, XCompose is great as a solution to typing math online. If you want to type into a tweet or a reddit post, its perfect.
(Other options exist: Unicodedeit (Mac/Linux) allows one to highlight LaTeX and it will convert it into unicode. It has an online version that is cross platform. Windows has built in solutions, but they require memorizing unicode codes.)
Then a natural question arises: can LaTeX accept unicode? And the answer is that theres a package for that. In particular, a lot of unicode support can be gained with the following:
\usepackage[utf8x]{inputenc}
\usepackage{amssymb}
Awesome. It isn’t perfect though. $α$ will cause errors because it maps α to \textalpha. Blackboard causes problems because it maps to \mathbbm rather than \mathbb. There’s also some characters like ⅓ that it doesn’t support. We can fix that though:
\let\textalpha=\alpha
\let\mathbbm=\mathbb
\DeclareUnicodeCharacter{8531}{\frac{1}{3}}
This allows for much simpler LaTeX. Compare
\item Suppose not. Then $(∃S, μ(S)=ε>0)(∃δ>0)(∀x∈S)(∀n∈ℕ)(f_n(x)>δ)$. Then it must be the case that $∫f_n>εδ$. Then $∫f_n \not → 0$.
with
\item Suppose not. Then $(\exists S, \mu(S)=\epsilon>0)(\exists \delta>0)(\forall x \in S)(\forall n∈\mathbb{N})(f_n(x)>\delta)$. Then it must be the case that $\int f_n> \epsilon \delta$. Then $\int f_n \not \to 0$.
One of them is much easier to read.
Tags: math, typesetting, unicode
April 12, 2011 at 07:38 |
You can use something like XCompose on Windows, too.
http://sourceforge.net/projects/allchars/
June 24, 2011 at 07:07 |
I wrote another web-based tool like unicodeit.net recently: http://vikhyat.net/stuff/latex_to_unicode/
January 20, 2012 at 17:38 |
For unicode support in math mode, have a look at unicode-math: https://github.com/wspr/unicode-math (works only with LuaTeX and XeTeX though). This saves you from redefining \textalpha et al.