jss
jss copied to clipboard
PDF metadata with formatted titles
I noticed that currently the PDF metadata is incorrect if title:
contains formatted parts such as [...]{.pkg}
or [...]{.proglang}
, even if title-plain
is specified. The problem seems to be that the default Pandoc template (re-)sets the metadata and overrides the metadata generated by the JSS class file (which uses the plain title).
I think there are two main options:
- Use
title
for the plain title and a new optionaltitle-formatted
for the formatted title (similar to the keywords); then the Pandoc template would automatically use the plain title whenever it falls back to thetitle
information and resetting the metadata would not mess up the title metadata - Do not use the default Pandoc template (which also e.g. already loads
lmodern
) but rather use a custom reduced template and include only desired Pandoc partials for e.g. tables but not the hypersetup block
I guess the second alternative would be cleaner since it would not reset and redefine things already handled by the JSS class file.
Can you point me at the LaTeX that isn't correct in this case? I'm having trouble finding it when title-plain
is specified (all looks well to my eyes, but I'm likely just missing where things are not being handled properly).
I'm not completely sure how the incorrect parts looked like exactly, so I tried to reproduce it with https://github.com/quarto-journals/jss/commit/b4dd1ab42ef24ab6581b0caf22c42250c88d442f and
---
title: "An [R]{.proglang} Package"
title-plain: "An R Package"
format:
pdf: default
jss-pdf:
keep-tex: true
pdf-engine: pdflatex
---
(I am sure I used pdflatex since the JSS style guide mentions that the document should be compiled with pdflatex.)
The resulting TeX file then contains
\hypersetup{
pdftitle={An Package},
colorlinks=true,
linkcolor={blue},
filecolor={Maroon},
citecolor={Blue},
urlcolor={Blue},
pdfcreator={LaTeX via pandoc}}
which is included by the default Pandoc template that is based only on the title
metadata. (As mentioned above, there are other redundant and unnecessary statements included by the Pandoc template as well such as \usepackage{lmodern}
.)
However, in contrast to the OP in my experiment actually the incorrect Pandoc metadata was overwritten by the default metadata of the JSS class file, and not the other way around (https://github.com/quarto-journals/jss/blob/main/_extensions/jss/jss.cls#L453 and https://github.com/quarto-journals/jss/blob/a5b928a765e0d87cc40aedcbf4302b8ce2ad5c9c/_extensions/jss/jss.cls#L461). I'm not sure why that was not the case when I opened the issue in September.
I also saw your recent commit (https://github.com/quarto-journals/jss/commit/a5b928a765e0d87cc40aedcbf4302b8ce2ad5c9c) that adds a title-plain
if only title
is specified. I don't think that's necessary or helpful in this case though since the Quarto extension seems to use title-plain
only (optionally) in https://github.com/quarto-journals/jss/blob/a5b928a765e0d87cc40aedcbf4302b8ce2ad5c9c/_extensions/jss/partials/title.tex#L8-L10 and the JSS class file already sets the plain title to the title if it is not specified (https://github.com/quarto-journals/jss/blob/a5b928a765e0d87cc40aedcbf4302b8ce2ad5c9c/_extensions/jss/jss.cls#L151 and https://github.com/quarto-journals/jss/blob/a5b928a765e0d87cc40aedcbf4302b8ce2ad5c9c/_extensions/jss/jss.cls#L159)
I don't think that's necessary or helpful in this case though since the Quarto extension seems to use title-plain only (optionally) in
Good call I didn't think to look in the class file itself. I'll revert that change!
I am having this issue with pandoc v3.1.11.1
.
We're happy to help - you'll need to provide some additional information in order for us to do so.
Currently if I:
mkdir test
cd test
quarto use template quarto-journals/jss --no-prompt
quarto render test.qmd
It successfully renders.
Yes. Sorry, I realised I should provide more information but my issue is exactly as described in the earlier posts so I didn't think of anything to add.
The problem is with markups in the title. If I use
mkdir test
cd test
quarto use template quarto-journals/jss --no-prompt
sed -i '' '2s/\(.*\)/title: "A Short Demo Article: Regression Models for Count Data in [R]{.proglang}"\ntitle-plain: "A Short Demo Article: Regression Models for Count Data in R"/' test.qmd
quarto render test.qmd
where the extra line is to replace "R" in the title with [R]{.proglang}
and add another line of title-plain
,
the tex file I get contains
\hypersetup{
pdftitle={A Short Demo Article: Regression Models for Count Data in },
pdfauthor={Achim Zeileis; Second Author},
pdfkeywords={JSS, style guide, comma-separated, not capitalized, R},
colorlinks=true,
linkcolor={blue},
filecolor={Maroon},
citecolor={Blue},
urlcolor={Blue},
pdfcreator={LaTeX via pandoc}}
You can see how "R" with the markup is ignored at the end of pdftitle
.
I am using quarto v1.4.549
and pandoc 3.1.11.1
. Let me know if you need anything else.
Ok I can reproduce this using the above - the document titles are correct in this case, but the hypersetup
option is incorrect.
Currently, to fix this, the JSS format would need to entirely replace the core pdf template, since that is where the hyper ref
options are set. That is a big bite (and will create maintenance headaches going forward), so this is something that I'd like to avoid.
Question - how does the incorrect title manifest itself in the rendered document? Just trying to weight how much to invest in trying to patch / fix this...
It doesn't... as far as I can tell. Even the title in the pdf metadata comes from title-plain
and not hypersetup
. As long as the journal is ok with it, I guess you don't need to fix it really.