![위 첨자가 배치되는 위치를 변경하지 않고 관계 위에 기호 배치](https://rvso.com/image/449632/%EC%9C%84%20%EC%B2%A8%EC%9E%90%EA%B0%80%20%EB%B0%B0%EC%B9%98%EB%90%98%EB%8A%94%20%EC%9C%84%EC%B9%98%EB%A5%BC%20%EB%B3%80%EA%B2%BD%ED%95%98%EC%A7%80%20%EC%95%8A%EA%B3%A0%20%EA%B4%80%EA%B3%84%20%EC%9C%84%EC%97%90%20%EA%B8%B0%ED%98%B8%20%EB%B0%B0%EC%B9%98.png)
위 첨자가 배치되는 위치를 변경하지 않고 관계 위에 기호를 배치하고 싶습니다.
\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{accents}
\newcommand{\rel}{\rhd}
\newcommand{\symb}{\text{I}}
\newcommand{\testmyrel}[1]{%
\begin{center}%
\begin{minipage}{\linewidth/2}%
\noindent Text text text\\%
$\text{T} #1^* \text{U}$\\%
$\text{T} \rel^* \text{U}$\\%
\end{minipage}%
\end{center}%
}%
\begin{document}
My goal is to place a symbol (e.g. $\symb$) over a rel (e.g. $\rel$) that can be used in text without overlapping with text above, and handles superscripts as if it did not have a symbol:
\begin{center}%
\begin{minipage}{\linewidth/2}%
\noindent Text text text\\%
$\text{T} \mathrel{\overset{\symb}{\rel}\vphantom{\rel}^*} \text{U}$\\%
$\text{T} \rel^* \text{U}$\\%
\end{minipage}%
\end{center}%
However, I do not want the superscript to be an argument of the command, which rules out the code above.
\begin{itemize}
\item Using overset makes the star too high:%
\testmyrel{%
\mathrel{%
\overset{%
\symb%
}{%
\mathord{\rel}%
}%
}%
}%
%
\item Smashing the rel makes it go over the text:%
\testmyrel{%
\mathrel{%
\smash{
\overset{\symb}{\mathord{\rel}}%
}%
}%
}%
%
\item Smashing the symbol makes it go over the text:%
\testmyrel{%
\mathrel{%
\overset{%
\smash{\symb}%
}{%
\mathord{\rel}%
}%
}%
}%
%
\item Adding a vphantom inside mathrel leads to the star being too high:%
\testmyrel{%
\mathrel{%
\overset{\symb}{\mathord{\rel}}%
\vphantom{\symb}%
}%
}%
%
\item Adding a vphantom after mathrel leads to the star being misplaced to the right:%
\testmyrel{%
\mathrel{%
\overset{\symb}{\mathord{\rel}}%
}%
\vphantom{\symb}%
}%
\item Accentset without mathrel does not have the spacing due to mathrel:
\testmyrel{%
\accentset{\symb}{\mathord{\rel}}%
}%
\item Accentset with mathrel puts the star too high:
\testmyrel{%
\mathrel{\accentset{\symb}{\mathord{\rel}}}%
}%
\end{itemize}
\end{document}
답변1
\text
수학에서 직립형으로 조판하는 데 사용하지 마세요 . 일반적으로 작동하지 않습니다. 사용 \mathrm
.
도\rhd
~ 아니다관계 기호이지만 그렇게 만드는 것은 어렵지 않습니다.
\documentclass{article}
\usepackage{amsmath,amssymb,accents}
% \rhd is not a relation symbol
\mathchardef\rel=\numexpr\rhd+"1000
\newcommand{\overrel}[2]{%
\mathrel{\accentset{#1}{#2}}%
\mathrel{\vphantom{#2}}%
}
\begin{document}
\begin{center}
Text text text\\
$T \overrel{\mathrm{I}}{\rel}^* U$\\
$T \rel^* U$
\end{center}
\end{document}
또는 다음을 사용하여 \overset
:
\newcommand{\overrel}[2]{%
\overset{#1}{#2}%
\mathrel{\vphantom{#2}}%
}
비결은 TeX가 연속 관계 원자 사이에 공백이나 줄 바꿈 지점을 추가하지 않는다는 것입니다. 따라서 우리는 가상 관계에 아래 첨자/위 첨자를 추가할 수 있습니다.