1

The task arose to create a template in which the text and mathematical formulas are written in the Times New Roman font, since it is the standard in Russian universities. It turned out almost everything, except for some characters, please tell me how it can be corrected? Perhaps you already have a template where everything is written in a single font?

My code

\documentclass[14pt]{extarticle}

\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage {tabularx}
\usepackage {longtable}
\usepackage {multirow}
\usepackage {multicol}
\usepackage{booktabs}


\usepackage{setspace}
\onehalfspacing
\usepackage{indentfirst}
\setlength{\parindent}{1.25cm}
\usepackage{euscript}


\usepackage{icomma}

\usepackage{mathspec}
\newcommand*{\myfont}{Times New Roman}
\setallmainfonts[Ligatures=TeX,Scale=0.975]{Times New Roman}
\setmathfont(Digits,Greek,Latin){\myfont}
\setmathfont(Greek)[Lowercase=Regular]{\myfont}
\usepackage[english,russian]{babel}

\usepackage{titlesec}
\titleformat{\section}[hang]{\normalfont\bfseries}{}{0pt}{}
\titlespacing{\section}{\parindent}{6pt}{6pt}
\titleformat{\subsection}[hang]{\normalfont\bfseries}{}{0pt}{}
\titlespacing{\subsection}{\parindent}{6pt}{6pt}

\usepackage{geometry} 
\geometry{a4paper, top = 2cm, bottom = 2cm, left = 3cm, right = 2cm}

\usepackage[unicode]{hyperref}
\hypersetup{
    colorlinks=true,
    urlcolor=black,
    filecolor=black,
    linkcolor=black,
    filecolor=black,
    citecolor=black
}

\RequirePackage{caption}
\DeclareCaptionLabelSeparator{defffis}{ --- }
\captionsetup[figure]{justification=centerlast,labelsep=defffis,textfont=onehalfspacing}
\captionsetup[table]{justification=raggedleft,labelsep=defffis,textfont=onehalfspacing,singlelinecheck=off}
\captionsetup{belowskip=-6pt}


\usepackage{ragged2e}
\usepackage{microtype}
\justifying
\sloppy
\tolerance=500
\hyphenpenalty=10000
\emergencystretch=3em

Example

4
  • 1
    does it really have to be exactly times new roman not a clone such as tex gyre termes, as far as I know there is no simple math setup for times new roman as it's not an opentype math font. with tex gyre termes you can simply use \setmainfont{TeX Gyre Termes}\setmathfont{TeX Gyre Termes Math} with unicode-math package Sep 18, 2021 at 19:00
  • And is this the only thing? It's just weird that everything else works. I found this phrase in the documentation for the mathspec package. That is, in unicode-math, characters can also be written in a single font along with the rest of the text. Touch me Sep 18, 2021 at 19:46
  • nothing will be set up for math, with times new roman, obviously the main characters are there but without a math table the math typesetting has no infomation about any math specific features such as subscript positions large delimiters, fraction positions etc, all the math-specific typographic features require a math font Sep 18, 2021 at 20:42
  • Have you ever heard of the \mathfont package. I almost succeeded with it, but a bug appeared - the quotation mark appears incorrectly. Do you know how to fix it? TOUCH ME PLEASE Sep 19, 2021 at 0:07

2 Answers 2

1

You want something like

\usepackage{unicode-math}
\usepackage{amsthm}

\setmainfont{Times New Roman}
\setmathfont{TeX Gyre Termes Math}[Scale=MatchLowercase]

Be careful: some Linux boxen ship with a version of Times New Roman from last century. You can load TeX Gyre Termes instead if this causes a problem.

You still want to load most of the same packages, but not amsfonts, amssymb or euscript, all of which are superceded by unicode-math. They shouldn’t do any harm, but they won’t work. If you need something close to Euler Script as \mathscr, you can add the line

\setmathfont{Latin Modern Math}[range={scr,bfscr},
                                Scale=MatchUppercase]

(There is also an OpenType version of AMS Euler, including script and fraktur, if you want it.)

If you do not want to use unicode-math, alternatives include:

\usepackage{newtxmath}
\usepackage{fontspec}

\setmainfont{Times New Roman}
\usepackage{mathastext}

There might be a few incompatibilities with some Greek letters.

Or, in XeLaTeX:

\usepackage{newtxmath}
\usepackage{mathspec}

\setmainfont{Times New Roman}
\setmathsfont(Digits,Latin,Greek){Times New Roman}
15
  • This is absolutely not what is required. In any case, not for the Russian contingent. Sep 19, 2021 at 16:28
  • Have you watched how unicode-math works? Text in TNR font, formulas in TeX Gyre, symbols in standard (Latin Modern (?)) font. I am silent about the received restrictions in mathematics. You can't use mathematical symbols in the headers after that. It's just unusable! Sep 19, 2021 at 16:49
  • @СергейКорягин It sounded to me like you currently were getting your symbols in Latin Modern and wanted them to be from (a clone of) Times. If you want it the other way around, you can load Latin Modern Math or New Computer Modern Math, then load your alphabets over it with range=.
    – Davislor
    Sep 19, 2021 at 20:22
  • @СергейКорягин However, it’s not clear to me what you are asking for.
    – Davislor
    Sep 19, 2021 at 20:22
  • @СергейКорягин If I understand you correctly, you also want to be able to load math symbols from 8-bit fonts together with unicode-math. This is almost always an XY-problem, but the way to do it is \AtBeginDocument{\DeclareMathSymbol...}.
    – Davislor
    Sep 19, 2021 at 20:25
0

[Solution path]

First, I had to accept the fact that Times New Roman is not a mathematical font by default. Times New Roman simply does not contain some symbols, such as the reduced Planck constant or the partial differential. I decided to use Latin Modern Math.

Secondly, the structure of the code has been changed, and I am applying it here because I believe that I am not the only person who was looking for ways to solve the problem.

%!TEX encoding = UTF-8 Unicode
\documentclass[14pt]{extarticle}


\usepackage{datetime}
\usepackage{texdate}


\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage {tabularx}
\usepackage {longtable}
\usepackage {multirow}
\usepackage {multicol}
\usepackage{booktabs}

\usepackage{setspace}
\onehalfspacing
\usepackage{indentfirst}
\setlength{\parindent}{1.25cm}
%\usepackage{minted}
\usepackage{euscript}


\usepackage{fontspec}
\setmainfont{Times New Roman}                 
\usepackage{unicode-math} 
\setmathfont{Latin Modern Math}
\usepackage{icomma}


\usepackage[english,russian]{babel} 

\usepackage{titlesec}
\titleformat{\section}[hang]{\normalfont\bfseries}{}{0pt}{}
\titlespacing{\section}{\parindent}{6pt}{6pt}
\titleformat{\subsection}[hang]{\normalfont\bfseries}{}{0pt}{}
\titlespacing{\subsection}{\parindent}{6pt}{6pt}

\usepackage{geometry} 
\geometry{a4paper, top = 2cm, bottom = 2cm, left = 3cm, right = 2cm}

\usepackage[unicode,psdextra]{hyperref}[2012/08/13]
\hypersetup{
    colorlinks=true,
    urlcolor=black,
    filecolor=black,
    linkcolor=black,
    filecolor=black,
    citecolor=black
}

\RequirePackage{caption}
\DeclareCaptionLabelSeparator{defffis}{ --- }
\captionsetup[figure]{justification=centerlast,labelsep=defffis,textfont=onehalfspacing}
\captionsetup[table]{justification=raggedleft,labelsep=defffis,textfont=onehalfspacing,singlelinecheck=off}
\captionsetup{belowskip=-6pt}

\usepackage{ragged2e}
\usepackage{microtype}
\justifying
\sloppy
\tolerance=500
\hyphenpenalty=10000
\emergencystretch=3em

You must log in to answer this question.

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