方程式のラベルと参照のスタイルを異なるものにするにはどうすればよいですか?

方程式のラベルと参照のスタイルを異なるものにするにはどうすればよいですか?

重複の可能性あり:
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および を使用している場合は、ラベルと括弧の両方を太字にするためにと を\eqref再定義する必要があります。\tagform@\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}

ここに画像の説明を入力してください

関連情報