0

I am trying to use Arial fonts and fira-math fonts and compiling with lualatex. I am also using mathastext. However there is a problem. The \begin{bmatrix}\end{bmatrix} doesn't work. Here is a MWE, compiled with lualatex.

\documentclass{article}
\usepackage{firamath-otf}
\setmainfont{Arial}[Scale=1.2]
\usepackage{amsmath}
\usepackage{mathastext}
\begin{document}
    This is running text.
\[\cos 2\theta=2\cos^2\theta-1\]    
\[
\begin{bmatrix}
a&b&2\\
A&b&1\\
c&X&Z
\end{bmatrix}
\]
\end{document}

enter image description here

Is there a work around for this? I want to use fira-math so, loading fontspec with no-math option is not possible I think.

  • 1
    firamath-otf loads the unicode-math package. You shouldn't use this together with mathastext. – Ulrike Fischer Mar 25 at 13:30
3

I use something like this. You can download Fira Math font from GitHub or use firamath-otf, of course. My advice is not to use text fonts as math fonts; they are missing a number of font dimens and glyphs needed for good math. So using them for math is always only a work-around.

\documentclass{article}
\usepackage{amsmath}
\usepackage[mathrm=sym]{unicode-math}
\setmathfont{Fira Math}
\setmainfont{Arial}%[Scale=1.2] too large .. 

\begin{document}    
This is running text.
\[
  \int_0^{\mathrm{\pi}} \sin x \, \mathrm{d}x = 2
\]
\[
  \cos 2\theta=2\cos^2\theta-1 
\]    
\[
  \begin{bmatrix}
    a & b & 2 \\
    A & b & 1 \\
    c & X & Z
  \end{bmatrix}
\]
\end{document}

enter image description here

| improve this answer | |
  • Thanks. Unfortunately, using text fonts for Mathematics is not my choice. It is forced upon me. I am now using arial for mathematics text in pdflatex with the help of several crude hacks. I was wondering if it will be any easier in lualatex or xetex. I will try out your solution instead of using mathastext.. – S. Venkataraman Mar 29 at 13:04

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.