daqana / tikzDevice

A R package for producing graphics output as PGF/TikZ code for use in TeX documents.
https://daqana.github.io/tikzDevice
132 stars 26 forks source link

New argument to provide additional options to tikzpicture environment #148

Open hbuschme opened 8 years ago

hbuschme commented 8 years ago

The changes in this pull request extend the R-function tikz with a new character string argument pictureOptions that allows for a specification of additional options that are provided to the tikzpicture environment's option list.

This feature results from a personal need of mine. I need the plots from tikzdevice to be typeset in a sans-serif font family. So far I have generated the plots as complete figures and have manually added ,font=\sffamily to the option list of the tikzpicture environment.

Using the new argument it is now possible to add the option from within R

tikz("tikz-example.tex", width = 3.25, height = 3.25, pictureOptions = ",font=\sffamily")
plot(1, 1, main = "Hello \\TeX !")
dev.off()

which then results in the following TikZ/LaTeX code:

    … \begin{tikzpicture}[x=1pt,y=1pt,font=\sffamily] …

Of course other options, or lists of options, can be specified as well.

yihui commented 8 years ago

Looks reasonable to me. Cc @krlmlr

hbuschme commented 6 years ago

Yes, I'm still interested in this, and I thought that I checked this PR now and then – apparently not, since I did not see your question from August 2017, sorry. I just got a notification about the closing of this PR and would be interested in re-opening it.

Concerning your questions, I'm not a C/C++ expert and am afraid that I cannot answer your memory-related questions competently.

Are you willing to continue?

krlmlr commented 6 years ago

Sure, I can reopen it. I have just pushed an update to tikzDevice to CRAN, but it hasn't been accepted yet. After that I'll be looking for a new maintainer who will be more responsive hopefully ;-)

krlmlr commented 6 years ago

Could you please take a look at the conflict?

hbuschme commented 6 years ago

I've rebased my changes. It has no conflicts anymore and we can start tackling the questions you raised above. If you think that things should change, feel free to make these changes.

rstub commented 6 years ago

I am sorry that this has been lying around for so long. Can you please rebase the PR again? Thanks.