In my latex document I of course have the normal lower case letter "k" in the default font. What I want to do is add the script version of this, "𝓀", to my document. I am not sure if I need to find a new font type so I can have $\mathscr{k}$
return 𝓀 (or some other math font command like mathpzc or mathcal), or if I need to find a package that will add the 𝓀 as a separate character. In either case, I don't want to change anything else about my document. I only want to change $\mathscr{k}$
to give 𝓀 or add the character itself. I have no idea where to start.
2 Answers
You can borrow the math script alphabet from STIX2.
\documentclass{article}
\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix2}{m}{n}
\DeclareMathAlphabet{\mathscr}{LS1}{stix2scr}{m}{n}
\begin{document}
$\mathscr{k}k$ and also $\mathscr{A}+\mathscr{V}$
\end{document}
-
Thanks! Do you know where I could look to learn about the commands you used and their parameters?– Adam7557Commented Dec 7, 2020 at 15:42
Several packages allow you to use \mathscr{k}
in math mode. I recommend using unicode-math
in LuaLaTeX when you can, and legacy fonts when you have to.
Here is a MWE that sets up the Libertinus fonts through fontsetup
, which loads unicode-math
.
\documentclass{article}
\usepackage[libertinus]{fontsetup}
\pagestyle{empty}
\begin{document}
$\mathscr{k}k$ and also $\mathscr{A}+\mathscr{V}$
\end{document}
Any OpenType math font will support lowercase script letters, although some might not use the style you prefer. It is possible to substitute another font’s \mathscr
alphabet with the range=
option of \setmathfont
. This MWE substitutes the alternative \mathscr
alphabet of Stylistic Set 1 from STIX Two Math, which you will notice is less-heavily slanted.
\documentclass{article}
\usepackage[libertinus]{fontsetup}
\setmathfont{STIX Two Math}[
range={scr,bfscr},
Scale=MatchUppercase,
StylisticSet=1 ]
\pagestyle{empty}
\begin{document}
$\mathscr{k}k$ and also $\mathscr{A}+\mathscr{V}$
\end{document}
In PDFLaTeX, you can select any script alphabet that supports lowercase letters with mathalpha
, for example \usepackage[scr=boondoxo]{mathalpha}
.
\documentclass{article}
\usepackage[scr=boondoxo]{mathalpha}
\pagestyle{empty}
\begin{document}
$\mathscr{k}k$ and also $\mathscr{A}+\mathscr{V}$
\end{document}
-
Thanks this is great! I think I can work with this, or at least I have something to work off of. I think the range= option is probably what I'm looking for.– Adam7557Commented Dec 7, 2020 at 15:43