# \eqref making mistakes

Somwhere in preambula:

\renewcommand{\f}[2]{\frac{#1}{#2}}
\newcommand{\eqnl}[2]{\label{eq:#1} \eqn{#2}} %eqn is smthlike 
\newcommand{\eqf}[1]{\eqref{eq:#1}}


Text part:

Будем полагать, что
\eqnl{a}{\pf{y}{x}=f(x,y)}
непрерывна (!) и
\eqnl{b}{y=y(x)}
такова, что
\eqnl{c}{\pf{y}{x} \equiv f(x,y(x))\qquad ,x \in (a,b)}
Имеем \eqf{c} для каждой точки кривой.
\cent{Тут крутой график}
Функция \eqf{b}, удовлетворяющая \eqf{c}, ....


And here is what i get in output: (equations are here, everything is as planned til...)

Функция (2), удовлетворяющая (2), ....

How can it be? It should be Функция (2), удовлетворяющая (3). It's my second day with LaTeX and this is the first time it ever made me cry.

• Welcome to TeX.sx! My only guess would that \newcommand{\eqnl}[2]{\eqn{#2}\label{eq:#1}} should solve your problem - putting the \label after your \eqn. It would help though to see the full definition of \eqn by providing a minimal working example (MWE). – Werner Sep 26 '12 at 23:19
• #define is evil... – Xiè Jìléi Sep 28 '12 at 7:50

I recommend against using that kind of abbreviations that make the input file very confuse. Here's an edited version:

\documentclass[a4paper]{article}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{amsmath}

\begin{document}
Будем полагать, что
$$\label{eq:a} \frac{y}{x}=f(x,y)$$
непрерывна (!) и
$$\label{eq:b} y=y(x)$$
такова, что
$$\label{eq:c} \frac{y}{x} \equiv f(x,y(x)),\qquad x \in (a,b)$$
Имеем \eqref{eq:c} для каждой точки кривой.
\begin{center}
Тут крутой график
\end{center}
Функция \eqref{eq:b}, удовлетворяющая \eqref{eq:c}
\end{document}


that prints correctly. I guess that the definition of \eqnl you have is wrong.

Because of lack of a MWE … try putting \label inside your math environment:

\documentclass{article}
\usepackage{amsmath}
\newcommand{\eqnl}[2]{$$#2 \label{eq:#1}$$} %eqn is smthlike 
\newcommand{\eqf}[1]{\eqref{eq:#1}}

\begin{document}
\eqnl{a}{a}
\eqnl{b}{b}
\eqnl{c}{c}
\eqf{a}, \eqf{b}, \eqf{c}, ....
\end{document}