4

I was checking this: Automatically replace open quote with accent, and it is actually similar to what I want. Since I'm starting with Emacs, and everything seems admissible to be automatized. Because I write spanish text, I type accents like for example á, é or í. I would like to have the instant automatic translation between the characters with an accent and their equivalent version using the slash form. So for instance, if I type á then it'll be translated to \'a and so on.

3
  • 4
    It is no more annoying nowadays if you use utf8 encoding. All modern systems know about utf8. I've been typing accented letters without any problem for more than twenty years, and it makes the code much more readable.
    – Bernard
    Commented Mar 21, 2016 at 1:34
  • 1
    I think this would be a step backward, really. We want people to use UTF-8 (and I hope you are when using Emacs!). And it is mostly a breeze to convert from one encoding to another (assuming it was encoded well to begin with). Even going from UTF-8 to the special world of TeX markup for a specific .tex file is not tricky if it should ever become necessary.
    – jon
    Commented Mar 21, 2016 at 4:36
  • If you want, you can use M-x replace-string to change every accent after typeset. Commented Mar 24, 2016 at 8:09

1 Answer 1

3

I'll echo what the commenters suggest and say that you would be better off writing the accents as you normally would and encoding the document in 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}

See also the answers to the questions How to write directly French characters in Emacs and print them in LaTeX? and Why should I use \usepackage[T1]{fontenc}? for more information.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .