Archive for the ‘LaTeX’ category

Article on typesetting pitch in LaTeX

November 3rd, 2015

I should have mentioned earlier, but the 2013 article I published in TUGboat is now freely available after the subscriber purdah period. The article shows how most pitch-related markings can be represented in LaTeX.

Note that Mark Wibrow’s excellent tikz-pitch-contour code is now located at GitHub, since Gitorious is no longer extant.


April 25th, 2013

Till Tantau’s PGF (Portable Graphics Format) is a package that adds graphics capabilities to {La|Xe}TeX, and TikZ (Tikz ist kein Zeichenprogramm – “Tikz is not a drawing program”) is a set of commands on top of PGF that makes it easier to handle. A number of packages that are useful to linguists use TikZ (eg Daniele Pighin’s TikZ-dependency for drawing dependency diagrams, or David Chiang’s tikz-qtree), and I’ve recently been investigating how to use it for representing pitch in tone and intonational languages.

One useful program that makes it easier to experiment with TikZ is Florian Hackenberger’s ktikz. Although this hasn’t been updated since 2010, it works well. You enter the TikZ code in the left-hand pane, and the right-hand pane gives you an immediate representation of what your graphic looks like. Some templates for standard LaTeX documents are available in /usr/share/kde4/apps/ktikz/templates, but it’s a good idea to set up a template in your home dir so that you don’t have to be root to edit it, and point ktikz to it. You can then add additional packages and frequently-used tikzlibrary options to that. Note that new tikzlibrary options will not be accessed until ktikz has been closed and restarted. Alternatively, you can just add tikzlibraries you will not be using frequently above the \begin{tikzpicture}.

Once you have drawn your graphic, you may want to put it on a webpage. One handy way of doing this is Pavel Holoborodko’s QuickLaTeX. The QuickLaTeX server compiles the LaTeX code you enter, and gives you a URL for the resulting output. You can then paste that URL into the webpage where you want the LaTeX output. For a TikZ graphic, put the tikzpicture code in the top box, and the environment:
in the Choose Options box. Then click Render to get the compiled code and its URL.

An alternative approach for a WordPress blog is to use Pavel’s plugin, which compiles the code and sends your blog the image to be inserted in place of the code. Add the above lines to the preamble box on the Advanced tab of the plugin settings, and then you can, for instance, use the following tikz-qtree code (taken from a TeX StackExchange question) to produce a nicely-formatted syntax tree:

\Tree [ 
  .TP [ 
      .T\1 \node(C){T+verb}; [
          .vP \qroof{`ana}.DP [
             .v\1 \node(B){v+verb};
                 .VP [
                     .V\1 \node(A){V+verb}; \qroof{taalib}.DP 
\draw [semithick,->] (A) to[out=240,in=270] (B.south);
\draw [semithick,->] (B) to[out=240,in=180] (C);

Rendered by

TikZ is a very powerful system for producing almost any kind of printed graphic, and QuickLaTeX allows those graphics to be made easily available on the web.

LaTeX template for play scripts

October 12th, 2011

I was recently asked by Steffan to put some playtexts into a neater format, and of course I chose LaTeX for the job. It may be that the template I came up with would be of use to others, so I’m posting it here, along with a pdf of the template output.

The template is fairly simple, depending on description lists for the most part, and I’ve commented it so that it should be fairly easy to adjust for what you need. Apologies to Sheridan for mucking about with The Rivals to give some sample text. The output is pretty similar to that of the Methuen playtexts series, so it should be acceptable in most good theatres …

The only issue I haven’t resolved yet is getting rid of the blank page at the very start of the pdf.

LaTeX and tonemics

July 29th, 2007

A number of the people I’ve been working with on software for Welsh have academic papers available for download, and when you look at them you can see that they are using the LaTeX development of Donald Knuth’s TeX typesetting system.

So I decided it was time that I got at least a nodding acquaintance with these systems. The key feature of TeX is a programmable markup system, and it does seem as if once you know the details, you can do virtually anything with it. I won’t be in that category for some years, so I’m using the excellent Kile to ease my entry. There are other frontends available (eg Texmaker, Lyx).

The best way of checking something out is to try doing something real-world with it, so I decided to go back to some papers I’d written a looooong time ago and see how these might come out in LaTeX. These were on African linguistics, and since most African languages are tone-languages, having access to diacritics that will allow you to represent these is essential.

A bit of reading around led me to TIPA, a package developed by Rei Fukui at the University of Tokyo, which is aimed at allowing all the symbols of the International Phonetic Alphabet to be represented in LaTeX. It’s a wonderful piece of work, and comes with a very extensive manual. The best thing about it is that it provides symbols for representing up to 5 levels of tone.

By default, these are set up to use a right-hand stem bar for the tone – this seems to be the default in most work on Asian tone-languages. Here’s an example:
However, most work on African tone-languages tends not to use this system, probably because glides are a lot less frequent, and because the relative rather than absolute pitch-level seems to be more important in systematising tonal phenomena there. So ideally I needed some way to suppress the display of the tone stem bar.

Professor Fukui was kind enough to give me the magic formula to do this, and I reproduce it here in case it might be of benefit to someone else. All you need to do, after invoking the TIPA tone module as usual in the document preamble, is to add a couple of extra lines, so that the preamble now looks like this:

\renewcommand\@tonestembar{\setbox0\hbox{\tipaencoding \char’277}\hbox{\vrule height \ht0 depth \dp0 width 0pt}} % no stem

With this in place, the tones now come out like this:

Perfect. That means that you can then (for example) use:
mpf\'umu [ \tone{44} \tone{22} ]
to produce:
(the Koongo word for “chief” in Hazel Carter’s orthography) and give the standard indication of the pitch-contour.