«»(프랑스어 길레모트) 기호와 함께 특수 수학 괄호를 사용하고 싶습니다. 그런데 문제는 \mbox
또는 를 사용하여 정의하면 \text
주변 텍스트와 함께 이탤릭체로 표시된다는 것입니다.
\documentclass[12pt,a4paper]{letter}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\begin{document}
\newcommand{\fopen}{\mathopen\text{\guillemotleft}}
\newcommand{\fclose}{\mathclose\text{\guillemotright}}
\newcommand{\ff}[1]{\fopen #1\fclose}
\textbf{What I have}
With normal text $\ff{O:P:Q}$
{\itshape With text in italic $\ff{O:P:Q}$ } (guillemots in italic)
\textbf{What it should be}
With normal text $\ff{O:P:Q}$
{\itshape With text in italic} $\ff{O:P:Q}$
\end{document}
답변1
에 사용되는 글꼴은 \text
수학 공식이 시작될 때 적용되는 글꼴이므로 기울임꼴 문맥에서는 기울임꼴이 됩니다.
대신 다음을 사용하세요 \textnormal
.
\newcommand{\fopen}{\mathopen{\textnormal{\guillemotleft}}}
\newcommand{\fclose}{\mathclose{\textnormal{\guillemotright}}}
추가 중괄호도 참고하세요. 오류 메시지가 표시되지 않는 것은 구현 때문입니다. 아래 예에서는 명령이 존중하도록 만드는 방법도 추가합니다 \boldmath
.
\documentclass[12pt,a4paper]{letter}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{pdftexcmds}
\makeatletter
\newcommand{\normalorbold}{%
\ifnum\pdf@strcmp{\math@version}{bold}=\z@\bfseries\fi
}
\makeatother
\newcommand{\fopen}{\mathopen{\textnormal{\normalorbold\guillemotleft}}}
\newcommand{\fclose}{\mathclose{\textnormal{\normalorbold\guillemotright}}}
\newcommand{\ff}[1]{\fopen #1\fclose}
\begin{document}
\textbf{What I have}
With normal text $\ff{O:P:Q}$
{\itshape With text in italic $\ff{O:P:Q}$}
\textbf{What it should be}
With normal text $\ff{O:P:Q}$
{\itshape With text in italic} $\ff{O:P:Q}$
{\boldmath $\ff{O:P:Q}$}
\end{document}
기호 글꼴이 부족하지 않다면 다음과 같이 정의할 수 있습니다.
\documentclass[12pt,a4paper]{letter}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\DeclareSymbolFont{supplsymbols}{T1}{\familydefault}{m}{n}
\SetSymbolFont{supplsymbols}{bold}{T1}{\familydefault}{bx}{n}
\DeclareMathSymbol{\fopen}{\mathopen}{supplsymbols}{19}
\DeclareMathSymbol{\fclose}{\mathclose}{supplsymbols}{20}
\newcommand{\ff}[1]{\fopen #1\fclose}
\begin{document}
\textbf{What I have}
With normal text $\ff{O:P:Q}$
{\itshape With text in italic $\ff{O:P:Q}$}
\textbf{What it should be}
With normal text $\ff{O:P:Q}$
{\itshape With text in italic} $\ff{O:P:Q}$
{\boldmath $\ff{O:P:Q}$}
\end{document}