bugGNU Octave - Bugs: bug #51640, latex mode no longer works

 
 

bug #51640: latex mode no longer works

Submitter:  Michael Godfrey <godfrey>
Submitted:  Tue 01 Aug 2017 10:51:00 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Wont Fix Assigned to:  None
Originator Name:  godfrey Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 12 Aug 2017 11:32:59 PM UTC, comment #6: 

Rik,
I just ran your example and what worries me is that the
axis labels appear as, for example $P(\omega_2...$
(\omega can be recognized within Octave).
I thought that I had a way of handling this, but this was
quite a while ago. And, either my code had other problems or
it never got applied, or...

However, during the postprocessing any TeX related changes can
be made before running TeX to produce the final plot, so the
present state can be made to work for PDFs. And, it will be
good to have the documentation match what happens.

So, good to close this. When I can I will see if any improvements
can be made.

Michael Godfrey <godfrey>
Group Member
Sat 12 Aug 2017 10:57:03 PM UTC, comment #5: 

I added a little bit more to the manual about how to form valid LaTeX strings (http://hg.savannah.gnu.org/hgweb/octave/rev/3b81ef7b562c).

Rik <rik5>
Group administrator
Sat 12 Aug 2017 10:27:21 PM UTC, comment #4: 

I found the issue which is that Octave no longer wraps text strings with '$' in latex interpreter mode.  This was an architectural decision.  Only the programmer knows which parts of a string should be set as regular text and which should be set in Math mode.  Accordingly, Octave no makes no modifications and it is up to the programmer to construct a valid LaTeX string.

Here is an example:


ht = text (0.25, 0.5, 'This is LaTeX text with inline formula $e^{i \pi} = -1$', 'interpreter', 'latex');

print -dpdflatexstandalone tst_latex2
system ("pdflatex tst_latex2.tex");
open tst_latex2.pdf


I re-coded the example you sent and it works if I wrap the strings with '$'.  I also explicitly set the interpreter to 'latex'.  If the entire plot is going to use the latex interpreter it might be easier to set it as the default with


set (0, 'DefaultTextInterpreter', 'latex');


Here is the new code for your example:


close all;
hf = figure;
cv = [58.125, 35.727];
ha = axes ('view', cv);
xlabel ('$\omega_2$');
ylabel ('$\omega_1$');
title ("MyFunction");
m = 10;
axis ([0 14 0 25 -2 2]);
text (m+3,-6.5,-1.6,'$\pi/2$', 'interpreter', 'latex');
text (m+4,24,-2,'$\pi$', 'interpreter', 'latex');
zlabel('$P(\omega_1, \omega_2, \omega_3)$','interpreter','latex');
print -dpdflatexstandalone fig_5_4_meshx
[r, status] = system ("pdflatex fig_5_4_meshx.tex")


I've attached both files as well.

I'm going to mark this as "Won't Fix" since we made the change for a good reason to give programmers more flexibility in how they want the output generated.




(file #41496, file #41497)

Rik <rik5>
Group administrator
Thu 10 Aug 2017 12:27:49 PM UTC, comment #3: 

The best I can do for a version that worked is the
dev that was current in March 2014. When I can
find time I will try to work on this since I wrote
some of the code. I am quite sure that the last fix
I submitted did work. The example below was used to
test it.

Michael Godfrey <godfrey>
Group Member
Thu 10 Aug 2017 12:58:15 AM UTC, comment #2: 

What was the last version this worked on?  I tried back to 3.8.3 and it doesn't appear to work.  Also, I had to change "fn(1:7)" to "MyTitle" in order to get the code to run.

Rik <rik5>
Group administrator
Tue 01 Aug 2017 11:48:46 PM UTC, comment #1: 

I noticed that the current Manual inserts the $ ... $
around math symbols and expressions.  So, the current
implementation may be as someone intended. But, this
does appear to prevent use of TeX math symbols in labels
and titles.

Michael Godfrey <godfrey>
Group Member
Tue 01 Aug 2017 10:51:00 PM UTC, original submission:  


>octave

cv = [58.125   35.727];
set(gca(),"view",cv)
xlabel('\omega_2');
ylabel('\omega_1');
title(fn(1:7), 'interpreter','none');
m = 10
axis([0 14 0 25 -2 2]);
text(m+3,-6.5,-1.6,'\pi/2');
text(m+4,24,-2,'\pi');
zlabel('P(\omega_1, \omega_2, \omega_3)','interpreter','tex');
print -dpdflatexstandalone fig_5_4_meshx

quit
pdflatex fig_5_4_meshx.tex

>> The above code fails because Octave no longer inserts $ --- $
>> surrounding the TeX symbols indicated by \

>> This worked correctly in March 2014. It fails in 4.2.1 and
>> in the current dev 4.3.0+ HGID: 3ac5d3d01cad


Michael Godfrey <godfrey>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #41496:  tst_latex.m added by rik5 (438B - text/x-matlab)
file #41497:  tst_latex2.m added by rik5 (201B - text/x-matlab)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by godfrey (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-12 rik5 Attached File- Added tst_latex.m, #41496
        Attached File- Added tst_latex2.m, #41497
        StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code