10

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?

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

2 Answers 2

15

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

3
  • For some reason I can't download the mathtools. I check to package manager (Admin) but it's not there
    – user161260
    Commented Apr 24, 2015 at 13:07
  • mathtools is part of texlive and i think of miktex too
    – MaxNoe
    Commented Apr 24, 2015 at 13:08
  • tex.stackexchange.com/a/187728/59716
    – MaxNoe
    Commented Apr 24, 2015 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 .