8

Why doesn't my XeLaTeX document turn this word into italics? I simply can't figure it out.

\documentclass[12pt,letterpaper]{article}
\usepackage{ifpdf}
\usepackage{mla}
\usepackage[T2A]{fontenc}
\usepackage{setspace}
\usepackage[utf8]{inputenc}
\singlespacing
\usepackage{endnotes}
\usepackage{hyperref}
\begin{document}
\emph{hi}
\end{document}
Andrew Swann
  • 95,762

2 Answers2

11

Let's see why it doesn't work.

The mla package says \usepackage{times} (which is not recommended), so that the default font family is, in LaTeX jargon, ptm, which corresponds to Times.

However, the Times font family that's chosen in this way has no version for the T2A encoding (that is, for Cyrillic), so when you typeset your document you get

LaTeX Font Warning: Font shape `T2A/ptm/m/n' undefined
(Font)              using `T2A/cmr/m/n' instead on input line 10.

Since no font in the T2A (Cyrillic) encoding is defined for the ptm family, LaTeX switches to the default. This happens at \begin{document}. Later, when\emph` is found, the following message is issued

LaTeX Font Warning: Font shape `T2A/ptm/m/it' undefined
(Font)              using `T2A/ptm/m/n' instead on input line 11.

and the reason is just the same: no T2A encoded italic font exists in the T2A family. Since T2A/ptm/m/n has already been defined as an alias for T2A/cmr/m/n, you get upright shape.

If you want to use the standard Computer Modern fonts for your document, just say, after \usepackage{mla},

\renewcommand{\sfdefault}{cmss}
\renewcommand{\rmdefault}{cmr}
\renewcommand{\ttdefault}{cmtt}

and don't use XeLaTeX. With pdflatex you must remember to add

\usepackage[utf8]{inputenc}

if you want to input cyrillic characters directly (or use another input encoding for cyrillic).

With XeLaTeX you don't load fontenc and inputenc. And you have to use fontspec to choose a system font with cyrillic glyphs coverage.

Update

There is nowadays a Times-like font that supports Cyrillic encodings, in particular T2A, also for pdflatex. The package is called tempora.

\documentclass[12pt,letterpaper]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{ifpdf}
\usepackage{mla}
\usepackage{tempora} % override \usepackage{times} of mla

\usepackage{setspace}
\usepackage{endnotes}
\usepackage{hyperref}

\singlespacing

\begin{document}
\emph{hi}
\end{document}
egreg
  • 1,121,712
  • Where do you see a reference to “cyrillic” in the question? It is about italics. – PointedEars Jan 20 '17 at 19:17
  • @PointedEars \usepackage[T2A]{fontenc} seems pretty clear, doesn't it? What do you think is the T2A encoding for? – egreg Jan 20 '17 at 20:33
  • @PointedEars You're free to downvote, if you deem so. But, please, read the whole answer before doing it. Do you think the diagnosis depends on the “cyrillic question”? It's about encodings, missing fonts and font substitutions. – egreg Jan 20 '17 at 20:39
  • I did not realize that T2A was a reference to Cyrillic. Unfortunately impossible to remove the downvote before the next edit. Perhaps you should make that part more clear, because I am not using Cyrillic and I have the same problem with XeTeX and LuaTeX, never had it with pdfLaTeX. Will RTFM. – PointedEars Jan 21 '17 at 14:43
  • @PointedEars Maybe now it's clearer. I also added an update about using Tempora instead of Times. – egreg Jan 21 '17 at 14:50
8

You should never load the inputenc package with XeTeX or LuaTeX. You should also not likely be loading the fontenc package unless you know what you're doing. Use the fontspec package instead. See Using XeLaTeX instead of pdfLaTeX for more details.

Alan Munn
  • 218,180