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?

  • Why shouldn't it be a good idea? – egreg Feb 11 '14 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.) – Ulrike Fischer Feb 11 '14 at 10:43
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}
| improve this answer | |
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}
| improve this answer | |

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.