bugGNU Octave - Bugs: bug #53535, print with eps driver should use...


bug #53535: print with eps driver should use '-tight' bbox by default for Matlab compatibility

Submitted by:  Hugo Raguet <snake>
Submitted on:  Sat 31 Mar 2018 06:51:19 PM UTC  
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: 4.2.2Operating System: GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 16 Apr 2018 10:11:15 PM UTC, comment #4:

Rik: Seems right to me.

The following code does the setting tight BB:
print (outfile, "-color");
close (gcf ()); %% ensure that figure is written to PDF
cropcmd = ["pdfcrop " outfile " " outfile];

"pdfcrop" is the script that does the work. It is available
from Sourgeforge and is just a pearl script which calls gs.
The version I used can be downloaded from:


Michael Godfrey <godfrey>
Project Member
Mon 16 Apr 2018 09:41:29 PM UTC, comment #3:

Matlab only defines -tight for eps and ps output, but given how closely related pdf is, it seems like it would be reasonable to extend it to that format as well if possible.

Rik <rik5>
Project Administrator
Mon 16 Apr 2018 09:33:59 PM UTC, comment #2:

It seems that it would be very helpful if
-tight was recognized for PDF output. Was there
a reason why it was defined for EPS only?

I agree that having -loose and -tight both
seems unreasonable.

Michael Godfrey <godfrey>
Project Member
Mon 16 Apr 2018 08:53:29 PM UTC, comment #1:

It does look correct to make tight the default. However, it looks to be slightly more complicated. For unknown reasons there is both a "loose" setting and a "tight_flag" setting and it is not the case "loose" is simply the logical inverse of "tight_flag".

In print.m the tight_flag is used to decide how to invoke epstool to produce output:

However, the loose option is used to set a different option in _print_parse_opts_.m.

I'm not sure why there are two options and whether they can be safely collapsed in to one.

Rik <rik5>
Project Administrator
Sat 31 Mar 2018 06:51:19 PM UTC, original submission:

´┐╝When printing in eps format with 'print',
Matlab uses tight bounding box by default, which can be changed by setting the '-loose' option
Octave uses loose bounding box by default, which can be changed by setting the '-tight' option.

Now, any Matlab code can be ported to Octave because the Octave also understands the '-loose' option, but I am afraid some Octave code cannot be ported to Matlab because Matlab does not know any '-tight' option.

It would be nice if code I write for Octave could be directly run by potential Matlab users, without having to test for wether its Matlab or Octave being run and duplicating code.

As a side note, the tight behavior really should be the default, in most case the loose bounding box is arbitrary and is not satisfying.

Attached is a very simple patch.

Hugo Raguet <snake>


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

Attach File(s):

Attached Files
file #43748:  print_eps_tight_doc.patch added by snake (781B - text/x-patch - modify the 'print' doc accordingly)
file #43745:  print_eps_tight.patch added by snake (782B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by godfrey (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by snake (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 16 Apr 2018 08:53:29 PM UTCrik5StatusNone=>Confirmed
    Sat 31 Mar 2018 06:57:11 PM UTCsnakeAttached File-=>Added print_eps_tight_doc.patch, #43748
    Sat 31 Mar 2018 06:51:19 PM UTCsnakeAttached File-=>Added print_eps_tight.patch, #43745

    Back to the top

    Powered by Savane 3.1-cleanup1