디센더(예: "y")가 줄과 겹치도록 서식이 지정된 텍스트에 고르게 밑줄을 긋습니다.

디센더(예: "y")가 줄과 겹치도록 서식이 지정된 텍스트에 고르게 밑줄을 긋습니다.

서식이 지정된 텍스트에 밑줄을 긋으려고 합니다.

내가하려는 일은 다음과 같습니다.

\usepackage{xcolor}
\usepackage{tikz}

\newcommand{\udensdot}[1]{%
    \tikz[baseline=(todotted.base)]{
        \node[inner sep=1pt,outer sep=0pt] (todotted) {#1};
        \draw[densely dotted] (todotted.south west) -- (todotted.south east);
    }%
}%

\newcommand{\ans}[1]{\udensdot{    
        \textcolor{blue}{\fontfamily{pzc}\selectfont{~#1~}}
    }
}
\begin{document}
I go to \ans{the} cinema in \ans{the} evening \ans{eventually}.
\end{document}

마지막 줄이 다른 줄 아래에 있는 다음과 같은 결과를 얻습니다.

결과 라인

모든 줄을 같은 수준에 두고 디센더(예: 여기서 "y")가 밑줄과 겹치도록 하고 싶지만 이를 달성하는 방법을 알 수 없습니다.

어떤 제안이 있으십니까?

답변1

이 그림과 같이 텍스트 문구의 파란색을 검은색 점으로 덮고 싶으십니까?:

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

그렇지 않은 경우 텍스트 줄의 기준선에 점이 있고 텍스트 구문의 파란색이 점의 검은색을 덮도록 하려면 로 노드를 만들고 \phantom선을 그린 다음 노드를 만들 수 있습니다. : 대신 텍스트 사용 \phantom:

\documentclass[border=6pt]{standalone}
\usepackage{xcolor}
\usepackage{tikz}

\newcommand{\udensdot}[1]{%
    \tikz[baseline=(todotted.base)]{
        \node[inner sep=1pt,outer sep=0pt] (todotted) {\phantom{\mbox{#1}}};
        \draw[densely dotted] (todotted.base west) -- (todotted.base east);
        \node at (todotted) [inner sep=1pt,outer sep=0pt] {\mbox{#1}};
    }%
}

\newcommand{\ans}[1]{\udensdot{%
        \textcolor{blue}{\fontfamily{pzc}\selectfont{~#1~}}%
    }%
}
\begin{document}
I go to \ans{the} cinema in \ans{the} evening \ans{eventually}.
\end{document}

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

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

답변2

TikZ에서 자신만의 밑줄을 만드는 대신 다음과 같은 패키지를 사용할 수 있습니다 lua-ul.

% !TeX TS-program = lualatex
\documentclass{article}
\usepackage{lua-ul}
\usepackage{xcolor}

\usepackage{fontspec}
\newfontfamily{\zapf}{Zapf Chancery}

\makeatletter
\newunderlinetype\beginUnderDot{\cleaders\hb@xt@ .44em{\hss\raisebox{-0.5ex}{.}\hss}}
\makeatother
\NewDocumentCommand\underDot{+m}{{\beginUnderDot#1}}

\newcommand{\ans}[1]{%
  {\zapf\underDot{~\textcolor{blue}{#1}~}}%
}
\begin{document}
I go to \ans{the} cinema in \ans{the} evening \ans{eventually}.
\end{document}

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

또는 ulem:

\documentclass{article}
\usepackage[normalem]{ulem}
\usepackage{xcolor}

\newcommand{\ans}[1]{%
  {\fontfamily{pzc}\selectfont\dotuline{~\textcolor{blue}{#1}~}}%
}
\begin{document}
I go to \ans{the} cinema in \ans{the} evening \ans{eventually}.
\end{document}

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

답변3

해결책은 명령에서 base west및 를 사용하는 것입니다 .base east\udensdot

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

\documentclass[border=6pt]{standalone}
\usepackage{xcolor}
\usepackage{tikz}

\newcommand{\udensdot}[1]{%
    \tikz[baseline=(todotted.base)]{
        \node[inner sep=1pt,outer sep=0pt] (todotted) {#1};
        \draw[densely dotted] (todotted.base west) -- (todotted.base east);
    }%
}

\newcommand{\ans}[1]{\udensdot{%
        \textcolor{blue}{\fontfamily{pzc}\selectfont{~#1~}}%
    }%
}
\begin{document}
I go to \ans{the} cinema in \ans{the} evening \ans{eventually}.
\end{document}

관련 정보