包 newunicodechar 錯誤:請求 ASCII 字符

包 newunicodechar 錯誤:請求 ASCII 字符

我嘗試過使用 newunicode,但遇到了這個問題:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}

\newunicodechar{Γ}{\ensuremath{\Gamma}}

\begin{document}

Γ

\end{document}

這應該只是將所有“Г”替換為“\Gamma”,這是 LateX 支援的。

但相反,我只得到一個“?”編譯時...

我怎樣才能改變這個?

答案1

問題中發布的文件採用 UTF-8 格式,與聲明為 LaTeX 的編碼相符。如果你將其儲存為 8 位希臘文(例如 ISO-2022),那麼你會得到

! Package newunicodechar Error: ASCII character requested.

See the newunicodechar package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.5 \newunicodechar{�}{\ensuremath{\Gamma}}

因為編碼聲明不正確。解決方案是確保您的編輯器將檔案儲存為 UTF-8。

相關內容