Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c03449

Browse files
committed
move latex preamble verbose.report from texmanager into
rc validation routines svn path=/trunk/matplotlib/; revision=3278
1 parent 0dbe1a3 commit 1c03449

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

lib/matplotlib/__init__.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,20 @@ def validate_comma_sep_str(s):
545545
except ValueError:
546546
raise ValueError('Could not convert all entries to strings')
547547

548+
def validate_latex_preamble(s):
549+
'return a list'
550+
preamble_list = validate_comma_sep_str(s)
551+
if not preamble_list == ['']:
552+
verbose.report("""
553+
*****************************************************************
554+
You have the following UNSUPPORTED LaTeX preamble customizations:
555+
%s
556+
Please do not ask for support with these customizations active.
557+
*****************************************************************
558+
"""% '\n'.join(preamble_list), 'helpful')
559+
return preamble_list
560+
561+
548562
class ValidateInStrings:
549563
def __init__(self, valid, ignorecase=False):
550564
'valid is a list of legal strings'
@@ -761,7 +775,7 @@ def __call__(self, s):
761775
# text props
762776
'text.color' : ['k', validate_color], # black
763777
'text.usetex' : [False, validate_usetex],
764-
'text.latex.preamble': ['', validate_comma_sep_str],
778+
'text.latex.preamble': ['', validate_latex_preamble],
765779
'text.dvipnghack' : [False, validate_bool],
766780
'text.fontstyle' : ['normal', str],
767781
'text.fontangle' : ['normal', str],

lib/matplotlib/texmanager.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,6 @@ def get_font_preamble(self):
174174
return self._font_preamble
175175

176176
def get_custom_preamble(self):
177-
custom_preamble = '\n'.join(rcParams['text.latex.preamble'])
178-
if custom_preamble is not '':
179-
verbose.report("""
180-
***************************************************************************
181-
You have the following UNSUPPORTED LaTeX preamble customizations:
182-
%s
183-
Please do not ask for support with these customizations active.
184-
***************************************************************************
185-
"""%custom_preamble, 'helpful')
186177
return '\n'.join(rcParams['text.latex.preamble'])
187178

188179
def get_shell_cmd(self, *args):

0 commit comments

Comments
 (0)