# Meta definition of diacritical marks

Could someone tell me at least approximately where in the bowels of TeX I could find the definition of various accents/decorations going on letters, such as the cedilla?

-

The accents are defined in the format, so where they are defined depends on the format. I'll assume that you are using LaTeX, and interested in text accents rather than math.

LaTeX classifies almost all these commands as encoding specific so the actual definitions depend on the declared encoding of the font currently in use.

I'll use the the OT1 (original TeX 7 bit) and T1 (8 bit latin1-based) encodings as examples ot1enc.def and t1enc.def files in the base latex distribution define:

ot1enc

\DeclareTextAccent{\.}{OT1}{95}
\DeclareTextCommand{\c}{OT1}[1]
{\leavevmode\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent24 #1%
\else{\ooalign{\unhbox\z@\crcr\hidewidth\char24\hidewidth}}\fi}

So in T1 \. uses the TeX primitive \accent to place the accent which is in position 95 over the base letter. \c is in position 24 and placed using the accent primitive or "by hand" using a table construct depending on the size of the base.

t1enc

\DeclareTextAccent{\.}{T1}{10}
\DeclareTextCommand{\c}{T1}[1]
{\leavevmode\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent11 #1%
\else{\ooalign{\unhbox\z@\crcr
\hidewidth\char11\hidewidth}}\fi}
\DeclareTextComposite{\c}{T1}{S}{147}
\DeclareTextComposite{\c}{T1}{T}{149}
\DeclareTextComposite{\c}{T1}{s}{179}
\DeclareTextComposite{\c}{T1}{t}{181}
\DeclareTextComposite{\.}{T1}{i}{\i}
\DeclareTextComposite{\.}{T1}{\i}{\i}
\DeclareTextComposite{\.}{T1}{Z}{155}
\DeclareTextComposite{\.}{T1}{I}{157}
...

So T1 is similar except that the accents are in different positions in the font, and the most common combinations are not constructed using \accent at all but are pre-designed glyphs with their own slot in the font. So in OT1 \.{s} uses a dot glyph and an s glyph and positions one over the other but in T1 encoding it simply uses the dotted s glyph from position 179.

-
Thank you! This looks very much like what I was looking for. – Sándor Kovács Apr 22 '12 at 23:54

the definitions of all accents are in the file plain.tex, and a little bit of an explanation accompanies the code in appendix b of the texbook. there are essentially three kinds of accent definitions:

• accents present in fonts in appropriate position for embellishing a lowercase letter are defined using the \accent primitive (all such accents have zero width in the cm fonts as designed explicitly for tex, and are positioned to sit over a lowercase letter of medium width, although the tex program will adjust the horizontal positioning over a wider or narrower letter, and the vertical positioning if needed for an uppercase or taller lowercase letter);

• accents that co-opt some other symbol or shape (e.g. a dot or a rule) and are intended to be set above a letter or symbol are defined using \oalign (also defined in `plain.tex);

• the cedilla, which is set below a letter, is (since the cedilla symbol is in fonts) accessed using \accent, and, if applied to a letter with height greater than 1ex, adjusted to the proper vertical position with \ooalign. (this is a kludge, and if knuth had had need for other "under" accents such as the ogonek, would probably have been implemented differently, with a real "underaccent" primitive.)

this is the story for accents in text; math accents are a different kettle of fish, as noted in the answer by stephan lehmke.

-
Thank you very much. This is very useful. – Sándor Kovács Apr 22 '12 at 23:56

The table 2.2 on page 25 of lshort (english) shows you the possible accents available. You get it with:

texdoc lshort.pdf

The table looks like:

-
Would be helpful if you would post a screen capture of the table here. – Peter Grill Apr 22 '12 at 20:19
@PeterGrill: I edited my answer and added the table. – Peter Breitfeld Apr 22 '12 at 20:24
@MartinScharrer: thank you for your answer, but my question was not how I can invoke the accents, but how they are defined. – Sándor Kovács Apr 22 '12 at 23:51
@SándorKovács: I didn't posted the answer, Peter Breitfeld did. I just edited it to correct some format. BTW, I find the information of this answer very useful but agree that your question is not the right place for it ;-) – Martin Scharrer Apr 23 '12 at 0:56
@MartinScharrer: sorry, I should have noticed that. Thanks! – Sándor Kovács Apr 23 '12 at 1:24

Maybe you should say with a little more detail what level you want this information on. The TeXbook sez on positioning math accents (on page 443):

12 . If the current item is an Acc atom (from \mathaccent), just go to Rule 16 if the accent character doesn't exist in the current size. Otherwise set box x to the nucleus in style C', and set u to the width of this box. If the nucleus is not a single character, let s = 0; otherwise set s to the kern amount for the nucleus followed by the \skewchar of its font. If the accent character has a successor in its font whose width is ≤ u, change it to the successor and repeat this sentence. Now set δ ← min(h(x); χ), where χ is \fontdimen5 (the x-height) in the accent font. If the nucleus is a single character, replace box x by a box containing the nucleus together with the superscript and subscript of the Acc atom, in style C, and make the sub/superscripts of the Acc atom empty; also increase δ by the difference between the new and old values of h(x). Put the accent into a new box y, including the italic correction. Let z be a vbox consisting of: box y moved right s + 1/2 (u - w(y)), kern -δ, and box x. If h(z) < h(x), add a kern of h(x) - h(z) above box y and set h(z) ← h(x). Finally set w(z) ← w(x), replace the nucleus of the Acc atom by box z, and continue with Rule 16.

If you can make head or tail of this, you're welcome :-)

-