Dear Julien, All, thanks for the reply. Nope, it does not work even with the \label within the \caption.
I copy&aste my entire file below. I tried to export and latex the .tex file. I get the same error, but the final .dvi file is fine. With pdflatex, the final .pdf file is fine too, but I get more errors. Lyx does not let me to compile, it just dies. I appreciate any further hint thanks, regards mario ps (/usr/local/texlive/2010/texmf-dist/tex/latex/oberdiek/hypcap.sty Package: hypcap 2008/09/08 v1.10 Adjusting anchors of captions (HO) %%%%%%%%%%%%%%%%%%% my .tex, exported (and simplified) %% LyX 2.0.0beta3 created this file. For more info, see http://www.lyx.org/. %% Do not edit unless you really know what you are doing. \documentclass[12pt,a4paper,italian]{letter} \usepackage[T1]{fontenc} \usepackage[latin9]{inputenc} \usepackage{color} \usepackage{babel} \usepackage{url} \usepackage{amssymb} \usepackage{graphicx} \usepackage[unicode=true, bookmarks=true,bookmarksnumbered=true,bookmarksopen=false, breaklinks=true,pdfborder={0 0 1},backref=page,colorlinks=true]{hyperref} \hypersetup{pdftitle={mario letter}, pdfauthor={mario}, pdfsubject={topic}, pdfkeywords={key}} \usepackage{breakurl} \makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. \special{papersize=\the\paperwidth,\the\paperheight} %% A simple dot to overcome graphicx limitations \newcommand{\lyxdot}{.} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. \usepackage[top=2cm, bottom=3cm, left=1cm, right=2cm]{geometry} %\usepackage{biblatex}%\bibliographystyle{plain} \usepackage{lmodern}% Enable Latin Modern fonts \usepackage{graphicx} \usepackage{fancyhdr} \usepackage[babel,italian=guillemets]{csquotes} \usepackage{ifthen} \usepackage{float} \usepackage{hypcap}% see .... %\usepackage[bf]{caption} %\usepackage[hypcap=true]{subcaption} %similar issues \AtBeginDocument{ \def\labelitemii{\(\circ\)} \def\labelitemiv{\(\checkmark\)} } \makeatother \begin{document} \letter{my friend \linebreak{} home \linebreak{} town} \address{myself\\ my place\\ home town\\ 123123123 } \opening{Dear} \signature{mario} bla bla \ref{pict} \ref{pict2} \closing{ciao} \floatstyle{ruled} \newfloat{myfig}{thp}{lop} \floatname{myfig}{Testo} \hypcapredef{myfig} \begin{myfig} \capstart \begin{center} \includegraphics[bb=0 0 173 468,scale=1.2]{./myfile.jpg} % myfile.jpg: 480x1300 pixel, 200dpi, 6.10x16.51 cm, bb=0 0 173 468 \end{center} \caption{my picture here \label{pict} } \end{myfig} \begin{myfig} \capstart \begin{center} \includegraphics[bb=0 0 173 468,scale=1.1]{./myfile.jpg} % myfile.jpg: 480x1300 pixel, 200dpi, 6.10x16.51 cm, bb=0 0 173 468 \end{center} \caption{my picture two here \label{pict2} } \end{myfig} \end{document} %%%%%%%% error (from .log file), when I latex .tex file ...... \@float@every@myfig=\toks28 \c@myfig=\count105 File: ./myfile.jpg Graphic file (type eps) <./myfile.jpg> Package hyperref Info: bookmark level for unknown myfig defaults to 0 on input line 79. ! Package hypcap Error: You have forgotten to use \caption. See the hypcap package documentation for explanation. Type H <return> for immediate help. ... l.80 \end{myfig} \global File: ./myfile.jpg Graphic file (type eps) <./myfile.jpg> ! Package hypcap Error: You have forgotten to use \caption. See the hypcap package documentation for explanation. Type H <return> for immediate help. ... l.90 \end{myfig} \global ..... %%%%%%%%% further error (from .log file), when I pdflatex .tex file .... l.91 \end{document} pdfTeX warning (ext4): destination with the same identifier (name{myfig.1}) has been already used, duplicate ignored ..... :-( On Tue, 2012-03-13 at 19:33 -0400, Julien Rioux wrote: > On 13/03/2012 7:06 PM, mario chiari wrote: > > Hi > > > > > > I am trying to use captions defined thanks to \usepackage{hypcap}, as > > you may see below. > > I get the error > > ! Package hypcap Error: You have forgotten to use \caption. > > > > Indeed I have not forgot it, and I am not sure what to try. > > Note, lyx displays myfile.jpeg. > > > > Any hint is welcome. > > Thanks, Regards > > mario > > > > > > > > --------------- > > \floatstyle{ruled} \newfloat{myfig}{thp}{lop} \floatname{myfig}{Testo} > > \hypcapredef{myfig} > > > > \begin{myfig} \capstart > > > > \begin{center} > > \includegraphics[bb=0 0 593 608,scale=1.05]{\lyxdot \lyxdot /\lyxdot > > \lyxdot /myfile.jpeg} > > \par\end{center} > > > > \caption{bla bla \cite{aaa}} > > > > > > \label{bbb}\end{myfig} > > > > > > Do you get a better result with the \label within the \caption? >