Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse titles #5

Open
digitalheir opened this issue May 26, 2017 · 0 comments
Open

Parse titles #5

digitalheir opened this issue May 26, 2017 · 0 comments

Comments

@digitalheir
Copy link
Owner

digitalheir commented May 26, 2017

Needs helper functions, see #1, #2, #3.

We’ll need several definitions before going further. The brace depth of an item is the number of
braces surrounding it. This is not a very formal definition, but for instance, in the title above, \LaTeX
has brace depth 2, the C has brace depth 1, and everything else has depth 0. A special character is a
part of a field starting with a left brace being at brace depth 0 immediately followed with a backslash,
and ending with the corresponding right brace. For instance, in the above example, there is no special
character, since \LaTeX is at depth 2. It should be noticed that anything in a special character is
considered as being at brace depth 0, even if it is placed between another pair of braces.
That’s it for the definitions. Generally speaking, several modifications can be applied to the title
by the bibliography style:
• first of all, the title might be used for sorting. When sorting, BibTEX computes a string, named
sort.key$, for each entry. The sort.key$ string is an (often long) string defining the order
in which entries will be sorted. To avoid any ambiguity, sort.key$ should only contain alphanumeric
characters. Classical non-alphanumeric characters23, except special characters, will
be removed by a BibTEX function named purify$. For special characters, purify$ removes
spaces and LATEX commands (strings beginning with a backslash), even those placed between
brace pairs. Everything else is left unmodified. For instance, t^ete, t{^e}te and t{^{e}}te
are transformed into tete, while tête gives tête; Bib{\TeX} gives Bib and Bib\TeX becomes
BibTeX. There are thirteen LATEX commands that won’t follow the above rules: \OE, \ae, \AE,
\aa, \AA, \o, \O, \l, \L, \ss. Those commands correspond to ı, , œ, Œ, æ, Æ, å, Å, ø, Ø, ł, Ł,
ß, and purify$ transforms them (if they are in a special character, in i, j, oe, OE, ae, AE, aa,
AA, o, O, l, L, ss, respectively.
• the second transformation applied to a title is to be turned to lower case (except the first character).
The function named change.case$ does this job. But it only applies to letters that are
a brace depth 0, except within a special character. In a special character, brace depth is always
0, and letters are switched to lower case, except LATEX commands, that are left unmodified.

http://tug.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant