4

I want to write some text in Spanish in which accents are used frequently, such as ó for which I have to write \'{o}. I have seen that in vimtex they have defined for example `a to convert into \alpha in math mode, but in normal mode I would like to convert it to for example à.

I also tried the command :ab 'o \'{o} but this only works with whole words, so not when it is part of a word. The same problem occurs when using snippets with UltiSnips.

How can I easily and quickly type an accented letter?

3
  • 3
    for what its worth: you dont have to write the braces
    – Bort
    May 27, 2016 at 12:57
  • 3
    You could just write ó and tell latex which encoding you are using, such as \usepackage[utf8]{inputenc} you do not have to use the ascii markup for accents unless you want to. May 27, 2016 at 12:58
  • Ok thank you Bort and @David, that is even easier!
    – agold
    May 27, 2016 at 13:09

2 Answers 2

11

You could just write ó and tell latex which encoding you are using, such as

\usepackage[utf8]{inputenc} 

you do not have to use the ascii markup for accents unless you want to.

7
  • 2
    I knew you liked answering vim questions :)
    – cmhughes
    May 27, 2016 at 13:22
  • You don't have to use accent commands, and you shouldn't if you want hyphenation, right? Or am I living in the 20th century? May 27, 2016 at 13:46
  • @Gilles: I got a conference template with these accent commands, therefore I thought it would be necessary.
    – agold
    May 27, 2016 at 14:10
  • @Gilles even in the 20th century it made no difference to the typeset result whether you use \'o or ó (you do want to use T1 font encoding in either case to get hyphenation (\usepackage[T1]{fontenc}) May 27, 2016 at 15:14
  • 2
    @agold if you have a keyboard like mine without the accented letters it's still easier to type \'o than remember what arcane combination of keystrokes produces ó May 27, 2016 at 15:16
1

For what it's worth you could achieve this with:

:imap 'o \'{o}

You must log in to answer this question.

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