tikz を使用して矢印付きの下線を引く

tikz を使用して矢印付きの下線を引く

行間を空けるために余分なスペースを追加せずに、数学オブジェクトに矢印(tikzから)で下線を付けたいのですが、次のようにします。

The object C has an underline with an arrowhead
from tikz. The only problem  is the extra space
between the lines.

現時点では、次のコード(MWE)を使用しています

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,decorations.markings}
\newcommand{\subtodisplay}{%
  {\tikz[baseline=-2ex] \draw[-stealth,line width=.4pt] (.3ex,0ex) -- (1.7ex,0ex);}
}

\begin{document}
The object $\mathop{C}\limits_{\subtodisplay}$ has an underline with an 
arrowhead from tikz. The only problem is the extra space between the lines,
which becomes apparent when adding extra text to get at least three lines.
\end{document}

下付き文字/上付き文字による余分なスペースが問題になることがよくあります。行間を強制する方法はありますか? この場合、余分なスペースは明らかに必要ありません。

矢印付きの下線

(通常は 1 つの文字に下線を引くだけなので、サイズは固定できますが、可変幅で機能する回答があれば歓迎します。)

答え1

代わりに \underrightarrow コマンドを使用してみませんか? たとえば次のようになります。

\underrightarrow{\mho}

入手方法:

下線矢印 mho

複数の文字や表現に下線を引くこともできます。

\underrightarrow{\mho+\sum^{n}_{i=1}K=0+\Psi}

下線表現

しかし、複数の文字でこれを使用することはあまりありません

答え2

考えられる解決策の 1 つを以下に示します。

\documentclass[varwidth,border=50]{standalone}
\usepackage{tikz}
\usepackage{blindtext}

\newcommand{\tikzunderarrow}[2][red]{\tikz[baseline={(N.base)}]{
  \node[inner sep=0, outer sep=0](N) {#2};
  \draw[overlay, -latex, line width=.04em, #1]
    ([yshift=-.14em]N.south west) -- ([yshift=-.14em]N.south east);}}

\begin{document}
  A test sentence : \tikzunderarrow{ypqj to ckeck if it is ok ;)}.
  \blindtext

  And we check with math formula \tikzunderarrow{$\left[ \sqrt{x^2+y^2} \right]$},
  and a {\Large \tikzunderarrow[purple,|-stealth]{Large}} underarrow.
\end{document}

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

編集:Peter Grill の提案に従って、overlayノード内のテキストと同じ垂直サイズを維持するように追加しました。

編集2:垂直距離が適切であることを示すために、ブラインド テキストを追加しました。

編集3:Paul Gaborit と Earthliŋ の提案に従って、inner xsep=0に置き換えましたinner sep=0。これで、この回答はコミュニティ ウィキになりました。

編集4:そして、オプションの引数として矢印のスタイルを変更できるようになりました。

関連情報