##
## Example showing unexpected results from querying 'interpreter' property 
## after setting its default value to 'none', and from formatting strings using
## xlabel(), text() and legend().
##
## Comments indicate expectation and actual results obtained with Octave 3.8.1,
## executed with the --norc option.
##


#
# Use gnuplot toolkit for all subsequent graphic ops.
#
graphics_toolkit('gnuplot');

#
# Expectation of the following statement is that the 'interpreter' property
# for all subsequently created graphics objects will be 'none', but this does
# not seem to be the case, as the example show. Was not able to locate
# authoritative documentation on this property in the info(1) pages, but
# cargo-cult usage seems to agree with the above expectation.
#
set(0, 'DefaultTextInterpreter', 'none');


#
# Examples of various results disagreeing with expectation.
#
h = plot(1:6, sin(1:6));
get(h, 'interpreter')     # Reports 'tex', expecting 'none'

h = xlabel('foo_bar');    # Displays 'foo\_bar', expecting 'foo_bar'
get(h, 'interpreter')     # Reports 'none', as expected

h = text(2, 0,'foo_bar'); # Displays 'foo\_bar', expecting 'foo_bar'
get(h, 'interpreter')     # Reports 'none', as expected

#
# In this example, the subscripting of 'b' is understandable given that the
# legend object has interpreter property 'tex'; but it seems incorrect that
# the interpreter property should be 'tex' in the first place, given the
# DefaultTextInterpreter statement earlier.
#
h = legend('foo_bar');    # Displays 'foo<subscript b>ar
get(h, 'interpreter')     # Reports 'tex', expecting 'none'


#
# vim:syn=octave
#
