# LSA & LaTeX

A somewhat comprehensive treatment of LaTeX for the purposes of linguistics and LSA in particular. Also, info on (some) LSA templates.

# Compiled examples are here.

## Tableaux are just tables

Despite having a fancy francophone ring to them, tableaux are just regular tables for the purposes of LaTeX. They are mere tables that appear in a particular place and have particular formatting – which actually simplifies the task of typesetting them in a way.

## Table and tabular

### Simple tables

So, usually, when you type in \begin[some_environment], LaTeX (most editors, but we focus on Overleaf in particular) automatically closes it with \end[some_environment] so that you don’t forget to close the environment. At the same time, when you begin figure or table, you get more help. What happens with figures shall remain a mystery since the page is about tables, but if you enter \begin{table} and are lucky, you get the following bit of code:

\begin{table}[]
\centering
\begin{tabular}{c|c}
&  \\
&
\end{tabular}
\caption{Caption}
\label{tab:my_label}
\end{table}


This has a couple of elements which are worth going over (even though Overleaf or any intro to LaTeX would do as well). Begin-table essentially creates a table proper (which is the tabular environment), but also centers it (\centering), adds caption to the table, and labels it (labels are not shown, but can be called in text with \ref{...} to create a hyperlink to the table within the text). For tableaux, there is not need for centering or for a caption of the kind above. So, a simple example of a table within the expex environment (\pex...\xe, that is) will create a numbered example which consists of a table (expex can hold almost anything, which is admirable).

So, here’s a more fleshed out example of a simple table:

Some text before the table.

% by default the line above will not be indented if it follows a section title
\begin{table}[h!]
% the h! bit tells to place the table right where it is mentioned in text; not where it fits on the page (LaTeX can be lenient with tables, letting them float for better effect)
\centering
% centering, trivially
\begin{tabular}{c|c}
% the {c|c} bit tells that there are two columns, to center, and to put a vertical line between two columns
LSLT & weird algebraic notation \\
% "\\" is *very* important
MP & legerdemain with set theory
% true facts about the MP
\end{tabular}
\caption{Caption}
\label{tab:my_label}
\end{table}

Some text following the table.


### Friendship of tabular and expex

Here’s a simple example of a table as a numbered example with expex:

\pex
\begin{tabular}{c|c}
Why didn't they ask Evans? & Hickory dickory dock \\
By the pricking of my thumbs & A pocket full of rye
\end{tabular}
\xe


And one with two tables a and b for one numbered example, as per usual for expex:

\pex
\a     \begin{tabular}{c|c}
Titus Andronicus & Tamora \\
Richard III & George, Duke of Clarence
\end{tabular}
\a     \begin{tabular}{c|c}
William Blake & Endless night \\
Alfred Tennyson & Lady of Shalott
\end{tabular}
\xe


Note that for the tables above, you only need expex (or nothing, for the very first table). Now, here’s a more involved example of a table with some comments on styling options:

\pex
\a  Things ordinary people can't play.  \\
\begin{tabular}{l|c|l}
% note l instead of c above creating left alignment
\hline
% hline creates a horizontal line
\textcolor{red}{Schumann} & \textit{Davidsbundlertanze} & too many notes \\
\hline
Shostakovich & \textbf{Prelude and fugue in D-flat major, Op. 87} & even more notes
\end{tabular}
% vspace inserts space between tables; but this is advisable only if this can't be specified with expex,
% or if it's a one-time thing whereas other examples do not require such spacing
\vspace{1em}
\a  Some caption \\
% this uses package array for what follows begin-tabular and fixes width of the columns
\begin{tabular}{||m{3cm}|m{4cm}|m{1cm}||}
\hline
James I of Scotland & Daemonologie & 1597 \\
\hline
\hline
Kramer and Sprener & Malleus Maleficarum & 1496 \\
\hline
\end{tabular}
\xe


## Tabularray

For more complex tables – like the one from the PDA template – you will need package tabularray (or so is recommended; feel free to achieve the same ends with whatever means, even if it’s TikZ). Here’s the table from PDA with some comments:

\pex /m\'{u}-bet\textipa{\E}/ $\rightarrow$ [m\'ibet\textipa{\E}̀] mouth'\\
% the bit above requires tipa and \UseRawInputEncoding
% also note the you are beginning not tabular, but tblr
\begin{tblr}[]
% colspec is where you, well, spec(ify) col(or)
% but also give the settings for lines and alignment
{colspec = {l c|c|c|[dashed]r},
% the line below says that fifth cell in second row should have color grey9
cell{2}{5} = {gray9},
% the colors available are 81, and they come from package ninecolors
% which -- bonus -- is automatically loaded by tabularray
cell{3}{5} = {gray9},
cell{4}{5} = {gray9},
cell{5}{5} = {gray9},
cell{3}{4} = {gray9},
cell{4}{4} = {gray9}
% close the colspec environment
}
% this is where the actual table starts
\hline
& m\'u-bet\textipa{\E} & {\sc faith}($\alpha${bk}) & {\sc (*a-span)}($\alpha${bk}) & {\sc fgdsp}($\alpha${bk})\\
\hline
a. & (m\'u)(bet\textipa{\E}) & & *! & *\\
b. & (m\'u)(bat\{a}) & !* & * & **\\
c. & (m\'u)(bat\{a}) & *!* & & **\\ \hline[dashed]
% note how you can have a dashed hline
d. \PointingHand & (m\'i)(bet\textipa{\E}̀) & & & *\\
% weird symbols like PointingHanf require packages, this one in particular is from marvosymb package
\hline
\end{tblr}
\xe


The beauty of tables is that you can indeed – provided you loaded the requisite packages – copy the example and use it to suit your needs. Some further notes:

• here’s documentation for tabularray on CTAN; it’s quite flexible and its use extends beyond what is shown above
• as noted above, tabularray automatically loads package ninecolors (which has 81 colors), the CTAN documentation for which is here; find the list of available colors on p. 1 (out of 4!)

The symbols (such as \PointingHand) will be briefly discussed on the page devoted to symbols.

back