# How to use unicode-math in an IEEEtran document

IEEEtran is to be used with pdflatex (and for journal papers, one does not have a choice for a document which should be published). But in two use cases, compilation with lualatex can be desired.

• For conference papers, I want to achieve the – in my point of view – most satisfying appearance. And this includes the use of unicode-math, since I recently discovered all of its convenient features.
• For journal papers, I include all figures (created either with TikZ or pgfplots) as separate .pdf documents. Therefore, these documents could be compiled with lualatex, especially when I want to make use of the lua-backend in pgfplots.

As a reference with reasonable math fonts, a simple pdflatex-compatible document may look like

\documentclass{IEEEtran}
\usepackage{mathtools}
\usepackage{newtxtext} % possible but not completely OK ?
\usepackage[cmintegrals]{newtxmath}
\usepackage{bm}

\begin{document}
aR$aR\bm{a}\mathbb{R}$
\end{document}


Changing the text font with the package newtxtext is apparently accepted, since I just checked a sample PDF with pdf-express and it passed the IEEE Xplore compatibility test.

How would I create a IEEEtran document for compilation with lualatex which uses fontspec and unicode-math and loads correct fonts, similar to newtx?

A related questions is found here: IEEEtran: Getting font right with lualatex. Unfortunately not with a satisying solution.

• There is no satisfying solution. The class is not meant for lualatex. If you don't want to use the various hacks you can find here, write the author and ask him to provide a luatex version of the class. Aug 29 '19 at 19:39

With a bit of experimentation, this seemed to work on a simple example. No guarantees. You probably need to make a few tweaks to the class file.

\documentclass[nofonttune]{IEEEtran}

%% Lie to [comsoc]{IEEEtran} about loading a font package it accepts.
\ProvidesPackage{newtxmath}

\usepackage{mathtools}
\usepackage{unicode-math}

\defaultfontfeatures{Scale = MatchLowercase}
\setmainfont{TeX Gyre Termes}[Scale = 1.0, NFSSFamily = tgtermes]
\setmathfont{TeX Gyre Termes Math}

% Monkey-patch the default font family.
\makeatletter
\def\@IEEEstringptm{tgtermes}
\makeatother

\begin{document}
aR$aR\mathbfit{a}\mathbb{R}$
\end{document}


There are several tips and tweaks you could try.

By default, the document will use ptm, which on most installations will use TeX Gyre Termes. If you want an exact copy of newtxtext, you can load TeX Gyre Termes X.

IEEEtran forces the cmintegrals option of newtxmath. If you want integrals like Computer Modern, you could add the following line beneath your main \setmathfont:

\setmathfont{Latin Modern Math}[
range={"222B-"2233, "2A0C-"2A1C},
Scale=MatchUppercase ]


You could also load upright, instead of sloped, integrals with:

\setmathfont{XITS Math}\setmathfont[
range={"222B-"2233, "2A0C-"2A1C},
Scale=MatchUppercase,
StylisticSet=8 ]


The bm package is incompatible. Use \mathbf, \symbfit or \symbfup for bold letters. if you need bold math symbols as well, you can load

\setmathfont[version=bold]{XITS Math Bold}


And then use \boldmath or \boldsymbol. Beware: As of August 2019, version= and range= do not mix!

I set nofonttune to disable the package’s attempts to adjust the interword spacing in two-column mode. You might want to turn on \sloppy and, in LuaLaTeX, load microtype to get font expansion. This should drastically reduce the amount of hyphenation you need and overfull hboxes you get.

IEEEtran has an option to change the fonts to a clone of Palatino. You can match the appearance of this by selecting Palatino, TeX Gyre Pagella or TeX Gyre Pagella X as the main font, and TeX Gyre Pagella Math or Asana Math as the math font.

• Between the 1st and 2nd pice of code, there is an unfinished sentence: You might try working around the pieces of the. ;) Aug 31 '19 at 7:03
• @Faekynn Whoops! Not sure how I missed that, but thanks for noticing. Aug 31 '19 at 7:41