# HG changeset patch # User Ben Abbott # Date 1296256695 18000 # Node ID 18f7aac81ef052d296bb667d72afc0d7276c0763 # Parent 52f6f2989fcd2dce5b38fb8cc991fa003ef34660 Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262. diff -r 52f6f2989fcd -r 18f7aac81ef0 scripts/ChangeLog --- a/scripts/ChangeLog Fri Jan 28 14:05:59 2011 -0500 +++ b/scripts/ChangeLog Fri Jan 28 18:18:15 2011 -0500 @@ -1,3 +1,8 @@ +2011-01-28 Ben Abbott + + * plot/__fltk_print__.m, plot/print.m: Fix {eps,ps,pdf}latexstandalone + printing for fltk, bug 32262. + 2011-01-28 John W. Eaton * sparse/svds.m: Use "test" instead of "testif HAVE_ARPACK". diff -r 52f6f2989fcd -r 18f7aac81ef0 scripts/plot/__fltk_print__.m --- a/scripts/plot/__fltk_print__.m Fri Jan 28 14:05:59 2011 -0500 +++ b/scripts/plot/__fltk_print__.m Fri Jan 28 18:18:15 2011 -0500 @@ -65,10 +65,11 @@ gl2ps_device = {sprintf("%snotxt", lower (suffix))}; gl2ps_device{2} = "tex"; if (dos_shell) - pipeline = {sprintf("copy con %s.%s", name, suffix)}; - pipeline{2} = sprintf ("copy con %s.tex", name); + ## FIXME - this will only work on MinGW with the MSYS shell + pipeline = {sprintf("cat > %s-inc.%s", name, suffix)}; + pipeline{2} = sprintf ("cat > %s.tex", name); else - pipeline = {sprintf("cat > %s.%s", name, suffix)}; + pipeline = {sprintf("cat > %s-inc.%s", name, suffix)}; pipeline{2} = sprintf ("cat > %s.tex", name); endif case "tikz" @@ -161,5 +162,9 @@ end_unwind_protect endfor + if (! isempty (strfind (opts.devopt, "standalone"))) + opts.latex_standalone (opts); + endif + endfunction diff -r 52f6f2989fcd -r 18f7aac81ef0 scripts/plot/print.m --- a/scripts/plot/print.m Fri Jan 28 14:05:59 2011 -0500 +++ b/scripts/plot/print.m Fri Jan 28 18:18:15 2011 -0500 @@ -577,9 +577,28 @@ endif endfunction -function latex_standalone (latexfile) +function latex_standalone (opts) + n = find (opts.name == ".", 1, "last"); + if (! isempty (n)) + opts.name = opts.name(1:n-1); + endif + latexfile = strcat (opts.name, ".tex"); + switch opts.devopt + case {"pdflatexstandalone"} + packages = "\\usepackage{graphicx,color}"; + graphicsfile = strcat (opts.name, "-inc.pdf"); + case {"pslatexstandalone"} + packages = "\\usepackage{epsfig,color}"; + graphicsfile = strcat (opts.name, "-inc.ps"); + otherwise + packages = "\\usepackage{epsfig,color}"; + graphicsfile = strcat (opts.name, "-inc.eps"); + endswitch + papersize = sprintf ("\\usepackage[papersize={%.2fbp,%.2fbp},text={%.2fbp,%.2fbp}]{geometry}", + opts.canvas_size, opts.canvas_size); prepend = {"\\documentclass{minimal}"; - "\\usepackage{epsfig,color}"; + packages; + papersize; "\\begin{document}"; "\\centering"}; postpend = {"\\end{document}"}; @@ -591,6 +610,9 @@ error ("print:errorclosingfile", "print.m: error closing file '%s'", latexfile); endif + ## TODO - should this be fixed in GL2PS? + latex = strrep (latex, "\\includegraphics{}", + sprintf ("\\includegraphics{%s}", graphicsfile)); else error ("print:erroropeningfile", "print.m: error opening file '%s'", latexfile);