π (pi) – Do not enter directly - compiler hangs. Is this a bug?
It is a question of whether your text font has such a character. If you look in the log file you will find
Missing character: There is no π (U+03C0) in font [lmroman12-regular]:+tlig;!
In your case pi represents a mathematical entity and in normal text with unicode input you can use
This is $π$.
if you load the package unicode-math
.
The siunitx
package provides a direct interpretation of \pi
in numbers so you can write
\SI{\pi/2}{\radian}
If you insert the pi character, even with unicode-math
it will complain with
! Invalid token 'π' in numerical input.
in the log file.
TeX only loops if you respond to the error message
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! siunitx error: "invalid-token-in-number"
!
! Invalid token 'π' in numerical input.
!
! See the siunitx documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.7 \SI{π/2}{\radian}
%Here latex hangs up
?
with a return and then do the same again on the following error. (Or equivalently if you choose to run in scrollmode automatically ignoring all errors)
If you do carry on it eventually will end up expanding \q_no_value
which expands to itself and tex then loops. (You should never reach such a "quark" in an error free document, but after an error more or less any behaviour is possible).
This typesets pi and gives an error message when using \SI. SI does not recognize pi as the number 3.14159....
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\setmainfont{DejaVu Serif}
\usepackage{siunitx} %Einheiten
\begin{document}
This is π.
\SI{π/2}{\radian} %Here latex hangs up
\end{document}