| 1 |
\documentclass{article} |
| 2 |
%\usepackage{interlinear} |
| 3 |
\usepackage{xparse} |
| 4 |
\usepackage{verbatim} |
| 5 |
|
| 6 |
% Commande pour afficher du code (sans les délimiteurs `d```) |
| 7 |
\NewDocumentCommand{\code}{m}{\texttt{#1}} |
| 8 |
\def\interlinearstyle{$\backslash$interlinearstyle} |
| 9 |
|
| 10 |
% Commande pour du texte en gras |
| 11 |
\NewDocumentCommand{\bftext}{m}{\textbf{#1}} |
| 12 |
|
| 13 |
% Commande pour liste avec itemize |
| 14 |
\NewDocumentCommand{\itm}{m}{\begin{itemize}\item #1\end{itemize}} |
| 15 |
|
| 16 |
% Metadata |
| 17 |
\title{interlinear Package Documentation} |
| 18 |
\author{Akpoué Kouamé Josué} |
| 19 |
\date{\today} |
| 20 |
|
| 21 |
\begin{document} |
| 22 |
|
| 23 |
\maketitle |
| 24 |
|
| 25 |
\section{Package Description} |
| 26 |
\subsection{Purpose} |
| 27 |
The \code{interlinear} package provides a new interface for typesetting interlinear texts. It is based on \code{cgloss4e.sty} and is designed to avoid conflicts with other packages, such as \code{linguex}. This package allows for the simultaneous use of \code{linguex} and \code{interlinear} by renaming commands from \code{cgloss4e.sty} for better clarity and maintenance. The package is part of a larger set of tools to facilitate linguistic document preparation using LaTeX. |
| 28 |
|
| 29 |
\subsection{What's New} |
| 30 |
|
| 31 |
\itm{\bftext{Toolbox Integration:} Support for SIL Linguists Field's Toolbox input (with some modifications). You can copy-paste the interlinear text from Toolbox directly into LaTeX.} |
| 32 |
\itm{\bftext{Four-Line Option:} Adds support for a fourth line (Part of speech) in interlinear texts.} |
| 33 |
\itm{\bftext{Markers:} New markers are provided for various parts of the example, including \code{\textbackslash ct} (context), \code{\textbackslash li} (language information), \code{\textbackslash lt} (literal translation), and \code{\textbackslash gj} (grammaticality judgments).} |
| 34 |
\itm{\bftext{Environment:} Defines an \code{interlinear} environment with options for fine-grained control over element appearance.} |
| 35 |
|
| 36 |
\section{Installation and Loading} |
| 37 |
To install, place \code{interlinear.sty} in a directory where LaTeX can find it. Load the package using: |
| 38 |
\begin{verbatim} |
| 39 |
\usepackage{interlinear} |
| 40 |
\end{verbatim} |
| 41 |
Alternatively, use: |
| 42 |
\begin{verbatim} |
| 43 |
\input{path/to/interlinear.sty} |
| 44 |
\end{verbatim} |
| 45 |
|
| 46 |
%\subsection{Required Packages} |
| 47 |
|
| 48 |
To ensure the proper functioning of the \texttt{interlinear} package, the following LaTeX packages are required: |
| 49 |
|
| 50 |
\begin{itemize} |
| 51 |
\item \texttt{marginnote}: This package is used for creating margin notes in your document. |
| 52 |
\item \texttt{xifthen}: Provides conditional commands for handling various logic in the package. |
| 53 |
\item \texttt{xkeyval}: Used to implement key=value options for customizing the behavior of the \texttt{interlinear} environment. |
| 54 |
\item \texttt{xparse}: Facilitates the definition of commands and environments with a more flexible interface. |
| 55 |
\item \texttt{etoolbox}: Supplies advanced tools for programming within LaTeX, such as patching and extending existing commands. |
| 56 |
\item \texttt{enumitem}: Allows customization of list environments (like \texttt{itemize}, \texttt{enumerate}, etc.), which may be used within \texttt{interlinear}. |
| 57 |
\end{itemize} |
| 58 |
|
| 59 |
Ensure that these packages are included in your LaTeX distribution. |
| 60 |
|
| 61 |
\section{Basic Usage} |
| 62 |
The main feature of \code{interlinear} is the \code{interlinear} environment. This environment allows you to structure interlinear texts using markers. Below is a comparison between \code{cgloss4e} and \code{interlinear} syntax. |
| 63 |
|
| 64 |
\subsection{Example 1: Two-Line Interlinear} |
| 65 |
\textbf{cgloss4e} code: |
| 66 |
\begin{verbatim} |
| 67 |
\gll lorem ipsum dolor\\ |
| 68 |
sit amet consegur\\ |
| 69 |
\glt `Lorem ipsum dolor' |
| 70 |
\end{verbatim} |
| 71 |
|
| 72 |
\textbf{interlinear} code: |
| 73 |
\begin{verbatim} |
| 74 |
\begin{interlinear} |
| 75 |
\tx lorem ipsum dolor\\ |
| 76 |
\gl sit amet consegur\\ |
| 77 |
\ft `Lorem ipsum dolor'\\ |
| 78 |
\end{interlinear} |
| 79 |
\end{verbatim} |
| 80 |
|
| 81 |
\subsection{Example 2: Three-Line Interlinear} |
| 82 |
\textbf{cgloss4e} code: |
| 83 |
\begin{verbatim} |
| 84 |
\glll lorem ipsum\\ |
| 85 |
dolor sit\\ |
| 86 |
amet consegur\\ |
| 87 |
\glt `Lorem ipsum dolor' |
| 88 |
\end{verbatim} |
| 89 |
|
| 90 |
\textbf{interlinear} code: |
| 91 |
\begin{verbatim} |
| 92 |
\begin{interlinear} |
| 93 |
\tx lorem ipsum\\ |
| 94 |
\mb dolor sit\\ |
| 95 |
\gl amet consegur\\ |
| 96 |
\ft `Lorem ipsum dolor'\\ |
| 97 |
\end{interlinear} |
| 98 |
\end{verbatim} |
| 99 |
|
| 100 |
\subsection{Complete Example} |
| 101 |
\begin{verbatim} |
| 102 |
\begin{interlinear} |
| 103 |
\li Language\\ |
| 104 |
\rf Identifier of the data in the corpus/corpora\\ |
| 105 |
\ct Context\\ |
| 106 |
\gj Grammaticality judgment\\ |
| 107 |
\tx Object language text\\ |
| 108 |
\mb Morpheme breaks\\ |
| 109 |
\gl Glosses\\ |
| 110 |
\ps Part-of-speech\\ |
| 111 |
\ft Free translation\\ |
| 112 |
\lt Literal translation\\ |
| 113 |
\nt Extra note\\ |
| 114 |
\end{interlinear} |
| 115 |
\end{verbatim} |
| 116 |
|
| 117 |
\section{Setting Options} |
| 118 |
The \code{interlinear} environment can be customized using the options described below. |
| 119 |
|
| 120 |
\subsection{Interlinear Lines Number} |
| 121 |
The number of interlinear lines is controlled by the \code{linesnumber} option. Possible values are 0, 2, 3, 4 (default is 2). |
| 122 |
|
| 123 |
\subsection{Markers and Customization} |
| 124 |
You can define custom markers for each part of the interlinear text: |
| 125 |
\begin{verbatim} |
| 126 |
\li languageinfomarker |
| 127 |
\rf referencemarker |
| 128 |
\ct contextmarker |
| 129 |
\gj gramjudgmarker |
| 130 |
\tx textmarker |
| 131 |
\mb morphbreakmarker |
| 132 |
\gl glossmarker |
| 133 |
\ps partofspeechmarker |
| 134 |
\ft freetranslationmarker |
| 135 |
\lt literaltranslationmarker |
| 136 |
\nt extranotemarker |
| 137 |
\end{verbatim} |
| 138 |
|
| 139 |
\subsection{Appearance Customization} |
| 140 |
You can modify the appearance of different elements using the following options: |
| 141 |
\begin{verbatim} |
| 142 |
lineoneformat % First line format |
| 143 |
linetwoformat % Second line format |
| 144 |
linethreeformat % Third line format |
| 145 |
linefourformat % Fourth line format |
| 146 |
exformat % Example text format (no-interlinear mode) |
| 147 |
extranoteformat % Extra note format |
| 148 |
contextnameformat % Context label format |
| 149 |
\end{verbatim} |
| 150 |
|
| 151 |
These options can control the font family, shape, series, size, and color. To specify multiple formatting options, enclose them in a group. For example, the command \code{lineoneformat=\{$\backslash$itshape$\backslash$bfseries$\backslash$small\}} will set the text on the first interlinear or gloss line to boldface italics in a small size. By default, all formats are set to \code{$\backslash$normalfont}. |
| 152 |
|
| 153 |
\subsection{Other Settings} |
| 154 |
Various other elements can be customized: |
| 155 |
|
| 156 |
\itm{The label indicating the context of the example can be changed using the \code{contextname} option. For instance, to change \code{Context:} to \code{Situation:}, use \code{contextname={Situation:}}.} |
| 157 |
|
| 158 |
\itm{The space between the context and the body of the example can be specified via the \code{contextvoffset} option.} |
| 159 |
|
| 160 |
\itm{By default, marginal notes are enclosed in parentheses \code{()}. To change this behavior, use the \code{extranoteleftpunct} and \code{extranoterightpunct} options. For example, to change the parentheses to square brackets \code{[]}, set \code{extranoteleftpunct={[}} and \code{extranoterightpunct={]}}. If you prefer no punctuation marks around your notes, set \code{extranoteleftpunct={}} and \code{extranoterightpunct={}}.} |
| 161 |
|
| 162 |
\itm{The placement of language information for the linguistic example is controlled by the \code{languageinfopos} option, which accepts two values: \code{head} and \code{margin}. The default value, \code{margin}, places this information in parentheses in the margin of the first line of the example. The \code{head} value places it in a separate line at the very beginning of the example, even before the context. When the no-interlinear mode is enabled, \code{languageinfopos} should be set to \code{head} to avoid positioning conflicts with marginal notes.} |
| 163 |
|
| 164 |
\subsection{Applying Options Outside the Environment} |
| 165 |
Options can also be specified outside the \code{interlinear} environment using the \code{\interlinearstyle} command, which takes one mandatory argument. This argument should contain the list of chosen options, and \code{\interlinearstyle} must be called before the environment. |
| 166 |
|
| 167 |
For example: |
| 168 |
\begin{verbatim} |
| 169 |
\begin{interlinear}[linesnumber=3,linefourformat=\itshape] |
| 170 |
(content) |
| 171 |
\end{interlinear} |
| 172 |
\end{verbatim} |
| 173 |
|
| 174 |
is equivalent to: |
| 175 |
\begin{verbatim} |
| 176 |
\interlinearstyle{linesnumber=3,linefourformat=\itshape} |
| 177 |
\begin{interlinear} |
| 178 |
(content) |
| 179 |
\end{interlinear} |
| 180 |
\end{verbatim} |
| 181 |
|
| 182 |
The \code{$\backslash$interlinearstyle} command redefines the default values for the specified options. Therefore, each time this command is used, it updates the default values for the specified options. |
| 183 |
|
| 184 |
\subsection{Using Predefined and Custom Styles} |
| 185 |
One of the features of the \code{interlinear} package is the ability to define multiple styles and use them throughout the document without having to call \code{$\backslash$interlinearstyle} each time. There are four predefined styles: |
| 186 |
|
| 187 |
\begin{itemize} |
| 188 |
\item \code{default}: Standard settings. |
| 189 |
\item \code{gsr}: Sets the first interlinear line in italics. |
| 190 |
\item \code{nointerlinear}: Configures the no-interlinear mode, changes the \code{$\backslash$ft} marker to \code{$\backslash$ot}, and sets \code{languageinfopos} to \code{head}. This style provides a safe way to configure the no-interlinear mode without worrying about the various parameters. |
| 191 |
\item \code{gsrnointerlinear}: Similar to \code{nointerlinear}, but the text of the example is italicized. |
| 192 |
\end{itemize} |
| 193 |
|
| 194 |
There are two ways to apply a style: |
| 195 |
\begin{enumerate} |
| 196 |
\item Using the \code{$\backslash$UseInterlinearStyle\{\}} command before the \code{interlinear} environment, at the beginning of the document, or in the preamble. |
| 197 |
\item Using the dedicated \code{style} option in the optional argument of the \code{interlinear} environment. |
| 198 |
\end{enumerate} |
| 199 |
|
| 200 |
Example: \code{$\backslash$begin\{interlinear\}[style=gsr]}. |
| 201 |
|
| 202 |
It is recommended to specify the \code{style} option first when combining it with other options. |
| 203 |
|
| 204 |
You can also specify additional options alongside the style to customize it as needed (e.g., if you want to temporarily modify a style parameter). |
| 205 |
|
| 206 |
For example, the \code{gsr} style was declared using the following code: |
| 207 |
\begin{verbatim} |
| 208 |
\DeclareInterlinearStyle{gsr}{% |
| 209 |
linesnumber=2,% |
| 210 |
lineoneformat=\itshape,% |
| 211 |
linetwoformat=\normalfont% |
| 212 |
} |
| 213 |
\end{verbatim} |
| 214 |
|
| 215 |
\end{document} |