9

Introduction

I know that \sin and \cos are supposed to produce non-italicized (operator) output when in math mode.

Oddly, these macros are producing italicized output, as if I had typed sin or cos---that is, without the backslash.

My Question

The unicode-math package seems to be at fault here. What's going on, and why would it override the trig commands?

Minimum Working Example (MWE)

I've got a rather large document, so my MWE includes a few packages that may seem unusual for this MWE. I've stripped it down quite a bit to get what is given below.

Here's the preamble:

\documentclass[10pt,letterpaper,notitlepage,final]{report}
%%##$#% !BIB TS-program = biber
% The above line is REQUIRED -- see http://tex.stackexchange.com/questions/38348/in-texshop-is-there-a-directive-to-select-biber-or-bibtex-on-a-per-document-bas

\usepackage[T1]{fontenc}
\usepackage{lmodern} % better font -- REQUIRED for special unicode characters
\usepackage{unicode-math}  % for \oiint command (also loads fontspec)
\usepackage{amsmath}  % conflicts with \oiint
\usepackage[arrow]{hhtensor}  % for vector and tensor notation
\usepackage{graphicx}   % Allows me to include figures


\begin{document}

Here's an equation:
\begin{equation}
    1 = \cos^2 \theta + \sin^2 \theta
\end{equation}

\end{document}
3
  • 2
    never use fontenc with xetex or luatex, use fontspec instead Commented May 12, 2016 at 22:01
  • @DavidCarlisle: Thanks--how come? (If it matters, I use XeLaTeX.)
    – jvriesem
    Commented May 13, 2016 at 16:35
  • it doesn't work:-) with xetex you should use opentype unicode fonts not 8bit tex encoded fonts like T1 encoding (otherwise hyphenation will be wrong) Commented May 13, 2016 at 17:05

1 Answer 1

12

unicode-math should be loaded after all font-packages (well, packages, that load fonts as well, like amsmath etc.) are loaded, to provide the corresponding changes.

The unicode-math package states (see section 3 Getting started):

Load unicode-math as a regular LATEX package. It should be loaded after any other maths or font-related package in case it needs to overwrite their definitions

\documentclass[10pt,letterpaper,notitlepage,final]{report}
%%##$#% !BIB TS-program = biber
% The above line is REQUIRED -- see http://tex.stackexchange.com/questions/38348/in-texshop-is-there-a-directive-to-select-biber-or-bibtex-on-a-per-document-bas


\usepackage{amsmath}  % conflicts with \oiint
\usepackage[arrow]{hhtensor}  % for vector and tensor notation
\usepackage{graphicx}   % Allows me to include figures
\usepackage{unicode-math}  % for \oiint command (also loads fontspec)

\begin{document}
Here's an equation:
\begin{equation}
    1 = \cos^2 \theta + \sin^2 \theta
\end{equation}

\end{document}

enter image description here

4
  • Loading fontenc and lmodern is completely useless in this context
    – egreg
    Commented May 12, 2016 at 21:48
  • 1
    @egreg: Yes, but it was in the OP's example already. I just forgot to remove them
    – user31729
    Commented May 12, 2016 at 21:52
  • @egreg: Thanks for pointing that out. Why is that?
    – jvriesem
    Commented May 13, 2016 at 16:40
  • 1
    @jvriesem fontenc is pretty useless with fontspec (that's loaded by unicode-math); the font choices made by lmodern are overridden by fontspec.
    – egreg
    Commented May 13, 2016 at 16:46

You must log in to answer this question.

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