svmiller / svm-r-markdown-templates

This is my (deprecated) suite of R Markdown templates for academic manuscripts, beamer presentations, and syllabi. DOWNLOAD {stevetemplates} INSTEAD.
http://svmiller.com/stevetemplates/
Other
894 stars 739 forks source link

Use templates in bookdown? (align environment definition needed for PDF output) #11

Open rvanmazijk opened 6 years ago

rvanmazijk commented 6 years ago

I'd love to be able to use your templates, e.g. svm-latex-ms.tex, in writing my dissertation and some manuscripts in bookdown.

The trouble is, bookdown supports align-style equation environments for LaTeX-PDF output. This is a very useful thing about bookdown, as it allows more customisable equation layout:

\begin{align}
  \hat{Y}_{i}
    &= \beta_{0} + \beta_{1} X_{i} + \epsilon_{i}
    &= 4.20 + 3.69 X_{i} + \epsilon
\end{align}

For example, I wish to render to PDF from .Rmd source files that contain align-style equations. Using svm-latex-ms.tex as the template, my _output.yml is as follows:

bookdown::pdf_book:
  latex_engine: xelatex
  template: svm-latex-ms.tex

On rendering (with bookdown::render_book("index.Rmd")), I get this error:

! LaTeX Error: Environment align undefined.

Error: Failed to compile manuscript.tex. See manuscript.log for more info.
Execution halted

I think it would be great to include a definition for the align environment in these templates (I'm willing to help!) so that they can be more flexibly applied to outputs from the wider RMarkdown ecosystem, such as bookdown 😄.

svmiller commented 6 years ago

Here's where I confess I know nothing of bookdown. Could I ask for your help with that? I'm at a point with these templates where I'm happy when they don't break for my narrow purposes. :P

rvanmazijk commented 6 years ago

I can sympathise with "narrow purpose" templates. We all want very specific and sometimes different things out of doc prep. Sometimes our own MacGyver-solutions are good enough 😉

I'd be happy to help 😃 . I don't know much about LaTeX templates, but I imagine adding support for a new environment in a template would be easy enough. Perhaps we can borrow from the pandoc templates bookdowncalls on? https://github.com/jgm/pandoc-templates