# Give me my fancy math 𝒳 from mathptmx back!

In the old times of mathptmx, we wrote stuff such as

\documentclass{article}
\pagestyle{empty}
\usepackage{mathptmx}
\begin{document}
Let $$\mathcal{X}=\{X_1,\ldots,X_n\}$$.
\end{document}


and got from pdflatex a fancy calligraphic math 𝒳, which was sufficiently fancy to be visibly distinct from the remaining italicized math 𝑋 in 𝑋₁ till 𝑋ₙ:

However, in the more modern times, mathptmx has been obsoleted in favor of newtx. Feeding

\documentclass{article}
\pagestyle{empty}
\usepackage{newtxmath}
\begin{document}
Let $$\mathcal{X}=\{X_1,\ldots,X_n\}$$.
\end{document}


to pdflatex results in a dull

The distinction between the first X and the remaining occurrences is far less prominent. This is unfortunate, as it requires additional attention from the reader to distinguish between the two.

For pdflatex, what is the advised way of getting the fancy math 𝒳, such as in mathptmx, , or similar, if you use newtxtext and newtxmath for standard text and math fonts? Yes, I know that one can use an image (with the traditional caveats of, e.g., X not appearing in the PDF text layer), and, I know there is mathrsfs, which is not obsolete in CTAN but is pretty dated (1999-06-30 is the date of the file mathrsfs.sty on the CTAN file system and 1996-01-01 is the internal date stated inside mathrsfs.sty). Is it still advisable to use mathrsfs+\mathscr or are there better options?

• Technically, it was the txfonts package, not the mathptmx package, that was obsoleted by the newtxtext/newtxmath pair of font packages.
– Mico
Apr 1, 2020 at 19:44
• That last font could be my scribble for "9C". Apr 3, 2020 at 15:14
• i.stack.imgur.com/aE6Gx.png looks like "9C". Apr 3, 2020 at 15:32

You can get the desired X by loading the mathrsfs ("Ralph Smith's Formal Script") font package and writing \mathscr{X}.

\documentclass{article}
\usepackage{newtxtext,newtxmath}
\usepackage{mathrsfs}
\begin{document}
Let $$\mathscr{X}=\{X_1,\ldots,X_n\}$$.
\end{document}

• @Just_A_Man - On what basis do you judge the mathrsfs package to be "dated". (Being several years old is not the same as being dated...)
– Mico
Apr 1, 2020 at 11:33
• @Just_A_Man You are humble and generous... that is my wish. Apr 1, 2020 at 20:01
• @Just_A_Man In the meantime I would like to thank you and inform you that I am one of the most modest users of LaTeX ans also in the English language. I try with all my heart to help you as much as I can and I send you my regards. Apr 4, 2020 at 9:13

The author of newtxmath also wrote (and actively maintains) the package mathalpha, to easily declare calligraphic, script, fraktur, and blackboard bold math alphabets. With mathalpha, you can get your script X with the following example.

\documentclass{article}
\usepackage{newtxmath}
\usepackage[cal=rsfs]{mathalpha}
\begin{document}
Let $$\mathcal{X}=\{X_1,\ldots,X_n\}$$.
\end{document}


By using scr instead of cal, the X will be obtained from the command \mathscr instead of the command \mathcal.

• This is the most elegant way to do it: a comprehensive, consistent interface with features like bold alphabets and scaling. Apr 2, 2020 at 0:11
• @Davislor yes, that's also what I think! The documentation of the package is also very useful, with complete examples from all of the available fonts. Apr 2, 2020 at 3:47

mathptmx uses this font here:

\documentclass{article}
\pagestyle{empty}
\usepackage{newtxmath}
\DeclareMathAlphabet{\mathcal}{OMS}{ztmcm}{m}{n}

\begin{document}
Let $$\mathcal{X}=\{X_1,\ldots,X_n\}$$.
\end{document}


• Does anything prevent you to simply try it out? But if you are happy with a \mathscr command, why did you reject Sebastiono's quite sensible answer? Apr 1, 2020 at 12:17
• I would suggest that you open the style and check its content. And then ask Sebastiano to undelete his answer so that you can accept it. Apr 1, 2020 at 12:29
• @Just_A_Man - I don't believe that your claim that "old styles (as well as old software in general) tend to die and get useless" is valid, at least not when it comes to LaTeX font packages. But if you insist, you can switch from \usepackage{mathrsfs} to \usepackage[scr=rsfs]{mathalfa}, as the mathalfa package should satisfy your "must not be dated" requirement.
– Mico
Apr 1, 2020 at 13:05
• @Mico: LaTeX suffers less from this than most software ecosystems, thanks to an extremely strong culture of long-term backward-compatibility. But it still does suffer from it — older packages get deprecated and experts recommend newer alternatives, for various reasons. Search e.g. deprecated package and obsolete package on this site for many examples, and see this question for some good overall discussion. Apr 3, 2020 at 8:12
• @PeterLeFanuLumsdaine - I must have expressed myself very unclearly. It was not my intent to claim that no LaTeX packages ever became obsolete or deprecated. (Indeed, under the OP's query, I noted that the newtx font package had been obsoleted by the newtxtext and newtxmath font packages.) The point I tried to make was merely that the time passed since the last time a LaTeX package has been updated needn't be a valid indicator for it being obsoleted.
– Mico
Apr 3, 2020 at 8:28