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
858 stars 184 forks source link

Strange line below chapter headline with \setchapterimage and fontsize=12pt #118

Closed tbm closed 3 years ago

tbm commented 3 years ago

Prerequisites

Description

If you use fontsize12=pt together with \setchapterimage, there's a line right below the headline text that shouldn't be there:

line

I tried to use an image with a larger height but that made no difference, so I think this is a problem with the template.

Minimal Working Example

Change fontsize=10pt to fontsize=12pt in examples/documentation/main.tex. I can provide a smaller example if you want.

Expected behavior: No such line should be there. It should look the same as when using 10pt font.

Additional Information

I tried with LaTeX from Debian stable and with the upcoming release, so it's not a problem with my LaTeX being old.

fmarotta commented 3 years ago

Thanks, it should be fixed now

tbm commented 3 years ago

Yes, this is fixed, but it introduced a new problem: the top of the image is now cut off. Changing the size parameter or the size of the photo doesn't make a difference. It's always cut off.

I'll prepare a test case.

tbm commented 3 years ago

Cutting off the top also happens with 10pt font.

tbm commented 3 years ago

Here's a test case:

https://github.com/tbm/kaobook-testcase

I used a spreadsheet as the image because that has a lot of lines/boxes. You will see that the top few lines of the image are cut off.

tbm commented 3 years ago

This comment is unrelated to the cut off of the image, but relates to the recent change:

I see you changed \setchapterimage[6.5cm]{seaside} to \setchapterimage[7.5cm]{seaside} when you made the change. I had to change mine to 9.5cm to get the same result as with older kaobook. I blindly copied 1279x551 (from seaside.jpeg) as the dimensions of my photos, but I don't know the aspect ratio was calculated. 1279x551 is 2.3212. Neither 7.5cm nor 9.5 matches that ratio when you take the 21.0cm width of A4. I'm not sure what that means. Anyway, 1279x551 works for me but maybe you have some insights on this.

fmarotta commented 3 years ago

Thanks for reporting this. Hopefully now I have figured out the TikZ package a little bit more, and the problems should be fixed (including the last one you mentioned, about the aspect ratio)

tbm commented 3 years ago

@fmarotta thank you! As far as I can tell it works as expected now. I'll look at it in more detail on the weekend or Monday.

(including the last one you mentioned, about the aspect ratio)

Can you expand on this some more? I still haven't quite figured out how to determine the aspect ratio.

fmarotta commented 3 years ago

Sure, I believe that now, as opposed to before, the optional argument to \setchapterimage is the true height of the picture. The width of the picture is always the paper width. So the aspect ratio of the original picture is not preserved... This is to allow users to always choose the same height across the chapters, so that the baseline of the image will always be at the same height.

tbm commented 3 years ago

As far as I can tell, this issue has been fixed. Thanks @fmarotta