Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have an unnumered section in a document, defining notation for the further contents. Since it's unnumbered, the equations within are labelled: '(1)', etc.

For example:

\documentclass[12pt]{book}
\begin{document}
\chapter*{Notation}
\label{sec:notation}
A dot over any object denotes the time derivative of that object. Hence,\\
\begin{equation}
    \frac{\partial}{\partial x^0}\alpha(x) = \frac{1}{c}\frac{\partial}{\partial t}\alpha(x) = \frac{1}{c}\dot{\alpha}(x).
\end{equation}
\end{document}

generates:

MWE

Is there a way I can tell latex to automatically label these as '(N.1)' similar to an appendix?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

In using an ordinary equation environment, you can prepend what you're interested in adding to the equation number by modifying \theequation - the printing mechanism for the equation counter. For example:

enter image description here

\documentclass{article}
\begin{document}
\section{A numbered section}
\begin{equation}
  f(x) =  ax^2 + bx + c \label{eqnA}
\end{equation}
See~(\ref{eqnA}).
\section*{An unnumbered section}
\renewcommand{\theequation}{N.\arabic{equation}}
\begin{equation}
  f(x) =  ax^2 + bx + c \label{eqnB}
\end{equation}
See~(\ref{eqnB}).
\end{document}

Note that you cannot update \theequation inside the equation environment, since the counter stepping (and reference setting) is done at the start of the environment. That is, it would be too late to update this inside equation for it to be picked up.

If the change should be temporary, you can either localize it using a group, or reset it manually where you want it to change.


If you're only after updating the reference and not the equation number itself, you could modify \p@equation, since the construction of \@currentlabel - the element that stored counters that are \refstep-ed - has the following form (from latex.ltx):

\def\refstepcounter#1{\stepcounter{#1}%
    \protected@edef\@currentlabel
       {\csname p@#1\endcsname\csname the#1\endcsname}%
}

Note how \@currentlabel is (roughly) defined as \p@<cntr>\the<cntr>.

share|improve this answer
    
A local \renewcommand for this section is exactly what I needed. Thanks. –  Duncan Macleod Mar 27 '13 at 19:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.