Graphics, Figures & TablesPackage Warning

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
stefano91
Posts: 3
Joined: Wed Mar 13, 2013 7:09 pm

Package Warning

Post by stefano91 »

Hi everybody!

Compiling my document I get this warning but I can't figure out why, anyone have idea?

Code: Select all

Package caption Warning: The option `hypcap=true' will be ignored for
this (caption) particular \caption on input line 280.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Package Warning

Post by cgnieder »

Hi stefano91,

Welcome to the LaTeX community.
stefano91 wrote:Compiling my document I get this warning but I can't figure out why, anyone have idea?
Not without a Infominimal working example. All I can say is that something's going wrong with the hyperlink there.

Regards
site moderator & package author
stefano91
Posts: 3
Joined: Wed Mar 13, 2013 7:09 pm

Package Warning

Post by stefano91 »

Code: Select all

\documentclass[a4paper,10pt,twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[italian,english]{babel}
\usepackage{url}
\usepackage[font={small}, labelfont=bf]{caption}[2004/07/16]
\usepackage{hyperref}
\usepackage{abstract}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{multirow}
\usepackage{xspace}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{bpchem}
\usepackage{siunitx}
\usepackage{amsmath}
\usepackage[babel]{csquotes}
\usepackage{guit}
\usepackage{listing} %inserisci codice in testo
\usepackage{alltt}
\usepackage[style=numeric-comp,sorting=none,sortcites=true,doi=false,url=false,hyperref]{biblatex}%style=numeric-comp,backend=biber

\hyphenation{QIAquick}

\renewbibmacro{in:}{% elimina il in nella biblio
  \ifentrytype{article}{}{%
  \printtext{\bibstring{in}\intitlepunct}}} 
\renewcommand*{\bibfont}{\small}

\bibliography{bib_lab}



%opening
\title{Lab Report}
\author{Stefano Grasso}

\begin{document}

\twocolumn[

\maketitle

\begin{onecolabstract}

\end{onecolabstract}

]



\input{labintro}

\input{MaM}

\input{results}

\input{DaC}



\printbibliography

\newpage
\input{suppl}


\end{document}

And this is the line giving the error:

Code: Select all

\begin{listing}                    
 \begin{alltt}\label{lis:sas3}  

.
.
.
                       
\end{alltt}
\caption{Amino acid alignment for sample Saswati3. Alignment with the hAQP10 sequence with N133Q mutation.}
\end{listing}
thank you!
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Package Warning

Post by cgnieder »

Not really minimal, this example, is it? Anyway: a minimal example to reproduce the warning is this one:

Code: Select all

\documentclass{article}
\usepackage{caption}
\usepackage{listing}
\usepackage{hyperref}
\begin{document}

\begin{listing}
 foo
 \caption{bar}\label{lst:bar}
\end{listing}

See listing~\ref{lst:bar}

\end{document}
Note, that I placed hyperref as last package to be loaded which is usually a good idea.

I am not really familiar with the hypcap package but its purpose is to redirect a hyperlink not to the caption but to the beginning of the float. As it seems you don't load the »hypcap« package so you can safely ignore the warning. If you load »caption« with the option hypcap=false the warning will disappear.

Code: Select all

\documentclass{article}
\usepackage[hypcap=false]{caption}
\usepackage{listing}
\usepackage{hyperref}
\begin{document}

\begin{listing}
 foo
 \caption{bar}\label{lst:bar}
\end{listing}

See listing~\ref{lst:bar}

\end{document}
On the other hand you could load »hypcap« (after »hyperref«, this is one of the exceptions) and place \capstart where you want the hyperlink to be directed to:

Code: Select all

\documentclass{article}
\usepackage{caption}
\usepackage{listing}
\usepackage{hyperref}
\usepackage{hypcap}
\begin{document}

\begin{listing}
 \capstart
 foo
 \caption{bar}\label{lst:bar}
\end{listing}

See listing~\ref{lst:bar}

\end{document}
Regards
site moderator & package author
stefano91
Posts: 3
Joined: Wed Mar 13, 2013 7:09 pm

Re: Package Warning

Post by stefano91 »

Sorry I just didn't know what was importan and what wasn't!
Also I had no idea what hycap was!

Anyway adding hycap=false as option of captation the warning disappeard.

I knew was nothing vital, but I wanted to understeand!

Thank you!
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Package Warning

Post by svend_tveskaeg »

stefano91 wrote:Sorry I just didn't know what was importan and what wasn't
If you had read the side about the minimal working example (MWE) that cgnieder linked to, you would know how to make your code into a MWE; you should have used the hacking down approach.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Package Warning

Post by sommerfee »

stefano91 wrote:Anyway adding hycap=false as option of captation the warning disappeard.
Yes, the warning has disappeared, but the "hypcap" feature, too. This means now all hyperlinks to figures and tables will jump to the caption of the figure and table instead to the figure or table itself.

An except of the caption package manual, appendix "A.3 Warnings":
"The option ‘hypcap=true’ will be ignored for this particular \caption."

The caption package hasn’t found a proper hyperlink anchor for this particular caption, so it decides to ignore the setting hypcap=true (which is set by default). As a result a link to this caption (e.g. in the List of Figures, or set by \ref or \autoref) will link you to the caption of the figure or table, not to the figure or table itself.

This can happen if you use \captionof inside a non-floating environment, but also if you use some package which redefines figure or table, and which is unknown to the caption package.

If this is ok for you but you want to suppress this warning, simply place a \captionsetup{hypcap=false} just before the \caption or \captionof command which is causing the warning. If this is not ok for you, you can set a hyperlink anchor with \captionsetup{type= float type } for yourself.

(See section 6.5: hyperref )
Post Reply