I'm using the unicode-math package in comination with xelatex. Thanks to this package I can write unicode symbols in the tex code. However some unicode symbols, don't compile the way I would expect it. For example, I hoped that if type $√{2+3}$ that this would compile the same way as $\sqrt{2+3}$. But I get this output:

enter image description here

What is happening here, and how can I fix this ?

Edit: I understand now that I can fix this using:


Now I'm wondering how I could define something like:


  • There is a difference between the character and a square root layout just as there is a difference between / and a fraction. The odd position is because TeX traditionally uses the height of character to specify the width of the rule, so it has small height and large depth. You could of course define √ to be an active character defined as \sqrt but that is not the default. – David Carlisle Nov 7 '13 at 9:26
  • @DavidCarlisle Ah, I found it. So I need to do: \usepackage{unicode-math,newunicodechar} \newunicodechar{√}{\sqrt} – Kasper Nov 7 '13 at 9:32

As you already figured out, by default is just printed as a usual symbol and not a mathematical object. Thus you must define it



Now you want to put the argument in between an equation environment. To do that you need to define an auxiliary macro which does that for you:


But there are more options. You can also make the character \active manually and use it as command name


Or you can mark the end of the equation by another character


To do this with newunicodechar you need to define


This has the possible problem, that when \begin{equation} is expanded, it can not see \end{equation} but only . Although it seems to work in my examples:


█{√{a^2 + b^2} = c}

▒{a + b ≥ c}

▙e^{iπ} + 1 = 0▜

▛f(z) = \frac{1}{2πi}∫_{∂B_ε(z)}{\frac{f(ζ)}{ζ-z}\;\mathrm{d}ζ}▟

  • 1
    \begin{equation} doesn't look up to find the matching \end{equation}, so this works (but I wouldn't recommend doing so). It won't work for align and the other multiline environments. In (Xe|Lua)LaTeX, \newunicodechar just makes the character active and defines it to what the second argument specifies. The definition is \protected, but not \long (which is irrelevant for a command with no argument). – egreg Feb 27 '14 at 13:43
  • With \newunicodechar no argument can be specified; but one can say \newcommand{\myeq}[1]{\begin{equation}#1\end{equation} and \newunicodechar{█}{\myeq}. Again, I wouldn't recommend doing so. – egreg Feb 27 '14 at 13:45
  • @egreg: Thanks for the details. The second comment is exactly what I wrote as the first suggestion ;-) – bodo Feb 27 '14 at 13:47
  • I should pay more attention. ;-) – egreg Feb 27 '14 at 13:55

as active character:

\setmathfont{XITS Math}


\catcode`\√=13 \let√\sqrt

enter image description here

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.