I found what the problem is. The forest function writes a lot of text labels with % in them, which of course is a latex comment. This causes latex error because the latex braces were not seen as closed. for example (this is hypothetical)<div>
<br></div><div>\command{ 100% of the whole }</div><div><br></div><div>will generate an error in latex. I implemented a quick fix in the tikzDevice code to print out </div><div><br></div><div>\command{ 100% of the whole %</div>
<div>}</div><div><br></div><div>instead. So no errors will be generated but the string after the % will be cut off. The long term solution would be to implement a "sanitizeString" function which converts characters such as %, $ and & to \%, \$ and \&. </div>
<div><br></div><div>Obviously you can go into the code for that function and change all the % to \%. But that is an extremely annoying solution. So for now you can either hack the forest function or install the updates from github (both of which are unsatisfactory). </div>
<div><br></div><div><a href="http://github.com/cameronbracken/rtikzdevice/tree/sanitize-strings">http://github.com/cameronbracken/rtikzdevice/tree/sanitize-strings</a></div><div><br></div><div>I can put together a long term solution in the next couple weeks. Thanks for bringing this to my attention. </div>
<div><br></div><div><br clear="all">-Cameron<br>
<br><br><div class="gmail_quote">On Thu, Nov 19, 2009 at 1:06 PM, Cameron Bracken <span dir="ltr"><<a href="mailto:cameron.bracken@gmail.com" target="_blank">cameron.bracken@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font face="arial, helvetica, sans-serif">Ok, I can reproduce this on my mac so it is not just a windows thing. I remember seeing this error before, I cant remember exactly where though. </font><span style="border-collapse:collapse"><font face="arial, helvetica, sans-serif"> I will investigate further and let you know. Thanks for the report. </font></span><br clear="all">
<font color="#888888">
-Cameron</font><div><div></div><div><br>
<br><br><div class="gmail_quote">On Thu, Nov 19, 2009 at 12:51 PM, Jacques Ropers <span dir="ltr"><<a href="mailto:jropers@freesurf.fr" target="_blank">jropers@freesurf.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#ffffff" text="#000000">
<font size="+1">Dear Cameron,<br>
This e-mail in order to submit you what may be a bug in tikzdevice.<br>
The following plot causes an error (in WinXP) with tikzdevice, whereas
it produces a forest plot with a standard device.<br>
<br>
#########################<br>
</font><font size="+1"><tt>options( tikzLatex =
"c:\\xetex\\bin\\pdflatex.exe" )<br>
options( tikzMetricsDictionary = "D:\\metrics")<br>
require(tikzDevice)<br>
library(meta)<br>
<br>
n.placebo <- c(205, 230, 200, 210, 185)<br>
N.placebo <- c(290, 295, 250, 250, 222)<br>
<a href="http://n.tt" target="_blank">n.tt</a> <- c(200, 400, 575, 400, 512)<br>
N.tt <- c(276, 537, 750, 450, 600)<br>
donnees <- data.frame(n.placebo, N.placebo, <a href="http://n.tt" target="_blank">n.tt</a>, N.tt)<br>
<br>
meta1 <- metabin(<a href="http://n.tt" target="_blank">n.tt</a>, N.tt, n.placebo, N.placebo,<br>
data=donnees, sm="RR", meth="MH", label.e="Treatment",
label.c="Placebo")<br>
<br>
<br>
tikz(file = "Rplots.tex", standAlone=TRUE)<br>
forest(meta1,lab.e="Treatment", lab.c="Placebo")<br>
dev.off()</tt></font><font size="+1"><br>
</font><font size="+1"><br>
#########################</font><br>
<font size="+1"><br>
The error message I get is:<br>
<br>
</font><font size="+1"><tt>Creating new tikz metrics dictionary in:<br>
D:\metrics<br>
Erreur dans if (width > 0) { : <br>
valeur manquante là où TRUE / FALSE est requis<br>
De plus : Messages d'avis :<br>
1: In getMetricsFromLatex(TeXMetrics) :<br>
NAs introduits lors de la conversion automatique<br>
2: In if (width > 0) { :<br>
la condition a une longueur > 1 et seul le premier élément est
utilisé</tt></font><font size="+1"><br>
<br>
Thanks for your help and for your job on tikzdevice!<br>
Best Regards<br>
Jacques<br>
</font>
</div>
</blockquote></div><br>
</div></div></blockquote></div><br></div>