输出

输出

我正在尝试使用 mathastext 包将数学字体更改为无衬线字体(我在文档的其余部分中使用的字体相同)。字母会改变,但数字不会改变,我不知道为什么。这是我的序言:

\documentclass[a4paper,10pt,twoside]{article}
\usepackage[margin=2cm]{geometry} % Margin

\usepackage{amsmath,tikz,mathrsfs,subdepth}
% amsmath   align equations
% tikz      create graphic elements
% subdepth  equalise the height of sub­scripts in math mode
% mathrsfs  handwritting math font

\usepackage{color, fancyhdr, fontspec, ragged2e, subfiles, titlesec}
% Color     text and background color
% Fancyhdr  customize headers and footers
% Fontspec  change main font
% Ragged2e  align text
% Subfiles  han­dle multi-file projects
% Titlesec  titles style

% ---------- COLOR PACKAGE ----------
\definecolor{amarillo}{RGB}{255,227,54}
\definecolor{azul}{RGB}{0,11,63}
\definecolor{blanco}{RGB}{255,255,255}
\definecolor{fucsia}{RGB}{255,49,127}
\definecolor{verde}{RGB}{5,187,136}

% ---------- FANCYHDR PACKAGE ----------
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0} % Deletes header line
\fancyhf{}
\fancyfoot[LE,RO]{\colorbox{amarillo}{Página \thepage}} % Numbering pages

% ---------- FONTSPEC PACKAGE ----------
\setmainfont[
BoldFont=RobotoCondensed-Bold.ttf,
ItalicFont=RobotoCondensed-RegularItalic.ttf,
]{Quicksand-Regular.ttf} % Main font, loaded

% ---------- MATHASTEXT PACKAGE ----------
\usepackage[defaultmathsizes]{mathastext}

% ---------- TITLESEC PACKAGE ----------
\titlespacing{\section}{0}{-1cm}{1cm}
\titlespacing{\subsection}{2cm}{0.75cm}{0.5cm}
\titlespacing{\subsubsection}{0}{0}{0.1cm}
\titleformat{\section}[display]{\bfseries\LARGE}{}{1cm}{\centering}[]
\titleformat{\subsection}[display]{\bfseries\Large}{}{0}{}[]
\titleformat{\subsubsection}[display]{\bfseries\large}{}{0}{}[]

% ---------- OTHERS ----------
\setlength{\parskip}{0} \setlength{\parindent}{0} % Paragraph formatting

\begin{document}

\subfile{sections/unidad4}

\end{document}

我已尽力将(西班牙语)翻译得更好,如有错误,请谅解。

然后,当我在数学模式下书写时:

\textbf{Math mode:} \\
\( 0123456789 \quad ABCDEFGHIJ\) \\
\\
\textbf{Text mode:} \\
0123456789 \quad ABCDEFGHIJ

数学模式与文本模式

有人能帮助我吗?

答案1

如果您fontspec使用选项加载包no-math(请参阅此包的手册),您的问题应该可以解决。另外,我建议写成\setlength{\parskip}{0pt}而不是\setlength{\parskip}{0}(请参阅编译后日志文件中的警告)。

输出

(水平线连接页面的顶部和底部,仅代表图像中断。)

在此处输入图片描述

\documentclass[a4paper,10pt,twoside]{article}
\usepackage[margin=2cm]{geometry} % Margin

\usepackage{amsmath,tikz,mathrsfs,subdepth}
% amsmath   align equations
% tikz      create graphic elements
% subdepth  equalise the height of sub­scripts in math mode
% mathrsfs  handwritting math font

\usepackage{color,fancyhdr,ragged2e,subfiles,titlesec}
\usepackage[no-math]{fontspec}
% Color     text and background color
% Fancyhdr  customize headers and footers
% Fontspec  change main font
% Ragged2e  align text
% Subfiles  han­dle multi-file projects
% Titlesec  titles style

% ---------- COLOR PACKAGE ----------
\definecolor{amarillo}{RGB}{255,227,54}
\definecolor{azul}{RGB}{0,11,63}
\definecolor{blanco}{RGB}{255,255,255}
\definecolor{fucsia}{RGB}{255,49,127}
\definecolor{verde}{RGB}{5,187,136}

% ---------- FANCYHDR PACKAGE ----------
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt} % Deletes header line
\fancyhf{}
\fancyfoot[LE,RO]{\colorbox{amarillo}{Página \thepage}} % Numbering pages

% ---------- FONTSPEC PACKAGE ----------
\setmainfont[
BoldFont=RobotoCondensed-Bold.ttf,
ItalicFont=RobotoCondensed-RegularItalic.ttf,
]{Quicksand-Regular.ttf} % Main font, loaded

% ---------- MATHASTEXT PACKAGE ----------
\usepackage[defaultmathsizes]{mathastext}

% ---------- TITLESEC PACKAGE ----------
\titlespacing{\section}{0}{-1cm}{1cm}
\titlespacing{\subsection}{2cm}{0.75cm}{0.5cm}
\titlespacing{\subsubsection}{0}{0}{0.1cm}
\titleformat{\section}[display]{\bfseries\LARGE}{}{1cm}{\centering}[]
\titleformat{\subsection}[display]{\bfseries\Large}{}{0}{}[]
\titleformat{\subsubsection}[display]{\bfseries\large}{}{0}{}[]

% ---------- OTHERS ----------
\setlength{\parskip}{0pt} \setlength{\parindent}{0pt} % Paragraph formatting

\begin{document}

\textbf{Math mode:} \\
\( 0123456789 \quad ABCDEFGHIJ\) \\
\\
\textbf{Text mode:} \\
0123456789 \quad ABCDEFGHIJ

\end{document}

相关内容