19

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 𝑋ₙ:

nice distinctive 𝒳

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

dull calligraphic X

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, FreeSerif symbol, 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?

Crosspost: http://latex.org/forum/viewtopic.php?p=112487 .

  • Technically, it was the txfonts package, not the mathptmx package, that was obsoleted by the newtxtext/newtxmath pair of font packages. – Mico Apr 1 at 19:44
  • @Mico ctan.org/pkg/mathptmx says, "The package is part of psnfss, but is reckoned to be obsolete. Users are recommended to switch to using newtx in its place." The Web page mentions txfonts only in "see also" . – Just_A_Man Apr 1 at 20:00
  • That last font could be my scribble for "9C". – rdtsc Apr 3 at 15:14
  • @rdtsc What is "9C"? – Just_A_Man Apr 3 at 15:23
  • i.stack.imgur.com/aE6Gx.png looks like "9C". – rdtsc Apr 3 at 15:32
15

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

enter image description here

\documentclass{article}
\usepackage{newtxtext,newtxmath}
\usepackage{mathrsfs}
\begin{document}
Let \(\mathscr{X}=\{X_1,\ldots,X_n\}\).
\end{document}
| improve this answer | |
  • 3
    Sure. The question is: as mathrsfs is extremely dated, is it still advisable to do so (for, say, long-term archival purposes)? – Just_A_Man Apr 1 at 11:32
  • 2
    @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 at 11:33
  • 2
    @Mico mirrors.ctan.org/macros/latex/contrib/jknappen/mathrsfs.sty has 1999 as filesystem date and 1996 as internal date. So, it has been several decades rather than years. – Just_A_Man Apr 1 at 11:35
  • Thanks for restoring! I'll enjoy what the others have to say here in comments. – Just_A_Man Apr 1 at 19:58
  • @Just_A_Man You are humble and generous... that is my wish. – Sebastiano Apr 1 at 20:01
30

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.

| improve this answer | |
  • 1
    This is the most elegant way to do it: a comprehensive, consistent interface with features like bold alphabets and scaling. – Davislor Apr 2 at 0:11
  • 1
    @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. – Vincent Apr 2 at 3:47
8

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}

enter image description here

| improve this answer | |
  • 3
    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? – Ulrike Fischer Apr 1 at 12:17
  • 2
    I have not rejected it. I asked a question in the comments, and he could agree or disagree (or, put neutrally, answer in one or the other way). I am happy with any solution if it has a chance to continue working within the next 10 years. I am just afraid that mathrsfs simply dies, e.g., developing some incompatibilities, while the rest of the LaTeX evolves. I don't care how the command is called exactly; you can name it \mathscript, for instance, if it helps. – Just_A_Man Apr 1 at 12:20
  • 4
    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. – Ulrike Fischer Apr 1 at 12:29
  • 3
    @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 at 13:05
  • 3
    @Mico That's why I wrote what I wrote concerning "this particular case". My negative experiences concerning "dated" were with ntheorem and xwatermark packages, just to give two examples. In more general software industry, you are generally well advised not to take a piece of software without a maintainer orelse you must be knowing well what you are doing. But yes, I'm ready to accept that the date of mathrsfs is not a problem if the folks here say so. – Just_A_Man Apr 1 at 13:27

Your Answer

By clicking β€œPost Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.