Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leading Chinese characters introduce unexpected boxes #363

Closed
zwz opened this issue Apr 7, 2023 · 5 comments
Closed

Leading Chinese characters introduce unexpected boxes #363

zwz opened this issue Apr 7, 2023 · 5 comments

Comments

@zwz
Copy link

zwz commented Apr 7, 2023

Here is a MWE

\documentclass{ctexart}
\usepackage{minted}
\begin{document}
\begin{minted}{cpp}
测试#include <string>
中文int main(){
    return 0;    // 中文
}
\end{minted}
\end{document}

And here is the result.
截屏2023-04-07 上午10 28 28

The 1st line测试# and 2nd line 中文 are in boxes.

@muzimuzhi
Copy link

You're using an outdated pygments.

The C-family lexers in pygments learnt support for unicode identifiers (see pygments/pygments#1848) since pygments 2.11.0, released in Dec, 2021.

With latest pygments is 2.14.0, released in Jan, 2023, your example gives (need either xelatex or lualatex)
image
(The thin red frame around # denotes an error token in default pygments style.) You can check it on https://pygments.org/demo/ yourself.

@zwz
Copy link
Author

zwz commented Apr 7, 2023

Yes, I am using an old version.

Is the red frame around # expected?

@muzimuzhi
Copy link

Is the red frame around # expected?

Yes. It marks an invalid (cpp) grammar.

@muzimuzhi
Copy link

With latest pygments is 2.14.0, released in Jan, 2023, your example gives (need either xelatex or lualatex)
image

CTeX-org/ctex-kit#580 contains some solutions to suppress the spacing between 中文 and int.

@zwz
Copy link
Author

zwz commented Apr 10, 2023

Thank you for the link.

@zwz zwz closed this as completed Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants