Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Certain unicode in Matplotlib + LaTeX #20262

Open
@numpde

Description

@numpde

The following code fails atset_ylabel:

importmatplotlib.pyplotaspltwithplt.style.context({'text.usetex':True}):    (fig,ax)=plt.subplots()ax.set_xlabel("€")ax.set_ylabel("Δ")plt.show()

It works with$\Delta$ instead of Δ and it works if I unsettext.usetex.

The generated tex is this:

\documentclass{article}\newcommand{\mathdefault}[1]{#1}\usepackage{type1cm}\usepackage{type1ec}\usepackage{type1ec}\usepackage{type1ec}\usepackage[utf8]{inputenc}\DeclareUnicodeCharacter{2212}{\ensuremath{-}}\usepackage[papersize=72in, margin=1in]{geometry}\makeatletter\@ifpackageloaded{textcomp}{}{\usepackage{textcomp}}\makeatother\pagestyle{empty}\begin{document}% The empty hbox ensures that a page is printed even for empty inputs, except% when using psfrag which gets confused by it.\fontsize{10.000000}{12.500000}%\ifdefined\psfrag\else\hbox{}\fi%{\sffamily Δ}\end{document}

and it compiles fine with pdflatex if I replace\usepackage[utf8]{inputenc} by\usepackage[utf8x]{inputenc}. Otherwise the error is the same:

! Package inputenc Error: Unicode character Δ (U+0394)(inputenc)                not set up for use with LaTeX.

I think this is on the side of unexpected behavior.

Versions:Python 3.8.5 andmatplotlib==3.4.1.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp