自動用重音符號的安全代碼替換帶有重音符號的輸入

自動用重音符號的安全代碼替換帶有重音符號的輸入

我正在檢查這個:自動用重音符號替換左引號,其實跟我想要的差不多。因為我是從 Emacs 開始的,所以一切似乎都可以自動化。因為我寫的是西班牙語文本,所以我會輸入重音符號,例如á,éí。我希望在帶有重音的字元和使用斜線形式的等效版本之間進行即時自動翻譯。例如,如果我輸入á,它就會被翻譯成\'a等等。

答案1

我會回應評論者的建議,並說您最好像平常一樣編寫重音符號並用 UTF-8 編碼文件:

\documentclass{article}
% Tells all the other packages that the document language is Spanish. It also  changes hyphenation rules and quotation marks. The choose the mexico or spain option depending on whether you want a period or a comma as a decimal separator in numbers. 
\def\spanishoptions{mexico}
\usepackage[spanish]{babel}
% Encodes the input as UTF-8. 
\usepackage[utf8]{inputenc}
% Encodes the fonts as T1
\usepackage[T1]{fontenc}

\begin{document}
ÁÉÍÓÚÜÑ áéíóúñ

\end{document}

另請參閱問題的答案如何在 Emacs 中直接編寫法語字元並在 LaTeX 中列印它們?為什麼我應該使用 \usepackage[T1]{fontenc}?了解更多。

相關內容