Skip to content

Commit bfd1a0a

Browse files
committed
(3.53) Fixed error in case of escaped tex/latex chars in EPS/PDF Title (issue #407)
1 parent 5dc68a2 commit bfd1a0a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

export_fig.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@
414414
% 31/03/25: (3.50) Revert bad fix for issue #401
415415
% 08/07/25: (3.51) Fixed: figure with non-default colormap exported with default colormap in some cases (issue #389)
416416
% 07/09/25: (3.52) Fixed: sgtitle was cropped in transparent PDF/EPS output (thanks @JohanWesto)
417+
% 12/09/25: (3.53) Fixed error in case of escaped tex/latex chars in EPS/PDF Title (issue #407)
417418
%}
418419

419420
if nargout
@@ -451,7 +452,7 @@
451452
[fig, options] = parse_args(nargout, fig, argNames, varargin{:});
452453

453454
% Check for newer version and exportgraphics/copygraphics compatibility
454-
currentVersion = 3.52;
455+
currentVersion = 3.53;
455456
if options.version % export_fig's version requested - return it and bail out
456457
imageData = currentVersion;
457458
return

print2eps.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function print2eps(name, fig, export_options, varargin)
117117
% 13/04/23: Reduced (hopefully fixed) unintended EPS/PDF image cropping (issues #97, #318)
118118
% 02/05/24: Fixed contour labels with non-default FontName incorrectly exported as Courier (issue #388)
119119
% 11/05/25: Override Matlab's default Title & Creator meta-data (issue #402)
120+
% 12/09/25: Fixed error in case of escaped tex/latex chars in Title (issue #407)
120121
%}
121122

122123
options = {'-loose'};
@@ -601,6 +602,7 @@ function print2eps(name, fig, export_options, varargin)
601602
title_str = get(fig,'Name');
602603
if isempty(title_str) && ~isempty(hAxes)
603604
try title_str = hAxes(1).Title.String; catch, end
605+
title_str = strrep(title_str,'\','\\'); %issue #407
604606
end
605607
fstrm = regexprep(fstrm, '(%%Title:)[^\n]*\n', ['$1 ' title_str '\n']);
606608
end
@@ -706,7 +708,7 @@ function print2eps(name, fig, export_options, varargin)
706708
%Find and replace the RGBA values within the EPS text fstrm
707709
%Note: .setopacityalpha is an unsupported PS extension that croaks in some GS versions (issue #285, https://bugzilla.redhat.com/show_bug.cgi?id=1632030)
708710
% (such cases are caught in eps2pdf.m and corrected by adding the -dNOSAFER Ghosscript option or by removing the .setopacityalpha line)
709-
if strcmpi(propName,'Face')
711+
if strcmpi(propName,'Face') %#ok<IFBDUP>
710712
oldStr = sprintf(['\n' colorID ' RC\n']); % ...N\n (removed to fix issue #225)
711713
newStr = sprintf(['\n' origRGB ' RC\n' origAlpha ' .setopacityalpha true\n']); % ...N\n
712714
else %'Edge'

0 commit comments

Comments
 (0)