PDF Format extension: How to change header declaration contents (include-in-header: header.tex) based on YAML value / How to declare two custom formats both extending from the same base-format in the same extension?
#14832
Replies: 1 comment 1 reply
|
Quarto has had a built-in Use
|
Uh oh!
There was an error while loading. Please reload this page.
Description
Hello,
I am currently porting the thesis latex template my university provides to quarto.
To that end, I have declared the
_extension.yml:The latex-template I am modelling sets in their preamble the following:
Notable here is that they configure
x-4as the pdf standard via\usepackage[x-4]{pdfx}, which will purposely break digital in-document linkage. This breaks:X",all do not work. This is in line with the reference I am targeting, so strictly speaking this is fine. Therefore I have incorporated this into the
header-print.tex.My issue is that during writing of a document - where everything is done digitally anyways - having to forego the usage of clickable cross-references is time-consuming and hinders productivity1.
Therefore it would be sensible to work with a different pdf-standard during writing. I currently use
\usepackage[a-2b]{pdfx}to preserve the features breaking underx-4when working digitally2.The question is how to incorporate this.
\usepackage-commands must be issued in the document header. To my knowledge, I cannot parse YAML-/frontmatter data at that point. This means I cannot use conditionals to control which pdf-standard is applied. The consequence is that I have to use two different header-files.But to include them exclusive to each other; the only idea I have found so far is to declare two different extensions; because I cannot control dynamically what in-header-include is used.
Unfortunately, it seems I cannot just declare both formats in the same extension, i.e. setting
_extension.yml:header-print.tex:header-digital.tex:testfile.qmdwill make
quartoerror out due to an unknown extension:The docs under https://quarto.org/docs/extensions/formats.html#overview, nor any of the format extensions shown under https://github.com/quarto-journals/#quarto-journal-templates have applicable examples (at a quick glance).
The docs on custom formats (as well as on Journal Formats: https://quarto.org/docs/journals/formats.html#common-metadata) talk about declaring multiple formats, but according to docs they must be derived from distinct base formats. This suggests that you cannot declare two custom formats both inheriting from
pdf.Actually, it seems like the directory containing the
_extension.ymlmust bear the same name as the declared format (sans the base-format-suffix, e.g.msc-angewandtebioinformatik-format-ext); which seems to be the limiting problem here.Overall this means I have just declared two extensions which are complete duplicates of each other, excepting the declaration under
include-in-header:.This seems to be an architectural problem to me. The current workaround is viable; but obviously not desirable.
So the question is:
include-in-header-edheader.tex-file?Side-question that is semi-related:
Without setting up a (website) project, declaring two profiles and associating the rendering to either format with a profile each; is there a way to namespace the generated
.pdf-files? I.e. to havethesis-digital.pdfandthesis-print.pdfas outputs, based on what format was rendered?Currently, if I were to use both extensions and had to render; I would have to set up profiles in order to set two different
output-dirto preserve both instances simultaneously. Is there a different way to generate both targets so they coexist?Thank you.
Claudius
Footnotes
besides this I would assume grading the digital instance is easier with working links, but that is not on me to decide/leverage ↩
This in turn breaks color-accuracy, but I have yet to find a color-accurate standard which preserves links; and am ignoring this side-problem for now. ↩
All reactions