logo

LaTeX에서 \mathrm, \text, \operatornane의 차이점 📂논문작성

LaTeX에서 \mathrm, \text, \operatornane의 차이점

\mathrm, \text

\begin{array}{cc}
\mathrm{sin}(\mathrm{mathrm}) & \text{sin}(\text{text})
\end{array}

$$ \begin{array}{cc} \mathrm{sin}(\mathrm{mathrm}) & \text{sin}(\text{text}) \end{array} \\[1em] \text{basic font: abcdefghijklmnopqrstuvwxyz} $$

기본 설정에서 보면 \mathrm과 \text의 렌더링에는 별 차이가 없어 보인다. 그것은 기본 글씨체가 \mathrm과 똑같이 때문이다. \mathrm은 정확하게 로만체로 렌더링하고, \text는 설정한 폰트를 따라간다. 따라서 폰트를 바꿔주면 렌더링 결과는 다음과 같다.

$$ \begin{array}{cc} \mathrm{sin}(\mathrm{mathrm}) & \textsf{sin}(\textsf{text}) \end{array} \\[1em] \textsf{basic font: abcdefghijklmnopqrstuvwxyz} $$

\operatorname

\mathrm과 \text는 '문자'를 렌더링 해주는 것이고, \operatorname은 이름 그대로 오퍼레이터로써 보여질 수 있게 렌더링 해주는 것이다. 예시로 사인함수를 네 방법으로 렌더링하면 다음과 같다.

\begin{array}{cccc}
a\mathrm{sin}x & a\text{sin}x & a\operatorname{sin}x & a\sin x \\
(\text{mathrm}) & (\text{text}) & (\text{operatorname}) & (\text{sin})
\end{array}

$$ \begin{array}{cccc} a\mathrm{sin}x & a\text{sin}x & a\operatorname{sin}x & a\sin x \\ (\text{mathrm}) & (\text{text}) & (\text{operatorname}) & (\text{sin}) \end{array} $$

\mathrm, \text의 경우 는 이게 asinx인지 a sin x인지 구별되지 않는 반면, \operatorname의 경우 sin 부분이 하나의 오퍼레이터를 의미한다는 것을 알아보기 쉽다.

\operatorname*

뒤에 $\ast$를 추가하면 인라인모드에서는 차이가 없지만, 디스플레이모드에서는 첨자가 위 아래로 이동한다.

\operatorname{Proj}\_{a}^{b} \quad \operatorname*{Proj}\_{a}^{b}

$$ {\textstyle \operatorname{Proj}_{a}^{b} \quad \operatorname*{Proj}_{a}^{b}}\quad (\text{ inline mode}) $$

$$ \operatorname{Proj}_{a}^{b} \quad \operatorname*{Proj}_{a}^{b}\quad (\text{ display mode}) $$