1## Copyright (C) 1998-2003 Joao Cardoso.
2##
3## This program is free software; you can redistribute it and/or modify it
4## under the terms of the GNU General Public License as published by
5## the Free Software Foundation; either version 2, or (at your option)
6## any later version.
7##
8## This program is distributed in the hope that it will be useful, but
9## WITHOUT ANY WARRANTY; without even the implied warranty of
10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11## General Public License for more details.
12##
13## This file is part of plplot_octave.
14
15## usage: title (text)
16##
17## Defines a title for the next plots
18##   The special character `#' followed by another special character may be
19##   used for special text manipulation, eg ';x#u2#d;' prints `x^2' in math,
20##	 and `title("#gS#u5#b#d#dn=1#u") prints \sum_{n=1}^{5}.
21##
22##		#u superscript, end with #d
23##		#d subscript, end with #u
24##		#b backspace
25##		## # itself
26##		#+ toogle overline mode
27##		#- toogle underline mode
28##		#gx greek letter x
29##		#fn switch to normal font
30##		#fr switch to roman font
31##		#fi switch to italic font
32##		#fs switch to script font
33##		#(nnn) hershey character nnn
34##
35##		For special fonts, the extended charset must be loaded first,
36##	 	use `plfontld(1)' to set, and `plfontld(0)' to return to normal.
37##
38## See also: xlabel, ylabel, zlabel
39
40function text = title (text)
41
42  global __pl
43  global pl_automatic_replot
44
45  strm = __pl_init;
46
47  if (nargin > 1)
48    usage ("title (text)");
49  endif
50
51  if (nargin == 1 && isempty(text))
52    text = " ";
53  endif
54
55  if (nargin == 0)
56    text = __pl.tlabel(strm,:);
57  else
58    __pl.tlabel = __pl_matstr(__pl.tlabel, text, strm);
59  endif
60
61  if (exist("pl_automatic_replot"))
62    if (pl_automatic_replot)
63      __pl_plotit;
64    endif
65  endif
66
67endfunction
68
69