bug: extra space before greek letter if rendered with painters

조회 수: 2 (최근 30일)
Jonas
Jonas 2015년 4월 1일
댓글: Aras 2019년 2월 7일
The following code creates a minimal working example to reproduce the bug in Matlab 2015a on Linux with export_fig 06/03/15 and ghostscript 9.10.
plot([2014 2015 2016], [0 1 0])
xlabel('MATLAB (\mu)')
ylabel('Space-bugs (\mu)')
title('Number of wrong spaces in MATLAB')
export_fig('/tmp/mu_bug_space' ,'-pdf','-png','-eps', '-painters') % bug
export_fig('/tmp/mu_bug_nospace' ,'-pdf','-png','-eps', '-opengl') % OK
Any ideas, where it comes from and how to fix it?

답변 (7개)

John M. O'Toole
John M. O'Toole 2018년 4월 3일
2018 and still not fixed?

Christoph
Christoph 2019년 2월 7일
To follow up on this:
  • I contacted support, as suggested by Ingrid Tigges
  • I got a prompt reply:
"Please note that the underlying issue has been fixed as of MATLAB R2017b:
If you are working on Linux systems:
This bug is present in MATLAB R2016a and occurs when saving a figure as a vector graphics file (e.g. EPS, PDF, SVG). A workaround noted in our knowledge database is to use LaTeX as the text interpreter, rather than the default text interpreter (TeX).
Please Note: This forces the use of the default LaTeX font, and also requires LaTeX's dollar sign ($) delimiters to be used when typesetting text.
Use the following command to set the default text interpreter to LaTeX globally.
>> set(groot,'DefaultTextInterpreter','latex');
Alternatively, to set the text interpreter locally for a specific text object, you can set the "Interpreter" property value as in the example below:
f = figure; plot(1:10); xlabel('This is some really really long text string for a label. $C_L$', 'Interpreter', 'latex'); print(f,'-dpdf','image.pdf');
Please Note: At the time of writing, the EBR link below suggests switching the "Renderer" property of a figure to "opengl" as a workaround for this issue. However, this forces a rasterization process to occur, which essentially embeds a bitmap version of the figure within a vector graphics file that is pixelated and does not scale as expected.
The workaround however is quite crappy: Matlab seems to have an agenda to reduce support for LaTeX interpreter, and as of now, only the default font is supported -- which is rarely acceptable if you want to submit the stuff somewhere.
Secondly, the information that the "underlying issue has been fixed as of MATLAB R2017b" is simply wrong. I installed 2018b, and the underlying issue is not fixed at all.
@Aras, can you maybe specify what exactly the "Copy Options" are? I can't find them (using 2018b on a linux machine). Also, is the "print preview" size different from that accessible via
fig.PaperPosition = [];
fig.PaperSize = [];
? And is it possible to control the size you are referring to with code instead of clicking on print preview?
Cheers,
Christoph
  댓글 수: 1
Aras
Aras 2019년 2월 7일
I am using MATLAB R2018b on Windows 10 x64.
I cannot reproduce the error by saving the figure as .eps or .pdf using the print function or Save As command.
The problem I have is incorrectly positioned text in a figure when I set its size too big and copy-paste it into Microsoft Office. I attached the sample document where I copied the figure to Word at two different sizes and saved it as PDF for convenience. The large figure has all the text incorrectly positioned. Greek letters are shifted more than standard text, so the "pi" symbol does not appear.
@Christoph :
The properties that I adjust using the Print Preview window are fig.PaperPosition and fig.PaperSize.
Copy Options is a page in MATLAB Preferences where you can find the option to copy the figure (to paste into other programs) either with the size of the figure window or with the size stored in PaperPosition and PaperSize.

댓글을 달려면 로그인하십시오.


Yair Altman
Yair Altman 2015년 4월 1일
편집: Walter Roberson 2016년 3월 6일
I answered this on the Github forum, where all export_fig issues should be discussed (not here).
  댓글 수: 1
Jonas
Jonas 2015년 4월 1일
편집: Jonas 2015년 4월 1일
Thank you very much for your extremely fast answer and your code example. I will report the bug now to Mathworks as suggested and hope it will be fixed before 2015b. Edit: Case Number 01306074

댓글을 달려면 로그인하십시오.


Christoph
Christoph 2018년 8월 29일
I'd love to have this fixed!!! Really annoying, just for this bug I have to open a vector graphics editor.

Ingrid Tigges
Ingrid Tigges 2015년 4월 29일
There is a workaround for this issue. Due to the disadvantages of the workaround, please contact technical support in order to get the workaround.
  댓글 수: 2
Christoph
Christoph 2018년 8월 29일
Sorry, but this answer is somewhat disappointing.
Paul
Paul 2018년 9월 6일
@ingrid Tigges - your answer is not very helpful, can you include the "workaround" in this thread so others can benefit from the "fix"?

댓글을 달려면 로그인하십시오.


Jonas Stein
Jonas Stein 2016년 3월 5일
Update: Unfortunately the bug was not fixed in 2015b and it is still present even in 2016a.

Aras
Aras 2018년 9월 19일
편집: Aras 2018년 9월 19일
I realized that this problem occurs when the size of the figure in Print Preview is large (when "Match figure screen size" is unselected in Copy Options.)
So, a workaround that works for me is to reduce the width, height, line width, and font size by the same ratio in the Print Preview options before copying or exporting the figure.
The workaround in the submitted bug report does not work for me in MATLAB R2018a on Windows 10 when I copy the figure to Microsoft Word or Powerpoint as vector graphics.

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by