LuaLaTeX: german special character ß with newpxtext

I use the font Palatino from the package newpxtext in combination with LuaLaTeX. With this package it is not possible to set the german special character ß directly:

% Magic comments for TeXstudio
% !TeX spellcheck = de_DE
% !TeX program = lualatex

\documentclass{scrartcl}

%\usepackage{fontspec}
% Font: Palatino
\usepackage{newpxtext}

\begin{document}

Draußen währt am längsten.

Drau\ss en währt am längsten.

\end{document}


The result from the MWE is: DrauSSen währt am längsten.. It works when I switch to fontspec.

How is it possible to use the sign ß instead of \ss to set a text?

• it makes no sense to use an Type 1 font and LuaTeX when there is a similar OpenType font like TeXGyre Pagella. See Ulrikes answer! – user2478 Feb 4 '14 at 13:33
• Thanks, I did not know this difference. Now I know why fontspec does not work well with newpxtext package. – Dirk Feb 4 '14 at 13:55
• use the Pagella font, then there is no need for newpx. – user2478 Feb 4 '14 at 13:57
• – Reinstate Monica - M. Schröder Feb 5 '14 at 9:40

You can make the ß active and define it:

\documentclass{scrartcl}
\usepackage{newpxtext}
\catcode\ß=13
\defß{\ss}
\begin{document}

Draußen währt am längsten.

Drau\ss en währt am längsten.

\end{document}


That's more or less what luainputenc does. But it is much better to use fontspec instead:

\documentclass{scrartcl}

\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella} %palatino clone

\begin{document}
Draußen währt am längsten.
\end{document}

• Thanks for your answer! I modify my document with respect to your suggestions. What do you think, which sansserif-font fits best to Palatino? Helvetia (tex-gyre-heros), as in newpxtext? – Dirk Feb 4 '14 at 13:37
• And another question rises: Is it correct to use \usepackage[euler-digits]{eulervm}? Or do I have to use \setmathfont{} instead? If yes, which font contains the euler font? Thanks! – Dirk Feb 4 '14 at 13:52
• @Dirk: Palatino Sans. – Reinstate Monica - M. Schröder Feb 5 '14 at 9:39
• @Martin Wie lade ich Palatino Sans? Ein \setsansfont{Palatino Sans} gibt mir eine Fehlermeldung. – Dirk Feb 5 '14 at 15:25
• @Dirk: You mean which free sans is a good fit? What is a good font for URLs to go with Palatino for the main text? – Reinstate Monica - M. Schröder Feb 5 '14 at 15:38

Which input encoding are you using? If you don't use fontspec, whatever the input encoding is you must indicate it to LuaLaTeX. E.g. if your editor is configured with utf8-unicode, you must insert the line

\usepackage[utf8]{luainputenc}


in the preamble of your program. In that case your file works perfectly for me.

• Thanks for your hint to luainputenc. I always use utf8. However, I thougth one has to use utf8 with LuaLaTeX. That is the reason I did not mentioned it. – Dirk Feb 4 '14 at 13:44
• You only have to enter your code in utf8 if the fontspec package is loaded (which is recommanded). Otherwise you may use any encoding you wish, you only have to specify it to LuaLaTeX via the luainputenc`package. That's the way to go if you want to import old 8-bits-encoded documents to LuaLaTeX. – Franck Pastor Feb 4 '14 at 14:30