Skip to content

Commit 5e5d7eb

Browse files
committed
Deprecate text.latex.unicode.
It is 2018 and Python3 is ruling the world; it is high time for usetex to default to unicode support as well. (If ``\usepackage[utf8]{inputenc}`` is irremediably breaking some users' setup we can always revisit this decision.)
1 parent 126113f commit 5e5d7eb

File tree

10 files changed

+20
-14
lines changed

10 files changed

+20
-14
lines changed

doc/api/next_api_changes/2018-02-15-AL-deprecations.rst

+1
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ The following classes, methods, functions, and attributes are deprecated:
3737

3838
The following rcParams are deprecated:
3939
- ``pgf.debug`` (the pgf backend relies on logging),
40+
- ``text.latex.unicode``,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Changes regarding the text.latex.unicode rcParam
2+
````````````````````````````````````````````````
3+
4+
The rcParam now defaults to True and is deprecated (i.e., in future versions
5+
of Maplotlib, unicode input will always be supported).
6+
7+
Moreover, the underlying implementation now uses ``\usepackage[utf8]{inputenc}``
8+
instead of ``\usepackage{ucs}\usepackage[utf8x]{inputenc}``.

examples/text_labels_and_annotations/tex_demo.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import numpy as np
1818
import matplotlib
1919
matplotlib.rcParams['text.usetex'] = True
20-
matplotlib.rcParams['text.latex.unicode'] = True
2120
import matplotlib.pyplot as plt
2221

2322

examples/text_labels_and_annotations/usetex_baseline_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
from matplotlib import rcParams
1313
rcParams['text.usetex'] = True
14-
rcParams['text.latex.unicode'] = True
1514

1615

1716
class Axes(maxes.Axes):

lib/matplotlib/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,8 @@ def gen_candidates():
820820
# do NOT include in _all_deprecated
821821
_deprecated_set = {'axes.hold',
822822
'backend.qt4',
823-
'backend.qt5'}
823+
'backend.qt5',
824+
'text.latex.unicode'}
824825

825826
_all_deprecated = set(itertools.chain(
826827
_deprecated_ignore_map, _deprecated_map, _obsolete_set))

lib/matplotlib/mpl-data/stylelib/_classic_test.mplstyle

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ text.usetex : False # use latex for all text handling. The following fo
109109
# If another font is desired which can loaded using the
110110
# LaTeX \usepackage command, please inquire at the
111111
# matplotlib mailing list
112-
text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for handling
113-
# unicode strings.
112+
# text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for handling
113+
# # unicode strings.
114114
text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
115115
# AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
116116
# IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.

lib/matplotlib/mpl-data/stylelib/classic.mplstyle

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ text.usetex : False # use latex for all text handling. The following fo
111111
# If another font is desired which can loaded using the
112112
# LaTeX \usepackage command, please inquire at the
113113
# matplotlib mailing list
114-
text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for handling
115-
# unicode strings.
114+
# text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for handling
115+
# # unicode strings.
116116
text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
117117
# AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
118118
# IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.

lib/matplotlib/rcsetup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ def _validate_linestyle(ls):
11151115
# text props
11161116
'text.color': ['black', validate_color],
11171117
'text.usetex': [False, validate_bool],
1118-
'text.latex.unicode': [False, validate_bool],
1118+
'text.latex.unicode': [True, validate_bool],
11191119
'text.latex.preamble': [[''], validate_stringlist],
11201120
'text.latex.preview': [False, validate_bool],
11211121
'text.dvipnghack': [None, validate_bool_maybe_none],

lib/matplotlib/tests/test_backend_ps.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
needs_ghostscript(
3333
('ps', False, {'ps.usedistiller': 'ghostscript'})),
3434
needs_usetex(needs_ghostscript(
35-
('ps', False, {'text.latex.unicode': True, 'text.usetex': True}))),
35+
('ps', False, {'text.usetex': True}))),
3636
('eps', False, {}),
3737
('eps', True, {'ps.useafm': True}),
3838
needs_usetex(needs_ghostscript(
39-
('eps', False, {'text.latex.unicode': True, 'text.usetex': True}))),
39+
('eps', False, {'text.usetex': True}))),
4040
], ids=[
4141
'ps',
4242
'ps with distiller',

lib/matplotlib/texmanager.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ def make_tex(self, tex, fontsize):
203203

204204
if rcParams['text.latex.unicode']:
205205
unicode_preamble = r"""
206-
\usepackage{ucs}
207-
\usepackage[utf8x]{inputenc}"""
206+
\usepackage[utf8]{inputenc}"""
208207
else:
209208
unicode_preamble = ''
210209

@@ -255,8 +254,7 @@ def make_tex_preview(self, tex, fontsize):
255254

256255
if rcParams['text.latex.unicode']:
257256
unicode_preamble = r"""
258-
\usepackage{ucs}
259-
\usepackage[utf8x]{inputenc}"""
257+
\usepackage[utf8]{inputenc}"""
260258
else:
261259
unicode_preamble = ''
262260

0 commit comments

Comments
 (0)