2

I'm typesetting a bunch of proofs and I want to follow a convention that whenever I introduce a premise it is numbered using a bold font (e.g. (1)), but then when I reference it in text it is written using normal font (e.g. (1)). However, I'm having problems with equations. I figured out how to customize style of equation tag to make it bold, but then when I reference that equation using \ref that reference is also in bold. Here's a minimal example:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
2 + 2 = 4
\refstepcounter{equation}\tag*{\textbf{(\theequation)}}
\label{foo}
\end{equation}

Reference to equation \ref{foo} is now in bold but I want it to be (1).

\end{document}

Above code produces:

result

How do I make the reference using a normal (non-bold) font?

2 Answers 2

1

One could change tag forms with the help of mathtools but this wouldn't help here directly since the current tag form would influence also the reference, which is what you do not want. One might change the tag form only in displayed equations and restore it to the default afterwards, but I'm not as comfortable in hacking into mathtools as I am with amsmath.

\documentclass[twocolumn]{article} % twocolumn for smaller snapshot

\usepackage{amsmath}

\makeatletter
\renewcommand{\eqref}[1]{\textup{(\ignorespaces\ref{#1}\unskip\@@italiccorr)}}
\def\maketag@@@#1{\hbox{\m@th\normalfont\bfseries#1}}
\makeatother

\begin{document}

\begin{align}
2 + 2 &= 4 \label{foo} \\
1 + 3 &= 4 \label{bar} \tag{test 1} \\
2 + 3 &= 5 \label{baz} \tag*{test 2} \\
3 + 3 &= 6 \label{bla} \tag{$*$}
\end{align}
Compare \ref{foo} and \eqref{foo};
\ref{bar} and \eqref{bar};\\
\ref{baz} and \eqref{baz};
\ref{bla} and \eqref{bla}
\end{document}

enter image description here

Note that the asterisk is of course not bold; if you need something like that, you'll have to make it bold yourself.

3
  • Thanks! This works but I see a potential problem. This doesn't allow me to control whether I want the tag to be in bold or not. At the moment I only need tags that are in bold, but I imagine this becoming a problem if I ever happen to need normal (non-bold) tags as well. Any way to fix that? Mar 3, 2021 at 11:21
  • 1
    @JanStolarek You could switch between the \maketag@@@ redefined as above and the original one while keeping the redefined \eqref. But if you really need to switch a lot it might be worth to look into the mathtools solution.
    – campa
    Mar 3, 2021 at 11:24
  • Thanks. That works sufficiently well for my purposes :-) Mar 3, 2021 at 11:56
-2

You are using amsmath, so you can use the command \eqref{foo} instead of \ref{foo}. That will generate the equation number in parentesis non-bolded. Theres also no need for anything in the equation environment besides \label{foo} this way.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
  2 + 2 = 4
  \label{foo}
\end{equation}

Reference to equation \eqref{foo}.

\end{document}

enter image description here

1
  • That doesn't work. I need the equation tag to be in bold font, which plain \label{foo} doesn't do. And if I use \tag*{...} then \eqref produces a bolded reference with a double pair of parentheses. Feb 20, 2021 at 10:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .