Mercurial > octave-nkf
comparison doc/interpreter/geometryimages.m @ 20370:b439ccc9a162
doc: Improve building of images for the Manual.
Switch to using 'qt' as the default toolkit.
Stop producing onscreen flicker when building images.
Correctly build extended.pdf with new non-recursive build system.
* plot.txi: Change sample code for generation of image 15.7 to match the code
in plotimages.m
* geometryimages.m, sparseimages.m, interpimages.m, splineimages.m:
Call new function set_graphics_toolkit which makes sure there is at least
something available to do plotting with. Change hide_output() function
to call figure() directly with "visible", "off" properties passed to it
so there is never a moment when the figure is visible (stops flicker).
* plotimages.m: Change directory to working directory where documentation files
are kept before executing print with "-pdflatexstandalone". Call pdflatex
from within the working directory since that is what it expects. Clean up
after pdflatex by deleting auxiliary files. Capture status and output of
system command which invokes pdflatex so that it does not spew in to the
logs. Change text() command to use '\displaystyle' which looks nicer.
Add set_graphics_toolkit function and modify hide_output function as above.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 12 Jul 2015 15:00:26 -0700 |
parents | d8992a16643c |
children |
comparison
equal
deleted
inserted
replaced
20369:07dd8e602f4e | 20370:b439ccc9a162 |
---|---|
15 ## You should have received a copy of the GNU General Public License | 15 ## You should have received a copy of the GNU General Public License |
16 ## along with Octave; see the file COPYING. If not, see | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | 17 ## <http://www.gnu.org/licenses/>. |
18 | 18 |
19 function geometryimages (d, nm, typ) | 19 function geometryimages (d, nm, typ) |
20 graphics_toolkit ("gnuplot"); | 20 set_graphics_toolkit (); |
21 set_print_size (); | 21 set_print_size (); |
22 hide_output (); | 22 hide_output (); |
23 outfile = fullfile (d, [nm "." typ]); | 23 outfile = fullfile (d, [nm "." typ]); |
24 if (strcmp (typ, "png")) | 24 if (strcmp (typ, "png")) |
25 set (0, "defaulttextfontname", "*"); | 25 set (0, "defaulttextfontname", "*"); |
133 hide_output (); | 133 hide_output (); |
134 end_unwind_protect | 134 end_unwind_protect |
135 endif | 135 endif |
136 endfunction | 136 endfunction |
137 | 137 |
138 ## This function no longer sets the graphics toolkit; That is now done | |
139 ## automatically by C++ code which will ordinarily choose 'qt', but might | |
140 ## choose gnuplot on older systems. Only a complete lack of plotting is a | |
141 ## problem. | |
142 function set_graphics_toolkit () | |
143 if (isempty (available_graphics_toolkits ())) | |
144 error ("no graphics toolkit available for plotting"); | |
145 endif | |
146 endfunction | |
147 | |
138 function set_print_size () | 148 function set_print_size () |
139 image_size = [5.0, 3.5]; # in inches, 16:9 format | 149 image_size = [5.0, 3.5]; # in inches, 16:9 format |
140 border = 0; # For postscript use 50/72 | 150 border = 0; # For postscript use 50/72 |
141 set (0, "defaultfigurepapertype", "<custom>"); | 151 set (0, "defaultfigurepapertype", "<custom>"); |
142 set (0, "defaultfigurepaperorientation", "landscape"); | 152 set (0, "defaultfigurepaperorientation", "landscape"); |
143 set (0, "defaultfigurepapersize", image_size + 2*border); | 153 set (0, "defaultfigurepapersize", image_size + 2*border); |
144 set (0, "defaultfigurepaperposition", [border, border, image_size]); | 154 set (0, "defaultfigurepaperposition", [border, border, image_size]); |
145 endfunction | 155 endfunction |
146 | 156 |
147 ## Use this function before plotting commands and after every call to | 157 ## Use this function before plotting commands and after every call to print |
148 ## print since print() resets output to stdout (unfortunately, gnpulot | 158 ## since print() resets output to stdout (unfortunately, gnuplot can't pop |
149 ## can't pop output as it can the terminal type). | 159 ## output as it can the terminal type). |
150 function hide_output () | 160 function hide_output () |
151 hf = figure (1); | 161 hf = figure (1, "visible", "off"); |
152 set (hf, "visible", "off"); | |
153 endfunction | 162 endfunction |
154 | 163 |
155 ## generate something for the texinfo @image command to process | 164 ## generate something for the texinfo @image command to process |
156 function image_as_txt (d, nm) | 165 function image_as_txt (d, nm) |
157 fid = fopen (fullfile (d, [nm ".txt"]), "wt"); | 166 fid = fopen (fullfile (d, [nm ".txt"]), "wt"); |