244

How to type these special letters from European languages in latex? ä, é, and L'?

doncherry
  • 54,637
user2918
  • 2,549

7 Answers7

208

You can type texdoc lshort in a command line (Command Prompt on Windows, Terminal on Linux/Mac OS X). Then have a look at Table 2.2 in Section 2.4.8. I'll quote it for you here. alt text

Kit
  • 16,430
  • 30
    You can also type them directly and use the inputenc package, which makes your source a lot more readable. – Alan Munn Jan 13 '11 at 03:25
  • 1
    Do you know how to type "L'" as well? Thanks. I typed "L'" and "L'", but both does ways do not display "L'" when it generates the pdf file. – user2918 Jan 13 '11 at 03:28
  • 2
    Assuming you typed "\L" and not "L", if you're still not getting the character its because of the font encoding or the font itself (which may not have the glyph.) It should work with a standard TeX distribution. Did you try my suggestion too? – Alan Munn Jan 13 '11 at 04:24
  • THe problem with using character modification is that spelling no longer works properly....or maybe there's a way around that too...let me ask a new questions. – Yossi Farjoun Jan 13 '11 at 11:57
  • 4
    The "L'" should work with \usepackage[T1]{fontenc} and \v L – Ulrike Fischer Jan 13 '11 at 13:00
  • Great tip for accessing the manual offline! – Barun Feb 18 '14 at 12:33
  • 2
    Using inputenc should be preferred these days, especially when teaching to novices. – Nicola Gigante Jan 09 '17 at 09:15
  • There is also "\k{e}" for "ę", which is different from "\c{e}". – Jakub Narębski Dec 10 '19 at 19:32
  • If you want to get a lowercase i with an accent but without the dot, use \i as the letter. e.g., \={\i} does ī whereas \={i} gives you an i with the line above the dot. – BallpointBen Dec 14 '20 at 00:46
157

With pdfLaTeX

Save your file as UTF-8 and put

\usepackage[utf8]{inputenc} % usually not needed (loaded by default)
\usepackage[T1]{fontenc}

in your preamble. With current (>2018) distributions inputenc is no longer needed if the file is UTF-8, as that is the assumed default encoding.

Then you can just type the characters normally into your source file.

With XeLaTeX or LuaLaTeX

ALternatively you can use XeLaTeX or LuaLaTeX which accept UTF-8 input natively. In that case you need to add only:

\usepackage{fontspec}

to your preamble. You should not load inputenc (or fontenc) in this case. These engines allow you to use any font installed on your system. See the fontspec documentation for more details.

Lousy editor

If your text editor doesn't support UTF-8 encoded files, you should probably get another editor. But if you're stuck with one, you can also use:

\usepackage[latin1]{inputenc} % for PCs
\usepackage[applemac]{inputenc} % for Macs

and save the files in the default encoding for your machine. You cannot use XeLaTeX or LuaLaTeX with such files, however.

Alan Munn
  • 218,180
  • 6
    Good advice. It's a good idea to load lmodern after switching the font encoding so that you get a font with all the extra accents and letters in it. – Will Robertson Jan 13 '11 at 07:29
  • 1
    Big upvote for fontspec. I was using lualatex and Unicode characters were not displayed at all. I tried inputenc, fontenc, lmodern, babel, polski and nothing worked. – user31389 May 13 '15 at 14:53
  • 1
    I'm all for UTF-8, but how would you suggest handling scenarios where the publisher's (archaic) template (I'm looking at you, IEEE) doesn't include the necessary packages? Would you simply add them to the template? – Dave Everitt Jan 31 '16 at 10:46
  • 2
    @DaveEveritt If the publisher accepts LaTeX source documents then you should definitely not change the engine, so using LuaLaTeX or XeLaTeX instead of pdfLaTeX is almost certainly not an option. But loading inputenc and fontenc is likely to be ok. If the publisher provides a style file but you submit camera ready PDF based on the style, then using any engine you like should be fine, and therefore loading the packages you need. – Alan Munn Jan 31 '16 at 14:52
  • 1
    @AlanMunn thanks, that's well-put. I suppose the only remaining issue is to make sure the result doesn't stray from the publisher's fonts. – Dave Everitt Jan 31 '16 at 15:15
  • Could your solution be modified to fit this case? http://tex.stackexchange.com/questions/314344/beamer-presentation-compile-error – An old man in the sea. Jun 12 '16 at 20:21
  • One important caveat: PDFTeX does not support decomposed characters. For that engine, make sure to save your UTF-8 in NFC form, which most editors should. – Davislor Sep 06 '20 at 16:28
39

Users looking to make common accents in regular text mode can do so with, for example, \'e.

MWE:

\documentclass[10pt]{article}
\begin{document}
Alfred Land\'e.
\end{document}

Output:

enter image description here

  • 5
    I think Kit already covered this in their answer from five years ago, no? – Au101 Apr 13 '16 at 16:23
  • 1
    This answer is a surely duplicate, as already noted by Au101. I flagged it for deletion. – Henri Menke Jan 09 '17 at 09:20
  • 3
    @HenriMenke, I'm sorry you feel that way; I think this answer much more clearly answers the question than Kit's answer. In face, I remember seeing this thread during my research and having to continue looking for the answer because it seems "buried" above. – user1717828 Jan 09 '17 at 13:42
  • 1
    This answer is very helpful--definitely not a duplicate. Kit's answer doesn't show how to produce a grave or acute accent using characters on a standard US keyboard layout. This shows that an acute accent can be produced with a normal apostrophe (U+0027), but Kit's answer shows a right single quotation mark (U+2019). – lehiester Mar 06 '18 at 21:26
13

You can use Detexify. Just draw your symbol, and it will figure out what you need to type! Much easier than plowing through endless symbol tables :).

Hendrik Vogt
  • 37,935
jqno
  • 667
  • 1
  • 5
  • 9
  • 3
    I tried and I couldn't make it work for any accented letter, although it works for a lot of usual mathematical signs. – Pere Jan 14 '18 at 09:41
3

The package selinput was not yet mentioned. Because I found good answers regarding its use on other places in TeX.SX let me first link to them:

The hardest part can be to find out, what has actually to be written in \SelectInputMappings, read the package documentation for this. You are not forced to add every letter not in ASCII range, but you have to add some distinctive characters for your language. Below I added the letters from question.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{%
  adieresis={ä},
  eacute={é},
  Lcaron={Ľ},
}

\begin{document}
äéĽ
\end{document}
Speravir
  • 19,491
3

Maybe a short hint for the users of some languages with so called diacritics (or combining diacretic marks as e.g. in the german layout, see below): If you want to get an é or É (e/E accent acute) as described in this answer, you have to pay attention to not write \´e as you are possibly used to do (in e.g. a text-based program like Microsoft Word). (´ is the (yellow) accent key between ß and BACKSPACE on a german layout)

Btw, that "locking in and waiting for input" or diacritic behavior is also called dead key, as it produces no output of its own but modifies the output of the key pressed after it.

You should write \'e instead (' is the (green) apostrophe key, SHIFT + #).

For reference I marked the correct key in green and the incorrect in yellow: Apostrophe (correct) vs accent (wrong)

This also applies to the other keyboard layouts with diacritics(link to languages with these letters), but not the ones with a dedicated key for the respective letter (in this example é) as french, spanish, swiss, italian or more (to put it differently, those layouts typically have a single key é or É among others).


This behavior of the accent keys is not present on the the standard english keyboards, but it can be switched to e.g. US/UK International to get a feel. Compare for example the dedicated ` key (~ without SHIFT).

Cadoiz
  • 213
  • 1
    This is really out-of-date advice. The default file encoding assumed by the LaTeX kernel is UTF-8, as is the default file encoding of most editors. So the simple answer is just type your letters as you would in any other application, and make sure you're loading a font that contains them. – Alan Munn Sep 06 '20 at 16:26
  • @Alan that's not right. The OP asked about "How to type these special letters from European languages in latex? ä, é, and L'?", so those keys are not present for him. True, he could copy-paste the é every time, but still, using \´e will always be more robust. Period. – Cadoiz Oct 12 '21 at 08:28
1

I don't mind plowing my way through symbol lists such as this one. Once I've found what I need, and then use it nth of times, I don't forget it. It's a good learning process.

Reference: The Comprehensive LaTeX Symbol List – Symbols accessible from LaTeX

Cadoiz
  • 213