5

I get the following error:

 <use myfile.jpg>
 Package hyperref Info: bookmark level for unknown myfig defaults to 0 on input 
 ! Package hypcap Error: You have forgotten to use \caption.

for the following document (see definition of myfig)

\documentclass[12pt]{article}

\usepackage{graphicx}
\usepackage{float}
\usepackage{hyperref}
\usepackage{hypcap}

\begin{document}

\floatstyle{ruled} 
\newfloat{myfig}{thp}{lop} 
\floatname{myfig}{Text}
\hypcapredef{myfig}
\begin{myfig} \capstart
\includegraphics[scale=.5]{myfile} 
\caption{myBook}
\end{myfig}

\end{document}

the final .dvi and .pdf output are ok, but I need to avoid any error to edit by lyx. I have seen a few posts on similar issues, but I am not sure how to fix things with my example. thks

8

You can use package caption. It also implements the function of hypcap, thus you do not need \hypcapredef and \capstart:

\documentclass[12pt]{article}

\usepackage{graphicx}
\usepackage{float}
\usepackage{hyperref}
\usepackage{caption}

\begin{document}

\ref{fig:myfig}

\floatstyle{ruled}
\newfloat{myfig}{thp}{lop}
\floatname{myfig}{Text}

\begin{myfig}
\includegraphics[scale=.5]{myfile}
\caption{myBook}\label{fig:myfig}
\end{myfig}

\end{document}
|improve this answer|||||
  • sorry for late accept – mario Jan 4 '15 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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