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 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

share|improve this question
1  
Welcome to TeX.sx! I'm afraid hypcap is incompatible with float –  egreg Mar 5 '13 at 14:51
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Aug 18 '13 at 20:25
add comment

1 Answer

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}
share|improve this answer
    
yes, it seems it works. thanks so much. m. –  mario Mar 5 '13 at 19:59
add comment

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.