Recommended approach to add a new LaTeX class for bookdown

I've been writing a book in bookdown, and the publisher sent me a custom LaTeX class (called Alon.cls) for typesetting. Which approach would you recommend to bake this class into my project?

Simply replacing
documentclass: book
with
documentclass: Alon

gives me cryptic LaTeX errors like

! Undefined control sequence.
<argument> \Hy@tocdestname 

which I don't know how to fix. By comparison, the book comes out ok if I use the krantz class provided in the bookdown repo.

The documentation says that a template may be the way to go, however I've been fiddling around with that (simply applying the Alon class and a basic template to the example book) and not finding my way out of LaTeX errors.

At this point I'm most likely going to drop bookdown and port my content to LaTeX, but if anyone has some good pointers on things to try I am all ears!

Cheers

I have not reallyy done anything in LaTex for several years but I think there should a LaTex folder with .sty and .cls files somewhere in your LateX installation, assuming you have TeXLive or MiTex installed. Otherwise, try just dropping it in the same folder as your .qmd file.

What is a .qmd file? Do you mean Quarto? I am using bookdown / R markdown.

Sorry, I normally use Quarto and typed .qmd automatically. I did mean Rmarkdown file.

My issue is not that LaTeX styles and classes are not found. For instance, it works fine if I use the "krantz" class. The "Alon" class that I want to use (and I put it into the same directory, as you mentioned), is also found, but the compilation generates errors.

I'd suggest applying directly to the publisher and asking for help. IIRC, you may have to create a couple of directories.

Ah, yes is this of any help?
https://www.maths.cam.ac.uk/computing/software/tex/package

Thanks -

the class itself is not a problem, I can compile their exampe document in LaTeX.

But it doesn't play nice with bookdown, I get errors with this class that I don't get with others such as krantz.

The publisher has no expertise on bookdown, unfortunately.

Beats me. What are people in the LaTeX community saying?

I wonder if it is a pandoc problem? Can you compile a test document in pure LaTex? If so, you may need to file an issue with RStudio.

Depending on how much text you have written I'd suggest considering abandoning RMarkdown and moving to LyX. I find that, conceptually, they are very close and I "think" that you can move most text and code across with relatively small changes though I suspect that citations could be a bugger.

This could mean that there are some conflicts with the class (and what it expects), and the LaTeX produced by Bookdown with the supported feature.

Some adjustments are probably required. Either some Bookdown / Pandoc feature are incompatible, or the Alon class is missing some stuff that the book class was loading.

Unfortunately this is LaTeX stuff - you need to look at the log file and try to sort it out. We don't know about Alon class so it is highly possibly that Pandoc or Bookdown does use something that is not supported out of the box.

1 Like

I suspected as much. Unfortunately fixing the class exceeds my humble LaTeX skills.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.