diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index 0eb97fd8..b42e8629 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -314,12 +314,18 @@ function _show(io::IO, mime::MIME"application/pdf", plt::Plot{PGFPlotsBackend}) PGFPlots.save(PGFPlots.PDF(fn), pgfplt) # read it into io - write(io, readall(open(fn))) + write(io, readstring(open(fn))) # cleanup PGFPlots.cleanup(plt.o) 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) + write(io, readstring(open(fn))) +end + function _display(plt::Plot{PGFPlotsBackend}) # prepare the object pgfplt = PGFPlots.plot(plt.o) diff --git a/src/output.jl b/src/output.jl index ff4a1def..ee9972ab 100644 --- a/src/output.jl +++ b/src/output.jl @@ -154,6 +154,7 @@ const _mimeformats = Dict( "application/postscript" => "ps", "image/svg+xml" => "svg", "text/plain" => "txt", + "application/x-tex" => "tex", ) const _best_html_output_type = KW(