| 1 |
\documentclass{ltxdoc} |
| 2 |
\usepackage{simplex} |
| 3 |
|
| 4 |
\usepackage{doc} |
| 5 |
\usepackage{hyperref} |
| 6 |
\usepackage{microtype} |
| 7 |
|
| 8 |
\newcommand{\env}[1]{\texttt{#1}} |
| 9 |
|
| 10 |
\title{The \textsf{simplex} package\\[4pt] |
| 11 |
\large Linguistic example environments for \LaTeX} |
| 12 |
\author{Kyle Gorman\\\small\texttt{[email protected]}} |
| 13 |
\date{Version 1.0} |
| 14 |
|
| 15 |
\EnableCrossrefs |
| 16 |
\CodelineIndex |
| 17 |
\RecordChanges |
| 18 |
|
| 19 |
\begin{document} |
| 20 |
\maketitle |
| 21 |
|
| 22 |
\begin{abstract} |
| 23 |
The \textsf{simplex} package provides three numbered example environments |
| 24 |
for use in linguistics papers---\env{unlabeledexample}, \env{shortexample}, |
| 25 |
and \env{example}---together with interlinear gloss macros (\cs{gll}, |
| 26 |
\cs{glll}, \cs{glt}, \cs{gln}, \cs{glend}) adapted from |
| 27 |
\textsf{covington.sty} and \textsf{gloss.tex}. |
| 28 |
\end{abstract} |
| 29 |
|
| 30 |
\tableofcontents |
| 31 |
|
| 32 |
\section{Introduction} |
| 33 |
|
| 34 |
Linguistics papers routinely include numbered examples, sometimes with |
| 35 |
descriptive labels, and frequently with word-by-word interlinear glosses |
| 36 |
paired with a free translation. The \textsf{simplex} package provides a |
| 37 |
minimal, self-contained set of macros for both tasks. |
| 38 |
|
| 39 |
The gloss alignment code is adapted from \textsf{gloss.tex} |
| 40 |
(v1.0, Marcel R.~van der Goot, 1991) and \textsf{covington.sty} |
| 41 |
(Michael Covington). The example counter environments are original. |
| 42 |
|
| 43 |
\section{Requirements} |
| 44 |
|
| 45 |
\textsf{simplex} requires \LaTeXe{} and automatically loads the |
| 46 |
\textsf{xparse} package (part of the standard \LaTeX{} distribution). |
| 47 |
|
| 48 |
\section{Numbered example environments} |
| 49 |
\label{sec:examples} |
| 50 |
|
| 51 |
All three environments share a single counter, \texttt{exampleno}, which |
| 52 |
increments automatically and is typeset as an Arabic numeral in |
| 53 |
parentheses, e.g.\ \textbf{(1)}, \textbf{(2)}, \ldots |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
\DescribeEnv{unlabeledexample} |
| 58 |
The \env{unlabeledexample} environment produces a numbered example with |
| 59 |
no label. It takes no arguments. |
| 60 |
|
| 61 |
\begin{verbatim} |
| 62 |
\begin{unlabeledexample} |
| 63 |
The cat sat on the mat. |
| 64 |
\end{unlabeledexample} |
| 65 |
\end{verbatim} |
| 66 |
|
| 67 |
\begin{unlabeledexample} |
| 68 |
The cat sat on the mat. |
| 69 |
\end{unlabeledexample} |
| 70 |
|
| 71 |
\DescribeEnv{shortexample} |
| 72 |
The \env{shortexample} environment produces a numbered example whose |
| 73 |
optional label appears on the \emph{same line} as the number. The label |
| 74 |
is given as an optional argument in square brackets. |
| 75 |
|
| 76 |
\begin{verbatim} |
| 77 |
\begin{shortexample}[Substance-freeness of structural change] |
| 78 |
Features changed by rule application need not be present in the rule's |
| 79 |
structural environment. |
| 80 |
\end{shortexample} |
| 81 |
\end{verbatim} |
| 82 |
|
| 83 |
\begin{shortexample}[\textsc{Substance-freeness of Structural Change}] |
| 84 |
Features changed by rule application need not be present in the rule's |
| 85 |
structural environment. |
| 86 |
\end{shortexample} |
| 87 |
|
| 88 |
\DescribeEnv{example} |
| 89 |
The \env{example} environment is like \env{shortexample} except that the |
| 90 |
label appears on a \emph{separate line} above the example content, |
| 91 |
separated by a small vertical skip. This is useful when the label is long |
| 92 |
or when the content is multi-line (such as a gloss block). |
| 93 |
|
| 94 |
\begin{verbatim} |
| 95 |
\begin{example}[Assibilating perfect passive participles and agents] |
| 96 |
\begin{tabular}[H]{llllll} |
| 97 |
metere & `reap' & messus & `harvested' & messor & `reaper' \\ |
| 98 |
fodere & `dig' & fossus & `dug' & fossor & `digger' \\ |
| 99 |
\end{tabular} |
| 100 |
\end{example} |
| 101 |
\end{verbatim} |
| 102 |
|
| 103 |
\begin{example}[Assibilating perfect passive participles and agents] |
| 104 |
\begin{tabular}[H]{llllll} |
| 105 |
metere & `reap' & messus & `harvested' & messor & `reaper' \\ |
| 106 |
fodere & `dig' & fossus & `dug' & fossor & `digger' \\ |
| 107 |
\end{tabular} |
| 108 |
\end{example} |
| 109 |
|
| 110 |
\subsection{Cross-referencing} |
| 111 |
|
| 112 |
All three environments call \cs{refstepcounter}, so standard |
| 113 |
\cs{label}/\cs{ref} cross-referencing works normally. |
| 114 |
|
| 115 |
\begin{verbatim} |
| 116 |
\begin{unlabeledexample} |
| 117 |
The cat sat on the mat. |
| 118 |
\label{ex:basic} |
| 119 |
\end{unlabeledexample} |
| 120 |
|
| 121 |
See~(\ref{ex:basic}). |
| 122 |
\end{verbatim} |
| 123 |
|
| 124 |
\section{Interlinear gloss macros} |
| 125 |
\label{sec:gloss} |
| 126 |
|
| 127 |
\textsf{simplex} provides macros for typesetting word-aligned interlinear |
| 128 |
glosses of the kind common in linguistic fieldwork and typological work. |
| 129 |
The macros accept two or three lines of space-separated tokens and stack |
| 130 |
them vertically, aligning each column. |
| 131 |
|
| 132 |
\subsection{Two- and three-line glosses: \texttt{\textbackslash gll} and \texttt{\textbackslash glll}} |
| 133 |
|
| 134 |
\DescribeMacro{\gll} |
| 135 |
\cs{gll} introduces a two-line gloss: a source-language line followed by |
| 136 |
a morpheme-gloss line. The two lines are separated by a literal newline |
| 137 |
(end of line) inside the macro argument; each line ends with \verb|\\|. |
| 138 |
After the two gloss lines, supply a translation with \cs{glt} (or |
| 139 |
\cs{gln} if no translation is needed), and optionally close with |
| 140 |
\cs{glend}. |
| 141 |
|
| 142 |
\DescribeMacro{\glll} |
| 143 |
\cs{glll} is like \cs{gll} but accepts three aligned lines (typically: |
| 144 |
source, morpheme gloss, and a second-tier gloss or transliteration). |
| 145 |
|
| 146 |
\begin{verbatim} |
| 147 |
\begin{example}[\textsc{Pre-Liquid Shortening} bled by external sandhi] |
| 148 |
\gll clāmōr=ad cael-um |
| 149 |
shout=to heaven-\textsc{acc.sg.} |
| 150 |
\glt `a shout to heaven' %(fragments of Ennius) |
| 151 |
% Omitted---no-op here. |
| 152 |
%\glend |
| 153 |
\end{example} |
| 154 |
\end{verbatim} |
| 155 |
|
| 156 |
\begin{example}[\textsc{Pre-Liquid Shortening} bled by external sandhi] |
| 157 |
\gll clāmōr=ad cael-um |
| 158 |
shout=to heaven-\textsc{acc.sg.} |
| 159 |
\glt `a shout to heaven' %(fragments of Ennius) |
| 160 |
% Omitted---no-op here. |
| 161 |
%\glend |
| 162 |
\end{example} |
| 163 |
|
| 164 |
\subsection{Translation and closing macros} |
| 165 |
|
| 166 |
\DescribeMacro{\glt} |
| 167 |
\cs{glt} closes the aligned gloss block and introduces a free |
| 168 |
translation. It must appear after the final gloss line even when no |
| 169 |
translation is needed (pass an empty line in that case). |
| 170 |
|
| 171 |
\DescribeMacro{\gln} |
| 172 |
\cs{gln} is an alternative to \cs{glt} for use when no translation is |
| 173 |
wanted at all; it closes the gloss block without adding a newline. |
| 174 |
|
| 175 |
\DescribeMacro{\glend} |
| 176 |
\cs{glend} is a semantic no-op provided for readability; it marks the |
| 177 |
end of a gloss block. |
| 178 |
|
| 179 |
\subsection{Customizing gloss fonts} |
| 180 |
|
| 181 |
Three token-list hooks control the font applied to each line: |
| 182 |
|
| 183 |
\begin{center} |
| 184 |
\begin{tabular}{ll} |
| 185 |
\cs{eachwordone} & font for the source line (default: \cs{rm})\\ |
| 186 |
\cs{eachwordtwo} & font for the first gloss line (default: \cs{rm})\\ |
| 187 |
\cs{eachwordthree} & font for the second gloss line (default: \cs{rm})\\ |
| 188 |
\end{tabular} |
| 189 |
\end{center} |
| 190 |
|
| 191 |
To italicize the source line, for example, add to your preamble: |
| 192 |
|
| 193 |
\begin{verbatim} |
| 194 |
\let\eachwordone=\it |
| 195 |
\end{verbatim} |
| 196 |
|
| 197 |
The inter-word spacing in gloss blocks is controlled by the skip register |
| 198 |
\cs{glossglue}, whose default value is \texttt{5pt plus 2pt minus 1pt}. |
| 199 |
|
| 200 |
\section{Known limitations} |
| 201 |
|
| 202 |
\begin{itemize} |
| 203 |
\item The \texttt{exampleno} counter is not reset at chapter boundaries. |
| 204 |
Users who want per-chapter numbering should add |
| 205 |
\verb|\@addtoreset{exampleno}{chapter}| to their preamble. |
| 206 |
\item \cs{gll} and \cs{glll} rely on active end-of-line characters and |
| 207 |
may behave unexpectedly inside certain environments or |
| 208 |
macro arguments. |
| 209 |
\item Long words without spaces will not be broken across lines. |
| 210 |
\end{itemize} |
| 211 |
|
| 212 |
\section{License} |
| 213 |
|
| 214 |
This package is copyright \copyright\ Kyle Gorman and is distributed |
| 215 |
under the \LaTeX{} Project Public License, version~1.3 or later |
| 216 |
(\url{http://www.latex-project.org/lppl.txt}). |
| 217 |
The gloss alignment code in \texttt{simplex.sty} was adapted from |
| 218 |
\textsf{gloss.tex} by Marcel R.~van der Goot (1991). |
| 219 |
Additional adaptations are derived from \textsf{covington.sty} by |
| 220 |
Michael Covington. |
| 221 |
|
| 222 |
\section{Version history} |
| 223 |
|
| 224 |
\begin{description} |
| 225 |
\item[v1.0 (2026/03/02)] Initial public release. |
| 226 |
\end{description} |
| 227 |
|
| 228 |
\end{document} |