# Some TeX Developments

Coding in the TeX world

## LaTeX training: in demand

with 4 comments

As part of my activity for UK-TUG, I and a couple of other members ran a training event last week in London: LaTeX for beginners. This is the third time we’ve run a similar course, and I think that this was the best presentation we’ve given to date. The slides and handouts seem to work pretty well, and the timing and so forth is now becoming a lot clearer!

Coming away from the event, what is most notable is the demand for LaTeX training. We’ve run the same course three times in just over a year, and I’ve currently got a waiting list which will easily fill the next presentation. At the same time, we get asked a lot about an intermediate-level course, and so we’ve made a start on assembling some slides for that, too.

On the course itself, we had a number of people from publishing backgrounds, and again there are more on the waiting list. So it’s clear that LaTeX continues to be a significant player, at least in the UK, in the publishing world.

Depending on availability of help, I’m hoping that we can run one course early in the new year, and another at around Easter. So this will be keeping me busy for a while!

Written by Joseph Wright

August 31st, 2011 at 8:26 pm

Posted in LaTeX

Tagged with

## LuaTeX category code tables

with 2 comments

There are lots of very clever ideas in LuaTeX, and it’s easy to miss some of the good stuff there is. One that many people might miss is category code tables. As any TeX programmer rapidly becomes aware, category codes are central to TeX, and the construction

`\catcode`\<char> = <number>\relax`

is one you soon get used to. The problem comes when several people start altering the codes: there is no easy way to get back to a known position.

A good illustration of this is verbatim material. The way that something like LaTeX’s \verb macro works is by setting the category code for all of the ‘special’ characters to ‘other’:

```\let\do\@makeother
\dospecials```

where both `\@makeother` and `\dospecials` are provided by the LaTeX kernel. That works because `\dospecials` is defined as

`\do \ \do \\\do \{\do \}\do \\$\do \&\do \#\do \^\do \_\do \%\do \~`

and so maps the function `\@makeother` to all of the ‘special’ characters. Using that, a (simplified) verbatim command looks like

```\makeatletter
\newcommand*\stdverb{%
\begingroup
\let\do\@makeother
\dospecials
\@stdverb
}
\newcommand*\@stdverb[1]{%
\catcode`#1=\active
\lccode`\~=`#1%
\lowercase{\let~}\endgroup
\ttfamily
}
\makeatother```

In most cases, this works fine. However, if someone makes another character ‘special’ then things go wrong:

```\catcode`\+=\active
\newcommand+{oops}
\stdverb=#{+=```

Of course, you could loop over every character, which would be slow for 8-bit input but with UTF-8 input that becomes impractical. Of course, you could add each active character to `\dospecials`, but this is dependent on everyone sticking to good practice.

This is where category code table come in. These are pre-set lists of category codes, which can be applied in one go. Heiko Oberdiek’s `luatex` package provides a LaTeX interface for these, meaning we can do:

```\usepackage{luatex}
\makeatletter
\newcommand*\luaverb{%
\begingroup
\BeginCatcodeRegime\CatcodeTableOther
\@stdverb
}
\makeatother```

(reusing the same internal macro as before). now trying

```\catcode`\+=\active
\newcommand+{oops}
\luaverb=#{+=```

works as expected, as all of the category codes change in one go. Simple, clear and effective!

Written by Joseph Wright

August 16th, 2011 at 9:07 am

Posted in General

Tagged with ,

## biblatex-chem updates

without comments

Recent changes to biblatex (in v1.6) mean that the biblatex-chem bundle is currently broken. I’ve not released a quick-fix as there are some long-standing issues to address in biblatex-chem. When I initially wrote the code, I started from scratch and defined only what I wanted. That works, but means that any changes in biblatex are not automatically picked up. From biblatex-ieee, I took the alternative approach and worked from the standard biblatex styles to what was needed. That’s a better long-term approach, so it’s the one I’m now bringing to biblatex-chem. It will take a little while, so user might want to keep an eye on the development code.

Written by Joseph Wright

August 14th, 2011 at 9:59 am

Posted in biblatex

Tagged with