[Tikzdevice-bugs] Special characters?

Cameron Bracken cameron.bracken at gmail.com
Wed Apr 20 18:34:40 CEST 2011


On Wed, Apr 20, 2011 at 7:55 AM, Matthieu Stigler
<matthieu.stigler at gmail.com> wrote:
> Hi
>
> Can I ask a further related question?
>
> How does one make expressions to be recognised? Like in:
>
>
> library(tikzDevice)
> tikz("~/temp/examT.tex", standAlone=TRUE)
> plot(runif(100), main=expression(rho==1))
> dev.off()
>
> does not come in greek... I looked in manual, did not find, maybe still
> section 4.5.5?

There is a little bit about this in section 4.5.8 but most the
practical advice is in section 4.4 under plotmath:

> There is specifically no support for input of plotmath characters as unicode since the user can simply input \LaTeX{} math directly. We strongly encourage the use of \LaTeX{} math over plotmath for style and consistency's sake.  A consequence of this is that most of the \lang{R} examples and demos of plotmath won't work without significant manipulation (your milage may vary but you may get anything from errors to warnings to documents that mysteriously won't compile).  That is not to say that the output could not be duplicated with \code{tikzDevice} but the examples will not work out of the box.

So considering that advice, your example could be changed to

library(tikzDevice)
tikz("~/temp/examT.tex", standAlone=TRUE)
plot(runif(100), main="$\\rho=1$")
dev.off()

>
> Thanks!
>
> Matthieu
>
> Le 20/04/2011 15:22, Cameron Bracken a écrit :
>>
>> Hi Matthieu-
>>
>> You are right, not verbose indeed ;), I will update that, thanks!
>>
>> You have two options:
>>
>> 1. Us the `sanitizeTexString()` function (recommended)
>>
>>     tikz('prob.tex')
>>     plot(runif(100), main=sanitizeTexString("Unit: us$/t"))
>>     dev.off()
>>
>> 2. Or for cases where you might not have direct access to the string
>> use the `sanitize` option
>>
>>     tikz('prob.tex',sanitize=T)
>>     plot(runif(100), main="Unit: us$/t")
>>     dev.off()
>>
>> This option can be dangerous since it might sanitize characters that
>> you do not expect. See ?sanitizeTexString for the default characters
>> that are replaced and how to set your own replacement characters if
>> you need to.
>>
>> Cheers,
>> -Cameron
>>
>>
>>
>> On Wed, Apr 20, 2011 at 6:56 AM, Matthieu Stigler
>> <matthieu.stigler at gmail.com>  wrote:
>>>
>>> Hi
>>>
>>> I have a trouble with special characters... Hoped to find answers in sec
>>> 4.5.5 but seems not so verbose :-)
>>>
>>> Problem is simply I have characters that have latex meaning:
>>>
>>> library(tikzDevice)
>>>
>>> tikz('prob.tex')
>>>
>>> plot(runif(100), main="Unit: us$/t")
>>> dev.off()
>>>
>>> How can I solve this?
>>>
>>> Thanks!!
>>>
>>> Matthieu
>>> _______________________________________________
>>> Tikzdevice-bugs mailing list
>>> Tikzdevice-bugs at lists.r-forge.r-project.org
>>>
>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tikzdevice-bugs
>>>

Cheers,
-Cameron


More information about the Tikzdevice-bugs mailing list