Encodings and Regimes - Old Content

From Wiki
Revision as of 08:59, 17 July 2006 by 218.108.24.117 (talk)
Jump to navigation Jump to search

< Fonts >

The Unicode effort clearly shows that 256 characters cannot possibly contain the world's languages. However (with the exception of modern variants like Omega and XeTeX), TeX is an old system, and will only deal with 256 characters per font. Similarly, many "legacy" file encodings on current operating systems will attempt to shoehorn a set of characters into eight bytes.

As a result, you need to make a choice which input encoding (regime) or font/output encoding (encoding) you use.

Encodings

LaTeX users will probably know them under the name fontenc (\usepackage[T1]{fontenc} for example). As TeX can only handle 256 characters at once, it is important to choose the encoding which covers all the characters of your language, otherwise the hyphenation won't work for words with composite characters and most probably you won't be able to simply extract text from the resulted PDFs.

To enable ec encoding in Latin Modern Roman for example, you can type:

\usetypescript[modern][ec]
\setupbodyfont[10pt,rm]

Some good choices for encodings are:

  • texnansi for Western European languages with only a small subset of additional accented characters (includes many other important glyphs)
  • ec for European languages with many accented characters (also known as cork)
  • qx as a compromise between the two above, supposed to cover most Central European languages (more accented characters than texnansi and more additional glyphs in comparison to ec)
  • t5 for Vietnamese
  • cyr, t2a, t2b, t2c, ... (?) for Cyrillic
  • iso-8859-7/greeek/grk (?) for Greek (see Greek for more details)

Users of il2 and pl0 should consider moving to qx.

A simple overview of which characters are present in some of the most common encodings (ec, texnansi, 8r and 8a): http://fun.contextgarden.net/encodingtable/enctable.rb?ec,texnansi,8r,8a

(I hope that the content of this section will soon move to a page on its own with more comprehensive overview of different encodings.)

Search for non-asci characters in Adobe

Some characters (\ccaron - 'č' being of them for example) are not properly recognized by Adobe (especially by older versions) when searching or copying text from PDF documents. In order to help Adobe recognize the glyphs and treat them properly, add this piece of code to your source:

\input enco-pfr
\startencoding [ec]
  \usepdffontresource ec
\stopencoding

At the time of writing this article, only il2 and ec are being supported, but support for other encodings can be added.

See also:

Available Regimes

ConTeXt name(s)Official name(s)Remarks
il1ISO-8859-1, ISO Latin 1western european languages
win = windowsWindows CP 1252 (nearly ISO Latin 1)western european languages
latin2Pseudo ISO Latin 2see regi-lat.tex
il9ISO-8859-15, ISO Latin 9Latin-1 plus Euro, not in default distribution
macMac Romanwestern european languages
ibmIBM PC DOSwestern european languages
grkISO-8859-7Greek
utfUTF-8Unicode, see below
vis = visciiVISCIIVietnamese
cp1251Windows CP 1251cyrillic
cp866, cp866navDOS CP 866cyrillic
koi8-r, koi8-u, koi8-ruKOI8cyrillic (russian, ukrainian, mixed)
maccyr, macukrMac Cyrilliccyrillic (russian, ukrainian)
cp855, cp866av, cp866mav, cp866tat, ctt, dbk, iso88595, isoir111, mik, mls, mnk, mos, ncc(several)rare cyrillic encodings, see regi-cyp.tex

A list of available language codes is in mult-sys.tex. You find output/font encodings in enco-*.tex files.

See http://czyborra.com/charsets/iso8859.html for ISO standards.

Typesetting in UTF-8

Use

\enableregime[utf]

in order to be able to typeset in unicode under ConTeXt.

Using non-ascii characters

As a TeX/LaTeX user you were probably told to use the accents in the following way (the example is taken from the TeXBOOK, page 24):

Once upon a time, in a distant
  galaxy called \"O\"o\c c
there lived a computer
named R.~J. Drofnats.

The galaxy name will be shown as.

In ConTeXt, please try to avoid that backslashed character composition if possible (there are several good reasons for it - hyphenation etc.).

You have two alternatives:

Type the characters as you do in any other text editor

\enableregime[utf] % or any other supported regime

...

Once upon a time, in a distant
  galaxy called Ööç

Once you figure out what regime you need, you can simply type the characters as you do in any text editor (See above fot the list of available regimes - some more will probably be added in the near future. If you don't find the one you would like to use, please ask on the mailing list)

Use glyph names

If you don't have the letter on your keyboard (or if you want some strange letters not supported by the regime you use, for example greek or cyrillic), you can access the glyphs by their names:

Once upon a time, in a distant
  galaxy called \Odiaeresis\odiaeresis\ccedilla

How do I know which glyph name to use?

How it works?

Robert Ermers and Adam provided a helpful explanation of how Characters are constructed in LaTeX and ConTeXt (in some discussion on the mailing list):

You know that all characters in a font have a number. If you type a, the font mechanism makes sure that you see an . In reality the font shows you the character that is put on the numerical position of a. In the font dingbats for example, the character on that position is not an , but a symbol.

===In Latex=== the combination \"{a} can mean two things:

  • in most fonts: show the charachter on the a given numerical position, which means that there is one character .
  • in some other fonts \"{a} means: combine " with a and make an . This means that " is combined with the character on the numerical position of a. TeX does this very well and thus construes very acceptable diacritical signs like \"{q}, \d{o}, \v{o}, which do not exist in regular fonts.

If you have a font which contains \"{q}, \d{o} or some other special characters, you may instruct TeX not to create the character, but rather to show the contents of a given numerical position in that font. That's what the .enc and .fd files under Latex are for.

That's also the reason there are, or used to be, special fonts for Polish an Czech and other languages: they contain predefined characters in one single numerical position, e.g. \v{s} and \v{c} that TeX does not have to create anew from two signs.

In ConTeXt

the combination \"{a} means one thing: \adiaeresis (see enco-acc). This \adiaeresis can mean one of two things, depending on the encoding:

  • Numerical position, or
  • The fallback case (defined in enco-def), where a diaeresis/umlaut is placed atop an glyph. Hyphenation implications as Hans described.

The interesting/helpful thing about ConTeXt is that internally, that glyph is given a consistent name, no matter how it is input or output. So, if you type ä in your given input regime, and that encoding is properly set, that numerical ä (e.g., character #228 in the windows regime) is mapped to \adiaeresis.

Wanna know what happens in UTF-8? Here's my 'simplified' explanation: In a UTF-8 bytestream, that character is signified by two bytes: 0xC3, 0xA4. That first byte triggers a conversion of both bytes into two different bytes, the actual Unicode number, 0x00 0xE4 (or: 0, 228). ConTeXt then looks into internal hashes set up (in this case, the unic-000 vector), looks at the 228th element, and sees that it's \adiaeresis. Things then proceed as normal. :)

(It's also interesting to note that for PostScript and TrueType fonts, that number > name > number (glyph) mapping happens yet again in the driver. But all that is outside of TeX proper, so to say any more would be confusing.)


[1] wolverine sex [2] wisconsin sex offender registry [3] wild sex clubs [4] wife too tight for sex [5] wiccan sex magick [6] white women having sex with black men [7] white discharge after sex [8] which sex and the city character are you quiz [9] whens the latest you can have sex during pregnancy [10] when do squirrels show there sex parts [11] what your mother never told you about sex [12] what your mother doesn t tell you about sex [13] what month can you see the sex of the baby [14] webcam chat sex [15] web site to find registered sex offenders [16] waterproof sex toys [17] water sex clips [18] watch wife sex [19] watch paris hilton sex tape now [20] wa sex offender list [21] voyeu sex tgp [22] virtual sex simulator [23] virgos and sex [24] virgin having sex [25] view paris hiltons sex tape [26] view celebrities sex pictures [27] videos of woman being raped by anal sex [28] videos of lesbian sex free [29] video of katie holmes having sex [30] victorian sex [31] vestal teen nude sex [32] vermont divorce law sex seperation [33] vaginal sex with two men at same time [34] vaginal burning after sex [35] vagina bleeding during sex [36] usb sex toys [37] us sex sites [38] upskirt sex video [39] underage sex vicky [40] under aged sex tapes [41] under 18 lolitas sex nudity photos [42] uncut sex pussy [43] trunks and goten having sex [44] triple x sex toy [45] trans sex kitten paris [46] totally free 3d sex games [47] torture extreme toys sex dildos [48] top 100 sex stories [49] tool anal sex [50] tips on how to give oral sex to a woman [51] tips for giving oral sex [52] tiny japanese sex video [53] time travel sex [54] thrisha sex [55] the most extreme sex [56] thai sex women [57] teeny sex movies thumbnails [58] teens under 18 having sex [59] teens having sex outdoors galleries free [60] teenagers questions about safe sex [61] teen sluts slut wifes hot teen sluts sex porn [62] teen sex videos clips [63] teen sex q a [64] teen sex information [65] teen sex fest [66] teen sex ed [67] teen lezz sex [68] teen girls having sex with a tolit [69] teen couples sex positions gallery [70] teasing sex [71] teacher sex with students videos [72] teacher charged sex video [73] tatoos sex [74] tamil free sex pics [75] tallahassee sex [76] take a sex quiz [77] swinger and sex clubs in austin texas [78] svensk massage sex [79] suck sex stories [80] stroys about sex [81] strapon sex [82] strap on sex toys [83] straight couples sex pics [84] story dog woman sex [85] stephen king it sex scene [86] steamy sex scenes [87] spike sex toys [88] spicing up your sex life [89] spa sex review [90] southern bells sex [91] somerset nj sex [92] snowblowing sex [93] sleeping girl sex [94] sister in law sex [95] single sex school boys [96] singapore sex price [97] sims 2 sex mods [98] simpsons sex pics [99] shower sex mature [100] show me sex education [101] shemale on girl sex [102] shaklin s sex couch [103] sex red headed [104] sex [105] sex hot pornography nude free [106] sex young lol [107] sex xxx pussy pic [108] sex world minneapolis [109] sex world for adults [110] sex with sis [111] sex with mothersinlaw [112] sex with demons [113] sex with a succubus [114] sex windsor [115] sex while in bondage [116] sex werewolf [117] sex wars game show [118] sex vixens from outer space [119] sex videos on line [120] sex videos amateur [121] sex video clips 89 [122] sex verhalen [123] sex van [124] sex vagina [125] sex trans inf [126] sex torch [127] sex theme resorts [128] sex text sms [129] sex terms dictoinary [130] sex teen pics [131] sex swing videos [132] sex suit [133] sex stories white women serve black women [134] sex stories ovulate lake babysitter [135] sex stories on rape [136] sex stories jockey hollow [137] sex stories blogs [138] sex squirters [139] sex slide shows [140] sex slaves in new york city [141] sex site swith young girls [142] sex site passwords free [143] sex shops carlsbad ca [144] sex shop mn [145] sex schoolgirl [146] sex sacrifice [147] sex russian girls smoking cigarettes [148] sex role play ideas [149] sex research studies [150] sex reassignment surgery preparatuion [151] sex quotes to get your man horney [152] sex printer [153] sex post sex reassignment [154] sex positions with pictures [155] sex positions tantric [156] sex positions movies [157] sex positions for licking clit [158] sex positions descriptions stories [159] sex phone dom live [160] sex pheens [161] sex personal movie free [162] sex pc game [163] sex partners las vegas [164] sex parlors chile [165] sex org