# Bicaption for longtables doesn't work

I'm trying to use bicaption for longtable, but I get this error:

! Misplaced \noalign.
\caption ->\noalign
\bgroup \@ifnextchar [{\egroup \LT@c@ption \@firstofone ...
l.26 \bicaption{Test}{Test}
\\


Here is an example:

\documentclass[a4paper,10pt]{article}

\usepackage{ucs}
\usepackage[utf8]{inputenc}
\usepackage{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{caption}[2012/02/19 v3.2f]
\usepackage[list=off]{bicaption}[2011/10/30 v1.0a]

\captionsetup[bi-first]{bi-first}
\captionsetup[bi-second]{bi-second}

\DeclareCaptionOption{bi-first}[]{
\def\tablename{Preglednica}
\def\figurename{Slika}}
\DeclareCaptionOption{bi-second}[]{
\def\tablename{Table}
\def\figurename{Figure}}

\date{12/20/15}

\begin{document}

\begin{longtable}{llllllll}
\bicaption{Test}{Test} \\
\label{test}
Test & 1 & 2 & 3 & 4 & 5 & 6 & 7\\\toprule
1 & 0 & 0.282468 & 0.275974 & 0.25 & 0.217532 & 0.292887 & 0.260465\\
2 & 0.282468 & 0 & 0.279236 & 0.2 & 0.24 & 0.054393 & 0.232558\\
3 & 0.275974 & 0.279236 & 0 & 0.24821 & 0.243437 & 0.221757 & 0.172093\\
4 & 0.25 & 0.2 & 0.24821 & 0 & 0.424979 & 0.158996 & 0.195349\\
5 & 0.217532 & 0.24 & 0.243437 & 0.424979 & 0 & 0.146444 & 0.204651\\
6 & 0.292887 & 0.054393 & 0.221757 & 0.158996 & 0.146444 & 0 & 0.255814\\
7 & 0.260465 & 0.232558 & 0.172093 & 0.195349 & 0.204651 & 0.255814 & 0
\end{longtable}

\end{document}


What could be wrong???

Thanks

• It probably does not support longtable, the caption in longtable is not the usual caption construction so unless bicaption directly lists longtable support, it is probably a bit much to ask for. Hopefully someone else can tell you what is needed for it to work with longtable Dec 20, 2015 at 13:00
• The bicaption package documentation does not include an own compatibility list. It should work with all packages the main caption package is adapted to, at least that was my intention.
– user2574
Dec 20, 2015 at 13:05

oh Axel just answered but this works for now:

\documentclass[a4paper,10pt]{article}

\usepackage{ucs}
\usepackage[utf8]{inputenc}
\usepackage{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{caption}[2012/02/19 v3.2f]
\usepackage[list=off]{bicaption}[2011/10/30 v1.0a]
\usepackage{booktabs}
\captionsetup[bi-first]{bi-first}
\captionsetup[bi-second]{bi-second}

\DeclareCaptionOption{bi-first}[]{
\def\tablename{Preglednica}
\def\figurename{Slika}}
\DeclareCaptionOption{bi-second}[]{
\def\tablename{Table}
\def\figurename{Figure}}

\date{12/20/15}

\begin{document}
\let\oldcaption\caption
\begin{longtable}{llllllll}
\multicolumn{8}{c}{%
\makebox[0pt]{\parbox{\textwidth}{\centering
\let\caption\oldcaption
\expandafter\def\csname @captype\endcsname{table}%
\bicaption{Test}{Test}}}} \\
\label{test}
Test & 1 & 2 & 3 & 4 & 5 & 6 & 7\\\toprule
1 & 0 & 0.282468 & 0.275974 & 0.25 & 0.217532 & 0.292887 & 0.260465\\
2 & 0.282468 & 0 & 0.279236 & 0.2 & 0.24 & 0.054393 & 0.232558\\
3 & 0.275974 & 0.279236 & 0 & 0.24821 & 0.243437 & 0.221757 & 0.172093\\
4 & 0.25 & 0.2 & 0.24821 & 0 & 0.424979 & 0.158996 & 0.195349\\
5 & 0.217532 & 0.24 & 0.243437 & 0.424979 & 0 & 0.146444 & 0.204651\\
6 & 0.292887 & 0.054393 & 0.221757 & 0.158996 & 0.146444 & 0 & 0.255814\\
7 & 0.260465 & 0.232558 & 0.172093 & 0.195349 & 0.204651 & 0.255814 & 0
\end{longtable}

\end{document}

• It is working, but problem is that counting of tables is wrong. Counter is one more that it should be. How could this be corrected?
– usil
Dec 20, 2015 at 18:04
• counter is raised for two
– usil
Dec 20, 2015 at 18:45
• @lobi oh sorry add \addtocounter{table}{-1} just before the \bicaption Dec 20, 2015 at 19:37

This is clearly a bug in bicaption. Since the combination bicaption+longtable is not part of my pre-release test cases (yet) it could be that this has never worked and an additional adaption is necessary here.

I have just opened a ticket and will fix that ASAP:

https://sourceforge.net/p/latex-caption/tickets/28/

Update (2016-02-01)

I fixed the bug by adding longtable support to \bicaption, it should be available on CTAN and as update for your TeX distribution soon.

Update (2020-01-03)

Starting with v3.4h of the caption package options cannot be used anymore prior to definition. Therefore \captionsetup[bi-first]{bi-first} and \captionsetup[bi-second]{bi-second} has to be done after \DeclareCaptionOption{bi-first}..., otherwise the document will not compile anymore.

I use Benjamin and David's solution, and solve it by "use head and first head":

\begin{longtable}{|p{2cm}|p{3cm}|p{7cm}|p{3cm}|}
\caption{my caption}
\label{variability_impl_mech}