From c4f2de198e1a4a2a396872617c88d4e89876de44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Ferenc=20Mezei?= Date: Sat, 2 Mar 2019 23:21:40 +0000 Subject: [PATCH] Add option :tex_output_standalone to set the 'include_preamble' argument in the PGFPlots backend. --- src/arg_desc.jl | 1 + src/args.jl | 1 + src/backends/pgfplots.jl | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/arg_desc.jl b/src/arg_desc.jl index 6fe8f068..32c4220f 100644 --- a/src/arg_desc.jl +++ b/src/arg_desc.jl @@ -63,6 +63,7 @@ const _arg_desc = KW( :link => "Symbol. How/whether to link axis limits between subplots. Values: `:none`, `:x` (x axes are linked by columns), `:y` (y axes are linked by rows), `:both` (x and y are linked), `:all` (every subplot is linked together regardless of layout position).", :overwrite_figure => "Bool. Should we reuse the same GUI window/figure when plotting (true) or open a new one (false).", :html_output_format => "Symbol. When writing html output, what is the format? `:png` and `:svg` are currently supported.", +:tex_output_standalone => "Bool. When writing tex output, should the source include a preamble for a standalone document class.", :inset_subplots => "nothing or vector of 2-tuple (parent,bbox). optionally pass a vector of (parent,bbox) tuples which are the parent layout and the relative bounding box of inset subplots", :dpi => "Number. Dots Per Inch of output figures", :thickness_scaling => "Number. Scale for the thickness of all line elements like lines, borders, axes, grid lines, ... defaults to 1.", diff --git a/src/args.jl b/src/args.jl index 3285571b..a5f043b4 100644 --- a/src/args.jl +++ b/src/args.jl @@ -298,6 +298,7 @@ const _plot_defaults = KW( :link => :none, :overwrite_figure => true, :html_output_format => :auto, + :tex_output_standalone => false, :inset_subplots => nothing, # optionally pass a vector of (parent,bbox) tuples which are # the parent layout and the relative bounding box of inset subplots :dpi => DPI, # dots per inch for images, etc diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index 1aebf6ef..4f6d99af 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -564,7 +564,7 @@ end function _show(io::IO, mime::MIME"application/x-tex", plt::Plot{PGFPlotsBackend}) fn = tempname()*".tex" - PGFPlots.save(fn, backend_object(plt), include_preamble=false) + PGFPlots.save(fn, backend_object(plt), include_preamble=plt.attr[:tex_output_standalone]) write(io, read(open(fn), String)) end