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:
\\documentclass{article} \\usepackage{longtable} \\usepackage[nooneline,justification=raggedright]{caption} \\begin{document} \\begin{longtable}[l]{|p{\\hsize}|p{50pt}|} row1col1&row1col2\\\\ row2col1&row2col2\\\\ \\caption{my table} \\end{longtable} \\end{document}
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% \\endgraf\\vskip\\baselineskip}% \\hss}}}