1

How can I have in a figure caption Figure 1: caption instead of Figure 1 - caption ?

I tried this

\usepackage[labelsep=endash]{caption}

but didnt work.

another simple question why we should use \label{} after every \caption{} ?

EDIT: here is the code

\documentclass{article}
\usepackage[labelsep=endash]{caption}
\usepackage{graphicx}

\begin{document}
\begin{figure}[t]
\begin{center}
\includegraphics[scale=.25]{image.png}
\end{center}
\caption{titre}
\label{fig:img}
\end{figure}
\end{document}
noob
  • 11
  • \label needs the current counter which has been increased -- the counter is increased by \caption (using \refstepcounter internally), so \label must come after \caption: By the way: : is the default –  Oct 14 '15 at 15:13
  • 1
    Regarding your question about "\label after every \caption": The \label has to go after \caption (see Why does an environment's \label have to appear after the \caption?), but you don't need a \label after every \caption; only those that you want to refer to in another part of the document. – Werner Oct 14 '15 at 15:16
  • article , fontenc babel, and of course graphicx package. i think none of them is concerned – noob Oct 14 '15 at 15:16
  • @Christian Hupfer if : is the default why do i have the dash i havent modify anything or load any package that could modify it. weird ? – noob Oct 14 '15 at 15:19
  • 4
    Just remove labelsep=endash, that's it. You are requesting an en-dash, with that option. – egreg Oct 14 '15 at 15:25
  • it was stupid from me thanks egreg i thought it does endashing(remove the dash) my bad english. now i understand i can put whatever char like labelsep=colon – noob Oct 14 '15 at 15:28
  • 1
    @noob: I suppose you write in French. Traditional French typography uses an endash for separator. That's why babel-french sets it that way. – Bernard Oct 14 '15 at 15:59
  • @noob by default it is a colon! – FionaSmith Oct 14 '15 at 16:10

0 Answers0