fmarotta / kaobook

A LaTeX class for books, reports or theses based on https://github.com/kenohori/thesis and https://github.com/Tufte-LaTeX/tufte-latex.
https://github.com/fmarotta/kaobook
LaTeX Project Public License v1.3c
861 stars 185 forks source link

Tables aligned on left on even pages when using two sided layout #66

Closed Scarli177 closed 3 years ago

Scarli177 commented 4 years ago

Hi,

I'm using currently the two sided layout (twoside=true) for my master thesis and I have the problem that tables when they are on even pages, they align with the outer frame of the margin and not with the text. How can I fix this?

Thanks for this amazing template

yordiak commented 4 years ago

I think that he mentions in kaobook documentation that the twoside option is buggy. Does this problem occurs if twoside=false?

Scarli177 commented 4 years ago

I just tried it, it doesn't. They align perfectly with the frame of the main text.

fmarotta commented 4 years ago

Hi, thanks for reaching out. Are you using the \centering command inside of the table environment?

Scarli177 commented 4 years ago

No, i don't use the \centering. Normal tables (not the wide ones) are already centered on odd pages (margin on the right) but are aligned on the left when they appear on even pages. I attached some photos.

even_normal_table even_normal_table even_raggedleft even_raggedleft even_raggedright even_raggedright odd_normal_table odd_normal_table odd_raggedleft odd_raggedleft odd_raggedright odd_raggedright

fmarotta commented 4 years ago

Yep, it is probably a bug. For the next ~10 days I'll take a break from LaTeX (sorry about that), but I'll see what I can do soon enough after that.

Scarli177 commented 4 years ago

Hi :-)

no hurry. Thanks for the help. I tried to figure out what the problem can be and saw that another table works just fine. The difference between the working table and the table I had the trouble with, is the caption. As I don't need the caption for this table I just removed it. But it seems that the caption is pushing the tables at the right position. I'm not sure how to solve this globally, but I made it like this now for the tables where I don't need a caption:

\begin{tabular}{l|l} $Q$ & Volume flow rate, \si{\meter ^{3} / \second} at \SI{1}{Pa} \ $k$ & flow coefficient \ $\Delta P$ & Pressure difference across crack, \si{Pa} \ $n$ & flow exponent \end{tabular}

fmarotta commented 3 years ago

Yes, the problem is indeed that if the caption is absent, the table is moved to the left by an amount equal to the space that the caption would have occupied, i.e. \marginparwidth + \marginparsep, and this happens only on even pages. I also discovered that figures are afflicted, too.

I have now added a way to check internally whether the table (or figure) has a caption, and, if it doesn't, I move it back to the correct position. This fix is implemented in the latest commit; I'll probably create a new release once it is confirmed that it works.