0

I am a new TeX user and was wondering if there is any way to keep my main font (Day Roman) while typing mathematical expressions inbetween dollar signs. Here is an example, I would like my font to look like the bottom three points A, B and C, rather than the first row. I found a paper with the style I would like to use, see the bottom picture.

First example

Second example

Is there any way I can stop the dollar signs from altering the font? Here is my preamble (I apologize if it's messy, if things are not needed and/or are overlapping):

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{ebgaramond,ebgaramond-maths}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\setmainfont{Dayrom.ttf}

\begin{document}

\textbf{1. }\text{Test 2}\\
$$A = (1, 1, 1), B = (2, 2, 2), C = (3, 3, 3)$$.

\centerline{$A =$ $($1, 1, 1$)$, $B =$ $($2, 2, 2$)$, $C =$ $($3, 3, 3$)$.}
\end{document}

As you can see, I have to avoid using dollar signs around numbers as it changes their font.

I have downloaded the Day Roman font and attached it to my file. I use XeLaTeX as compiler.

Thanks in advance.

3

1 Answer 1

1

You can declare the font as a math font and declare digits use it:

enter image description here

\documentclass[10pt,a4paper]{article}
% not in xetex \usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{ebgaramond,ebgaramond-maths}
% not in xetex \usepackage[T1]{fontenc}
\usepackage{fontspec}
\setmainfont[NFSSFamily=dayrom]{Comic Sans MS}% I don't have this \setmainfont{Dayrom.ttf}

\DeclareSymbolFont{digits}{TU}{dayrom}{m}{n}
\AtBeginDocument{
\DeclareMathSymbol{0}{\mathalpha}{digits}{`0}
\DeclareMathSymbol{1}{\mathalpha}{digits}{`1}
\DeclareMathSymbol{2}{\mathalpha}{digits}{`2}
\DeclareMathSymbol{3}{\mathalpha}{digits}{`3}
\DeclareMathSymbol{4}{\mathalpha}{digits}{`4}
\DeclareMathSymbol{5}{\mathalpha}{digits}{`5}
\DeclareMathSymbol{6}{\mathalpha}{digits}{`6}
\DeclareMathSymbol{7}{\mathalpha}{digits}{`7}
\DeclareMathSymbol{8}{\mathalpha}{digits}{`8}
\DeclareMathSymbol{9}{\mathalpha}{digits}{`9}
}

\begin{document}
\showoutput
\textbf{1. }\text{Test 2}% never before a math display\\
\[A = (1, 1, 1), B = (2, 2, 2), C = (3, 3, 3) \text{.}\]


\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .