Skip to content

If you have a table in a float, and you use adjustwidth, caption centering is wrong

In the files in the attached zip (a .lyx and a .tex file), when the "caption" package isn't used, the caption on the table in a table float is centered. I had until recently been using a version of TexLive I installed in 2019, in which I used both \adjustwidth from "changepage"; as well as "caption". The captions were nicely centered. I updated to TexLive a few days ago, and all of a sudden, they weren't centered or having any other particular placement. After several hours of scratching my head, researching, and finally taking apart my preamble piece by piece, I figured out that the offending line causing the problem was:

\usepackage{caption}

The simple inclusion of this line messes up the centering of captions. Fortunately, the workaround is simple. I can still get handy caption styling features AND get a properly centered caption by putting the caption in the default frameless minipage box in Lyx, inside the table's float.

Interestingly, it places it in a similar place if there is no \adjustwidth. Don't get me wrong: it's not a bad place where it is now; but in various tables of varying length, the position is unpredictable. In one fairly narrow table with a long caption, it is centered nicely. Without adjustwidth in a table float, it is centered fine. With it, it is to the left of the top of the table. In that table, it seems to be even with the indentation I'm using on the first lines of paragraphs. If I use "caption" options to supposedly center the caption, it is unchanged inside the float and the adjustwidth. It seems to me that the simple inclusion of the "caption" package shouldn't change one's caption justification, until some setting has been made. If the caption and the table are wrapped in \begin{centering} and '\end{centering}`, it still is not centered. Until it is in a box, it's haphazard positioning seemingly can't be modified whatsoever, no matter what. It seemed to work just fine in the 2019 version which was apparently installed 11/26/19.

Centering_Problem.zip

Edited by Axel Sommerfeldt