I'm adding captions for pictures but it shows this error :

\caption outside float. } My code is like this

        \caption{Pav. 2}

What is wrong here and what i should fix ?

  • 2
    Welcome to TeX.SE! \caption had to be inside figure float environment: \begin{figure} \includegraphics{...}\caption{...}\label{...}\end{figure} – Zarko Jan 28 '17 at 8:30
  • 1
    If you want to have a table, figure, picture with a numbered caption that stays at a fixed place, use the caption package. See this answer for an explanation. If you are happy to use the figure or table numbering already provided by LaTeX, then \captionof{figure}{This is the caption.} does the job (having included \usepackage{caption} into the preamble). – gernot Jan 28 '17 at 8:38

You have two issues with your code:

  • inside \href can not be nested \caption
  • outside of figure \caption{...} cannot be used. Instead of it you can use \captionof{figure}{...}. For this you need to use package caption or capt-of.

Correct code for both cases:



    \captionof{figure}{Pav. 2}

        \caption{Pav. 2}
| improve this answer | |

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