From what I understand modern latex programs should be able to render unicode characters without any issue. However, the following MWE renders the ±
(ord 177 PLUS-MINUS SIGN) character as the ś
chracter (ord 347: LATIN SMALL LETTER S WITH ACUTE).
\documentclass{article}%
\usepackage[T1]{fontenc}%
\usepackage[utf8]{inputenc}%
\usepackage{lmodern}%
\usepackage{textcomp}%
\usepackage{parskip}%
%
\usepackage{graphicx}%
%
\begin{document}%
\pagestyle{empty}%
\normalsize%
13.787±0.020%
\end{document}
Running the command:
lualatex --interaction=nonstopmode document.tex
The PDF renders as:
I've also tried:
latexmk --pdf --interaction=nonstopmode document.tex
and
xelatex --interaction=nonstopmode document.tex
And I'ved tried changing \usepackage[utf8]{inputenc}
to \usepackage[utf8x]{inputenc}
.
The result is the same. Any idea what I'm doing wrong?
For my use-case I'm auto generating a document with pylatex
, so it's not as simple as replace the unicode character with \textpm{}
. I really do want to be able to render unicode character as-is.
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020/Debian)
. Do you have a newer version? The textcomp and inputenc are coming from pylatex, but that's good to know. I did try manually without them and I got the same result. Marjin's answer works for me though.