5.4.1 Using AUCTeX with European Languages
5.4.1.1 Typing and Displaying Non-ASCII Charactersโ
First you will need a way to write non-ASCII characters. You can either use macros, or teach TeX about the ISO character sets. I prefer the latter, it has the advantage that the usual standard emacs word movement and case change commands will work.
With LaTeX2e, just add โ\usepackage[latin1]{inputenc}
โ. Other languages than Western European ones will probably have other encoding needs.
To be able to display non-ASCII characters you will need an appropriate font and a version of GNU Emacs capable of displaying 8-bit characters. The manner in which this is supported differs between Emacsen, so you need to take a look at your respective documentation.
A compromise is to use an European character set when editing the file, and convert to TeX macros when reading and writing the files.
โiso-cvt.el
โโ
Much like โiso-tex.el
โ but is bundled with Emacs 19.23 and later.
โX-Symbol
โโ
a much more complete package for Emacs that can also handle a lot of mathematical characters and input methods.
5.4.1.2 Style Files for Different Languagesโ
AUCTeX supports style files for several languages. Each style file may modify AUCTeX to better support the language, and will run a language specific hook that will allow you to for example change ispell dictionary, or run code to change the keyboard remapping. The following will for example choose a Danish dictionary for documents including โ\usepackage[danish]{babel}
โ. This requires parsing to be enabled, see Parsing Files.
(add-hook 'TeX-language-dk-hook (lambda () (ispell-change-dictionary "danish")))
The following style files are recognized:
โbulgarian
โโ
Runs style hook TeX-language-bg-hook
. Gives โ"
โ word syntax, makes the ๏นค"๏นฅ key insert a literal โ"
โ. Typing ๏นค"๏นฅ twice will insert insert โ"`
โ or โ"'
โ depending on context. Typing ๏นค-๏นฅ twice will insert โ"=
โ, three times โ--
โ.
โczech
โโ
Runs style hook TeX-language-cz-hook
. Pressing ๏นค"๏นฅ will insert โ\uv{
โ and โ}
โ depending on context.
โdanish
โโ
Runs style hook TeX-language-dk-hook
. Pressing ๏นค"๏นฅ will insert โ"`
โ and โ"'
โ depending on context. Typing ๏นค-๏นฅ twice will insert โ"=
โ, i.e. a hyphen string allowing hyphenation in the composing words.
โdutch
โโ
Runs style hook TeX-language-nl-hook
.
โenglish
โโ
โaustralian
โโ
โcanadian
โโ
โnewzealand
โโ
Runs style hook TeX-language-en-hook
.
โfrenchb
โโ
โfrancais
โโ
Runs style hook TeX-language-fr-hook
. Pressing ๏นค"๏นฅ will insert โ\\og
โ and โ\\fg
โ depending on context. Note that the language name for customizing TeX-quote-language-alist
is โfrench
โ.
โgerman
โโ
โngerman
โโ
Runs style hook TeX-language-de-hook
. Gives โ"
โ word syntax, makes the ๏นค"๏นฅ key insert a literal โ"
โ. Pressing the key twice will give you opening or closing German quotes (โ"`
โ or โ"'
โ). Typing ๏นค-๏นฅ twice will insert โ"=
โ, three times โ--
โ.
โicelandic
โโ
Runs style hook TeX-language-is-hook
. Gives โ"
โ word syntax, makes the ๏นค"๏นฅ key insert a literal โ"
โ. Typing ๏นค"๏นฅ twice will insert insert โ"`
โ or โ"'
โ depending on context. Typing ๏นค-๏นฅ twice will insert โ"=
โ, three times โ--
โ.
โitalian
โโ
Runs style hook TeX-language-it-hook
. Pressing ๏นค"๏นฅ will insert โ"<
โ and โ">
โ depending on context.
โpolish
โโ
Runs style hook TeX-language-pl-hook
. Gives โ"
โ word syntax and makes the ๏นค"๏นฅ key insert a literal โ"
โ. Pressing ๏นค"๏นฅ twice will insert โ"`
โ or โ"'
โ depending on context.
โpolski
โโ
Runs style hook TeX-language-pl-hook
. Makes the ๏นค"๏นฅ key insert a literal โ"
โ. Pressing ๏นค"๏นฅ twice will insert โ,,
โ or โ''
โ depending on context.
โslovak
โโ
Runs style hook TeX-language-sk-hook
. Pressing ๏นค"๏นฅ will insert โ\uv{
โ and โ}
โ depending on context.
โswedish
โโ
Runs style hook TeX-language-sv-hook
. Pressing ๏นค"๏นฅ will insert โ''
โ. Typing ๏นค-๏นฅ twice will insert โ"=
โ, three times โ--
โ.
Replacement of language-specific hyphen strings like โ"=
โ with dashes does not require to type ๏นค-๏นฅ three times in a row. You can put point after the hypen string anytime and trigger the replacement by typing ๏นค-๏นฅ.
In case you are not satisfied with the suggested behavior of quote and hyphen insertion you can change it by customizing the variables TeX-quote-language-alist
and LaTeX-babel-hyphen-language-alist
respectively.
user option
TeX-quote-language-alistโ
Used for overriding the default language-specific quote insertion behavior. This is an alist where each element is a list consisting of four items. The first item is the name of the language in concern as a string. See the list of supported languages above. The second item is the opening quotation mark. The third item is the closing quotation mark. Opening and closing quotation marks can be specified directly as strings or as functions returning a string. The fourth item is a boolean controlling quote insertion. It should be non-nil if if the special quotes should only be used after inserting a literal โ"
โ character first, i.e. on second key press.
user option
LaTeX-babel-hyphen-language-alistโ
Used for overriding the behavior of hyphen insertion for specific languages. Every element in this alist is a list of three items. The first item should specify the affected language as a string. The second item denotes the hyphen string to be used as a string. The third item, a boolean, controls the behavior of hyphen insertion and should be non-nil if the special hyphen should be inserted after inserting a literal โ-
โ character, i.e. on second key press.
The defaults of hyphen insertion are defined by the variables LaTeX-babel-hyphen
and LaTeX-babel-hyphen-after-hyphen
respectively.
user option
LaTeX-babel-hyphenโ
String to be used when typing ๏นค-๏นฅ. This usually is a hyphen alternative or hyphenation aid provided by โbabel
โ and the related language style files, like โ"=
โ, โ"~
โ or โ"-
โ.
Set it to an empty string or nil in order to disable language-specific hyphen insertion.
user option
LaTeX-babel-hyphen-after-hyphenโ
Control insertion of hyphen strings. If non-nil insert normal hyphen on first key press and swap it with the language-specific hyphen string specified in the variable LaTeX-babel-hyphen
on second key press. If nil do it the other way round.