bugGNU Octave - Bugs: bug #46037, bad Tex interpretation for gnuplot

 
 

bug #46037: bad Tex interpretation for gnuplot

Submitter:  Francesco Potortì <pot>
Submitted:  Wed 23 Sep 2015 12:51:38 PM UTC
   
 
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.0.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 22 Mar 2016 08:21:09 PM UTC, comment #5: 

I tested the patch with gnuplot 4.6.6 and 5.0.1.  I used terminals qt, wxt, and x11.  It seems fine so I pushed it here (http://hg.savannah.gnu.org/hgweb/octave/rev/aac8b2ca9280).

Rik <rik5>
Group administrator
Sun 20 Mar 2016 12:29:58 AM UTC, comment #4: 

I've installed gnuplot 5 and ran a few simple tests. The patch worked for me. But it could use some more testing before being committed (I worry that some gnuplot terminals may be negatively impacted)

Ben Abbott <bpabbott>
Group Member
Sat 19 Mar 2016 06:34:39 PM UTC, comment #3: 

I'm attaching a trivial fix. I haven't tested on gnuplot 5, but it works for me with gnupot 4.6.6

(file #36695)

Ben Abbott <bpabbott>
Group Member
Sat 19 Mar 2016 05:44:42 PM UTC, comment #2: 

@Rik,

This looks like a fairly easy thing to fix. Do you know what other gnuplot 5 syntaxes also require curly braces?



Ben Abbott <bpabbott>
Group Member
Sat 26 Sep 2015 01:36:02 AM UTC, comment #1: 

I think there are several problems going on here.  This is one of the reasons why Octave is slowly moving away from gnuplot.

First, a simpler example for me to use is


close all
graphics_toolkit gnuplot
ht = text (0.5, 0.5, '\bf Hello')


which produces the text


/-bold Hello


on the screen.

This is the correct syntax for versions of gnuplot < 5.0, but it seems that gnuplot also wants the whole string enclosed by curly braces.


ht = text (0.5, 0.5, '{/-bold Hello}')
print tst.pdf
open tst.pdf


If I use the above code then the resulting printed output has bold text.  Whether the onscreen viewer will have bold text depends on the capabilities of the terminal you are using.

So, it seems that things could be improved here if you are interested.  The code is contained in the m-file _gnuplot_draw_axes_.m.  The function to modify is _tex2enhanced_.

I think get_fontname_and_size needs to be changed to start with the following.


function [f, s, fnt, it, bld] = get_fontname_and_size (t)
  if (isempty (t.fontname) || strcmp (t.fontname, "*"))
    fnt = "";
  else
    fnt = t.fontname;
  endif


That way the fnt variable will expand to the null string in _tex2enhanced_ in


      elseif (strncmp (f, "bf", 2))
        bld = true;
        if (it)
          str = [str(1:s(i) - 1) '/' fnt '-bolditalic ' str(s(i) + 3:end)];
        else
          str = [str(1:s(i) - 1) '/' fnt '-bold ' str(s(i) + 3:end)];
        endif


But there is still the problem of wrapping everything in curly braces.

For versions of gnuplot greater than 5.0 a different syntax may be necessary according to this bug report (http://sourceforge.net/p/gnuplot/bugs/1240/).

Rik <rik5>
Group administrator
Wed 23 Sep 2015 12:51:38 PM UTC, original submission:  

$ octave   --no-site-file   --no-init-file --no-gui
GNU Octave, version 4.0.0
...

>> graphics_toolkit gnuplot
>> plot(1:2)
>> text(1.5, 1.5, "\\bfccc")


The text on the plot is "/-boldccc"

Francesco Potortì <pot>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #36695:  changeset.patch added by bpabbott (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pot (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-03-22 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2016-03-19 bpabbott Attached File- Added changeset.patch, #36695
    2015-09-26 rik5 CategoryPlotting Plotting with gnuplot
        StatusNone Confirmed
        Summarybad Latex interpretation bad Tex interpretation for gnuplot

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code