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 not very experienced with LaTeX and I'm having trouble when trying to define a macro to include some images. I want to do it this way because I'm trying to take notes using LaTeX and I need to type it quickly. The macro is:

\newcommand{\capeps}[3]{\begin{figure}[h]
\begin{center} 
\includegraphics[width=.9\linewidth]{./figures/#1.eps}
\caption{#2} 
\label{fig:#3} 
\end{center} 
\end{figure}}

but I can't make it recognize the label. Do you know what's the problem with this?

share|improve this question

closed as too localized by egreg, lockstep, Qrrbrbirlbel, cgnieder, Martin Schröder Oct 26 '12 at 21:54

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

4  
Works like a charm for me. Maybe you could include a minimal working example (MWE)? –  Silex Oct 26 '12 at 19:04
3  
What @Silex said! Besides: you might want to replace the center environment with \centering. Welcome to TeX.sx! –  cgnieder Oct 26 '12 at 19:06
    
What is your parameter of \ref? For \capeps{xxx}{yyy}{zzz} it has to be \ref{fig:zzz} and not just \ref{zzz}. –  Qrrbrbirlbel Oct 26 '12 at 20:34
    
thank you for the answers, I didn't expected to be so quick :) Well, it kind of work for me, but when I use the label I get "??" instead of the reference number. –  German Oct 26 '12 at 20:37
    
ohh, your are right. My error was in the \ref part, the macro was good. Thank you very much. –  German Oct 26 '12 at 20:54

Browse other questions tagged or ask your own question.