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'm writing all my equations with

\begin{equation} ... \end{equation}

so all of them are numbered but only some of them are labeled. I don't want all of them with numbers but only the labeled ones.

Since I have a real big document I don't wanna do this manually using * for all the others. How can I do this automatically?

share|improve this question
    
Since it seems that the answer by Bernard wasn't useful to you, please provide a minimal (non-)working example (MWE) showing the issue. Only then we can really help you. –  tohecz Aug 15 at 0:37

2 Answers 2

up vote 8 down vote accepted

You have a possibility, with the mathtools package (that loads amsmath, so it's useless to load the latter): write

\mathtoolsset{showonlyrefs,showmanualtags}

in your preamble, and only the referenced equations will be numbered (use \eqref). It's not exactly what you ask (number labelled equations), but you can try to make ‘fake references’ at the very end of your document.

share|improve this answer
    
Thanks for your answer. I tried that and equations are referred non of them have numbers –  David Aug 14 at 23:38
    
You mean non-referred equations have no number, I suppose? Your comment isn't quite clear to me. –  Bernard Aug 14 at 23:43
    
I mean, I have numbers in my text referring to equations but my equations don't have numbers anymore –  David Aug 14 at 23:52
    
Could you post a Minimal Working Example? –  Bernard Aug 14 at 23:55
1  
Btw, did you think of using eqref rather than ref? –  Bernard Aug 15 at 0:11

No warranty. ;-)

\documentclass{article}
\usepackage{amsmath}
\usepackage{etoolbox}


\makeatletter
\newif\ifdavid@number
\preto\equation{\david@numberfalse}
\preto\endequation{\ifdavid@number\else\notag\fi}
\patchcmd\label@in@display{\@empty}{\@empty\david@numbertrue}{}{}
\makeatother

\begin{document}
Text
\begin{equation}
\text{this has a number}\label{a}
\end{equation}
text
\begin{equation}
\text{this hasn't}
\end{equation}
\end{document}

enter image description here

share|improve this answer
    
This is awesome but it failed for 'aligns' and for some reason links in my document don't lead to the right places anymore (I'm using \usepackage{hyperref}) –  David Aug 14 at 23:50
    
@David You just mentioned equation, didn't you? I can't guess what you're using in your document. Besides, do you really mean to number only the labeled equations in an align? –  egreg Aug 15 at 9:21

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.