Math & ScienceHow to customize equation referencing?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
niek
Posts: 6
Joined: Sat May 15, 2010 3:32 pm

How to customize equation referencing?

Post by niek »

Dear all,

I would like to ease my referencing to equations in an article I am working on. Currently I use this:

Code: Select all

Equation (\ref{eq1})
... to produce "Equation (1)".

Is there a way to simply type something like this:

Code: Select all

\ALTERNATIVEref{eq1}
... to produce "Equation (1)", or perhaps something like this:

Code: Select all

Equation \ANOTHERref{eq1}
... to produce "Equation (1)", that is, with the number of the equation automatically put within parentheses?


I hope to hear from you.

Thank you,

Niek

Recommended reading 2024:

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

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

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

How to customize equation referencing?

Post by meho_r »

If you're using amsmath package, all you have to do is to use \eqref instead of \ref command.

Or, if you're not using amsmath, you may define a new command:

Code: Select all

\newcommand{\eqref}[1]{(\ref{#1})}
Last edited by meho_r on Tue Jun 08, 2010 3:02 pm, edited 1 time in total.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to customize equation referencing?

Post by gmedina »

Hi, Niek
niek wrote:...
Is there a way to simply type something like this:

Code: Select all

\ALTERNATIVEref{eq1}
... to produce "Equation (1)",...
An example using the cleveref package:

Code: Select all

\documentclass{article}
\usepackage{cleveref}

\begin{document}

\begin{equation}\label{equ:test}
  a=b
\end{equation}

\Cref{equ:test} shows that...

As we can see from \cref{equ:test}...

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
niek
Posts: 6
Joined: Sat May 15, 2010 3:32 pm

Re: How to customize equation referencing?

Post by niek »

Thank you both!

This is really helpful.


Cheers,

Niek
Post Reply