7

Using lualatex and the code example I can compile the code without any errors, but pi doesn't show up. This part of UTF-8 is not yet covered, or does this have a other reason?

I used in \SI environment with lualatex, xelatex and pdflatex. All compiler just hang with 100 percent usage of thread. Without errors.

It took me a bit to discover my fault, that's why I wanted to report it. Just use \pi. I also do not know where to post a BugReport (compiler / siunitx) Perhaps somebody could explain why this happens? The symbol GREEK SMALL LETTER PI (U+03C0) is just not supported?

 \documentclass[12pt,a4paper]{article}
%\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\usepackage{siunitx} %Einheiten
\begin{document}
    This is π. 
%   \SI{π/2}{\radian} %Here latex hangs up
\end{document}
  • It seems so. For me it doesn't print anything too. – TeXnician Feb 16 '17 at 16:47
  • 1
    The standard font is Latin Modern, which doesn't support Greek. OpenType/TrueType fonts are not required to support every bit of Unicode. – egreg Feb 16 '17 at 17:04
  • Tex does not hang with no error (which would be bad) it stops with an error twice and only if you tell it to ignore the error and carry on does it eventually find itself in a loop. – David Carlisle Feb 16 '17 at 17:23
12

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.

  • You are right. The logs are perfect in the MWE. I'm pretty sure I looked at the logs of my big project and they were blank. But I can't test it right now so I won't wager my boots on it. – TimK Feb 17 '17 at 15:48
6

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).

5

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}

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.