1

I need to display all the math in the typewriter style, so I used mathastext to do it, but now matrix brackets are not being displayed. Everything else works fine as far as I can tell.

Here's my code:

\documentclass{book}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{unicode-math}
\setmathfont{xits-math.otf}
\renewcommand\familydefault\ttdefault
\usepackage[defaulttt]{mathastext}
\renewcommand\familydefault\rmdefault

\begin{document}
    \[
        \begin{bmatrix*}[l]
            a & (b+c)\\
            \{c\} & [d]\\
        \end{bmatrix*}
    \]  
\end{document}

The output looks like this:

enter image description here

As you can see, the matrix brackets are missing. How can I fix this? The answer to this related question did not work for me.

Milos
  • 391

1 Answers1

2

I just \setmathfont{xits-math.otf} last.

\documentclass{book}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{unicode-math}
\renewcommand\familydefault\ttdefault
\usepackage[defaulttt]{mathastext}
\renewcommand\familydefault\rmdefault
\setmathfont{xits-math.otf}

\begin{document}
    \[
    \begin{bmatrix*}[l]
    a & (b+c)\\
    \{c\} & [d]\\
    \end{bmatrix*}
    \]  
\end{document}

enter image description here

Edit

To get parenthesis and brackets in \tt.

\documentclass{book}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{unicode-math}
\renewcommand\familydefault\ttdefault
\usepackage[defaulttt]{mathastext}
\MTnonlettersobeymathxx     % math alphabets will act on (, ), [, ], etc...
\MTexplicitbracesobeymathxx % math alphabets will act on \{ and \}
%\MTfamily {\ttdefault}      % we will declare a math version using tt font
%\Mathastext [typewriter]    % the math version is called typewriter

\renewcommand\familydefault\rmdefault
\setmathfont{xits-math.otf}

\begin{document}
    \[
    \begin{bmatrix*}[l]
    a & (b+c)\\
    \{c\} & [d]\\
    \end{bmatrix*}
    \]  
\end{document}

enter image description here

NBur
  • 4,326
  • 10
  • 27