![如何在 PDFLatex 中输入这些字符](https://linux22.com/image/459284/%E5%A6%82%E4%BD%95%E5%9C%A8%20PDFLatex%20%E4%B8%AD%E8%BE%93%E5%85%A5%E8%BF%99%E4%BA%9B%E5%AD%97%E7%AC%A6.png)
我希望能够输入 ∫、∘、→、←、× 的 unicode 字符。具体来说,我希望能够将它们包含到我的 latex 代码中,并让它们在相应的 pdf 上正确呈现。我似乎无法在配备 M1 芯片的 Mac 上解决这个问题。
这是一个我想实现的例子:
\documentclass[12pt,A4]{article}
\usepackage[outputdir=build,cache=false]{minted}
\begin{document}
\begin{minted}{lean}
It would be nice to type ∫,∘,→,←,×,!,? in PDF Latex on my M1 Mac with Mac OSX Monterey since I want to use these symbols in Lean with minted.
\end{minted}
\end{document}
现在我从终端运行 pdflatex,如下所示:
pdflatex -synctex=1 -shell-escape -interaction=nonstopmode
-shell-escape 很重要,因为 Minted 调用 Python 的方式。只要对 pdflatex 的任何修改仍能使用此命令进行编译,我就可以使用它。另外,我需要这些包:
\documentclass[12pt,a4paper]{article}
\usepackage[margin=1.3in]{geometry}
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault}
\usepackage{verbatim, minted}
\usepackage[outputdir=build,cache=false]{minted}
\usepackage[T1]{fontenc, tgcursor, newunicodechar, graphicx}
\usepackage{verbatim, graphicx, amsmath, mathtools, enumerate, hyperref, tcolorbox, sourcecodepro, newunicodechar, textgreek}
有人建议改用 xelatex,但如果能以某种形式延续我的内含物就更好了。
答案1
\documentclass[12pt,a4paper]{article}
\usepackage{minted}
\DeclareUnicodeCharacter{222B}{\ensuremath{\int}}
\DeclareUnicodeCharacter{2218}{\ensuremath{\circ}}
\begin{document}
\begin{minted}{lean}
It would be nice to type ∫,∘,→,←,×,!,? in PDF Latex on my M1 Mac with Mac OSX Monterey since I want to use these symbols in Lean with minted.
\end{minted}
\end{document}