[Tikzdevice-bugs] Tikzdevice bug

Cameron Bracken cameron.bracken at gmail.com
Fri Nov 20 06:31:01 CET 2009


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)

\command{ 100% of the whole }

will generate an error in latex.  I implemented a quick fix in the
tikzDevice code to print out

\command{ 100% of the whole %
}

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 \&.

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).

http://github.com/cameronbracken/rtikzdevice/tree/sanitize-strings

I can put together a long term solution in the next couple weeks. Thanks for
bringing this to my attention.


-Cameron


On Thu, Nov 19, 2009 at 1:06 PM, Cameron Bracken
<cameron.bracken at gmail.com>wrote:

> 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.  I
> will investigate further and let you know.  Thanks for the report.
>  -Cameron
>
>
>
> On Thu, Nov 19, 2009 at 12:51 PM, Jacques Ropers <jropers at freesurf.fr>wrote:
>
>>  Dear Cameron,
>> This e-mail in order to submit you what may be a bug in tikzdevice.
>> The following plot causes an error (in WinXP) with tikzdevice, whereas it
>> produces a forest plot with a standard device.
>>
>> #########################
>> options( tikzLatex = "c:\\xetex\\bin\\pdflatex.exe" )
>> options( tikzMetricsDictionary = "D:\\metrics")
>> require(tikzDevice)
>> library(meta)
>>
>> n.placebo <- c(205, 230, 200, 210, 185)
>> N.placebo <- c(290, 295, 250, 250, 222)
>> n.tt <- c(200, 400, 575, 400, 512)
>> N.tt <- c(276, 537, 750, 450, 600)
>> donnees <- data.frame(n.placebo, N.placebo, n.tt, N.tt)
>>
>> meta1 <- metabin(n.tt, N.tt, n.placebo, N.placebo,
>> data=donnees, sm="RR", meth="MH", label.e="Treatment", label.c="Placebo")
>>
>>
>> tikz(file = "Rplots.tex", standAlone=TRUE)
>> forest(meta1,lab.e="Treatment", lab.c="Placebo")
>> dev.off()
>>
>> #########################
>>
>> The error message I get is:
>>
>> Creating new tikz metrics dictionary in:
>>         D:\metrics
>> Erreur dans if (width > 0) { :
>>   valeur manquante là où TRUE / FALSE est requis
>> De plus : Messages d'avis :
>> 1: In getMetricsFromLatex(TeXMetrics) :
>>   NAs introduits lors de la conversion automatique
>> 2: In if (width > 0) { :
>>   la condition a une longueur > 1 et seul le premier élément est utilisé
>>
>> Thanks for your help and for your job on tikzdevice!
>> Best Regards
>> Jacques
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/tikzdevice-bugs/attachments/20091119/d426ac01/attachment.htm 


More information about the Tikzdevice-bugs mailing list