다른 문자와 겹치는 문자를 쓰는 방법

다른 문자와 겹치는 문자를 쓰는 방법

같은 곳에 두 글자를 어떻게 쓸 수 있나요?

특히 화살표를 쓴 $\rightarrow$뒤 화살표가 글자를 관통하도록 글자를 쓰고 싶다. 비슷한 질문을 찾았습니다 (문자에 대한 범위 기호,문자를 다른 문자로 대체(Lualatex)등) 그러나 정확히 같은 질문은 아닙니다.

답변1

텍스트로 원하는지 수학으로 원하는지 명확하지 않습니다...

\documentclass{article}
\usepackage{stackengine}
\begin{document}
In te\stackengine{0pt}{x}{$\rightarrow$}{O}{c}{F}{T}{L}t...

$\ensurestackMath{\stackengine{0pt}{y}{\rightarrow}{O}{c}{F}{T}{L}} = mx + b$
\end{document}

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

또한 화살표의 너비를 고려하려는 경우 명확하지 않습니다.

\documentclass{article}
\usepackage{stackengine}
\begin{document}
In te\stackengine{0pt}{x}{$\rightarrow$}{O}{c}{F}{F}{L}t...

$\ensurestackMath{\stackengine{0pt}{y}{\rightarrow\!}{O}{c}{F}{F}{L}} = mx + b$
\end{document}

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

위에서 쉽게 조정할 수 있는 다른 항목으로는 수평 정렬(현재 중앙)과 화살표 배치의 수직 높이(현재 자연 높이에 배치)가 있습니다.

사용 사례에 대한 세부 사항이 결정되면 이를 매크로에 쉽게 캡슐화할 수 있습니다.

아래에서는 egregs에 맞춰 \overarrow수학 스타일을 유지하는 수학용 매크로 버전( )을 구현합니다.

\documentclass{article}
\usepackage{stackengine,scalerel}
\newcommand\overarrow[1]{\ThisStyle{\ensurestackMath{%
  \stackengine{0pt}{\SavedStyle#1}{\SavedStyle\rightarrow\!}{O}{c}{F}{F}{L}}}}
\begin{document}
$\overarrow{y} = mx_{\overarrow{z}} + b$
\end{document}

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

답변2

간단한 방법 \makebox[0pt]{..}으로 이를 달성할 수 있습니다. 실제 사용 사례에 따라 약간의 조정이 필요할 수 있습니다.

\documentclass[12pt,a4paper]{article}    
\begin{document}

$\makebox[0pt][l]{$\rightarrow$}A$

\end{document}

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

답변3

두 가지 버전의 텍스트는 다음과 같습니다.

\documentclass{article}

\DeclareRobustCommand{\asA}[1]{% arrow strike
  \leavevmode\begingroup
  \vphantom{#1}%
  \ooalign{\hidewidth$\mathsurround0pt\rightarrow$\hidewidth\cr#1\cr}%
  \endgroup
}
\DeclareRobustCommand{\asB}[1]{% arrow strike
  \leavevmode\begingroup
  \vphantom{#1}%
  \ooalign{$\mathsurround0pt\rightarrow$\cr\hidewidth#1\hidewidth\cr}%
  \endgroup
}

\begin{document}

st\asA{r}uck

st\asB{r}uck

\end{document}

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

수학의 경우:

\documentclass{article}

\makeatletter
\DeclareRobustCommand{\as}[1]{% arrow strike
  {\vphantom{#1}\mathpalette\erel@as{#1}}%
}

\newcommand{\erel@as}[2]{%
  \ooalign{\hfil$\m@th#1\rightarrow$\hfil\cr\hfil$\m@th#1#2$\hfil\cr}%
}
\makeatother

\begin{document}

$a+\as{b}+c_{\as{x}}$

\end{document}

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

답변4

약간의 유연성과 화살표가 통과하는 항목의 너비에 맞게 조정하려는 경우 를 사용할 수 있습니다 tikzmark.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\newcounter{atm}
\newcommand{\arrowthrough}[2][]{\stepcounter{atm}\tikzmarknode[path picture={
\draw[->,#1] (path picture bounding box.west) --
(path picture bounding box.east);}]{atm-\theatm}{#2}}
\begin{document}
 \arrowthrough{x}
 \[ E=\arrowthrough{m}c^2\]
 \arrowthrough[red,-latex]{Hello} \arrowthrough[latex-,thick,blue]{World!}
\end{document}

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

관련 정보