0

I am trying to type these accented characters directly, without trying to use the built-in LaTeX commands: ā,ē,ō,ū,ą,ę,ǫ,ų,ṅ,ṡ,ċ,ż and their uppercase equivalents.

The code compiles alright, when I try to use the following commands:

\k{} % for ogonek
\.{} % for the overdot
\={} % for the macron

However, when I try directly typing the characters, the file compiles but does not show the accented characters. Instead the following message is displayed:

Package inputenc Error: inputenc is not designed for xetex or luatex. >\endinput
Font shape `T3/ptm/m/it' in size <10> not available(Font)
Font shape `T3/ptm/m/sl' tried instead

I am using XeLaTeX as my compiler. Below is the preamble:

\documentclass[10pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1,OT2]{fontenc}
4
  • xelatex assumes that the input is always utf8. So the inputenc package should not be used with xelatex
    – daleif
    Commented Jul 11, 2019 at 13:41
  • Is it possible to change my code to be able to type the characters directly? Commented Jul 11, 2019 at 13:43
  • Just write them (remove those two packages). Make sure the saved text is UTF8 encoded.
    – daleif
    Commented Jul 11, 2019 at 13:44
  • remove \usepackage[utf8]{inputenc}\usepackage[T1,OT2]{fontenc} neither package should be used with xetex, accented characters should work automatically if they are in the font. Commented Jul 11, 2019 at 15:37

1 Answer 1

3

XeLaTeX already assumes the input is UTF8, so you should not load inputenc or fontenc under xelatex.

\documentclass[10pt]{book}
\begin{document}
I am trying to type these accented characters directly without trying to use
the built-in LaTeX commands: ā,ē,ō,ū,ą,ę,ǫ,ų,ṅ,ṡ,ċ,ż and their uppercase equivalents.
\end{document}

The above example compiles just fine under XeLaTeX.

4
  • This works but then the font reverts to the default if I remove fontenc. Is there a different way to load fonts in xelatex? Commented Jul 11, 2019 at 13:50
  • Under pdflatex fontenc does not have much to do with the choice of font. It specifies that non ascii chars are real chars to be found in the font. You might want to look at the fontspec package, but for that you should do some research and perhaps post another question.
    – daleif
    Commented Jul 11, 2019 at 13:52
  • Thanks, that explains it! Commented Jul 11, 2019 at 13:54
  • 3
    For fonts and xelatex, use the fontspec package.
    – crmdgn
    Commented Jul 11, 2019 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .