captions of wide longtables are indented

Some of my longtables are wider than \hsize (=\columnwidth). It's ok. The problem is the left-aligned captions of such tables. If a table is X too wide, then the caption is indented by X.

An example to reproduce the problem:

\\caption{my table}

In this example, the caption is indented by 50pt.

I asked in comp.text.tex: Any suggestions how to avoid indenting? Or, at least, any ideas why it happens?

Axel Sommerfeldt, the author of the longtable package, explained that the caption in a longtable is typeset as centered multicolumn. It, and looking at the source code of \LT@makecaption, revealed me the source of the problem.

Among Axel's suggestins, I've choosen patching the definition of \LT@makecaption. It combines code from the longtable and caption2 packages, and uses the fact that my captions are always of \hsize.

\\def\\LT@makecaption#1#2#3{ %
  \\LT@mcol\\LT@cols l{\\hskip-\\tabcolsep\\hbox to\\z@{\\parbox[t]\\hsize{ %
    \\captionfont\\selectfont {#2: }#3%
Categories: TeX