-
Notifications
You must be signed in to change notification settings - Fork 27
New argument to provide additional options to tikzpicture environment #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -172,6 +172,7 @@ SEXP TikZ_StartDevice ( SEXP args ){ | |
| int maxSymbolicColors = asInteger(CAR(args)); args = CDR(args); | ||
| Rboolean timestamp = asLogical(CAR(args)); args = CDR(args); | ||
| Rboolean verbose = asLogical(CAR(args)); args = CDR(args); | ||
| const char *pictureOptions = CHAR(asChar(CAR(args))); args = CDR(args); | ||
|
|
||
| /* Ensure there is an empty slot avaliable for a new device. */ | ||
| R_CheckDeviceAvailable(); | ||
|
|
@@ -203,7 +204,7 @@ SEXP TikZ_StartDevice ( SEXP args ){ | |
| if( !TikZ_Setup( deviceInfo, fileName, width, height, onefile, bg, fg, baseSize, lwdUnit, | ||
| standAlone, bareBones, documentDeclaration, packages, | ||
| footer, console, sanitize, engine, symbolicColors, colorFileName, | ||
| maxSymbolicColors, timestamp, verbose ) ){ | ||
| maxSymbolicColors, timestamp, verbose, pictureOptions ) ){ | ||
| /* | ||
| * If setup was unsuccessful, destroy the device and return | ||
| * an error message. | ||
|
|
@@ -249,7 +250,8 @@ static Rboolean TikZ_Setup( | |
| const char *packages, const char *footer, | ||
| Rboolean console, Rboolean sanitize, int engine, | ||
| Rboolean symbolicColors, const char* colorFileName, | ||
| int maxSymbolicColors, Rboolean timestamp, Rboolean verbose){ | ||
| int maxSymbolicColors, Rboolean timestamp, Rboolean verbose, | ||
| const char *pictureOptions ){ | ||
|
|
||
| /* | ||
| * Create tikzInfo, this variable contains information which is | ||
|
|
@@ -315,6 +317,7 @@ static Rboolean TikZ_Setup( | |
| tikzInfo->onefile = onefile; | ||
| tikzInfo->timestamp = timestamp; | ||
| tikzInfo->verbose = verbose; | ||
| tikzInfo->pictureOptions = calloc_strcpy(pictureOptions); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to free this after we're done?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might need a call to |
||
|
|
||
| /* initialize strings, just to be on the safe side */ | ||
| strscpy(tikzInfo->drawColor, "drawColor"); | ||
|
|
@@ -2291,7 +2294,9 @@ static void TikZ_CheckState(pDevDesc deviceInfo) | |
|
|
||
| if ( tikzInfo->bareBones != TRUE ) | ||
| { | ||
| printOutput(tikzInfo, "\\begin{tikzpicture}[x=1pt,y=1pt]\n"); | ||
| printOutput(tikzInfo, "\\begin{tikzpicture}[x=1pt,y=1pt%s%s]\n", | ||
| tikzInfo->pictureOptions[0] != '\0' ? "," : "", | ||
| tikzInfo->pictureOptions); | ||
|
|
||
| if( tikzInfo->symbolicColors && tikzInfo->outColorFileName) | ||
| printOutput(tikzInfo, "\\InputIfFileExists{%s}{}{}\n", tikzInfo->outColorFileName); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm slightly worried about protection here, because
asChar()might allocate memory in corner cases.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
CHAR(PROTECT(asChar(...))), and then increase the number passed toUNPROTECT()by one?