2

I'm able to typeset a ~50 page set of lecture notes with heavy math using

\usepackage{libertine}
\usepackage[libertine]{newtxmath}

with both PDFLaTeX and XeLaTeX. I know that the libertine package automatically loads and uses fontspec if used with XeTeX. However, someone here mentioned that it's not a good idea to use Type1 and OpenType fonts together. So, what could go wrong?

2
  • Why shouldn't it be a good idea?
    – egreg
    Feb 11, 2014 at 10:39
  • It should be not a problem to use type1 math fonts - that is the default if you load only fontspec. Perhaps you mixed up T1-encoding and type1 fonts: to use in text T1-encoding is generally not a good idea.) Feb 11, 2014 at 10:43

2 Answers 2

2

Works for xelatex and pdflatex

\documentclass{article}
\usepackage{iftex}
\ifXeTeX
  \usepackage[no-math]{fontspec}
  \usepackage[libertine]{newtxmath}
\else
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
\fi
\usepackage{libertine}
\begin{document}
$\mathbf{\Delta}$
\end{document}
2
1

It's important not to confuse math fonts and text fonts. Loading fontspec with the [no-math] option keeps the math font untouched, so math font packages should work as usual. Font packages written for PDFLaTeX may not work.

However, before switching an existing document to XeLaTeX, proofreading is necessary. I found that there are some special cases that do go wrong. The code below is rendered correctly with PDFLaTeX, but with XeLaTeX I get a ☒ character:

\documentclass{article}
\usepackage{iftex}
\ifXeTeX\else
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
\fi
\usepackage{libertine}
\usepackage[libertine]{newtxmath}
\begin{document}
$\mathbf{\Delta}$
\end{document}

You must log in to answer this question.

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