색상 추가를 위한 서식 지정 명령 재정의

색상 추가를 위한 서식 지정 명령 재정의

문서를 작성 중인데 굵은 텍스트를 모두 빨간색으로 표시하고 싶습니다. 명령이 래핑되도록 어떻게 명령 renewcommand을 내릴 수 있는지 궁금합니다 .textbf\textcolor{red}

감사해요

답변1

기본 정의는 textbf다음과 같습니다.

\DeclareTextFontCommand{\textbf}{\bfseries}

새로운 기능을 추가하려면 간단히 추가하면 됩니다.\color{red}

\DeclareTextFontCommand{\textbf}{\bfseries\color{red}}

\DeclareTextFontCommand오류 없이 원래 정의를 재정의합니다. 당신은 다음을 통해서만 정보를 얻습니다.\@latex@info

전체 MWE는 다음과 같습니다.

\documentclass[]{article}

\usepackage[T1]{fontenc}
\usepackage{xcolor}
\DeclareTextFontCommand{\textbf}{\bfseries\color{red}}
\begin{document}
text \textbf{foo} bar
\end{document}

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

관련 정보