[Tikzdevice-bugs] metapost device: problem with calculating font space?

mat matthieu.stigler at gmail.com
Fri Apr 22 12:48:53 CEST 2011


Le 22. 04. 11 07:52, Charlie Sharpsteen a écrit :
> On Thu, Apr 21, 2011 at 2:57 AM, Matthieu Stigler<
> matthieu.stigler at gmail.com>  wrote:
>
>> Hi
>>
>> This metapost() is really nice, thanks again Charlie and Cameron!!
>>
>> I'm encountering a problem that arises typically with metapost but not
>> tikz(): when legend is horinzontal, there is a problem of spacing, as well
>> as tick mark below the text. Can you confirm?
>>
>> library(tikzDevice)
>>
>> metapost("~/temp/regimes.tex")
>> plot(runif(100))
>> legend(0,1, lty=1, leg=c("High regime probability","Future prices") ,
>> bty="n", horiz=TRUE, lwd=1, bg="white")
>> dev.off()
>>
> This is most likely due to the fact that I did not implement any metric
> calculations for the Metapost device---it simply uses the results by
> computed by LaTeX for TikZ which are not correct but better than nothing.
>
>
> Also, do you think you would extend the font size calculation for metapost()
>> too soon? Would be so useful!!
>>
>   I pushed some changes that should help although a complete solution will be
> difficult to do in a short period of time. One place where MetaPost
> is decidedly worse than TikZ is access to font info.  With TIkZ we can
> extract all sorts of useful information such as the ascent and descent of
> characters. With MetaPost, the only clear parameter that can be clearly
> extracted is the overall height of the text box.  So, text may not
> vertically center exactly as it should---but things like legends will at
> least look passable.  Also, you should now be able to resize the text. There
> is still no support for text color.
>
> I don't have the time to write extensive error checking at this moment---but
> the device is still generating all of our test graphs without a problem.  If
> the device cannot find the ConTeXt compiler, you may need to manually edit
> the path assigned to `tikzContext` in R/deviceUtils.R.
>
Great, seems you did a very nice job, thanks!!!

I'm however facing a very strange problem, that I do not understand... 
It seems now that opening tikzDevice, there won't be any search for the
compilers anymore, right? As consequence, the default options are not 
set anymore, which will break the simplest tikz, see:

library(tikzDevice)
Loading required package: filehash
filehash: Simple key-value database (2.1-1 2010-10-04)
 > getOption("tikzFooter")
NULL
 > getOption("tikzDefaultEngine")
NULL
 > library(tikzDevice)
 > tikz("~/temp/go.tex")
Error in switch(engine, pdftex = { : EXPR must be a length 1 vector

(btw, is this line useful also for the metapost function?)


So I tried to open the session with setTikzDefaults()
which partly solves the problem, but I came to something more critical:

Error in .External("metapDevice", file, width, height, bg, fg, baseSize 
= pointsize,  :
   C symbol name "metapDevice" not in DLL for package "tikzDevice"
Calls: metapost -> .External

which I do not understand....

Any idea? Thanks!!!

Matthieu



> -Charlie
>
>
>> 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
>>
> _______________________________________________
> 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



More information about the Tikzdevice-bugs mailing list