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 Commented Apr 24, 2015 at 11:35
  • How do you want to refer to those equations? With [1] too? Commented Apr 24, 2015 at 11:36
  • See mathtools, one of its features is to control the formatting of the equation number. 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 Commented Apr 24, 2015 at 13:07
  • mathtools is part of texlive and i think of miktex too Commented Apr 24, 2015 at 13:08
  • tex.stackexchange.com/a/187728/59716 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 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.