quarto-dev/quarto-cli

`LaTeX Error` when specifying non-standard `documentclass`

pat-alt opened this issue · 4 comments

Hi there,

I'm trying to use the ACM class for typesetting as follows:

format:
   pdf:
      documentclass: acmart

When trying to render I get the following error:

compilation failed- error
LaTeX Error: Command `\Bbbk' already defined.

According to the docs I should be able to use

any other class made available by LaTeX packages [I] have installed.

I'm using Tex Live on MacOs and have checked that the package is in fact installed. According to the answers provided here I also understand that I don't need to specify \usepackage{acmart} anywhere.

What am I missing? Thanks in advance!

Thanks for using quarto! We're actively working on custom templates right now, so you can expect the quarto story on this to improve soon.

One issue is that simply switching the documentclass is unlikely to work, because of the other settings which come from pandoc's latex template. If you want to take a look at a (different!) attempt to make a custom template, you can for now take a look at https://github.com/cscheid/quarto-tvcg/tree/main/src.

Notice how I had to create a custom template rather than simply change the document class (which is unfortunately a lot more work). If you choose to go that route, you'll find that the option keep-tex: true is very useful. Calling quarto render test-file.qmd on the following file:

---
title: Test
format: pdf
keep-tex: true
---

# This is a test.

will produce a test-file.tex file that you can inspect.

If your use case is not super urgent, though, I would recommend waiting until support for templates lands, which again will be coming up soon.

Thanks very much for the quick response @cscheid and thanks for all the hard work on this project. I have limited bandwidth right now, so I'll wait for updates 😄 Thanks again!

cderv commented

Hey @pat-alt, Just curious if you could share the file you tried to run ? Oddly, I don't have the error on Windows and I am curious why.
For context, this error happens because Pandoc's template load the amssymb package which conflict with acmart (borisveytsman/acmart#395). So I should get the error too.

Anyway, this is a case where indeed a custom template is required as Pandoc does not offer any flag to opt-out loading amssymb - post processing the tex file before rendering to PDF would be an option.

Thanks @cderv! I can confirm that just removing amssymb from line 8 in the tex file (\usepackage{amsmath,amssymb}) seems to do the trick.

The full paper and code base is on a private repo I'm afraid, but I've created a minimum working example here. Hope this helps!