bugGNU Octave - Bugs: bug #36349, print -dpflatex with empty...

 
 

bug #36349: print -dpflatex with empty \includegraphics{}

Submitter:  Ben Abbott <bpabbott>
Submitted:  Mon 30 Apr 2012 11:39:22 AM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  bpabbott
Originator Name:  Jose Vallet Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 19 Jul 2013 03:30:40 PM UTC, comment #8: 

No reports of problems, so I'm closing this report.

Ben Abbott <bpabbott>
Group Member
Sat 08 Jun 2013 03:29:01 AM UTC, comment #7: 

I added some checks when extracting the graphic file name and pushed the changeset below.

http://hg.savannah.gnu.org/hgweb/octave/rev/3806afcf974a

Ben Abbott <bpabbott>
Group Member
Fri 07 Jun 2013 01:53:06 PM UTC, comment #6: 

I'm attaching a second changeset all in c++.  The approach is clumsy.

The fltk toolkit calls drawnow() twice.  Once for the image file to be included and a second time for the tex file.  A static variable has been added to store the prior file name.  When the tex file is written the prior file is assumed to be the image file to be included in the tex document.

(file #28280)

Ben Abbott <bpabbott>
Group Member
Thu 06 Jun 2013 08:51:27 AM UTC, comment #5: 

Assuming the print command is,


print -dpdflatex test


The diff below needs to have "gl2ps-inc" replaced with "test-inc".


diff --git a/libinterp/interp-core/gl2ps-renderer.cc b/libinterp/interp-core/gl2ps-renderer.cc
--- a/libinterp/interp-core/gl2ps-renderer.cc
+++ b/libinterp/interp-core/gl2ps-renderer.cc
@@ -78,7 +78,7 @@
                            | GL2PS_BEST_ROOT | gl2ps_text
                            | GL2PS_NO_PS3_SHADING),
                           GL_RGBA, 0, NULL, 0, 0, 0,
-                          buffsize, fp, "" );
+                          buffsize, fp, "gl2ps-inc" );

           opengl_renderer::draw (go);
           state = gl2psEndPage ();


I haven't figured out how to do this yet.  Help from someone who is familiar with c/c++ would be appreciated.

Ben Abbott <bpabbott>
Group Member
Thu 06 Jun 2013 08:44:03 AM UTC, comment #4: 

A proper fix requires the "gl2ps-inc" to be replaced by the equivalent of print_cmd.c_str + "-inc".


diff --git a/libinterp/interp-core/gl2ps-renderer.cc b/libinterp/interp-core/gl2ps-renderer.cc
--- a/libinterp/interp-core/gl2ps-renderer.cc
+++ b/libinterp/interp-core/gl2ps-renderer.cc
@@ -78,7 +78,7 @@
                            | GL2PS_BEST_ROOT | gl2ps_text
                            | GL2PS_NO_PS3_SHADING),
                           GL_RGBA, 0, NULL, 0, 0, 0,
-                          buffsize, fp, "" );
+                          buffsize, fp, "gl2ps-inc" );

           opengl_renderer::draw (go);
           state = gl2psEndPage ();


My c/c++ knowledge is too low for me to figure this part out :-(

Ben Abbott <bpabbott>
Group Member
Tue 01 May 2012 11:17:11 PM UTC, comment #3: 

I've attached a changeset that works for me.

(file #25766)

Ben Abbott <bpabbott>
Group Member
Tue 01 May 2012 12:12:26 AM UTC, comment #2: 

I don't see how to properly fix this, but can easily produce a changeset that does a search-and-replace in the tex-file that is equivalent to

s/includegraphics{} /includegraphics{foo-inc.pdf} /g

Ben Abbott <bpabbott>
Group Member
Mon 30 Apr 2012 12:41:19 PM UTC, comment #1: 

I think the problem is that the gl2psPrintTeXHeader routine in gl2ps.c does not extract the "name" correctly. It is always empty.


Ben Abbott <bpabbott>
Group Member
Mon 30 Apr 2012 11:39:22 AM UTC, original submission:  

There is a problem when saving a figure using the pdflatex device (with fltk backend, as gnuplot does not support it, and octave 3.6.1).

Do:


plot(1,1);
print('-dpdflatex', 'foo.tex');


This will produce two files:foo.tex and foo-inc.pdf. As I understand it, foo.tex should contain a reference to foo-inc.pdf, and there is not such a reference. There is, however, a suspicious empty "\includegraphics{}" inside a picture environment.

When using foo.tex as it is in a latex document there is an error complaining about this empty includegraphics. Changing it manually to "\includegraphics{foo-inc.pdf}" solves the problem.

Ben Abbott <bpabbott>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #28280:  changeset.patch added by bpabbott (3KiB - application/octet-stream)
file #25766:  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 (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 20 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-08-01 bpabbott StatusReady For Test Fixed
        Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}
    2013-07-19 bpabbott Open/ClosedOpen Closed
        Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}
    2013-06-08 bpabbott StatusPatch Submitted Ready For Test
        Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}
    2013-06-07 bpabbott Attached File- Added changeset.patch, #28280
        Release3.6.1 dev
        Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}
    2013-06-06 bpabbott Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}
    2013-06-06 bpabbott Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}
    2012-05-03 bpabbott StatusReady For Test Patch Submitted
        Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}
    2012-05-03 bpabbott Assigned toNone bpabbott
        Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}
    2012-05-01 bpabbott Attached File- Added changeset.patch, #25766
        StatusNone Ready For Test
        Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}
    2012-05-01 bpabbott Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}
    2012-04-30 bpabbott Summaryprint -dpflatex with empty \\includegraphics{} print -dpflatex with empty \includegraphics{}

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code