# Pi, Kappa, Latin Small Letter Long S: problems with UTF8

I'm using Springers svmono for a book with many mathematical symbols and special characters.

There are quite a few problems with characters that are simply not printed (using pdfLatex), so I tried to add utf8 support:

\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}


However, there are errors. This is a MWE (svmono.cls needed to make it run):


%%%%%%%%%%%%%%%%%%%% book.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% sample root file for the chapters of your "monograph"
%
% Use this file as a template for your own input.
%
%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%%

% RE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[graybox,envcountchap,sectrefs]{svmono}

% choose options for [] as required from the list
% in the Reference Guide

\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}

\begin{verbatim}
# sin(π * t)
\end{verbatim}

Kudos (κῦδος)

\end{document}




Using utf8x I get:


ERROR: Undefined control sequence.

--- TeX said ---
\u-default-954 #1->\textkappa




Using utf8 I get:


ERROR: Package inputenc Error: Unicode char \u8:π not set up for use with LaTeX.



And I need characters more exotic than pi or kappa - like latin small letter long s e.g.

-
There's little hope to get different sets of characters in this way: LaTeX fonts have only 256 characters. –  egreg Aug 26 '12 at 20:48
And couldn't you use \pi  instead of π, and similarly for the other symbols? You can do a Find&Replace in any good text editor. –  yo' Aug 26 '12 at 21:06
@tohecz yes, but \pi doesn't work in verbatim environments, and there are quite a lot a rare characters for which I don't know the macro name (e.g. latin small letter long s). –  user17106 Aug 26 '12 at 21:22
@user17106 Couldn't you use some "cleverer" environment than verbatim? E.g. alltt or listings? (Disclaimer: I don't say that verbatim is wrong, but it simply does not interpret anything, and allowing the commands to be interpreted is one of the ways IMHO.) –  yo' Aug 27 '12 at 6:05
@MartinSchröder Did you try it out before flaming? I was surprised how poorly LuaLaTeX handles this example. The main problem is that lmodern does not contain upright Greek characters or the long s. In any case, tex.stackexchange.com/questions/65141/… might help to point you in the right direction since I agree that without LuaLaTeX you're pretty sure to be screwed. As for verbatim unicode ... boy, good luck with that. –  Christian Sep 6 '12 at 23:46

The long s (ſ) is accessible through the TS1 fontencoding.
Depending on the frequency you need it in your text, you can use it

• with the \longs command or
• the "s command.

For written Greek text I'd use the babel package.
For Greek text in verbatim mode you can use the alltt package and either the babel package again or (for single letters) the textgreek package.
Edit: I just read that you use a customized wideverbatim environment. Can you provide a definition? I coudn't find one.

I have troubles with the Greek font encoding LGR.
Someone with a better understanding of font encoding might improve this answer.

\documentclass[graybox,envcountchap,sectrefs]{svmono}

\usepackage[LGR,TS1,T1]{fontenc}
\usepackage[utf8x]{inputenc}

\usepackage{lmodern}
\usepackage[polutonikogreek,english]{babel}
\usepackage{textgreek}
\usepackage{alltt}

\def\longs{{\fontencoding{TS1}\selectfont s}}
\def\greek#1{{\selectlanguage{greek}\fontencoding{LGR}\selectfont #1}}

\catcode\"=\active%
\def"s{{\fontencoding{TS1}\selectfont s}}
\def\noLongS{\catcode\"=12}

\begin{document}

\begin{alltt}
# sin(\textpi * t)
# sin(\greek{p} * t)
\end{alltt}

\noindent Kudos ({\greek{k~udos}) % κῦδος
\\
long s: Wach\longs tube\\
long s: Wach"stube\\
{\noLongS%
not a long s: Wach"stube}
\end{document}

-
Thanks, that solves the problem. –  user17106 Sep 8 '12 at 10:27

I was able to compile properly your MWE (although simplified a bit) using the textalpha package instead of textgreek. Here is how :

\documentclass{article}
\usepackage[utf8x]{inputenc} % Note : option utf8 works also
\usepackage[T1]{fontenc}
\usepackage{textalpha}

\begin{document}
\begin{verbatim}
# sin(π * t)
\end{verbatim}
Kudos (κῦδος)
\end{document}


So I obtain the following result :

(Added:) Please note that the textalpha package seems to give better results than the textgreek one.

-
Sorry, I only had one bounty and one 'answered' choice, but after downloading two packages I could make your solution work too, and its to simple. Thanks. –  user17106 Sep 8 '12 at 10:29