tudace / tuda_latex_templates

LaTeX Templates for TU Darmstadt
LaTeX Project Public License v1.3c
208 stars 71 forks source link

Typst port of tudapub thesis template - how font sizes are calculated #453

Closed JeyRunner closed 8 months ago

JeyRunner commented 8 months ago

I created a port of the tudapub template to write a thesis with Typst (a new modern typesetting system inspired by Latex). Everything is working well and looking good so far with the new template port tuda-typst-templates:

(Here is the full pdf, example_tudapub.pdf, and the typst file that produced the pdf, example_tudapub.typ )

For the current implementation, I hardcoded all font sizes to make it look like the original latex template. But I guess that in the latex template, all font sizes (e.g. for headings) are calculated based on the fontsize property of tudapub. But I could not figure out how this is calculated (also why is the main document font in the resulting pdf 10.9091pt even though I set 11pt for fontsize)

TeXhackse commented 8 months ago

There is a difference in pt and pt depending on what scheme you use. TeX defines 1pt =1in/72.27 as it was used in classic book printing. DTP software usually uses a different definition, which is 1pt = 1in/72 = 1bp. TeX defines that as 1bp, namely big point.

Concerning Typst: I appreciate the idea, there might be issues with the PDF export as long as Typst doesn't support PDF/A and you don't have a definition for cmyk colors, which might be required for printing. (Just had short look at it).

JeyRunner commented 8 months ago

Thank you :) I guess I could just add some conversion function then (at least for the main document font).

Yes sadly PDF/A export is not supported yet (https://github.com/typst/typst/issues/2942) which is required for submission in TUbama. But I tested just using a converter to convert the pdf from typst to pdf/a and it seems to work fine (https://www.ilovepdf.com/de/pdf-in-pdfa-konvertieren).

Regarding cmyk colors, at least for my case I guess I don't need them, so this is fine (currently a thesis just has to be submitted online). But this will be fixed once https://github.com/typst/typst/issues/2942 is implemented.

TeXhackse commented 8 months ago

I know it's technically possible, just were those things i just stumbled across -> I'd prefer if you add those in the readme in your repo or make issues there waiting for those issues you just linked. , as it doesn't help anyone in here if you link unrelated typst issues ;-)

JeyRunner commented 8 months ago

I added the issues to the readme (so anyone will be aware of the limitations).

Nevertheless, is there an obvious method how the heading font sizes are calculated from the main document font size, or is this just Latex "magic" in the sense that it can't be reimplemented?

TeXhackse commented 8 months ago

Ah, sorry, got that wrong. I was a bit confused about how you mean “calculate” the header font sizes. Those are set by the design guideline.

The setup is done in the clo-files, e.g. https://github.com/tudace/tuda_latex_templates/blob/c87120160af94705676d95b475e241604e651c15/tex/tuda-a4paper.clo#L33 beside that the requirements matched the standard setting of KOMA-script (except for the letter template).

So generally LaTeX doesn't do any magic here but has predefined scaling setup done via clo-files. We don't rely on the base fontsize setup and use as far as possible the KOMA implementation. sources for those can be found here: https://mirrors.ctan.org/macros/latex/contrib/koma-script/scrkernel-fonts.dtx

JeyRunner commented 8 months ago

Ah that's the info I needed, I'll look at the files. Thank you :)