1

I am working on a document, which uses the fontspec package to ensure the usage of company fonts for main font, sans-serif font and monospaced font. That is working fine.

\usepackage{fontspec}
\setmainfont[
    ItalicFont={Hoefler Text Regular Italic},
    SmallCapsFont={Hoefler Text Roman SC},
    BoldFeatures={
        SmallCapsFont={Hoefler Text Bold SC}
    },
    ItalicFeatures={
        SmallCapsFont={Hoefler Text Regular Italic SC}
    },
    BoldItalicFeatures={
        SmallCapsFont={Hoefler Text Bold Italic SC}
    },
]{Hoefler Text}

\usepackage{biolinum}
\setsansfont[
    Numbers=OldStyle,
    BoldFont={LinBiolinumOB},
    ItalicFont={LinBiolinumOI},
    BoldItalicFont={LinBiolinumOBO},
]{LinBiolinumO}

\usepackage{sourcecodepro}

The problem is, I also need passages being set in "Computer Modern" font. Therefore I added the following to my preamble:

\newcommand*{\computermodern}{\fontfamily{cmr}\selectfont}
\newenvironment{cmfont}{\fontfamily{cmr}\selectfont}{\par}
\DeclareTextFontCommand{\textcm}{\computermodern}

The passages, put between \begin{cmfont} and \end{cmfont} are set in Computer Modern font, but additional format information like italic, slanted, bold, etc. is ignored. How can I also achieve this?

Thanks in advance.

  • the 7bit cmr in xetex sounds like trouble, do you really need cm as opposed to latin modern? – David Carlisle Mar 11 '15 at 18:01
  • Thank you very much, David. Latin Modern is fine, too. Got it working now. :) – HiDensity Mar 11 '15 at 18:30
  • Hi Paul: Yes, it is solved. At least for my special purposes. – HiDensity Mar 11 '15 at 23:43
1

Using the Latin Modern, instead of Computer Modern font, solved the problem.

Just had to include the lmodern package \usepackage{lmodern} and changed the self introduced font commands to:

\newcommand*{\latinmodern}{\fontfamily{lmr}\selectfont}
\newenvironment{lmfont}{\fontfamily{lmr}\selectfont}{\par}
\DeclareTextFontCommand{\textlm}{\latinmodern}
\newcommand*{\latinmodernsans}{\fontfamily{lmss}\selectfont}
\newenvironment{lmsfont}{\fontfamily{lmss}\selectfont}{\par}
\DeclareTextFontCommand{\textlms}{\latinmodernsans}
\newcommand*{\latinmoderntype}{\fontfamily{lmtt}\selectfont}
\newenvironment{lmtfont}{\fontfamily{lmtt}\selectfont}{\par}
\DeclareTextFontCommand{\textlmt}{\latinmoderntype}

This makes it also possible to access Latin Modern font's sans-serif and typewriter face.

  • 1
    \usepackage{lmodern} is not needed when you load fontspec. – egreg Mar 13 '15 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.