Mercurial > octave-nkf
comparison scripts/plot/print.m @ 12279:18f7aac81ef0 release-3-4-x
Fix {eps,ps,pdf}latexstandalone printing for fltk, bug 32262.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Fri, 28 Jan 2011 18:18:15 -0500 |
parents | b0084095098e |
children | e81ddf9cacd5 |
comparison
equal
deleted
inserted
replaced
12278:52f6f2989fcd | 12279:18f7aac81ef0 |
---|---|
575 if (opts.debug) | 575 if (opts.debug) |
576 fprintf ("fig2dev command: '%s'\n", cmd); | 576 fprintf ("fig2dev command: '%s'\n", cmd); |
577 endif | 577 endif |
578 endfunction | 578 endfunction |
579 | 579 |
580 function latex_standalone (latexfile) | 580 function latex_standalone (opts) |
581 n = find (opts.name == ".", 1, "last"); | |
582 if (! isempty (n)) | |
583 opts.name = opts.name(1:n-1); | |
584 endif | |
585 latexfile = strcat (opts.name, ".tex"); | |
586 switch opts.devopt | |
587 case {"pdflatexstandalone"} | |
588 packages = "\\usepackage{graphicx,color}"; | |
589 graphicsfile = strcat (opts.name, "-inc.pdf"); | |
590 case {"pslatexstandalone"} | |
591 packages = "\\usepackage{epsfig,color}"; | |
592 graphicsfile = strcat (opts.name, "-inc.ps"); | |
593 otherwise | |
594 packages = "\\usepackage{epsfig,color}"; | |
595 graphicsfile = strcat (opts.name, "-inc.eps"); | |
596 endswitch | |
597 papersize = sprintf ("\\usepackage[papersize={%.2fbp,%.2fbp},text={%.2fbp,%.2fbp}]{geometry}", | |
598 opts.canvas_size, opts.canvas_size); | |
581 prepend = {"\\documentclass{minimal}"; | 599 prepend = {"\\documentclass{minimal}"; |
582 "\\usepackage{epsfig,color}"; | 600 packages; |
601 papersize; | |
583 "\\begin{document}"; | 602 "\\begin{document}"; |
584 "\\centering"}; | 603 "\\centering"}; |
585 postpend = {"\\end{document}"}; | 604 postpend = {"\\end{document}"}; |
586 fid = fopen (latexfile, "r"); | 605 fid = fopen (latexfile, "r"); |
587 if (fid >= 0) | 606 if (fid >= 0) |
589 status = fclose (fid); | 608 status = fclose (fid); |
590 if (status != 0) | 609 if (status != 0) |
591 error ("print:errorclosingfile", | 610 error ("print:errorclosingfile", |
592 "print.m: error closing file '%s'", latexfile); | 611 "print.m: error closing file '%s'", latexfile); |
593 endif | 612 endif |
613 ## TODO - should this be fixed in GL2PS? | |
614 latex = strrep (latex, "\\includegraphics{}", | |
615 sprintf ("\\includegraphics{%s}", graphicsfile)); | |
594 else | 616 else |
595 error ("print:erroropeningfile", | 617 error ("print:erroropeningfile", |
596 "print.m: error opening file '%s'", latexfile); | 618 "print.m: error opening file '%s'", latexfile); |
597 endif | 619 endif |
598 fid = fopen (latexfile, "w"); | 620 fid = fopen (latexfile, "w"); |