Here is information that may be useful for people who are new to brew.
(I learned about brew today and used it to create a book document with a chapter for each "specialty.")
Shane's link is helpful. Another link is Brew . It has downloads and a quick reference guide (seven pages).
In at least one way, brew is better than Sweave:
- In brew, tags are simpler; they are variations of <% ...%>.
- In Sweave, the tags are <<... → = ... @ and \ Sexpr {...}.
If you want to try brew, follow these steps in R:
install.packages("brew") library(brew)
Save the following brew code in a file called book.brew . The code prints several digits pi with one digit for each chapter. Note that there is one loop, and its parts are in latex, and its parts are in brew tags.
\documentclass{book} \title{A book} \begin{document} \maketitle <%# This comment will not appear in the Latex file. %> <% digits = c(3, 1, 4, 1, 5, 9) for (i in 1:length(digits)) { %> \chapter{Digit $<%= i %>$} Digit $<%= i %>$ of $\pi$ is $<%= digits[i] %>$. <% } %> \end{document}
Note: when you save the file, make the last line empty, or brew will give you a warning about the incomplete line.
In R, enter
brew("/your/path/to/book.brew", "/where/you/want/brew/to/create/book.tex")
Compile the Latex book.tex file.
source share