1

I'm newbie in XeLaTeX and have to adopt already typeset (in LaTeX) textbook with the Computer Modern Roman mainfont. So I want to have slanted text, while the compiler with default introduction (taken somewhere)

\usepackage[T2A]{fontenc}
\usepackage[russian]{babel}
\usepackage{fontspec} 
\defaultfontfeatures{Ligatures={TeX},Renderer=Basic}
\setmainfont{CMU Serif Roman}
\setsansfont{CMU Sans Serif}  
\setmonofont{CMU Typewriter Text}

(and latex-preserved commands \textsl{} and \slshapr for the usage) writes that slanted text is replaced by the simple italic.

I tried in two ways: (I) load the font cmunsl.otf as overall-windows-installed and tried to use it as independent new font:

\font\wslant="CMU Serif Extra RomanSlanted" at 12pt

(II) In the fontspec documentation (p.11) I found that the slanted font can be added as an option to the \setmainfont; I tried (a)

\setmainfont[SlantedFont = CMU Serif Extra RomanSlanted]{CMU Serif Roman}

and (b)

\setmainfont[SlantedFont = cmunsl.otf]{CMU Serif Roman}
(this OTF-file cmunsl.otf is presented in the folder
C:\texlive\2016\texmf-dist\fonts\opentype\public\cm-unicode\)

In all cases the error is 'your font is not found'. The same if I declare Path explicitly: \setmainfont[Path=...,SlantedFont =...]

Could anybody help with proper font declaration and proper usage in the text? In the questions with tag 'slanted' I did not found the solution for the main font family.

Thanks

1
  • @Akira Kakuto It works! Many thanks. I have found the font indentifications in the Net. Probably those were valid for Linux
    – torcli
    Nov 9, 2016 at 8:09

2 Answers 2

2

Use fullname obtained by

fc-list : file fullname

\setmainfont[SlantedFont=CMU Serif Roman Slanted]{CMU Serif Roman}

must be ok.

\setmainfont[SlantedFont=[cmunsl.otf]]{CMU Serif Roman}

may also be ok.

0

If you can call the fonts by system name, the simplest is

\documentclass[a4paper]{article}

\usepackage{fontspec}
\usepackage[russian]{babel}

\setmainfont{CMU Serif Roman}[
  SlantedFont=CMU Serif Roman Slanted,
]

\begin{document}

Normal, \textit{italic}, \textsl{slanted}.

\end{document}

Otherwise you need to specify all font file names:

\documentclass[a4paper]{article}

\usepackage{fontspec}
\usepackage[russian]{babel}

\setmainfont{cmun}[
  Extension      = .otf,
  UprightFont    = *rm,
  BoldFont       = *bx,
  ItalicFont     = *ti,
  BoldItalicFont = *bi,
  SlantedFont    = *sl,
]

\begin{document}

Normal, \textit{italic}, \textsl{slanted}.

\end{document}

enter image description here

Note that \usepackage[T2A]{fontenc} is not to be used with XeLaTeX. Also

\defaultfontfeatures{Ligatures={TeX},Renderer=Basic}

is not needed, because the Ligatures=TeX option is set by default and Renderer=Basic does nothing with XeLaTeX.

You must log in to answer this question.

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