텍스트 라벨링 및 설명을 위한 환경

텍스트 라벨링 및 설명을 위한 환경

다음과 같이 텍스트에 레이블을 지정할 수 있는 tex 환경을 찾고 있습니다.여기에 이미지 설명을 입력하세요 '라벨'이라는 단어가 이미 사용 중이므로 Google에서 해결책을 찾는 방법을 모르겠습니다. 누구든지 아이디어가 있나요? 어쩌면 tikz 솔루션이 있을까요?

답변1

이를 위해 간단한 매크로를 정의할 수 있습니다.

\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\newcommand{\yourcmd}[3]{%
    \begin{center}
    \begin{tikzpicture}
        \node[inner xsep=0pt,inner ysep=1pt,red] (a) {#1};
        \draw[red] (a.south west)--(a.south east);
        \coordinate (a1) at (a.south);
        \node[inner xsep=0pt,right=0pt of a] (b) {#2};
        \node[inner xsep=0pt,inner ysep=1pt,right=0pt of b,green!50!black] (c) {#3};
        \draw[green!50!black] (c.south west)--(c.south east);
        \coordinate (c1) at (c.south);
        \draw[red] ($(a1)+(-110:0.1)$)--($(a1)+(-110:1)$) node[fill=white,font=\tiny\sffamily,inner sep=2pt] {Some text};
        \draw[green!50!black] ($(c1)+(-70:0.1)$)--($(c1)+(-70:1)$) node[fill=white,font=\tiny\sffamily,inner sep=2pt] {Hello world};
    \end{tikzpicture}
    \end{center}
}
\begin{document}
\lipsum[1]

\yourcmd{12}{34567}{8910}

\lipsum[2]
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보