GeneralLabelling equations

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Labelling equations

Post by avp3000 »

Hello,

When I write an equation, I also label it like this:

Code: Select all

Code, edit and compile here:
\begin{equation}
\frac{dA_t}{dk}=\frac{d\tau_t/dk-C_{AH}(\cdot)dH_t/dk+\mu_t \Psi_A(\cdot)}{C_{AA}(\cdot)}\label{test_label}
\end{equation}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Than, when at some point of my text I use \ref{test_label}, than I get, say "equation 12". However, at one point it happened to me, that I got only "12" instead of "equation 12". I hadn't changed any settings in the preamble (of course, I would have seen that, because that would have affected the previous \ref 's as well, which is not the case). Do you have any ideas why this happened? Also, do you know how the options for what is displayed when \ref is used be controled. For example, since I got "equation 12", I expected that I would get "figure 12", when I use \ref with labels of figures, but I again got just the number.

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10344
Joined: Mon Mar 10, 2008 9:44 pm

Labelling equations

Post by Stefan Kottwitz »

Hi,

there's information missing. With your code I will also get just the number of the equation when I use \ref.
Show us, how you get "equation 12", perhaps your preamble or a minimal working example. There can be different ways.

Stefan
LaTeX.org admin
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Labelling equations

Post by avp3000 »

Sorry, guys, that was a dumb mistake. It appears that I have written the "equation" part manually and that \ref has all the time produced only the number. Never mind, I'm still interested in the question, if there is some more extensive use of \ref than only the number.

Cheers and once again sorry for the donfusion,
Alex

P.S. This is my preamble:

Code: Select all

Code, edit and compile here:
\documentclass[12pt]{article}
\usepackage[a4paper,pagesize]{typearea}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{color}
\usepackage{graphicx}
\usepackage{eurosym}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{blindtext}
\usepackage{url}
\usepackage[authoryear,longnamesfirst,comma]{natbib}
\usepackage{mathrsfs}
\usepackage{tikz}
\usepackage{wrapfig}
\usepackage[small,bf]{caption}
\usepackage{subfig}
\newcommand{\bi}{\begin{itemize}}
\newcommand{\ei}{\end{itemize}}
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\tr}{\toprule[1.5pt]}
\newcommand{\mr}{\midrule}
\newcommand{\br}{\bottomrule[1.5pt]}
\newcommand{\superscript}[1]{\ensuremath{^{\textrm{#1}}}}
\newcommand{\subscript}[1]{\ensuremath{_{\textrm{#1}}}}
\newcommand{\scaption}[1]{\caption{\tiny{#1}}}
\definecolor{myorange}{rgb}{1.00,0.60,0.16}
\definecolor{mygray}{rgb}{0.75,0.75,0.75}
\linespread{1.3}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User avatar
Stefan Kottwitz
Site Admin
Posts: 10344
Joined: Mon Mar 10, 2008 9:44 pm

Labelling equations

Post by Stefan Kottwitz »

Hi Alex,

you could use the cleveref package. Have a look at this example:

Code: Select all

Code, edit and compile here:
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\usepackage{cleveref}
\begin{document}
\begin{equation}
\frac{dA_t}{dk}=\frac{d\tau_t/dk-C_{AH}(\cdot)dH_t/dk+
\mu_t \Psi_A(\cdot)}{C_{AA}(\cdot)}\label{test_label}
\end{equation}
\begin{figure}
\centering Text\caption{Test}\label{fig1}
\end{figure}
See \cref{test_label} and \cref{fig1}.
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
You can change the reference names, for example insert those lines to change the appearance of equation references:

Code: Select all

Code, edit and compile here:
\crefname{equation}{equation}{equations}
\Crefname{equation}{Equation}{Equations}
\creflabelformat{equation}{\textup{(#2#1#3)}}
\crefrangelabelformat{equation}{\textup{(#3#1#4)}--\textup{(#5#2#6)}}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Stefan
LaTeX.org admin
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Re: Labelling equations

Post by avp3000 »

Thank you very very much :-)
Post Reply