tectonic-typesetting / tectonic

A modernized, complete, self-contained TeX/LaTeX engine, powered by XeTeX and TeXLive.
https://tectonic-typesetting.github.io/
Other
3.92k stars 161 forks source link

More flexible parsing of command-line paper sizes #979

Open jgranduel opened 1 year ago

jgranduel commented 1 year ago

Hi,

I am giving tectonic a new try on Windows (tectonic-0.12). Usually using pandoc with --pdf-engine=xelatex, I wanted to change the paper-size like I do with pandoc.

Where can I find all available options for allowed paper-size (or any option)?

 -Z paper-size=<spec>        Change the default paper size [default: letter]

I tried a first guess option

> tectonic -Zpaper-size=A4 .\myfirstdoc.tex
error: Unrecognized paper format: A4

I found issue #216 and #182. The format is a4 for some reason, maybe TeX history?

The ISO 276 standard uses capital letters (and so are we used to). Could they be included as alternative?

Nonetheless the output PDF file is not in A4 format:

> tectonic.exe myfirstdoc.tex
Writing `myfirstdoc.pdf` (21.60 KiB)

> pdfinfo.exe myfirstdoc.pdf 
Page size:       612 x 792 pts (letter)

> rm myfirstdoc.pdf

> tectonic.exe -Zpaper-size=a4 myfirstdoc.tex
Writing `myfirstdoc.pdf` (21.60 KiB)

> pdfinfo.exe myfirstdoc.pdf 
Page size:       612 x 792 pts (letter)

with pandoc

> pandoc -s -V papersize:a4 myfirstdoc.tex -o my.pdf

> pdfinfo.exe my.pdf
Page size:       595.276 x 841.89 pts (A4)

I am just realizing ironically that pandoc also uses a4 and that A4 is not the default!

Modifying the TeX source works well (\documentclass[a4paper]{article}) works well:

> tectonic.exe .\myfirstdoc.tex
Writing `.\myfirstdoc.pdf` (21.59 KiB)

> pdfinfo.exe .\myfirstdoc.pdf | rg.exe 'Page size'
Page size:       595.28 x 841.89 pts (A4)
kpym commented 1 year ago

There is no a4 option in LaTeX. Have you checked with a4paper in place of a4 or A4 as in your \documentclass[a4paper]{article} ?

jgranduel commented 1 year ago

@kpym yes, I tried and added \documentclass[a4paper]{article} at the end of my issue. My issue was about getting the list of allowed page-size in in help and if possible, having the option to use a case insensitive page size (tectonic -Zpaper-size=A4, or Zpaper-size=a4, or -Zpaper-size=a4paper), all of them being minor issues!

pkgw commented 1 year ago

The code implementing this matching is in the C layer, in crates/pdf_io/pdf_io/dpx-dpxconf.c. It shouldn't be too hard for someone with knowledge of C to make it a bit more flexible!