7

This question already has an answer here:

Does anyone knows how can I use square brackets instead of parenthesis when numbering my equations?

I used this command:

\begin{equation}
y = 2x
\end{equation}

enter image description here

The number appears on the right hand side like (1) I want to make it [1].

Does anyone have any ideas?

marked as duplicate by Werner, user31729, user13907, ChrisS, Svend Tveskæg Apr 25 '15 at 6:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I want to make it [1]. In square bracket not in parenthesis – user161260 Apr 24 '15 at 11:35
  • How do you want to refer to those equations? With [1] too? – user31729 Apr 24 '15 at 11:36
  • See mathtools, one of its features is to control the formatting of the equation number. – daleif Apr 24 '15 at 11:37
10

This is much simpler if you load mathtools, an add-on package for amsmath:

\documentclass{article}

\usepackage{mathtools}

\newtagform{brackets}{[}{]}
\usetagform{brackets}

\begin{document}

  \begin{equation}\label{eq:test}
    y = 2x
  \end{equation}

  See eq~\eqref{eq:test}.
\end{document}

Result: enter image description here

  • For some reason I can't download the mathtools. I check to package manager (Admin) but it's not there – user161260 Apr 24 '15 at 13:07
  • mathtools is part of texlive and i think of miktex too – MaxNoe Apr 24 '15 at 13:08
  • tex.stackexchange.com/a/187728/59716 – MaxNoe Apr 24 '15 at 13:12
4

If package amsmath is loaded, then it uses \tagform@ for the formatting of the equation number:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\def\tagform@#1{\maketag@@@{[\ignorespaces#1\unskip\@@italiccorr]}}
\makeatother

\begin{document}
\begin{equation}
  \label{eq:y=2x}
  y = 2x
\end{equation}
Equation \eqref{eq:y=2x}.
\end{document}

Result

Standard LaTeX uses \@eqnum for this purpose:

\makeatletter
\renewcommand*{\@eqnnum}{{\normalfont \normalcolor [\theequation]}}
\makeatother

Not the answer you're looking for? Browse other questions tagged or ask your own question.