I type in English but I need the following few Latvian letters.
Minimal case
\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
diņš
\end{document}
which gives di only.
How can you have those Latvian letters?
I type in English but I need the following few Latvian letters.
Minimal case
\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
diņš
\end{document}
which gives di only.
How can you have those Latvian letters?
The letter š is supported by the T1 encoding and you should load
\usepackage[T1]{fontenc}
anyway. The “n with cedilla” is not supported by the fonts, so it must be composed. With newunicodechar it's pretty easy:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\newunicodechar{Ņ}{\c{N}}
\newunicodechar{ņ}{\c{n}}
\begin{document}
diņš DIŅŠ
\end{document}
However you might prefer a comma below, instead of a cedilla.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\makeatletter
\ProvideTextCommandDefault\textlatviancommabelow[1]
{\hmode@bgroup\ooalign{\null#1\crcr\hidewidth
\raise-.15ex\hbox{\check@mathfonts
\fontsize\ssf@size\z@
\math@fontsfalse\selectfont,}\hidewidth}\egroup}
\makeatother
\newunicodechar{Ņ}{\textlatviancommabelow{N}}
\newunicodechar{ņ}{\textlatviancommabelow{n}}
\begin{document}
diņš DIŅŠ
\end{document}

With some more work you can make the composite character copyable (provided the PDF viewer supports the feature; Adobe Reader does); the following is similar to my answer to Unable to search word with Romanian characters in output pdf
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{accsupp}
\usepackage{newunicodechar}
\makeatletter
\ProvideTextCommandDefault\textlatviancommabelow[1]
{\hmode@bgroup\ooalign{\null#1\crcr\hidewidth
\raise-.15ex\hbox{\check@mathfonts
\fontsize\ssf@size\z@
\math@fontsfalse\selectfont,}\hidewidth}\egroup}
\makeatother
\newunicodechar{Ņ}{%
\BeginAccSupp{method=hex,unicode,ActualText=0145}%
\textlatviancommabelow{N}%
\EndAccSupp{}%
}
\newunicodechar{ņ}{%
\BeginAccSupp{method=hex,unicode,ActualText=0146}%
\textlatviancommabelow{n}%
\EndAccSupp{}%
}
\begin{document}
diņš DIŅŠ
\end{document}
UTF-8 input is fine, you just need to tell tex what to do with that character:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{0146}{\c{n}}
\begin{document}
diņš
\end{document}
If you can use XeLaTeX or LuaLaTeX, I would like to welcome you to current century:
\documentclass{article}
\usepackage{polyglossia} % also loads package fontspec
\setmainfont{Minion Pro} % or whatever OTF you have on your system
\setmainlanguage{latvian} % loads language hyphenation rules and such
\usepackage{unicode-math} % if you also need maths
\setmathfont{Cambria Math} % or whatever math OTF you have on your system
\begin{document}
diņš
\end{document}
(and save your files in utf8)
pdflatex this is nothing you can make profit of. If you can use XeLaTeX or LuaLaTeX, of course you get the “real” glyph.
– egreg
Nov 22 '14 at 15:52
\usepackage[utf8]{inputenc} would assume PDFLaTeX because you wouldn't use it with (Lua/Xe)LaTeX. Although, to know that already requires some amount of expertise. I think it would be helpful to draw some kind of diagram regarding different engine choices and link it to our help pages.
– morbusg
Nov 29 '14 at 09:09
It's the older version: utf8x, but this works with pdflatex
\documentclass{article}
\usepackage[T1]{fontenc}%
\usepackage[utf8x]{inputenc}
\begin{document}
diņš
\end{document}

europecvclass arbitrarily decided thatutf8is not a good option and usesutf8xeven if the passed option isutf8, which is of course stupid. I'll try finding a workaround, but it's better to make a new question. – egreg Dec 15 '14 at 14:03europecvthat usingutf8is *good*. A new question is surely necessary: other people might incur in the same problem. – egreg Dec 15 '14 at 14:31