0

I'm writting a simple document with a font I created and I don't know why when I use mathmode the commas appear as semicolons and the points as double points.

Here's an example:

Example

This is the document:

\documentclass{article}

\usepackage[spanish]{babel}
\usepackage{amsmath,amsthm,amssymb,amsfonts,mathrsfs,latexsym,stmaryrd}
\usepackage{color} 
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{textpos}
\usepackage{enumerate}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{float}
\usepackage{bm}

\usepackage[no-math]{fontspec}

\DeclareSymbolFont{letters}{TU}{MiLetra}{m}{n}

\usepackage{fontspec}
\newfontfamily{\miletra}{MiLetra}[
  NFSSFamily=MiLetra,
  UprightFont=*,
  BoldFont=*,
  BoldFeatures={FakeBold=3},
]

\renewcommand{\familydefault}{MiLetra}

\DeclareSymbolFont{numbers}{TU}{MiLetra}{m}{n}
\SetSymbolFont{numbers}{bold}{TU}{MiLetra}{bx}{n}
\DeclareMathSymbol{0}\mathalpha{numbers}{"30}
\DeclareMathSymbol{1}\mathalpha{numbers}{"31}
\DeclareMathSymbol{2}\mathalpha{numbers}{"32}
\DeclareMathSymbol{3}\mathalpha{numbers}{"33}
\DeclareMathSymbol{4}\mathalpha{numbers}{"34}
\DeclareMathSymbol{5}\mathalpha{numbers}{"35}
\DeclareMathSymbol{6}\mathalpha{numbers}{"36}
\DeclareMathSymbol{7}\mathalpha{numbers}{"37}
\DeclareMathSymbol{8}\mathalpha{numbers}{"38}
\DeclareMathSymbol{9}\mathalpha{numbers}{"39}

\DeclareSymbolFont{grletters}{OML}{cmm}{m}{it}

\DeclareMathSymbol{\pi}{\mathord}{grletters}{"19}

\DeclareSymbolFont{operators}{TU}{MiLetra}{m}{n}
\DeclareSymbolFontAlphabet{\mathsf}{operators}

\DeclareSymbolFont{letters}{TU}{MiLetra}{m}{n}
\DeclareSymbolFontAlphabet{\mathsf}{letters}

\begin{document}

\section{Introduction}

$(0,0)$

\end{document}

If someone knows what could I do in order to correct it I would be really thankful.

6
  • 4
    Interesting layout. Your question will be better if you add a complete but minimal example.
    – mickep
    Commented Jan 15, 2023 at 20:48
  • 1
    @mickep I am agree with you. But what is the MWE?
    – Sebastiano
    Commented Jan 15, 2023 at 20:49
  • 4
    this is identical to your last question but with comma not pi and you still have provided no example Commented Jan 15, 2023 at 20:49
  • 1
    @Sebastiano A simple short compilable document, including the problematic character (a comma).
    – mickep
    Commented Jan 15, 2023 at 20:52
  • 3
    you based this on my answer, which requires remapping for all characters, I just showd \pi there, you would be better to use the other unicode-math answer which replaces all the math code you show and will make , map correctly Commented Jan 15, 2023 at 20:53

1 Answer 1

1

You should consider the unicode-math answer to your previous question, but if you go this rout you need to declare characters for the TU (Unicode) font you are using (I again switched fonts to one I had available)

enter image description here

\documentclass{article}

\usepackage[spanish]{babel}
\usepackage{amsmath,amsthm,amssymb,amsfonts,mathrsfs,latexsym,stmaryrd}
\usepackage{color} 
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{textpos}
\usepackage{enumerate}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{float}
\usepackage{bm}

\usepackage[no-math]{fontspec}



\usepackage{fontspec}
\newfontfamily{\miletra}{Comic Sans MS}[
  NFSSFamily=MiLetra,
  UprightFont=*,
  BoldFont=*,
  BoldFeatures={FakeBold=3},
]

\DeclareSymbolFont{letters}{TU}{MiLetra}{m}{n}

\renewcommand{\familydefault}{MiLetra}

\DeclareSymbolFont{numbers}{TU}{MiLetra}{m}{n}
\SetSymbolFont{numbers}{bold}{TU}{MiLetra}{bx}{n}
\DeclareMathSymbol{0}\mathalpha{numbers}{"30}
\DeclareMathSymbol{1}\mathalpha{numbers}{"31}
\DeclareMathSymbol{2}\mathalpha{numbers}{"32}
\DeclareMathSymbol{3}\mathalpha{numbers}{"33}
\DeclareMathSymbol{4}\mathalpha{numbers}{"34}
\DeclareMathSymbol{5}\mathalpha{numbers}{"35}
\DeclareMathSymbol{6}\mathalpha{numbers}{"36}
\DeclareMathSymbol{7}\mathalpha{numbers}{"37}
\DeclareMathSymbol{8}\mathalpha{numbers}{"38}
\DeclareMathSymbol{9}\mathalpha{numbers}{"39}

\DeclareSymbolFont{grletters}{OML}{cmm}{m}{it}

\DeclareMathSymbol{\pi}{\mathord}{grletters}{"19}

\DeclareSymbolFont{operators}{TU}{MiLetra}{m}{n}
\DeclareSymbolFontAlphabet{\mathsf}{operators}

\DeclareSymbolFont{letters}{TU}{MiLetra}{m}{n}
\DeclareSymbolFontAlphabet{\mathsf}{letters}

\DeclareMathSymbol{,}\mathpunct{numbers}{`,}

\begin{document}

\section{Introduction}

$(0,0)$

\end{document}
2
  • Thanks! It worked, but I did the same for the point and it's not working
    – ian
    Commented Jan 15, 2023 at 21:40
  • 2
    \DeclareMathSymbol{.}\mathalpha{numbers}{`.} would work but spanish babel is mapping it back to comma, see if it has an option not to do that. Failing that put \mathcode`\.=`\. after \begin{document} Commented Jan 15, 2023 at 21:51

You must log in to answer this question.

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