I usually export my TikzPictures two times: once as a pdf/svg, which I use for immediate inspection; and then as a TEX file.
The latter one is always meant to be embedded in a larger document, which has its own preamble. Sometimes, I also want to omit the tikzpicture environment, so that setting include_preamble=false does not suffice. Skipping the tikzpicture environment has the advantage that its options can be altered in the main document, without changing the included Tikz file.
Doing so is particularly nice when exporting Tikz code from PGFPlots.jl.
This PR provides an option to either i) save a complete TEX file that can be compiled as a standalone document; ii) omit the preamble, which is just identical to setting include_preamble=false; and iii) to print the Tikz code just as it is. The first option remains the default and the include_preamble argument is maintained for compatibility.
save(TEX("test"; limit_to=:all), tp) # the default, save a complete file
save(TEX("test"; limit_to=:picture), tp) # only wrap in a tikzpicture environment
save(TEX("test"; include_preamble=false), tp) # equivalent to the above line
save(TEX("test"; limit_to=:data), tp) # do not wrap the Tikz code, at all
For those who do not use the new limit_to argument, nothing changes.
I usually export my TikzPictures two times: once as a pdf/svg, which I use for immediate inspection; and then as a
TEX
file.The latter one is always meant to be embedded in a larger document, which has its own preamble. Sometimes, I also want to omit the
tikzpicture
environment, so that settinginclude_preamble=false
does not suffice. Skipping thetikzpicture
environment has the advantage that its options can be altered in the main document, without changing the included Tikz file.Doing so is particularly nice when exporting Tikz code from PGFPlots.jl.
This PR provides an option to either i) save a complete
TEX
file that can be compiled as a standalone document; ii) omit the preamble, which is just identical to settinginclude_preamble=false
; and iii) to print the Tikz code just as it is. The first option remains the default and theinclude_preamble
argument is maintained for compatibility.For those who do not use the new
limit_to
argument, nothing changes.