首页 > 解决方案 > What replaces text.latex.unicode?

问题描述

In my matplotlibrc, I'm using the text.latex.unicode rcparam, as (still) recommended by the documentation:

#text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for handling
                            # unicode strings.

text.latex.unicode : True

But since Matplotlib 3.0, I am getting a MatplotlibDeprecationWarning:

/group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/envs/FCDR37a/lib/python3.7/site-packages/matplotlib/__init__.py:846: MatplotlibDeprecationWarning:
The text.latex.unicode rcparam was deprecated in Matplotlib 2.2 and will be removed in 3.1.
  "2.2", name=key, obj_type="rcparam", addendum=addendum)
/group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/envs/FCDR37a/lib/python3.7/site-packages/matplotlib/__init__.py:846: MatplotlibDeprecationWarning:
The text.latex.unicode rcparam was deprecated in Matplotlib 2.2 and will be removed in 3.1.
  "2.2", name=key, obj_type="rcparam", addendum=addendum)

What is the replacement for the deprecated text.latex.unicode rcparam?

Unfortunately, I can't seem to reach the Matplotlib Tex Cookbook at the moment.

标签: pythonmatplotlibunicode

解决方案


api变更说明告诉我们

关于text.latex.unicodercParam
的更改 rcParam 现在默认为 True 并且已被弃用(即,在 Maplotlib 的未来版本中,将始终支持 unicode 输入)。
此外,底层实现现在使用\usepackage[utf8]{inputenc}而不是\usepackage{ucs}\usepackage[utf8x]{inputenc}.

这实质上意味着如果您使用 matplotlib 2.2 或更高版本,您应该完全忽略该参数。

这也反映在当前文档的示例中,其中没有使用此类参数。

此外,当前版本的 rc 文件甚至没有这个参数。


推荐阅读