あなたのIsにハートを点在させることは可能ですか?

あなたのIsにハートを点在させることは可能ですか?

デフォルトの LaTeX フォントの mathmode i だけを、ほぼ同じ文字で、i のドットが小さなハートになっているものに置き換えることは可能でしょうか。例:

ここに画像の説明を入力してください

ありがとう!

答え1

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}

ここに画像の説明を入力してください

マクロはどのように動作するのでしょうか? まず、4 つの引数を持つための mathpalette のトリックをいくつか紹介します。

  1. いつも通り、現在の数学スタイル
  2. 文字をタイプセットする文字なので\imath\jmath
  3. ハートの前の(数学の)カーン
  4. 組み合わせ後の数学カーンは、心臓の突出を補正するために考慮されていないため、\hidewidth

ハートを文字に重ねたウィズを中に入れています\vbox\ialign

最後に、ハートは、\heartsuit縮小とせん断を適用するアフィン変換の対象となる適切な数学スタイルの太字です。

おそらく、さまざまなパラメータについてさらに実験が必要になるでしょう。

答え2

ここに画像の説明を入力してください

\documentclass{article}
\begin{document}
$2\pi{\mathop{{}\imath}\limits^{\scriptscriptstyle\heartsuit}}$
\end{document}

答え3

ムウェ

\documentclass{article}
\usepackage{amsmath,graphicx}
\newcommand\iheart[1][\imath]{%
#1\kern-.2em\rlap{%
\raisebox{1.2ex}[0pt][0pt]{%
\rotatebox{-15}{%
\resizebox{.5ex}{.5ex}{\ensuremath{\heartsuit}}}}}\kern.2em} 
\begin{document}
\Huge  \[ 2\pi ii\iheart ii  =  2\pi\iheart[\jmath] \]
\end{document}

関連情報