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

대신 \underrightarrow 명령을 사용하는 것이 어때요? 예를 들면 다음과 같습니다.

\underrightarrow{\mho}

획득:

밑줄 친 모호

여러 문자/표현에도 밑줄을 긋을 수 있습니다.

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

밑줄 표현

하지만 여러 글자와 함께 이것을 자주 사용하지는 않을 것입니다.

답변2

가능한 해결책은 다음과 같습니다.

\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:이제 화살표 스타일을 선택적 인수로 변경할 수 있습니다.

관련 정보