# Getting italic Computer Modern numerals with Times Roman font elsewhere in math

I am typesetting a document in Times Roman (using txfonts). However, the digits (0123456789) when italicized (with \textit{} or \emph{}) do not have the same script-y look as they do in Computer modern. With Times, they merely look slanted.

Is there a way I can use the italic versions of digits from Computer Modern in my otherwise Times Roman document? [I would like to have them available as separate symbols, say \eins, \zwei etc., instead of overwriting the default numbers.] I use script digits for a few purposes, including section headings, characteristic functions of sets (\mathord{\textit{1}}_A), power classes of sets (\mathord{\textit{2}}^\varOmega).

• you should be using \mathit not \textit then you may get what you ask for already if you are only using newtxtext and not newtxmath – David Carlisle May 24 '17 at 6:52
• unrelated but you don't need \mathord around \textit (or better, \mathit) such constructs are automatically mathord. – David Carlisle May 24 '17 at 10:34
• \mathit{1} doesn't seem to produce what I desire. txfonts sets the math mode in times too. So, \mathit{1} and \textit{1} are (visually) identical. – sami.spricht.sprache May 24 '17 at 14:30
• \mathit is the thing to use in any case \mathit gives a fixed font from the math setup, \textit will give you whatever italic font is current in that part of the text. and won't get smaller in subscripts unless amsmath is used. – David Carlisle May 24 '17 at 14:34
• Don't use \it in any case. It is long obsolete in LaTeX. – cfr May 24 '17 at 14:46

## 1 Answer

A comment up front: The txfonts package, which provides both text and math fonts, has been superseded for several years now by a pair of packages: newtxtext and newtxmath. I can see no good reason for using the txfonts package if the vintage of your TeX distribution is more recent than, say, 2012.

If you can at all switch to LuaLaTeX, it becomes very straightforward to handle almost any number of math fonts side-by-side within a single document. Indeed, for what you appear to have in mind, something like the following setup is entirely sufficient:

\usepackage[no-math]{fontspec}
\setmainfont{STIX Two Text}[Numbers={OldStyle,Proportional}]
\usepackage{unicode-math}
\setmathfont{STIX Two Math}


The "STIX Two" text and math fonts may be downloaded free of charge from https://sourceforge.net/projects/stixfonts/

A full MWE (the use of "old-style", proportional-width text-mode numerals is optional):

% !TeX program = lualatex
\documentclass{article}
\usepackage[no-math]{fontspec}
\setmainfont{STIX Two Text}[Numbers={OldStyle,Proportional}]
\usepackage{unicode-math}
\setmathfont{STIX Two Math}

% macros for characteristic functions and power classes of sets
\newcommand\cfset[1]{\mathit{1}_{\mkern-1.5mu#1}}
\newcommand\pcset[1]{\mathit{2}^{#1}}

\begin{document}
0123456789abcdef   % text: oldstyle numerals, proportional width

$0123456789abcdef$ % math: lining style numerals, fixed width

$\mathit{0123456789abcdef}$ "\mathit" automatically uses Latin Modern glyphs

$\cfset{K}$ $\pcset{\varpi}$
\end{document}

• So, I assume there's no way to get this done with pdfLaTeX. Thanks anyway. – sami.spricht.sprache May 27 '17 at 14:48
• @sami.spricht.sprache You could do it with pdfLaTeX, if you wanted to. – cfr May 28 '17 at 3:09
• @sami.spricht.sprache - Is there something that's keeping you from adopting LuaLaTeX? – Mico May 28 '17 at 6:58
• @Mico, Just the fact that I have never used it before, and I don't know the (non-technical) advantages or disadvantages of a switch. Plus, I usually have a set preamble, which will have to be modified; e.g., I use fontenc which can't be used in LuaLaTeX. – sami.spricht.sprache May 28 '17 at 15:12
• @sami.spricht.sprache - For the most part, the LuaLaTeX format is a superset of the (pdf)LaTeX format, meaning that (almost) every document that compiles fine under pdfLaTeX should compile equally fine under LuaLaTeX. LuaLaTeX recognizes only one input encoding -- utf8. Hence one should indeed not load the inputenc package -- nor, for that matter and as you've noted in the comment, the fontenc package -- if the document is to be compiled with LuaLaTeX. The fontspec package allows LuaLaTeX (and XeLaTeX) users to access system fonts in fairly natural way. – Mico May 28 '17 at 15:19