I am trying to use system font for LaTeX. I am able to do it for text but not for the math part. Here is an example (compiled using XeLaTeX), where I use the font "Broadway", but it doesn't work for the math part. Any suggestion for how to define the font for the math part?
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[xetex]{graphicx}
\usepackage{fontspec,xunicode}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\setmainfont[Scale=.95]{Broadway}
\setmonofont{Broadway}
\begin{document}
This is the formula for $(a+b)^2$
\begin{equation}
(a+b)^2=a^2+2ab+b^2
\end{equation}
\end{document}
I found alternate ways from The LaTex Font Catalogue.
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{concmath}
\usepackage[T1]{fontenc}
\begin{document}
This is the formula for $(a+b)^2$
\begin{equation}
(a+b)^2=a^2+2ab+b^2
\end{equation}
\end{document}
I was looking for typewritter font and "concmath" is a good one and also provides math support. But I am more interested in courier font which is also available in catalogue
\usepackage{courier}
\renewcommand*\ttdefault{lcmtt}
\renewcommand*\familydefault{\ttdefault}
\usepackage[T1]{fontenc}
But now the maths appears in Roman. Is there any possible way to make the math part use the courier font. I am not sure if it can be done by modifying the corresponding .sty file somehow or if there is any other better way. All I am trying to do is to make the math part use the same font (for the text part only, not for the symbol) as text without any italic or bold.
Best Answer
Use
mathspec
package. Note however that most fonts include only Latin, Greek alphabets that can be used withmathspec
. If you want the math fonts, alphabets and symbols alike, to be consistent, you needunicode-math
package together with an OpenType fonts with MATH table. Such fonts are relatively rare, and the only font with complete Unicode coverage is XITS/STIX.Basic usage of
mathspec
:Several comments:
fontspec
package. It will clash withmathspec
.mnsymbol
package, which is designed to work with Minion Pro, use the option\usepackage[MnSymbol]{mathspec}
.Basic usage of
unicode-math
:This package is for fonts that contain an OpenType MATH table. Currently only these fonts are available:
The last one is recommended for its complete coverage and times-like appearance (most professional books use times-like fonts for math).
The last line is only usable with
XITS Math
orSTIX
. It makes sure that \mathcal and \mathscr looks different and be consistent with looks in traditional TeX fonts.Miscellaneous comments on your code:
inputenc
with XeTeX or LuaTeX. The utf8 option ofinputenc
is a compilation of dirty hacks that implements a tiny fraction of Unicode while XeTeX natively suuports UTF-8 and UTF-16.xetex
withgraphicx
package. In modern distributions it auto detects.xetex
.