Computation for Linguists

LaTeX, Day 2

Dr. Andrew M. Byrd

2025-08-29

Review

  • What did we talk about in Wednesday’s class?

Review of Concepts

  • Documentclass

  • Preamble

  • Packages

  • Comments

  • Commands

  • Environments

Finding Additional Features

Additional Features

Load up your “example_project”. There are lots of features in this document. Scan the code, and identify how to do the following:

  1. “Math Mode”

  2. Changing the margins & paper size

  3. Changing the document language

  4. Spell check settings

  5. Adding citations & references

Identify their type: commands or environments or something else?

Math Mode

Additional Features: Math Mode

When would you use math mode in Linguistics?

  1. Easy Superscripts & Subscripts

  2. Semantic Formulae

  3. Greek Letters

  4. Primes for intermediate projections / traces in Syntax

Additional Features: Superscripts & Subscripts in Mathmode

Text$_{subscript}$  

Text$^{superscript}$
  • Notice anything special about the mathmode text?

Additional Features:Superscripts & Subscripts in Textmode

Text\textsubscript{subscript}

Text\textsuperscript{subscript}
  • Textmode allows you to maintain the same style

Additional Features: Semantic Formulae

L(n, j) ∨ C(j)

$L(n, j)\lor C(j)$ 
  • The symbol < ∨ > = disjunction (vs. conjunction)
  • “Either L is true of n and j, or C is true of j, or both.”

Additional Features: Greek Letters

Remember “alpha notation” from phonology? We need a way to use these symbols.

$\alpha$, $\beta$, $\gamma$
  • We’ll learn in a bit how to input Greek letters outside of mathmode.

  • These are all lowercase – how do you think we can make them uppercase?

    • Test your ideas in your tex file.

Activity: Math Mode

Return to your “301-LaTeX-practice” project. Create the following semantic notation formula in LaTeX using math mode. Refer to page 31 of Anke Himmelreich’s pdf for the commands.

Font Effects

Additional Features: Font Effects as Commands

\textit{words in italics} 
\textsl{words slanted} 
\textsc{words in smallcaps}
\textbf{words in bold}
\texttt{words in teletype}
\textsf{sans serif words}
\textrm{roman words}
\underline{underlined words}
\uuline{doubly underlined text}
\uwave{wavy underlined text}
\sout{crossed out text}
\xout{x'd out text}
  • You’ll notice that while there are line breaks in the code, there aren’t in the document. How might you add a line break between each of these lines?

Additional Features: Line Breaks

\textit{words in italics}

\par \textsl{words slanted}

or

\textit{words in italics}

\textsl{words slanted}
  • You can also use \\ to signal a linebreak, but it sometimes messes with spacing / document structure.

Additional Features: Other Types of Breaks

\pagebreak

\newpage

\clearpage
  • Try these out in your “example_project”. What do they do?

Additional Features: Font Effects as Environments

\begin{bfseries}
blah blah blah 
\end{bfseries}
\begin{itshape}
blah blah blah
\end{itshape}
\begin{em}
blah blah blah
\end{em}
  • If you have large sections of text, it may make sense to do these within an environment instead.

Additional Features: Font Sizes

{\tiny tiny words} tiny words

{\scriptsize scriptsize words} scriptsize words

{\footnotesize footnotesize words} footnotesize words

{\small small words} small words

{\normalsize normalsize words} normalsize words

{\large large words} large words

{\Large Large words} Large words

{\LARGE LARGE words} LARGE words

{\huge huge words} huge words

Additional Features: Inputting Manual spacing

\vspace{12pt}

Blah blah

\vspace{40mm}

Blah blah

\vspace{12pt}

\hspace{36 mm}

test

Tables

Additional Features: Tables

\begin{tabular}{|l|l|}
Apples & Green \\
Strawberries & Red \\
Oranges & Orange \\
\end{tabular}
  • Let’s plug this code into your tex file.
  • How do tables (tabular) work? What do you notice about the code’s structure?
  • What do you think “l” means? Replace it with “c”, and “r”. What happens?

Additional Features: Tables

\centering 
\begin{tabular}{rc} \\
Apples & Green \\ 
\hline 
Strawberries & Red \\ 
\cline{1-1} 
Oranges & Orange \\
\\end{tabular}

Additional Features: Tables

\centering 
\
\begin{tabular}{|r|l|} % 
\hline 
8 & here's \\ 
\cline{2-2} 
86 & stuff \\ 
\hline \hline 
2008 & now \\ 
\hline 
\
\end{tabular}

Activity: Tables

Tabular Activity
  • Create the above table in LaTeX.

Citations

Additional Features: Citations

  • Citations in LaTeX will refer to a .bib file

  • Let’s create one in our “301-LaTeX-practice” project folder

  • Call this .bib file “refs.bib”

Additional Features: Your First .bib

@article{smith2017,
    author = {Smith, John},
    title = {Some paper},
    year = {2017},
    journal = {Journal of Research},
    volume = {2},
    number = {1},
    pages = {1--69}
}

@book{knuth1986,
  author    = "Donald E. Knuth",
  title     = "The {TeX} Book",
  year      = "1986",
  publisher = "Addison-Wesley Professional",
  address   = "Massachusetts"
}

Additional Features: Citations

  • With these two references now in the system, let’s practice citing them.

  • Edit your preamble with the following text, after the documentclass command.

\documentclass{article}
\usepackage{natbib}
\bibliographystyle{apalike}
\begin{document}

Additional Features: Citations

  • End your document as follows:
\bibliography{refs} 
\end{document}

Additional Features: Citations

\documentclass{article}
\usepackage{natbib}
\bibliographystyle{apalike}

\begin{document}
\title{My First Document}
\author{My Name}
\date{December 6, 2017}
\maketitle

\section{Introduction}
 This is the introduction.\cite{smith2017}
\section{Methods}
\subsection{Stage 1}
The first part of the methods.\nocite{knuth1986}
 \subsection{Stage 2}
The second part of the methods.\cite[p. 215]{smith2017}
 \section{Results}
 Here are my results.\cite{knuth1986,smith2017}
 
\bibliography{refs} 
\end{document}
  • Copy the above code and run it in your project tex file.

Activity: Zotero

  • A much more user-friendly reference platform is Zotero.

  • Click here to sign up for the platform or log into your account.

  • Add at least one reference if you do not have one already.

  • Select all of the references to export

  • Click the “upwards arrow” icon

  • You now have a .bib file!

Activity Solutions

Activity: Tables Solution

\begin{center}
\begin{tabular}{||r||l|l||}
\hline\hline
ID & Item & Note \\
\hline
11   & pears    & firm     \\
\hline
101  & bananas  & ripe     \\
\hline\hline
42   & apples   & crisp    \\
\cline{1-1}
73   & oranges  & tart     \\
\cline{3-3}
\hline
2025 & grapes   & seedless \\
\hline\hline
\end{tabular}
\end{center}

Activity: Mathmode Solution

\(\forall w^{'} (wRw^{'} \rightarrow \exists e^{'} \land Ag(e^{'}, x)))_{nuclearscope}\)

$\forall w^{'} (wRw^{'} \rightarrow \exists e^{'} \land  Ag(e^{'}, x)))_{nuclearscope}$