-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
In lectures where we have 'text.usetex': True
, we need to add the following headers:
# Configure Matplotlib to use pdfLaTeX and CJKutf8
mpl.rcParams.update({
'text.usetex': True,
'text.latex.preamble': r'''
\usepackage{{CJKutf8}}
\usepackage{{amsmath}}
'''
})
# Function to wrap Chinese text in CJK environment
def cjk(text):
return rf'\begin{{CJK}}{{UTF8}}{{gbsn}}{text}\end{{CJK}}'
Then apply the cjk
function to the Chinese character to the figure plotting matplotlib
.
Example:
37c0d3c#diff-6d11baeb8df592b6a934e4de8f805cb9986d5b4524917a25c82e3dff8a670180L258-R270
Metadata
Metadata
Assignees
Labels
No labels