Possible to dot your Is with hearts?
https://tex.stackexchange.com/questions/716175/possible-to-dot-your-is-with-hearts
Why not also j?
\documentclass{article}
\usepackage{amsmath}
\usepackage{l3draw}
\makeatletter
\NewDocumentCommand{\iheart}{}{\mathord{\mathpalette\iheart@{\imath{7}{1}}}}
\NewDocumentCommand{\jheart}{}{\mathord{\mathpalette\iheart@{\jmath{12}{2}}}}
\newcommand{\iheart@}[2]{\iheart@@#1#2}
\newcommand{\iheart@@}[4]{%
\vbox{\m@th\offinterlineskip
\sbox\z@{$\mkern1mu$}%
\ialign{##\cr\hidewidth\smallheart@{#1}{#3}\hidewidth\cr\noalign{\kern\wd\z@}\cr$#1#2$\cr}%
}%
\mkern#4mu
}
\ExplSyntaxOn
\cs_new_protected:Npn \smallheart@ #1 #2
{
\draw_begin:
\draw_transform_matrix_absolute:nnnn { 0.4 } { 0 } { 0.2 } { 0.3 }
\draw_path_moveto:n { 0cm, 0cm }
\hbox_set:Nn \l_tmpa_box { \boldmath$#1\mkern#2mu\heartsuit$ }
\draw_box_use:N \l_tmpa_box
\draw_end:
}
\ExplSyntaxOff
\makeatother
\begin{document}
$2\pi\iheart_{\jheart}+\jheart$
\end{document}
How do the macros work? First off, some mathpalette trickery to have four arguments:
- the current math style, as usual
- the letter to be typeset, so either
\imath
and\jmath
- the (math) kern in front of the heart
- the math kern after the combination, to compense for the protrusion of the heart which is not taken into account because of
\hidewidth
I make a \vbox
with \ialign
inside it that oversets the heart to the letter.
Finally, the heart is a bold \heartsuit
in the suitable math style subject to an affine transformation that applies reduction and shearing.
Maybe some more experiments are needed for the various parameters.