I am writing a quarto book. I include abstract:
under book:
in the _quarto.yml
file. My GitHub Actions knits the file to several output formats (HTML, EPUB, and PDF). Knitting to HTML and EPUB works fine. However, knitting to PDF errors out with the following error:
ERROR:
compilation failed- error
LaTeX Error: Environment abstract undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.328 \begin{abstract}
ERROR: Error
at Object.onComplete (file:///opt/quarto/bin/quarto.js:92847:91)
at eventLoopTick (ext:core/01_core.js:153:7)
at async renderFiles (file:///opt/quarto/bin/quarto.js:78077:16)
at async renderProject (file:///opt/quarto/bin/quarto.js:78479:25)
at async Command.actionHandler (file:///opt/quarto/bin/quarto.js:83077:32)
at async Command.execute (file:///opt/quarto/bin/quarto.js:8017:13)
at async Command.parseCommand (file:///opt/quarto/bin/quarto.js:7907:20)
at async quarto (file:///opt/quarto/bin/quarto.js:118224:9)
at async file:///opt/quarto/bin/quarto.js:118244:9
at async mainRunner (file:///opt/quarto/bin/quarto.js:118128:9)
Error: Process completed with exit code 1.
The error is because my LaTeX document class (krantz) does not include an abstract environment, as noted in the following forum posts:
However, it is "by design" that my document class does not include an abstract environment. I don't want the abstract to appear in the PDF version, if possible, because I want to use the krantz document class. Yet I still want to include the Abstract in the HTML version. And I'd prefer not to have to maintain separate _quarto.yml files for HTML vs PDF outputs.
To try to address this, I moved abstract:
to the format:
section. This allows the book to be knitted to each format--i.e., it no longer results in an error; however, it results in the abstract being printed on every page/chapter of the HTML, as described in the following discussion: in quarto book, why is META-DESCRIPTION posted on top of every page? · quarto-dev/quarto-cli · Discussion #2282 · GitHub.
Any help would be greatly appreciated. Basically, I want to accomplish the following:
- I want the HTML output to include an Abstract section, but I do not want to include it at the top of every chapter
- I do not want the PDF output to include an Abstract section
- I do not to maintain separate
_quarto.yml
files for the HTML, EPUB, and PDF versions - I do not want the PDF version (or any version) to error out when knitting
Thanks in advance!