KristofferC / PGFPlotsX.jl

Plots in Julia using the PGFPlots LaTeX package
Other
301 stars 40 forks source link

I do not know the key '/tikz/show background rectangle' #256

Closed gustaphe closed 2 years ago

gustaphe commented 3 years ago

Tikz doesn't recognize the argument show background rectangle given when printing a plot to tikz file.

KristofferC commented 3 years ago

I think you need to add

\usetikzlibrary{backgrounds}

to the preamble. When does this occur?

gustaphe commented 3 years ago

Yes, that did the trick. I got a list of other tikzlibraries to import when compiling, but not that one.

When compiling a document containing a figure saved as a *.tikz file. Nothing touching any background settings in the plot( call.

Perhaps it should write a comment line listing required libraries?

tpapp commented 3 years ago

That would make sense. PRs are welcome.

gustaphe commented 3 years ago

I'll see what I can do :)

tpapp commented 3 years ago

Basically the functionality is in this print_tex method. I think it would be OK if include_preamble == false also printed a preamble, just prepended with with %, and perhaps a beginning/end comment, like

%%% Recommended preamble:
% ...
%%% END OF PREAMBLE

I think this is innocuous since preambles are usually super-short and comments should not cause any problems.