
Aquí está el código que utilicé:
\documentclass[10pt]{extarticle}
\usepackage{color}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{hyphenat}
\usepackage{mathtools}
\usepackage{fontspec}
\usepackage[hiresbb]{graphicx}
\usepackage{mathastext}
\newcommand{\lt}{<}
\newcommand{\hyphen}{\hyp}
\newcommand{\gt}{>}
\setmainfont[
Path = /var/www/html/phplatex/Font/,
Extension = .ttf,
Ligatures = TeX,
BoldFont = timesbd,
ItalicFont = timesi,
BoldItalicFont = timesbi
]{timesbi}
\pagestyle{empty}
\newsavebox{\mybox}
\newlength{\mywidth}
\newlength{\myheight}
\newlength{\mydepth}
\setlength{\topskip}{0pt} \setlength{\parindent}{0pt}
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\fontsize{20pt}{12pt}\selectfont
\begin{lrbox}{\mybox}
$$f(x) = ax_2 + bx + c$$
\end{lrbox}
\settowidth {\mywidth} {\usebox{\mybox}} \settoheight{\myheight}
{\usebox{\mybox}} \settodepth {\mydepth} {\usebox{\mybox}}
\newwrite\foo
\immediate\openout\foo=\jobname.sizes
\immediate\write\foo{"Depth" : "\the\mydepth",}
\immediate\write\foo{"Height" : "\the\myheight",}
\addtolength{\myheight} {\mydepth}
\immediate\write\foo{"TotalHeight" : "\the\myheight",}
\immediate\write\foo{"Width" : "\the\mywidth"}
\closeout\foo
\begin{document}
\color[rgb]{0,0,0}
\pagecolor[rgb]{1,1,1}
\usebox{\mybox}
\end{document}
Cuando uso single $
en la ecuación, la fuente no se aplica, pero si $$
se usa, entonces la fuente se aplica a la ecuación, pero no perfectamente.
Aquí está el resultado del tex:
- ¿Por qué la fuente no se aplica a la ecuación en línea?
- ¿Por qué la fuente no se aplica después del subíndice en la ecuación de visualización?