# Automatic formatting of syntactic annotations in glossed examples with LaTeX

The preceding post explained how to automatically format grammatical labels in glossed examples with LaTeX. The same kind of code can be used to automatically format syntactic brackets and annotations, so I added this functionality to my experimental package now called igt-format.sty (https://bitbucket.org/tpellard/igt-format) [update] typgloss (https://github.com/tpellard/typgloss).

Adding brackets and annotations for syntactic structure in a glossed examples poses two problems:

1. brackets and annotations are italicized if the first line is in italics, which does not look nice;
2. glosses get aligned with the brackets instead of the text.
\documentclass[11pt]{article}\usepackage{gb4e}\noautomath\usepackage{typgloss}\renewcommand{\eachwordone}{\itshape}\begin{document}\begin{exe}  \ex  \gll  [\textsubscript{NP}My s Marko] poexa-l-i avtobus-om v Peredelkino \\	1PL COM Marko go-PST-PL bus-INS ALL Peredelkino \\  \glt  Marko and I went to Perdelkino by bus.'  \ex test\end{exe}\end{document}

It is possible to correct these locally by hand with for example \textup{} and \phantom{}, but it is time consuming. Instead, I wrote some code to automatically:

• put brackets and annotations in upright style;
• put annotations in subscript style (no need to add \textsubscript{} around each annotation);
• resolve alignments issues.

It works with both annotations after an opening bracket and annotations after a closing bracket. You only need to put a space between the opening bracket+annotation block and the following text, and a pair of empty braces on the gloss line:

\documentclass[11pt]{article}\usepackage{leipzig}\makeglossaries\usepackage{gb4e}\noautomath\usepackage{typgloss}\begin{document}\renewcommand{\eachwordonestyle}{\itshape}\begin{exe}  \ex  \gll  [NP My s Marko]S poexa-l-i avtobus-om v Peredelkino \\	{} 1PL COM Marko go-PST-PL bus-INS ALL Peredelkino \\  \glt  Marko and I went to Perdelkino by bus.'\end{exe}\end{document}

The following commands are defined:

• \syntbann{} for scanning the first line and add the following commands around brackets and annotations;
• \syntbformat{} for the formatting of brackets;
• \syntannformat{} for the formatting of annotations;
• \syntnegspace for the negative space used to correct the alignment.

As with grammatical labels, \eachwordone should not be redefined to set the style of the first line. Use \eachwordonestyle instead.

The full code is available as an experimental package igt-format.sty on bitbucket:
https://bitbucket.org/tpellard/igt-format

[Update] The package is now called typgloss and can be found on github: https://github.com/tpellard/typgloss.

If you have problems or suggestions, do not hesitate to file an issue on bitbucket github, or just contact me at thomas.pellard@cnrs.fr.

Ce billet peut être cité de la façon suivante: Thomas Pellard, « Automatic formatting of syntactic annotations in glossed examples with LaTeX », Cipanglossia, 16 juin 2019, https://cipanglo.hypotheses.org/1236.

#### Vous aimerez aussi...

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.

Rechercher dans OpenEdition Search

Vous allez être redirigé vers OpenEdition Search