GeneralCustomize layout of equation numbering to include text

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
User avatar
FreddieWidgeon
Posts: 7
Joined: Fri Jun 01, 2007 4:31 pm

Customize layout of equation numbering to include text

Post by FreddieWidgeon »

Can anyone help please? I need to number equations using the format:
Equation 1.1
Equation 1.2
Equation 1.3
etc. (where the first digit is the chapter number).

I know that to achieve the numbering within chapters I should just need to add:

Code: Select all

\numberwithin{equation}{chapter}
to the preamble but can anyone please help me with Latex code to reformat the equation number to include the word "Equation"?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm

Customize layout of equation numbering to include text

Post by Ted »

There are a number of ways to do this (note: you'll still need to use numberwithin as you have already done).

The oldest way is from the varioref package. See the documentation. You can do something like...

Code: Select all

\labelformat{equation}{Equation~#1}
Alternatively, you could try using hyperref, which includes the macros autoref and autoref*. Both do exactly what you want (and you can customize how it does it), but the former hyperlinks the reference to the equation and the latter does not.

The newest way is to use cleveref. It is highly customizable. See its documentation. It actually gives a little history of many of the other automatic referencing packages, including varioref.

Search this forum for terms like cleveref, varioref, and autoref. A number of recent posts have answered this question (and more).
-- Ted [home/blog]
User avatar
FreddieWidgeon
Posts: 7
Joined: Fri Jun 01, 2007 4:31 pm

Re: Customize layout of equation numbering to include text

Post by FreddieWidgeon »

I'm really sorry about this Ted but I think I must be missing something. After reading the documentation for the varioref, hyperref and cleveref pacakges it looks to me like they only change the text in references to items such as equations or figures. What I'm looking to do is replace the default numbering system of (1), (2), (3), etc. which are displayed next to the equations into the words Equation 1.1, Equation 1.2, Equation 1.3, etc. I can't see anything in the options for the three packages which will let me do this.

Given my lack of experience with Latex I guess the options to do this must be staring me in the face but I can't see them.
User avatar
pumpkinegan
Posts: 91
Joined: Thu May 03, 2007 10:29 pm

Customize layout of equation numbering to include text

Post by pumpkinegan »

Try redefining the equation counter in the document preamble:

Code: Select all

\renewcommand{\theequation}{Equation \thechapter.\arabic{equation}}
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Customize layout of equation numbering to include text

Post by gmedina »

Here (page 61) is the answer to your question.
Just add (in your document preamble) the macro and the line pumpkinegan suggested.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
countbela666
Posts: 64
Joined: Thu Apr 26, 2007 2:44 pm

Customize layout of equation numbering to include text

Post by countbela666 »

gmedina wrote: Here (page 61) is the answer to your question.
The document you linked to is quite outdated. The latest version can be obtained from CTAN: http://tug.ctan.org/tex-archive/info/ma ... /mathmode/

Regards
Marcel
Listen to me children of the night, beyond the doors of darkness you will find
a thousand worlds for you to see here, take my hand and follow me...
User avatar
FreddieWidgeon
Posts: 7
Joined: Fri Jun 01, 2007 4:31 pm

Re: Customize layout of equation numbering to include text

Post by FreddieWidgeon »

8) Excellent! Thanks.
Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm

Customize layout of equation numbering to include text

Post by Ted »

FreddieWidgeon wrote:I'm really sorry about this Ted but I think I must be missing something. After reading the documentation for the varioref, hyperref and cleveref pacakges it looks to me like they only change the text in references to items such as equations or figures. What I'm looking to do is replace the default numbering system of (1), (2), (3), etc. which are displayed next to the equations into the words Equation 1.1, Equation 1.2, Equation 1.3, etc. I can't see anything in the options for the three packages which will let me do this.
From varioref:

Code: Select all

\labelformat{equation}{Equation~(#1)}
will cause every \ref to automatically add "Equation" in front as well as parentheses around the reference.

Something I do frequently is

Code: Select all

\labelformat{equation}{\textup{(#1)}}
and then use \autoref (from hyperref package) to add the "Equation". So, \autoref{eq} produces "Equation~(2.2)" adn \ref{eq} produces "(2.2)".
-- Ted [home/blog]
Post Reply