comparison doc/interpreter/splineimages.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 splineimages (d, nm, typ) 19 function splineimages (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", "*");
157 print (outfile, d_typ); 157 print (outfile, d_typ);
158 endif 158 endif
159 hide_output (); 159 hide_output ();
160 endfunction 160 endfunction
161 161
162 ## This function no longer sets the graphics toolkit; That is now done
163 ## automatically by C++ code which will ordinarily choose 'qt', but might
164 ## choose gnuplot on older systems. Only a complete lack of plotting is a
165 ## problem.
166 function set_graphics_toolkit ()
167 if (isempty (available_graphics_toolkits ()))
168 error ("no graphics toolkit available for plotting");
169 endif
170 endfunction
171
162 function set_print_size () 172 function set_print_size ()
163 image_size = [5.0, 3.5]; # in inches, 16:9 format 173 image_size = [5.0, 3.5]; # in inches, 16:9 format
164 border = 0; # For postscript use 50/72 174 border = 0; # For postscript use 50/72
165 set (0, "defaultfigurepapertype", "<custom>"); 175 set (0, "defaultfigurepapertype", "<custom>");
166 set (0, "defaultfigurepaperorientation", "landscape"); 176 set (0, "defaultfigurepaperorientation", "landscape");
167 set (0, "defaultfigurepapersize", image_size + 2*border); 177 set (0, "defaultfigurepapersize", image_size + 2*border);
168 set (0, "defaultfigurepaperposition", [border, border, image_size]); 178 set (0, "defaultfigurepaperposition", [border, border, image_size]);
169 endfunction 179 endfunction
170 180
171 ## Use this function before plotting commands and after every call to 181 ## Use this function before plotting commands and after every call to print
172 ## print since print() resets output to stdout (unfortunately, gnpulot 182 ## since print() resets output to stdout (unfortunately, gnuplot can't pop
173 ## can't pop output as it can the terminal type). 183 ## output as it can the terminal type).
174 function hide_output () 184 function hide_output ()
175 hf = figure (1); 185 hf = figure (1, "visible", "off");
176 set (hf, "visible", "off");
177 endfunction 186 endfunction
178 187
179 ## generate something for the texinfo @image command to process 188 ## generate something for the texinfo @image command to process
180 function image_as_txt (d, nm) 189 function image_as_txt (d, nm)
181 fid = fopen (fullfile (d, [nm ".txt"]), "wt"); 190 fid = fopen (fullfile (d, [nm ".txt"]), "wt");