Conversation Analysis Transcript in LaTeX – Part 2: CAfont

In this post we’ll work with CAfont in LaTeX documents. CAfont is a monospaced font used in CLAN for conversation analysis transcripts. A while ago I wrote a post about my workflow when adding conversation analysis transcripts to a LaTeX document. That post spawned a few comments and different ideas about how to go about it. Gareth Walker brought to attention his own package convtran. I think that convtran is a great package and is useful for a lot of things, but using it to produce Jeffersonian-like transcripts requires a lot of fiddling around.

A friend of mine recently brought me down another path – namely using CLAN’s CAfont directly in LaTeX. Therefore, what we’ll be doing in this post is to use CAfont to create conversation analysis transcripts in LaTeX that can be directly copied from CLAN or other editors using the CAfont. Cafont is an OpenType font that comes with the CLAN installation, and is part of a module written for CLAN which enables conversation analysis annotations like this:

Getting the CAfont

So, if you have CLAN installed you should have the CAfont installed already. If you don’t you can get CLAN here. Now, you need to copy the font to the working directory of your LaTeX document.

On a Mac you’ll find the font in /Library/fonts, which you can copy into your working directory.
On Windows you’ll find the font in C:\Windows\Fonts.

Other packages required

In addition to the font itself we also need the packages fontspec and alltt installed. As you’ll see later the caption and the newfloat packages can prove useful as well, so make sure you have those installed. Since the fontspec package requires the XeLaTex or the LuaTex engine you need to compile with either one of those. If you run LaTeX from Overleaf you don’t need to worry about neither engine nor packages installations as Overleaf will automatically detect those requirements.

First, we setup a preamble:

\documentclass{article}
\usepackage{fontspec}
\usepackage{alltt}
\newfontfamily\cafont{CAfont.otf}
\newenvironment{CA}{\alltt\cafont}{\par\endalltt}

In the final line, you’ll see that we define a new environment that uses the CAfont as the default font, let’s see how this environment works in practice. Too add a transcription start with:

\begin{CA}

Go to your transcription in CLAN, mark and copy the part of the transcription you want to add to the LaTeX document. In your LaTeX document you paste the your transcript in after \begin{CA}. After the last line add:

\end{CA}

Your document after the preamble should look like something like this this:

I have only used 3 lines here, but you can add as many as you want. Note however, that underlinings are lost so you’ll have to re-add them manually by using \underline{word}. Unlike how LaTeX normally works, pressing the spacebar will actually produce a white space. This makes it much easier to align the text for example in cases where you need to mark overlap.

Captions and more

You’d generally also like to have the ability to use captions for transcripts so that you can reference to it in your text. To do just that we can use the \captionof command from the captions package. However, before we can do that we have to define a new float environment which we’ll call “Extract” – you’re free to change it to transcript, example, excerpt or whatever you prefer. For this we’ll need the caption and newfloat packages I mentioned earlier. First, we’ll define a new environment in the preamble:

\usepackage{newfloat}
\DeclareFloatingEnvironment[fileext=frm,placement={!ht},name=Extract]{Extract}

In our document we’ll first tell LaTeX that the type of caption is ‘Extract’, then add the caption using \captionof, and optionally we can add a label. We then need to pack these 3 lines in a group to tell LaTeX that these belong together. It will still working without this grouping, but you’ll get a bunch of warnings and in larger documents the caption can end up in places where you don’t want them.

\begingroup
\captionsetup{type=Extract}
\captionof{Extract}{Some extract}
\label{ex:someExtract}
\endgroup
\begin{CA}
'pasted transcript'
\end{CA}

You can put this group before or after the transcript depending on where you want the caption to appear. This could be achieved much easier if we had called the ‘Extract’ environment as a float (which is how we defined the environment in the preamble). However, using a non-float environment enables the transcript to span over a page. This, makes the document a bit more flexible, but also makes it possible to paste in large transcripts which wouldn’t be possible with a float environment.

Complete MWE

Below is everything you need in order paste you transcript from CLAN into a LaTeX document.

\documentclass{article}
\usepackage{fontspec}
\usepackage{alltt}
\newfontfamily\cafont[Scale=0.85]{CAfont.otf}
\newenvironment{CA}{\alltt\cafont\normalsize}{\par\endalltt}
\usepackage{caption}
\usepackage{newfloat}
\DeclareFloatingEnvironment[fileext=frm,placement={!ht},name=Extract]{Extract}
 
\begin{document}
\begingroup
   \captionsetup{type=Extract}
   \captionof{Extract}{Some Extract}
   \label{ex:someExtract}
\endgroup
\begin{CA}
   'pasted CA transcripted'
\end{CA}

\end{document}

Inline CA notation

Sometimes you would like to add one or several words with special characters indicating stress, pitch, and other prosodic information directly into your inline text. This works right off the bat after you’ve imported the font and compiled with fontspec. However, if you want write inline with the CAfont you will have to wrap the text in the font:

{\CAfont{something cool}}

This might just seem awfully complex but what you get is a fairly flexible way to add CA transcripts into your LaTeX document. There is no need for conversion software or image editing. You can simply copy lines from CLAN and directly into your document. I’d love to hear what you think though!

Acknowledgments

Thanks to Lucas Seuren for pointing me to the alltt environment, to my colleages at @pipe_sdu to provide me with challenges, and to the good folks over at StackExchange for just being there 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.