可能的重複:
使用 amsmath 變更方程式編號的外觀
我需要能夠將方程式的標籤設為粗體,但同時我需要對這些方程式的引用,以便在文字的其餘部分中具有正常的樣式。
這是我嘗試過的:
\let\theoldequation\theequation
\renewcommand*{\theequation}{\textbf{\theoldequation}} % bold equation numbers
和這個(使用etoolbox
包)
\pretocmd{\theequation}{\textbf}{}{}
輸出:
為了解決這個問題,我用谷歌搜尋了很多,只能得到以下試驗:
\renewcommand{\eqref}[1]{\textnormal{(\ref{#1})}}
和
\let\oldeqref\eqref
\renewcommand*{\eqref}{\textnormal{\oldeqref}} % bold equation numbers
和
\pretocmd{\eqref}{\textnormal}{}{}
最後一個:
\patchcmd{\eqref}{\textbf}{\textnormal}{}{}
但沒有一個產生我需要做的事情。你能給出這個問題的解決方案嗎?
答案1
如果您使用amsmath
and \eqref
,則需要重新定義\tagform@
and\eqref
將標籤和括號都以粗體顯示:
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\def\tagform@#1{\maketag@@@{\bfseries(\ignorespaces#1\unskip\@@italiccorr)}}
\renewcommand{\eqref}[1]{\textup{{\normalfont(\ref{#1}}\normalfont)}}
\makeatother
\begin{document}
\begin{equation}\label{eq:test}
a + b = c.
\end{equation}
See equation~\eqref{eq:test}
\end{document}
如果只需要將標籤加粗,那麼您可以說:
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\def\tagform@#1{\maketag@@@{(\ignorespaces\textbf{#1}\unskip\@@italiccorr)}}
\renewcommand{\eqref}[1]{\textup{{\normalfont(\ref{#1}}\normalfont)}}
\makeatother
\begin{document}
\begin{equation}\label{eq:test}
a + b = c.
\end{equation}
See equation~\eqref{eq:test}
\end{document}
答案2
重新定義\@eqnnum
。 (編輯:正如 Torbjørn T. 指出的那樣,如果作為 OP 使用 ,則這不起作用amsmath
。)
\documentclass{article}
\makeatletter
\def\@eqnnum{{\normalfont\normalcolor\bfseries(\theequation)}}
\makeatother
\begin{document}
\begin{equation}\label{eq:test}
a^2 + b^2 = c^2
\end{equation}
See equation~\ref{eq:test}.
\end{document}