Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rvanmazijk opened this issue Aug 3, 2018 · 2 comments

Comments

@rvanmazijk
Copy link

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
Copy link
Owner

svmiller commented Aug 6, 2018

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants