Comments (3)
The fact that you're getting a Python error means that things are going wrong in Pygments. That may or may not indicate that this is a Pygments issue, though.
minted
is running pygmentize
, and somewhere between LaTeX and Pygments there are character encoding issues. The first thing you need to try is downloading the latest minted.sty
(v2.0alpha2), and using encoding=utf8
(or whatever is appropriate for your file) as the first optional argument for the minted
environment. (You can just put the new minted.sty
in the same directory as your document for testing purposes.)
If that doesn't work, there may be system encoding issues. Can you type/paste these Chinese characters into the terminal? What is your terminal's encoding? (One way to get that is to open a terminal, start Python, and then type import sys; sys.stdout.encoding
.)
It's possible that even if all that is fine, pygmentize
won't accept anything but ASCII from the command line. This Pygments issue suggests that that may indeed be the case. If that's the cause of the problem, then this is a Pygments issue.
If possible, you could also try all of this with Python 3.2+.
One workaround is to put your label in a macro, say \newcommand{\mylabel}{mainε½ζ°}
, and then in the minted
optional argument use label=\mylabel
.
from minted.
thanks for your quick response.
I have solved my problem with your suggestion.
- I first tried lastest
minted.sty(v2.0alpha2)
and usingencoding=utf8
as first argument, do not work. - My terminal's encoding is UTF8, and environment variable
LANG=en_US.UTF8
. it can copy/paste Chinese. - your workaround works.
- Use
python3
works, but have to useencoding=utf8
as first optional argument tominted
environment to get it work. I removedpython-pygments
installed from Ubuntu repository, and installedpython3
, downloadPygments-1.6.tar.gz
from pypi.python.org, extract and install it withsudo python3 setup.py install
. This waypython
remain linked topython2.7
and I can usepygmentize
withpython3
(the first line of/usr/local/bin/pygmentize
set to#!/usr/bin/python3
).
also have to use latest minted.sty(v2.0alpha2)
. minted 1.7
do not work, get error
! Package keyval Error: encoding undefined.
See the keyval package documentation for explanation.
Type H for immediate help.
from minted.
Thanks for the nice summary. It looks like the Pygments issue I referenced is responsible for the problem under Python 2.7.
minted
1.7 won't work because it doesn't support the encoding
option; only the latest versions of minted
support it.
I am closing this issue since the only existing issue is on the Pygments side. I will also add a note in the documentation for the next release about this use case.
from minted.
Related Issues (20)
- Didn't receive error message that fvextra was not installed HOT 2
- Minted ignores fontfamily setting HOT 4
- Font settings (migrating from lst-listings) HOT 12
- clearing `\verbatim@nolig@list` does not allow for code ligatures HOT 2
- Confused by arbitrary failure HOT 6
- Is it possible to `/inputminted` a whole github repository or a whole directory? HOT 1
- problems with escapeinside and --enable-pipes HOT 8
- CustomLexer: Setting environment variables HOT 3
- Support custom lexers HOT 2
- Include snippets of external files based on regular expressions/literal delimiters HOT 1
- Add an option to not show error boxes HOT 1
- multicols HOT 7
- Breaking line within \newmintinline throws error
- `linerange` to select the exact lines to output HOT 2
- `newmintedfile` env* to specify additional options HOT 9
- [bug] `gobble` results in malformed formatting, `autogobble` works HOT 5
- [show-&-tell] ad-hoc adoptations from a different style to another one. HOT 1
- [feature] Support for PDDL programming language HOT 2
- [bug][compatibility] `Verbatim` environment generated by `minted` with `mathescape` broken with `babel`'s `magyar.ldf` (Hungarian ππΊ language) HOT 1
- JSX highlighting is not working in overleaf HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minted.