diff options
Diffstat (limited to 'macros/latex/contrib')
-rw-r--r-- | macros/latex/contrib/interlinear/DEPENDS.txt | 6 | ||||
-rw-r--r-- | macros/latex/contrib/interlinear/LICENSE.txt | 415 | ||||
-rw-r--r-- | macros/latex/contrib/interlinear/README.md | 89 | ||||
-rw-r--r-- | macros/latex/contrib/interlinear/VERSION_1_0 | 3 | ||||
-rw-r--r-- | macros/latex/contrib/interlinear/interlinear-doc.pdf | bin | 0 -> 118771 bytes | |||
-rw-r--r-- | macros/latex/contrib/interlinear/interlinear-doc.tex | 215 | ||||
-rw-r--r-- | macros/latex/contrib/interlinear/interlinear.sty | 1176 | ||||
-rw-r--r-- | macros/latex/contrib/tutodoc/code/tutodoc.sty | 4 | ||||
-rw-r--r-- | macros/latex/contrib/tutodoc/doc/tutodoc-en.pdf | bin | 713562 -> 714026 bytes | |||
-rw-r--r-- | macros/latex/contrib/tutodoc/doc/tutodoc-en.tex | 4 | ||||
-rw-r--r-- | macros/latex/contrib/tutodoc/doc/tutodoc-fr.pdf | bin | 748226 -> 748835 bytes | |||
-rw-r--r-- | macros/latex/contrib/tutodoc/doc/tutodoc-fr.tex | 4 |
12 files changed, 1910 insertions, 6 deletions
diff --git a/macros/latex/contrib/interlinear/DEPENDS.txt b/macros/latex/contrib/interlinear/DEPENDS.txt new file mode 100644 index 0000000000..e06d77ce7c --- /dev/null +++ b/macros/latex/contrib/interlinear/DEPENDS.txt @@ -0,0 +1,6 @@ +hard marginnote # for marginnotes +hard xifthen +hard xkeyval # For key=val options +hard xparse +hard etoolbox +hard enumitem diff --git a/macros/latex/contrib/interlinear/LICENSE.txt b/macros/latex/contrib/interlinear/LICENSE.txt new file mode 100644 index 0000000000..842cf85e3c --- /dev/null +++ b/macros/latex/contrib/interlinear/LICENSE.txt @@ -0,0 +1,415 @@ +The LaTeX Project Public License +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +LPPL Version 1.3c 2008-05-04 + +Copyright 1999 2002-2008 LaTeX3 Project + Everyone is allowed to distribute verbatim copies of this + license document, but modification of it is not allowed. + + +PREAMBLE +======== + +The LaTeX Project Public License (LPPL) is the primary license under +which the LaTeX kernel and the base LaTeX packages are distributed. + +You may use this license for any work of which you hold the copyright +and which you wish to distribute. This license may be particularly +suitable if your work is TeX-related (such as a LaTeX package), but +it is written in such a way that you can use it even if your work is +unrelated to TeX. + +The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', +below, gives instructions, examples, and recommendations for authors +who are considering distributing their works under this license. + +This license gives conditions under which a work may be distributed +and modified, as well as conditions under which modified versions of +that work may be distributed. + +We, the LaTeX3 Project, believe that the conditions below give you +the freedom to make and distribute modified versions of your work +that conform with whatever technical specifications you wish while +maintaining the availability, integrity, and reliability of +that work. If you do not see how to achieve your goal while +meeting these conditions, then read the document `cfgguide.tex' +and `modguide.tex' in the base LaTeX distribution for suggestions. + + +DEFINITIONS +=========== + +In this license document the following terms are used: + + `Work' + Any work being distributed under this License. + + `Derived Work' + Any work that under any applicable law is derived from the Work. + + `Modification' + Any procedure that produces a Derived Work under any applicable + law -- for example, the production of a file containing an + original file associated with the Work or a significant portion of + such a file, either verbatim or with modifications and/or + translated into another language. + + `Modify' + To apply any procedure that produces a Derived Work under any + applicable law. + + `Distribution' + Making copies of the Work available from one person to another, in + whole or in part. Distribution includes (but is not limited to) + making any electronic components of the Work accessible by + file transfer protocols such as FTP or HTTP or by shared file + systems such as Sun's Network File System (NFS). + + `Compiled Work' + A version of the Work that has been processed into a form where it + is directly usable on a computer system. This processing may + include using installation facilities provided by the Work, + transformations of the Work, copying of components of the Work, or + other activities. Note that modification of any installation + facilities provided by the Work constitutes modification of the Work. + + `Current Maintainer' + A person or persons nominated as such within the Work. If there is + no such explicit nomination then it is the `Copyright Holder' under + any applicable law. + + `Base Interpreter' + A program or process that is normally needed for running or + interpreting a part or the whole of the Work. + + A Base Interpreter may depend on external components but these + are not considered part of the Base Interpreter provided that each + external component clearly identifies itself whenever it is used + interactively. Unless explicitly specified when applying the + license to the Work, the only applicable Base Interpreter is a + `LaTeX-Format' or in the case of files belonging to the + `LaTeX-format' a program implementing the `TeX language'. + + + +CONDITIONS ON DISTRIBUTION AND MODIFICATION +=========================================== + +1. Activities other than distribution and/or modification of the Work +are not covered by this license; they are outside its scope. In +particular, the act of running the Work is not restricted and no +requirements are made concerning any offers of support for the Work. + +2. You may distribute a complete, unmodified copy of the Work as you +received it. Distribution of only part of the Work is considered +modification of the Work, and no right to distribute such a Derived +Work may be assumed under the terms of this clause. + +3. You may distribute a Compiled Work that has been generated from a +complete, unmodified copy of the Work as distributed under Clause 2 +above, as long as that Compiled Work is distributed in such a way that +the recipients may install the Compiled Work on their system exactly +as it would have been installed if they generated a Compiled Work +directly from the Work. + +4. If you are the Current Maintainer of the Work, you may, without +restriction, modify the Work, thus creating a Derived Work. You may +also distribute the Derived Work without restriction, including +Compiled Works generated from the Derived Work. Derived Works +distributed in this manner by the Current Maintainer are considered to +be updated versions of the Work. + +5. If you are not the Current Maintainer of the Work, you may modify +your copy of the Work, thus creating a Derived Work based on the Work, +and compile this Derived Work, thus creating a Compiled Work based on +the Derived Work. + +6. If you are not the Current Maintainer of the Work, you may +distribute a Derived Work provided the following conditions are met +for every component of the Work unless that component clearly states +in the copyright notice that it is exempt from that condition. Only +the Current Maintainer is allowed to add such statements of exemption +to a component of the Work. + + a. If a component of this Derived Work can be a direct replacement + for a component of the Work when that component is used with the + Base Interpreter, then, wherever this component of the Work + identifies itself to the user when used interactively with that + Base Interpreter, the replacement component of this Derived Work + clearly and unambiguously identifies itself as a modified version + of this component to the user when used interactively with that + Base Interpreter. + + b. Every component of the Derived Work contains prominent notices + detailing the nature of the changes to that component, or a + prominent reference to another file that is distributed as part + of the Derived Work and that contains a complete and accurate log + of the changes. + + c. No information in the Derived Work implies that any persons, + including (but not limited to) the authors of the original version + of the Work, provide any support, including (but not limited to) + the reporting and handling of errors, to recipients of the + Derived Work unless those persons have stated explicitly that + they do provide such support for the Derived Work. + + d. You distribute at least one of the following with the Derived Work: + + 1. A complete, unmodified copy of the Work; + if your distribution of a modified component is made by + offering access to copy the modified component from a + designated place, then offering equivalent access to copy + the Work from the same or some similar place meets this + condition, even though third parties are not compelled to + copy the Work along with the modified component; + + 2. Information that is sufficient to obtain a complete, + unmodified copy of the Work. + +7. If you are not the Current Maintainer of the Work, you may +distribute a Compiled Work generated from a Derived Work, as long as +the Derived Work is distributed to all recipients of the Compiled +Work, and as long as the conditions of Clause 6, above, are met with +regard to the Derived Work. + +8. The conditions above are not intended to prohibit, and hence do not +apply to, the modification, by any method, of any component so that it +becomes identical to an updated version of that component of the Work as +it is distributed by the Current Maintainer under Clause 4, above. + +9. Distribution of the Work or any Derived Work in an alternative +format, where the Work or that Derived Work (in whole or in part) is +then produced by applying some process to that format, does not relax or +nullify any sections of this license as they pertain to the results of +applying that process. + +10. a. A Derived Work may be distributed under a different license + provided that license itself honors the conditions listed in + Clause 6 above, in regard to the Work, though it does not have + to honor the rest of the conditions in this license. + + b. If a Derived Work is distributed under a different license, that + Derived Work must provide sufficient documentation as part of + itself to allow each recipient of that Derived Work to honor the + restrictions in Clause 6 above, concerning changes from the Work. + +11. This license places no restrictions on works that are unrelated to +the Work, nor does this license place any restrictions on aggregating +such works with the Work by any means. + +12. Nothing in this license is intended to, or may be used to, prevent +complete compliance by all parties with all applicable laws. + + +NO WARRANTY +=========== + +There is no warranty for the Work. Except when otherwise stated in +writing, the Copyright Holder provides the Work `as is', without +warranty of any kind, either expressed or implied, including, but not +limited to, the implied warranties of merchantability and fitness for a +particular purpose. The entire risk as to the quality and performance +of the Work is with you. Should the Work prove defective, you assume +the cost of all necessary servicing, repair, or correction. + +In no event unless required by applicable law or agreed to in writing +will The Copyright Holder, or any author named in the components of the +Work, or any other party who may distribute and/or modify the Work as +permitted above, be liable to you for damages, including any general, +special, incidental or consequential damages arising out of any use of +the Work or out of inability to use the Work (including, but not limited +to, loss of data, data being rendered inaccurate, or losses sustained by +anyone as a result of any failure of the Work to operate with any other +programs), even if the Copyright Holder or said author or said other +party has been advised of the possibility of such damages. + + +MAINTENANCE OF THE WORK +======================= + +The Work has the status `author-maintained' if the Copyright Holder +explicitly and prominently states near the primary copyright notice in +the Work that the Work can only be maintained by the Copyright Holder +or simply that it is `author-maintained'. + +The Work has the status `maintained' if there is a Current Maintainer +who has indicated in the Work that they are willing to receive error +reports for the Work (for example, by supplying a valid e-mail +address). It is not required for the Current Maintainer to acknowledge +or act upon these error reports. + +The Work changes from status `maintained' to `unmaintained' if there +is no Current Maintainer, or the person stated to be Current +Maintainer of the work cannot be reached through the indicated means +of communication for a period of six months, and there are no other +significant signs of active maintenance. + +You can become the Current Maintainer of the Work by agreement with +any existing Current Maintainer to take over this role. + +If the Work is unmaintained, you can become the Current Maintainer of +the Work through the following steps: + + 1. Make a reasonable attempt to trace the Current Maintainer (and + the Copyright Holder, if the two differ) through the means of + an Internet or similar search. + + 2. If this search is successful, then enquire whether the Work + is still maintained. + + a. If it is being maintained, then ask the Current Maintainer + to update their communication data within one month. + + b. If the search is unsuccessful or no action to resume active + maintenance is taken by the Current Maintainer, then announce + within the pertinent community your intention to take over + maintenance. (If the Work is a LaTeX work, this could be + done, for example, by posting to comp.text.tex.) + + 3a. If the Current Maintainer is reachable and agrees to pass + maintenance of the Work to you, then this takes effect + immediately upon announcement. + + b. If the Current Maintainer is not reachable and the Copyright + Holder agrees that maintenance of the Work be passed to you, + then this takes effect immediately upon announcement. + + 4. If you make an `intention announcement' as described in 2b. above + and after three months your intention is challenged neither by + the Current Maintainer nor by the Copyright Holder nor by other + people, then you may arrange for the Work to be changed so as + to name you as the (new) Current Maintainer. + + 5. If the previously unreachable Current Maintainer becomes + reachable once more within three months of a change completed + under the terms of 3b) or 4), then that Current Maintainer must + become or remain the Current Maintainer upon request provided + they then update their communication data within one month. + +A change in the Current Maintainer does not, of itself, alter the fact +that the Work is distributed under the LPPL license. + +If you become the Current Maintainer of the Work, you should +immediately provide, within the Work, a prominent and unambiguous +statement of your status as Current Maintainer. You should also +announce your new status to the same pertinent community as +in 2b) above. + + +WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE +====================================================== + +This section contains important instructions, examples, and +recommendations for authors who are considering distributing their +works under this license. These authors are addressed as `you' in +this section. + +Choosing This License or Another License +---------------------------------------- + +If for any part of your work you want or need to use *distribution* +conditions that differ significantly from those in this license, then +do not refer to this license anywhere in your work but, instead, +distribute your work under a different license. You may use the text +of this license as a model for your own license, but your license +should not refer to the LPPL or otherwise give the impression that +your work is distributed under the LPPL. + +The document `modguide.tex' in the base LaTeX distribution explains +the motivation behind the conditions of this license. It explains, +for example, why distributing LaTeX under the GNU General Public +License (GPL) was considered inappropriate. Even if your work is +unrelated to LaTeX, the discussion in `modguide.tex' may still be +relevant, and authors intending to distribute their works under any +license are encouraged to read it. + +A Recommendation on Modification Without Distribution +----------------------------------------------------- + +It is wise never to modify a component of the Work, even for your own +personal use, without also meeting the above conditions for +distributing the modified component. While you might intend that such +modifications will never be distributed, often this will happen by +accident -- you may forget that you have modified that component; or +it may not occur to you when allowing others to access the modified +version that you are thus distributing it and violating the conditions +of this license in ways that could have legal implications and, worse, +cause problems for the community. It is therefore usually in your +best interest to keep your copy of the Work identical with the public +one. Many works provide ways to control the behavior of that work +without altering any of its licensed components. + +How to Use This License +----------------------- + +To use this license, place in each of the components of your work both +an explicit copyright notice including your name and the year the work +was authored and/or last substantially modified. Include also a +statement that the distribution and/or modification of that +component is constrained by the conditions in this license. + +Here is an example of such a notice and statement: + + %% pig.dtx + %% Copyright 2008 M. Y. Name + % + % This work may be distributed and/or modified under the + % conditions of the LaTeX Project Public License, either version 1.3 + % of this license or (at your option) any later version. + % The latest version of this license is in + % https://www.latex-project.org/lppl.txt + % and version 1.3c or later is part of all distributions of LaTeX + % version 2008 or later. + % + % This work has the LPPL maintenance status `maintained'. + % + % The Current Maintainer of this work is M. Y. Name. + % + % This work consists of the files pig.dtx and pig.ins + % and the derived file pig.sty. + +Given such a notice and statement in a file, the conditions +given in this license document would apply, with the `Work' referring +to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being +generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' +referring to any `LaTeX-Format', and both `Copyright Holder' and +`Current Maintainer' referring to the person `M. Y. Name'. + +If you do not want the Maintenance section of LPPL to apply to your +Work, change `maintained' above into `author-maintained'. +However, we recommend that you use `maintained', as the Maintenance +section was added in order to ensure that your Work remains useful to +the community even when you can no longer maintain and support it +yourself. + +Derived Works That Are Not Replacements +--------------------------------------- + +Several clauses of the LPPL specify means to provide reliability and +stability for the user community. They therefore concern themselves +with the case that a Derived Work is intended to be used as a +(compatible or incompatible) replacement of the original Work. If +this is not the case (e.g., if a few lines of code are reused for a +completely different task), then clauses 6b and 6d shall not apply. + + +Important Recommendations +------------------------- + + Defining What Constitutes the Work + + The LPPL requires that distributions of the Work contain all the + files of the Work. It is therefore important that you provide a + way for the licensee to determine which files constitute the Work. + This could, for example, be achieved by explicitly listing all the + files of the Work near the copyright notice of each file or by + using a line such as: + + % This work consists of all files listed in manifest.txt. + + in that place. In the absence of an unequivocal list it might be + impossible for the licensee to determine what is considered by you + to comprise the Work and, in such a case, the licensee would be + entitled to make reasonable conjectures as to which files comprise + the Work. diff --git a/macros/latex/contrib/interlinear/README.md b/macros/latex/contrib/interlinear/README.md new file mode 100644 index 0000000000..1a13cca806 --- /dev/null +++ b/macros/latex/contrib/interlinear/README.md @@ -0,0 +1,89 @@ +# Interlinear + +## Overview + +**Interlinear** is a LaTeX package designed to facilitate the typesetting of interlinear glossed text, commonly used in linguistic examples. This package provides customizable formatting for interlinear text, allows for the specification of multiple lines with different formatting, and includes options for managing the presentation of context and language information. + +The package also supports predefined styles for common use cases, such as glossing text in italics or setting up non-interlinear modes, making it versatile for a variety of linguistic documentation needs. + +## Installation + +To install this package, follow these steps: + +1. **Manual Installation:** + - Download the package files. + - Place the `interlinear.sty` file in your LaTeX working directory or a directory that is part of your LaTeX path. + +2. **Required Packages:** + - marginnote : for marginnotes + - xifthen + - xkeyval : For key=val options + - xparse + - etoolbox + - enumitem + +3. **Using a LaTeX Distribution:** + - If the package is included in a LaTeX distribution like TeX Live or MikTeX, you can install it using the distribution's package manager. + - Example (for TeX Live users on Linux): + ```bash + sudo tlmgr install interlinear + ``` + - Example (for MikTeX users on Windows): + ```bash + miktex-console + ``` + +## Usage + +After installation, you can use **Interlinear** in your LaTeX documents by adding the following line in the preamble of your document: + +```latex +\usepackage{interlinear} +``` + +## Basic Example + +Here’s a basic usage example: + +```latex +\documentclass{article} +\usepackage{interlinear} + +\begin{document} + +\begin{interlinear}[linesnumber=3,linefourformat=\itshape] +% Interlinear content here +\end{interlinear} + +\end{document} +``` + +## License + +This work (this version and later ones) may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), version 1.3c or later. + +The latest version of this license is available at: [LaTeX Project Public License](https://www.latex-project.org/lppl/) + +This package is maintained (as per LPPL maintenance status) by **Kouamé Josué Akpoué**. + +## Contributing + +If you would like to contribute to the development of this package, you can do so by: + +- Reporting bugs or suggesting features via the issue tracker. +- Submitting pull requests with improvements or bug fixes. + +## Contact Information + +For any inquiries or support requests, please contact: + +**Kouamé Josué Akpoué** +**Email:** [josueakpoue@gmail.com](mailto: josueakpoue@gmail.com) +**GitHub:** [https://github.com/dbjoshua](https://github.com/dbjoshua) + +## Changelog + +### Version 1.0.0 (2024-08-22) + +- Initial release. +- Key features include customizable formatting for interlinear text, predefined styles, and margin note customization. diff --git a/macros/latex/contrib/interlinear/VERSION_1_0 b/macros/latex/contrib/interlinear/VERSION_1_0 new file mode 100644 index 0000000000..f27673edf3 --- /dev/null +++ b/macros/latex/contrib/interlinear/VERSION_1_0 @@ -0,0 +1,3 @@ +version 1.0 +- initial release +- main functionalities: interlinear environnement supporting SIL Field's Linguists Toolbox's markers; supporting optional customization and defined styles. Also supports four-lines interlinear gloss texts. diff --git a/macros/latex/contrib/interlinear/interlinear-doc.pdf b/macros/latex/contrib/interlinear/interlinear-doc.pdf Binary files differnew file mode 100644 index 0000000000..ab72182639 --- /dev/null +++ b/macros/latex/contrib/interlinear/interlinear-doc.pdf diff --git a/macros/latex/contrib/interlinear/interlinear-doc.tex b/macros/latex/contrib/interlinear/interlinear-doc.tex new file mode 100644 index 0000000000..f16f120754 --- /dev/null +++ b/macros/latex/contrib/interlinear/interlinear-doc.tex @@ -0,0 +1,215 @@ +\documentclass{article} +%\usepackage{interlinear} +\usepackage{xparse} +\usepackage{verbatim} + +% Commande pour afficher du code (sans les délimiteurs `d```) +\NewDocumentCommand{\code}{m}{\texttt{#1}} +\def\interlinearstyle{$\backslash$interlinearstyle} + +% Commande pour du texte en gras +\NewDocumentCommand{\bftext}{m}{\textbf{#1}} + +% Commande pour liste avec itemize +\NewDocumentCommand{\itm}{m}{\begin{itemize}\item #1\end{itemize}} + +% Metadata +\title{interlinear Package Documentation} +\author{Akpoué Kouamé Josué} +\date{\today} + +\begin{document} + +\maketitle + +\section{Package Description} +\subsection{Purpose} +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. + +\subsection{What's New} + +\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.} +\itm{\bftext{Four-Line Option:} Adds support for a fourth line (Part of speech) in interlinear texts.} +\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).} +\itm{\bftext{Environment:} Defines an \code{interlinear} environment with options for fine-grained control over element appearance.} + +\section{Installation and Loading} +To install, place \code{interlinear.sty} in a directory where LaTeX can find it. Load the package using: +\begin{verbatim} +\usepackage{interlinear} +\end{verbatim} +Alternatively, use: +\begin{verbatim} +\input{path/to/interlinear.sty} +\end{verbatim} + +%\subsection{Required Packages} + +To ensure the proper functioning of the \texttt{interlinear} package, the following LaTeX packages are required: + +\begin{itemize} + \item \texttt{marginnote}: This package is used for creating margin notes in your document. + \item \texttt{xifthen}: Provides conditional commands for handling various logic in the package. + \item \texttt{xkeyval}: Used to implement key=value options for customizing the behavior of the \texttt{interlinear} environment. + \item \texttt{xparse}: Facilitates the definition of commands and environments with a more flexible interface. + \item \texttt{etoolbox}: Supplies advanced tools for programming within LaTeX, such as patching and extending existing commands. + \item \texttt{enumitem}: Allows customization of list environments (like \texttt{itemize}, \texttt{enumerate}, etc.), which may be used within \texttt{interlinear}. +\end{itemize} + +Ensure that these packages are included in your LaTeX distribution. + +\section{Basic Usage} +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. + +\subsection{Example 1: Two-Line Interlinear} +\textbf{cgloss4e} code: +\begin{verbatim} +\gll lorem ipsum dolor\\ + sit amet consegur\\ +\glt `Lorem ipsum dolor' +\end{verbatim} + +\textbf{interlinear} code: +\begin{verbatim} +\begin{interlinear} +\tx lorem ipsum dolor\\ +\gl sit amet consegur\\ +\ft `Lorem ipsum dolor'\\ +\end{interlinear} +\end{verbatim} + +\subsection{Example 2: Three-Line Interlinear} +\textbf{cgloss4e} code: +\begin{verbatim} +\glll lorem ipsum\\ + dolor sit\\ + amet consegur\\ +\glt `Lorem ipsum dolor' +\end{verbatim} + +\textbf{interlinear} code: +\begin{verbatim} +\begin{interlinear} +\tx lorem ipsum\\ +\mb dolor sit\\ +\gl amet consegur\\ +\ft `Lorem ipsum dolor'\\ +\end{interlinear} +\end{verbatim} + +\subsection{Complete Example} +\begin{verbatim} +\begin{interlinear} +\li Language\\ +\rf Identifier of the data in the corpus/corpora\\ +\ct Context\\ +\gj Grammaticality judgment\\ +\tx Object language text\\ +\mb Morpheme breaks\\ +\gl Glosses\\ +\ps Part-of-speech\\ +\ft Free translation\\ +\lt Literal translation\\ +\nt Extra note\\ +\end{interlinear} +\end{verbatim} + +\section{Setting Options} +The \code{interlinear} environment can be customized using the options described below. + +\subsection{Interlinear Lines Number} +The number of interlinear lines is controlled by the \code{linesnumber} option. Possible values are 0, 2, 3, 4 (default is 2). + +\subsection{Markers and Customization} +You can define custom markers for each part of the interlinear text: +\begin{verbatim} +\li languageinfomarker +\rf referencemarker +\ct contextmarker +\gj gramjudgmarker +\tx textmarker +\mb morphbreakmarker +\gl glossmarker +\ps partofspeechmarker +\ft freetranslationmarker +\lt literaltranslationmarker +\nt extranotemarker +\end{verbatim} + +\subsection{Appearance Customization} +You can modify the appearance of different elements using the following options: +\begin{verbatim} +lineoneformat % First line format +linetwoformat % Second line format +linethreeformat % Third line format +linefourformat % Fourth line format +exformat % Example text format (no-interlinear mode) +extranoteformat % Extra note format +contextnameformat % Context label format +\end{verbatim} + +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}. + +\subsection{Other Settings} +Various other elements can be customized: + +\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:}}.} + +\itm{The space between the context and the body of the example can be specified via the \code{contextvoffset} option.} + +\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={}}.} + +\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.} + +\subsection{Applying Options Outside the Environment} +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. + +For example: +\begin{verbatim} +\begin{interlinear}[linesnumber=3,linefourformat=\itshape] +(content) +\end{interlinear} +\end{verbatim} + +is equivalent to: +\begin{verbatim} +\interlinearstyle{linesnumber=3,linefourformat=\itshape} +\begin{interlinear} +(content) +\end{interlinear} +\end{verbatim} + +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. + +\subsection{Using Predefined and Custom Styles} +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: + +\begin{itemize} + \item \code{default}: Standard settings. + \item \code{gsr}: Sets the first interlinear line in italics. + \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. + \item \code{gsrnointerlinear}: Similar to \code{nointerlinear}, but the text of the example is italicized. +\end{itemize} + +There are two ways to apply a style: +\begin{enumerate} +\item Using the \code{$\backslash$UseInterlinearStyle\{\}} command before the \code{interlinear} environment, at the beginning of the document, or in the preamble. +\item Using the dedicated \code{style} option in the optional argument of the \code{interlinear} environment. +\end{enumerate} + +Example: \code{$\backslash$begin\{interlinear\}[style=gsr]}. + +It is recommended to specify the \code{style} option first when combining it with other options. + +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). + +For example, the \code{gsr} style was declared using the following code: +\begin{verbatim} +\DeclareInterlinearStyle{gsr}{% + linesnumber=2,% + lineoneformat=\itshape,% + linetwoformat=\normalfont% +} +\end{verbatim} + +\end{document} diff --git a/macros/latex/contrib/interlinear/interlinear.sty b/macros/latex/contrib/interlinear/interlinear.sty new file mode 100644 index 0000000000..dd881b83db --- /dev/null +++ b/macros/latex/contrib/interlinear/interlinear.sty @@ -0,0 +1,1176 @@ +% ^package_name="lingwrit-interlinear"_version="1.0"_container="lingwrit" +% ^markup-language="WRIML" +% ^purpose +% This package processes interlinear gloss text, providing tools for handling and formatting glosses in linguistic documents. +% It is based on the cgloss4e.sty package, but with significant modifications to avoid conflicts with other packages and to extend functionality. +% As part of the lingwrit package, lingwrit-interlinear should not be loaded alongside it. +% _purpose +% ^base-program cgloss4e.sty _base-program + +% ^rem General Information +% ^- lingwrit-interlinear is a modified version of cgloss4e.sty _- +% ^- It primarily renames commands according to a customized syntax to prevent conflicts with other similar packages. _- +% ^- Additional modifications include new commands and a new interlinear environment. _- +% ^- Code added to the original has been marked with % ^added and % _added _- +% _rem + +% ^module_name="interlinear"_container="lingwrit" +% ^desc +% This module is a modified version of the cgloss4e.sty. +% +% Modifications include: +% - Command renaming: Commands have been renamed to avoid potential conflicts with other packages using similar names. +% - Commands for processing four-lines interlinearization +% - interlinear environment with its options +% - markup commands and other functionalities +% +% Below is the list of new command names and their counterparts in cgloss: + +% ^list +% ^cat Functions _cat + +% \more ^_becomes \lw_iln_process:words_queue +% \lastword ^_becomes \lw_iln_fun_get:last_word +% \testdone ^_becomes \lw_iln_check:queue_emptyness +% \getwords ^_becomes \lw_iln_fun_get:line_words +% \donewords ^_becomes \lw_iln_fun_exit:word_extraction +% \twosent ^_becomes \lw_iln_fun_align:two_lines_words +% \threesent ^_becomes \lw_iln_fun_align:three_lines_words +% \glossglue ^_becomes \lw_iln_glue:inter_word_space +% \gll ^_becomes \lw_iln_fun_enter:two_lines_interlinearization +% \glll ^_becomes \lw_iln_fun_enter:three_lines_interlinearization +% \glt ^_becomes \lw_iln_fun_insert:free_translation +% \glend ^_becomes \lw_iln_fun_exit:interlinearization +% \gl@stop ^_becomes \lw_iln_fun_exit:words_alignment + +% ^cat Boxes variables _cat + +% \lineone ^_becomes \lw_iln_var_box:line_one +% \linetwo ^_becomes \lw_iln_var_box:line_two +% \linethree ^_becomes \lw_iln_var_box:line_three +% \linefour ^_becomes \lw_iln_var_box:line_four +% \wordone ^_becomes \lw_iln_var_box:word_one +% \wordtwo ^_becomes \lw_iln_var_box:word_two +% \wordthree ^_becomes \lw_iln_var_box:word_three +% \wordfour ^_becomes \lw_iln_var_box:word_four +% \gline ^_becomes \lw_iln_var_box:iln_text_lines + +% ^cat Setting Appearence _cat + +% \eachwordone ^_becomes \lw_iln_fun_set:line_one_words_format +% \eachwordtwo ^_becomes \lw_iln_fun_set:line_two_words_format +% \eachwordthree ^_becomes \lw_iln_fun_set:line_three_words_format +% \eachwordfour ^_becomes \lw_iln_fun_set:line_four_words_format +% _list + +% The naming of the commands follows the following schema: + +% \<container>_<package>_<type>_<subtype>:<name/description> + +% <container> code is: lw (for lingwrit) +% <package> code is: iln (for interlinear) +% <type> code includes: "var" (for variables) and "fun" (for functions) + +% Variable Subtypes +% box: for boxes + +% Function Subtypes +% enter: initialize a process +% exit: terminates a process +% get: extract information +% check: test if some condition is met +% insert: inserts some stuff (i.e. the translation) +% process: process given elements +% calc: calculates the value of some variable +% set: sets (manually) the values of some variable +% _desc + +% ^code +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{lingwrit-interlinear}[2024/08/22 v1.0 (Linguistic Writing) Interlinear gloss text processing] + +% todo Required Packages +\RequirePackage{marginnote} % ^rem for marginnotes _rem +\RequirePackage{xifthen} +\RequirePackage{xkeyval} % ^rem For key=val options +\RequirePackage{xparse,etoolbox,enumitem} + +% todo 0. Utilities + +% todo a. LW Syntax Related Commands +% Shortcut for some conditional statements +\DeclareDocumentCommand{\IfValueArgTF}{mmmm}{\ifthenelse{\equal{#1}{#2}}{#3}{#4}} +% Enabling the package syntax +\providecommand{\switchlwsyntaxon}{\makeatletter\catcode `:=11 \catcode `_=11} +\providecommand{\switchlwsyntaxoff}{\makeatother \catcode `:=12 \catcode `_=8} +% if you want to modify some internal commands, check if your code is +% surrounded by \switchlwsyntaxon and \switchlwsyntaxoff (LW Syntax enables "@", ":" and "_" to be used in csnames. So you need not using \makeatletter and \makeatother when you are using lwsyntax)) + + +% ^action_name="Enabling LingWrit Syntax" +\switchlwsyntaxon +% _action + +% todo b. Renaming of some TeX primitives +\let\enter:group\bgroup\relax +\let\exit:group\egroup\relax + +% todo c. Defining some helpers +\def\lw_fun_helper:store#1{\expandafter\let\csname call:stored_#1\endcsname\expandafter\csname #1\endcsname} +\def\lw_fun_helper:call#1{#1} +\def\lw_fun_helper:clear#1{\RenewDocumentCommand{#1}{}{\relax}}% + +% todo d. Usefull Commands That are not used +% The following commands are not used actually but may be usefull in some contexts +% Fixing bugs with setspace package +% If you encounter an error message using \singlespacing, \onehalfspacing or \doublespacing, use either of the following commands, according to your needs. + +\def\usedoublespacing{\lw_fun_helper:store{doublespacing} + \renewcommand\doublespacing{% + \call:stored_doublespacing% + \def\baselinestretch{1.69}}% +} +% +\def\useonehalfspacing{% + \lw_fun_helper:store{onehalfspacing} + \renewcommand\onehalfspacing{% + \call:stored_onehalfspacing% + \def\baselinestretch{1.24}}% + } +\def\usesinglespacing{% + \lw_fun_helper:store{singlespacing} + \renewcommand\singlespacing{% + \call:stored_singlespacing% + \def\baselinestretch{1}}% + } + +% Line Stretch Size Calculator + +% Enable LW Syntax +%\switchlwsyntaxon +%\newcounter{currentsize} +%\setcounter{currentsize}{10} +%\addtocounter{currentsize}{\@ptsize} +%\newlength{\lw_iln_length:line_stretch_size} +%\setlength{\lw_iln_length:line_stretch_size}{\dimexpr\baselinestretch pt * \thecurrentsize} +%Current size: \thecurrentsize +%Current interline size: +%\the\lw_iln_length:line_stretch_size +% Disable LW Syntax +% \switchlwsyntaxoff + +% todo enter:cgloss4e modifications * + +% todo 1. Borrowings from covington + +% Forcing and disabling single spacing +\let\@gsingle=1 +\def\lw_iln_fun_enable:force_single_spacing{\let\@gsingle=1} +\def\lw_iln_fun_disable:force_single_spacing{\let\@gsingle=0} +\@ifundefined{new@fontshape}% +{\def\@selfnt{\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi}} +{\def\@selfnt{\selectfont}} + +% todo a. 2-lines global interlinearization processing commands +% ^modif_action="\begin{flushleft} removed" +% ^rem inspired by Alexis Dimitriadis cgloss.sty _rem + +\def\lw_iln_fun_enter:two_lines_interlinearization% % Introduces 2-line text-and-gloss. +{%\begin{flushleft} + \ifx\@gsingle1% conditionally force single spacing (hpk/MC) + \vskip\baselineskip\def\baselinestretch{1}% + \@selfnt\vskip-\baselineskip\fi% + \enter:group% + \lw_iln_fun_align:two_lines_words% + } +% _modif + +% todo b. 3-lines global interlinearization processing commands +% ^modif_action="\begin{flushleft} removed" +% ^rem inspired by Alexis Dimitriadis cgloss.sty _rem + \def\lw_iln_fun_enter:three_lines_interlinearization% % Introduces 3-line text-and-gloss. + {%\begin{flushleft} + \ifx\@gsingle1% conditionally force single spacing (hpk/MC) + \vskip\baselineskip\def\baselinestretch{1}% + \@selfnt\vskip-\baselineskip\fi% + \enter:group + \lw_iln_fun_align:three_lines_words + } +% _modif + +% todo c. 4-lines global interlinearization processing commands +% ^added_action="\lw_iln_fun_enter:four_lines_interlinearization defined for initiating 4-lines interlinearization" + % ^rem inspired by Alexis Dimitriadis cgloss.sty _rem + \def\lw_iln_fun_enter:four_lines_interlinearization% % Introduces 3-line text-and-gloss. + {%\begin{flushleft} + \ifx\@gsingle1% conditionally force single spacing (hpk/MC) + \vskip\baselineskip\def\baselinestretch{1}% + \@selfnt\vskip-\baselineskip\fi% + \enter:group + \lw_iln_fun_align:four_lines_words + } + % _modif + +% todo d. Translation and interlinear end +% ^modif_action="Is now obsolete" +% \def\lw_iln_fun_insert:free_translation{} ^rem obsolete _rem +% _modif +% ^modif_action="Definition modified" + % Introduces a translation + \let\trans\relax% ^rem obsolete _rem +% _modif + + \def\lw_iln_fun_exit:interlinearization{% + \lw_iln_fun_insert:interlinear_bottom_skip% + } + % Ends the gloss environment. +% _modif + +% todo 2. Adaptation of gloss.tex + + % The following TeX code is adapted, with permission, from: + % gloss.tex: Macros for vertically aligning words in consecutive sentences. + % Version: 1.0 release: 26 November 1990 + % Copyright (c) 1991 Marcel R. van der Goot (marcel@cs.caltech.edu). + % Original Midnight/gloss.tex and Midnight/gloss.doc are available from + % csvax.cs.caltech.edu [131.215.131.131] in pub/tex + % and many other anonymous ftp archives. + +% todo a. Box Variables Declaration + \newbox\lw_iln_var_box:line_one% boxes with words from first line + \newbox\lw_iln_var_box:line_two% + \newbox\lw_iln_var_box:line_three% + \newbox\lw_iln_var_box:line_four% ^rem ADDED _rem + \newbox\lw_iln_var_box:word_one% a word from the first line (hbox) + \newbox\lw_iln_var_box:word_two% + \newbox\lw_iln_var_box:word_three% + \newbox\lw_iln_var_box:word_four% ^rem ADDED _rem + \newbox\lw_iln_var_box:iln_text_lines% the constructed double line (hbox) + +% todo b. Skip Variable Declaration and setting + \newskip\lw_iln_glue:inter_word_space% extra glue between glossed pairs or triples + \lw_iln_glue:inter_word_space = 0pt plus 2pt minus 1pt % allow stretch/shrink between words + %\lw_iln_glue:inter_word_space = 5pt plus 2pt minus 1pt % allow stretch/shrink between words + \newlength{\lw_iln_length:base_line_stretch} + \setlength{\lw_iln_length:base_line_stretch}{.61ex} + + \AtBeginDocument{% + \def\lw_iln_fun_calc:line_stretch_factor{% + \ifdim\baselinestretch\p@=1\p@% + \def\lw_iln_multiplier:line_stretch_factor{.5} + \else% + \ifdim\baselinestretch\p@<1.26\p@% + \def\lw_iln_multiplier:line_stretch_factor{.5} + \else% + \ifdim\baselinestretch\p@<1.6\p@ + \def\lw_iln_multiplier:line_stretch_factor{1.6} + \else% + \ifdim\baselinestretch\p@>1.6\p@ + \def\lw_iln_multiplier:line_stretch_factor{2.23} + \else% + \ifdim\baselinestretch\p@=1.6\p@ + \def\lw_iln_multiplier:line_stretch_factor{2.23} + \else% + \fi% + \fi% + \fi% + \fi% + \fi% + } + \lw_iln_fun_calc:line_stretch_factor% + % + \newlength{\lw_iln_length:line_spread} + \setlength{\lw_iln_length:line_spread}{0ex} + \addtolength{\lw_iln_length:line_spread}{\lw_iln_multiplier:line_stretch_factor\lw_iln_length:base_line_stretch} + \addtolength{\lw_iln_length:line_spread}{.16\lw_iln_length:base_line_stretch} + } + %\addtolength{\lw_iln_length:line_spread}{\lw_iln_multiplier:line_stretch_factor\lw_iln_length:base_line_stretch} + + +% todo c. Boolean Declaration + \newif\ifnotdone + +% todo d. \rmfamily font declaraton (for backward compatibility) + % For any REALLY old distributions without \rmfamily + \@ifundefined{rmfamily}{\let\rmfamily=\rm} + +% todo e. Définition functions controlling the appearance of words in each line of the interlinearized text +% ^modified_action="Adding low level commands to format different aspects of the appearence of words" +\@ifundefined{lw_iln_fun_set:line_one_words_format}% + {\newcommand\lw_iln_fun_set:line_one_words_format{% + \lw_iln_fun_set:line_one_words_font_size% + \lw_iln_fun_set:line_one_words_font_series% + \lw_iln_fun_set:line_one_words_font_shape% + \lw_iln_fun_set:line_one_words_font_color% + } + }{\relax} + % ^added + \let\lw_iln_fun_set:line_one_words_font_size=\normalsize + \let\lw_iln_fun_set:line_one_words_font_series=\mdseries% + \let\lw_iln_fun_set:line_one_words_font_shape=\upshape% + \let\lw_iln_fun_set:line_one_words_font_color=\normalcolor% + % _added + % +\@ifundefined{lw_iln_fun_set:line_two_words_format}% + {\newcommand\lw_iln_fun_set:line_two_words_format{% + \lw_iln_fun_set:line_two_words_font_size% + \lw_iln_fun_set:line_two_words_font_series% + \lw_iln_fun_set:line_two_words_font_shape% + \lw_iln_fun_set:line_two_words_font_color} + }% + {\relax} +% + % ^added + \let\lw_iln_fun_set:line_two_words_font_size=\normalsize + \let\lw_iln_fun_set:line_two_words_font_series=\mdseries% + \let\lw_iln_fun_set:line_two_words_font_shape=\upshape% + \let\lw_iln_fun_set:line_two_words_font_color=\normalcolor% + % _added + % +\@ifundefined{lw_iln_fun_set:line_three_words_format}{% + \newcommand\lw_iln_fun_set:line_three_words_format{% + \lw_iln_fun_set:line_three_words_font_size% + \lw_iln_fun_set:line_three_words_font_series% + \lw_iln_fun_set:line_three_words_font_shape% + \lw_iln_fun_set:line_three_words_font_color} + }{\relax} + % ^added + \let\lw_iln_fun_set:line_three_words_font_size=\normalsize + \let\lw_iln_fun_set:line_three_words_font_series=\mdseries% + \let\lw_iln_fun_set:line_three_words_font_shape=\upshape% + \let\lw_iln_fun_set:line_three_words_font_color=\normalcolor% + % _added + % +% +\@ifundefined{lw_iln_fun_set:line_four_words_format}{% + \newcommand\lw_iln_fun_set:line_four_words_format{% + \lw_iln_fun_set:line_four_words_font_size% + \lw_iln_fun_set:line_four_words_font_series% + \lw_iln_fun_set:line_four_words_font_shape% + \lw_iln_fun_set:line_four_words_font_color} + }{\relax}% ^rem ADDED _rem + % ^added + \let\lw_iln_fun_set:line_four_words_font_size=\normalsize + \let\lw_iln_fun_set:line_four_words_font_series=\mdseries% + \let\lw_iln_fun_set:line_four_words_font_shape=\upshape% + \let\lw_iln_fun_set:line_four_words_font_color=\normalcolor% + % _added + % +% _modified +% todo f. General Interlinearization Functions Definition + \def\lw_iln_fun_get:last_word#1#2#3% #1 = \each, #2 = line box, #3 = word box + {\setbox#2=\vbox{\unvbox#2% + \global\setbox#3=\lastbox% + }% + \ifvoid#3\global\setbox#3=\hbox{#1\strut{} }\fi + % extra space following \strut in case #1 needs a space + } + + \def\lw_iln_check:words_queue_emptyness + {\ifdim\ht\lw_iln_var_box:line_one=0pt + \ifdim\ht\lw_iln_var_box:line_two=0pt \notdonefalse % tricky space after pt + \else\notdonetrue + \fi + \else\notdonetrue + \fi + } + + \gdef\lw_iln_fun_get:line_words(#1,#2)#3 #4\\% #1=linebox, #2=\each, #3=1st word, #4=remainder + {\setbox#1=\vbox{\hbox{#2{\strut#3} }% adds space + \unvbox#1% + }% + \def\lw_iln_process:words_queue{#4}% + \ifx\lw_iln_process:words_queue\empty\let\lw_iln_process:words_queue=\lw_iln_fun_exit:word_extraction + \else\let\lw_iln_process:words_queue=\lw_iln_fun_get:line_words + \fi + \lw_iln_process:words_queue(#1,#2)#4\\% + } + + \gdef\lw_iln_fun_exit:word_extraction(#1,#2)\\{}% + +% todo g. Processing of 2-lines interlinear texts +% ^modif_action"Rename \twosent into original twosent" + \gdef\lw_iln_fun_align:two_lines_words#1\\ #2\\{% #1 = first line, #2 = second line + \lw_iln_fun_get:line_words(\lw_iln_var_box:line_one,\lw_iln_fun_set:line_one_words_format)#1 \\% + \lw_iln_fun_get:line_words(\lw_iln_var_box:line_two,\lw_iln_fun_set:line_two_words_format)#2 \\% + \loop\lw_iln_fun_get:last_word{\lw_iln_fun_set:line_one_words_format}{\lw_iln_var_box:line_one}{\lw_iln_var_box:word_one}% + \lw_iln_fun_get:last_word{\lw_iln_fun_set:line_two_words_format}{\lw_iln_var_box:line_two}{\lw_iln_var_box:word_two}% + \global\setbox\lw_iln_var_box:iln_text_lines=\hbox{\unhbox\lw_iln_var_box:iln_text_lines + \hskip\lw_iln_glue:inter_word_space + \vtop{\box\lw_iln_var_box:word_one % vtop was vbox + \nointerlineskip + \box\lw_iln_var_box:word_two + }% + }% + \lw_iln_check:words_queue_emptyness + \ifnotdone + \repeat + \exit:group % matches \enter:group in \gloss + \lw_iln_fun_exit:words_alignment} +% _modif + + +% todo h. Processing of 3-lines interlinear texts + \gdef\lw_iln_fun_align:three_lines_words#1\\ #2\\ #3\\{% #1 = first line, #2 = second line, #3 = third + \lw_iln_fun_get:line_words(\lw_iln_var_box:line_one,\lw_iln_fun_set:line_one_words_format)#1 \\% + \lw_iln_fun_get:line_words(\lw_iln_var_box:line_two,\lw_iln_fun_set:line_two_words_format)#2 \\% + \lw_iln_fun_get:line_words(\lw_iln_var_box:line_three,\lw_iln_fun_set:line_three_words_format)#3 \\% + \loop\lw_iln_fun_get:last_word{\lw_iln_fun_set:line_one_words_format}{\lw_iln_var_box:line_one}{\lw_iln_var_box:word_one}% + \lw_iln_fun_get:last_word{\lw_iln_fun_set:line_two_words_format}{\lw_iln_var_box:line_two}{\lw_iln_var_box:word_two}% + \lw_iln_fun_get:last_word{\lw_iln_fun_set:line_three_words_format}{\lw_iln_var_box:line_three}{\lw_iln_var_box:word_three}% + \global\setbox\lw_iln_var_box:iln_text_lines=\hbox{\unhbox\lw_iln_var_box:iln_text_lines + \hskip\lw_iln_glue:inter_word_space + \vtop{\box\lw_iln_var_box:word_one % vtop was vbox + \nointerlineskip + \box\lw_iln_var_box:word_two + \nointerlineskip + \box\lw_iln_var_box:word_three + }% + }% + \lw_iln_check:words_queue_emptyness + \ifnotdone + \repeat + \exit:group % matches \enter:group in \gloss + \lw_iln_fun_exit:words_alignment} + + +% todo i. Processing of 4-lines interlinear texts +% ^added_action"Four lines interlinear processor, equivalent to an hypothetic \foursent for gloss.tex based interlinearization packages" +\gdef\lw_iln_fun_align:four_lines_words#1\\ #2\\ #3\\ #4\\{% #1 = first line, #2 = second line, #3 = third + \lw_iln_fun_get:line_words(\lw_iln_var_box:line_one,\lw_iln_fun_set:line_one_words_format)#1 \\% + \lw_iln_fun_get:line_words(\lw_iln_var_box:line_two,\lw_iln_fun_set:line_two_words_format)#2 \\% + \lw_iln_fun_get:line_words(\lw_iln_var_box:line_three,\lw_iln_fun_set:line_three_words_format)#3 \\% + \lw_iln_fun_get:line_words(\lw_iln_var_box:line_four,\lw_iln_fun_set:line_four_words_format)#4 \\% + \loop\lw_iln_fun_get:last_word{\lw_iln_fun_set:line_one_words_format}{\lw_iln_var_box:line_one}{\lw_iln_var_box:word_one}% + \lw_iln_fun_get:last_word{\lw_iln_fun_set:line_two_words_format}{\lw_iln_var_box:line_two}{\lw_iln_var_box:word_two}% + \lw_iln_fun_get:last_word{\lw_iln_fun_set:line_three_words_format}{\lw_iln_var_box:line_three}{\lw_iln_var_box:word_three}% + \lw_iln_fun_get:last_word{\lw_iln_fun_set:line_four_words_format}{\lw_iln_var_box:line_four}{\lw_iln_var_box:word_four}% + \global\setbox\lw_iln_var_box:iln_text_lines=\hbox{\unhbox\lw_iln_var_box:iln_text_lines + \hskip\lw_iln_glue:inter_word_space + \vtop{\box\lw_iln_var_box:word_one % vtop was vbox + \nointerlineskip + \box\lw_iln_var_box:word_two + \nointerlineskip + \box\lw_iln_var_box:word_three + \nointerlineskip + \box\lw_iln_var_box:word_four + }% + }% + \lw_iln_check:words_queue_emptyness + \ifnotdone + \repeat + \exit:group % matches \enter:group in \gloss + \lw_iln_fun_exit:words_alignment} + +% _added + + +% todo j. Ending interlinearization +% ^modif_action="\end{flushleft} removed" +% ^rem inspired by Alexis Dimitriadis cgloss.sty _rem + \def\lw_iln_fun_exit:words_alignment{{\hskip -\lw_iln_glue:inter_word_space}\unhbox\lw_iln_var_box:iln_text_lines} +% _modif +% todo * exit:cgloss4e modifications + +% todo 1. Other added features +% todo a. Managing line spacing after interlinearization +\def\baselinestretch{1} +\def\lw_iln_fun_insert:interlinear_bottom_skip{\vskip \lw_iln_length:line_spread}% + +% todo b. Configuring ex-parts boxes + +% ^rem Examples will now be placed within boxes, alongside glosses lines (old genericx.tex's \mb and \gl lines), and hanging bracketed language informations (like LangSci jamboxes) _rem +% todo i. Setting Lengths +% =============== +% Setting Lengths +% =============== +% + +\newlength{\lw_iln_var_dim:ex_box_width} +\newlength{\lw_iln_var_dim:ex_box_right_margin} +%\newlength{\lw_iln_var_dim:ex_box_bottom_sep} +%\newlength{\lw_iln_var_dim:ex_box_top_sep} +\newlength{\lw_iln_var_dim:iln_box_width} +\newlength{\lw_iln_var_dim:iln_box_right_margin} +%\newlength{\lw_iln_var_dim:iln_box_bottom_sep} +%\newlength{\lw_iln_var_dim:iln_box_top_sep} +\newlength{\lw_iln_var_dim:trans_box_width} +\newlength{\lw_iln_var_dim:trans_box_right_margin} +\newlength{\lw_iln_var_dim:gramjudg_len} +\newlength{\lw_iln_var_dim:gramjudg_reserved_space} +\newlength{\lw_iln_var_dim:langinfo_box_width} +\newlength{\lw_iln_var_dim:langinfo_box_left_sep} +\newlength{\lw_iln_var_dim:langinfo_box_right_sep} +\newlength{\lw_iln_var_dim:langinfo_reserved_space} +%\newlength{\lw_iln_var_dim:langinfo_left_margin} +\newlength{\lw_iln_var_dim:extranote_box_width} +\newlength{\lw_iln_var_dim:extranote_box_left_sep} +\newlength{\lw_iln_var_dim:extranote_box_right_sep} +\newlength{\lw_iln_var_dim:extranote_reserved_space} +%\newlength{\lw_iln_var_dim:extranote_left_margin} + +% Initializing lengths +\setlength{\lw_iln_var_dim:ex_box_width}{\linewidth} +\setlength{\lw_iln_var_dim:ex_box_right_margin}{0ex} +\setlength{\lw_iln_var_dim:iln_box_width}{\linewidth} +\setlength{\lw_iln_var_dim:iln_box_right_margin}{0ex} +\setlength{\lw_iln_var_dim:trans_box_width}{\linewidth} +\setlength{\lw_iln_var_dim:trans_box_right_margin}{0ex} +\addtolength{\lw_iln_var_dim:trans_box_width}{-\lw_iln_var_dim:trans_box_right_margin} +\setlength{\lw_iln_var_dim:gramjudg_len}{0ex}% ^rem default value _rem +\setlength{\lw_iln_var_dim:langinfo_box_width}{0ex}% ^rem default value _rem +\setlength{\lw_iln_var_dim:langinfo_reserved_space}{0ex} +\setlength{\lw_iln_var_dim:langinfo_box_left_sep}{3.4ex} +\setlength{\lw_iln_var_dim:langinfo_box_right_sep}{3.4ex} +\setlength{\lw_iln_var_dim:extranote_box_width}{0ex}% ^rem default value _rem +\setlength{\lw_iln_var_dim:extranote_reserved_space}{0ex} +\setlength{\lw_iln_var_dim:extranote_box_left_sep}{0pt} +\setlength{\lw_iln_var_dim:extranote_box_right_sep}{0pt} + +% =========================== +% Defining Booleans for Boxes +% Opennings +% =========================== +\newif\ifnoglosslines% +\noglosslinestrue +% todo ii. Defining Opening CS for Boxes +% ============================= +% Defining Opening CS for Boxes +% ============================= +\NewDocumentCommand{\lw_iln_fun_open:ex_box}{}{% + % ^rem example box opening code _rem + % ^rem \lw_iln_fun_open:ex_box should be called after \label{key} to avoid linebreak _rem + % ^rem no_op command _rem + } +\NewDocumentCommand{\lw_iln_fun_open:iln_box}{}{% + % ^rem interlinear text box opening code _rem + \addtolength{\lw_iln_var_dim:iln_box_width}{-1.15\lw_iln_var_dim:langinfo_reserved_space}% + \begin{itemize}[% + align=left,% + labelwidth=\lw_iln_var_dim:gramjudg_len,% + leftmargin=\lw_iln_var_dim:gramjudg_reserved_space]% + \item[\lw_iln_fun_print:gramjudg]% + \begin{minipage}[t]{\lw_iln_var_dim:iln_box_width}% +} +\NewDocumentCommand{\lw_iln_fun_open:langinfo_box}{}{% + % ^rem language info box opening code _rem + \begin{minipage}[t]{\lw_iln_var_dim:langinfo_box_width} +} +\NewDocumentCommand{\lw_iln_fun_open:trans_box}{}{% + \setlength{\lw_iln_var_dim:trans_box_width}{\linewidth} + \addtolength{\lw_iln_var_dim:trans_box_width}{-1.069\lw_iln_var_dim:extranote_reserved_space}% + \trans \begin{minipage}[b]{\lw_iln_var_dim:trans_box_width} +} +\NewDocumentCommand{\lw_iln_fun_open:extra_note_box}{}{% + \begin{minipage}[t]{\lw_iln_var_dim:extranote_box_width}% + \raggedright% + } + +% todo iii. Defining Closing CS for Boxes +% ============================= +% Defining Closing CS for Boxes +% ============================= +\def\lw_iln_fun_format:ex_text{\normalfont}% +\NewDocumentCommand{\lw_iln_fun_close:ex_box}{}{% + % ^rem example box closing code _rem + \setlength{\lw_iln_var_dim:trans_box_width}{\linewidth} + \addtolength{\lw_iln_var_dim:trans_box_width}{-\lw_iln_var_dim:gramjudg_reserved_space} + \addtolength{\lw_iln_var_dim:trans_box_width}{-1.0618\lw_iln_var_dim:extranote_reserved_space}% + \IfValueArgTF{\lw_iln_var_stored:gramjudg_text}{}{\relax}% + {\begin{minipage}[t]{\lw_iln_var_dim:gramjudg_len} + \lw_iln_fun_print:gramjudg% + \end{minipage}} + \begin{minipage}[t]{\lw_iln_var_dim:trans_box_width} + \lw_iln_fun_format:ex_text% + \lw_iln_var_stored:free_trans_text\space% + \normalfont% + \IfValueArgTF{\lw_iln_var_stored:reference_text}{}{\relax}{\lw_iln_fun_print:reference}% + \end{minipage} + \IfValueArgTF{\lw_iln_var_stored:extranote_text}{}{\relax}% + {\vskip -2.6ex + \hfill% + \begin{minipage}[t]{\lw_iln_var_dim:extranote_box_width} + (\lw_iln_var_stored:extranote_text)% + \end{minipage}}% +} +\NewDocumentCommand{\lw_iln_fun_close:iln_box}{}{% + % ^rem interlinear text box closing code _rem + \lw_iln_fun_exit:interlinearization + \end{minipage}\lw_iln_fun_print:langinfo% + \end{itemize} +} +\NewDocumentCommand{\lw_iln_fun_close:langinfo_box}{}{% + % ^rem language info box closing code _rem + \end{minipage}% +} +\NewDocumentCommand{\lw_iln_fun_close:extranote_box}{}{% + \end{minipage}% +} +\NewDocumentCommand{\lw_iln_fun_close:trans_box}{}{% + \end{minipage}\hfill% +} + +% todo iv. Defining CS for setting or inserting example parts or metadata +\def\lw_iln_var_stored:langinfo_text{} +% the * and : versions print the language name as a title. +% If \lw_iln_fun_set:langinfo if followed by an ex_box, use the * version +% If there is some text -- e.g. specifying the context for the data -- before the ex_box, use the : version +% To print the language information as a margin note, use the "bear" version +\NewDocumentCommand{\langinfo}{s t/ m }{% + \IfBooleanTF{#1}% + {{\normalfont #3}}% + {% + \IfBooleanTF{#2}% + {{\normalfont #3}\\}% + {\def\lw_iln_var_stored:langinfo_text{#3} + \settowidth{\lw_iln_var_dim:langinfo_box_width}{#3} + \setlength{\lw_iln_var_dim:langinfo_reserved_space}{\lw_iln_var_dim:langinfo_box_width} + \addtolength{\lw_iln_var_dim:langinfo_reserved_space}{\lw_iln_var_dim:langinfo_box_left_sep} + \addtolength{\lw_iln_var_dim:langinfo_reserved_space}{\lw_iln_var_dim:langinfo_box_right_sep} + }% + }% +}% + +\NewDocumentCommand{\lw_iln_fun_set:langinfo}{m}{\langinfo{#1}} +\NewDocumentCommand{\lw_iln_fun_make:langinfo_box}{}{% + \ifthenelse{\equal{\lw_iln_var_stored:langinfo_text}{}}{}{% + \marginnote{\hskip -\lw_iln_var_dim:langinfo_reserved_space\lw_iln_fun_open:langinfo_box% + {\normalfont(\lw_iln_var_stored:langinfo_text)}% + \lw_iln_fun_close:langinfo_box}[0cm]% + }% +} +\NewCommandCopy{\lw_iln_fun_print:langinfo}{\lw_iln_fun_make:langinfo_box} + +\def\lw_iln_var_stored:gramjudg_text{} +\NewDocumentCommand{\lw_iln_fun_set:gramjudg}{m}{% + \def\lw_iln_var_stored:gramjudg_text{#1}% + \settowidth{\lw_iln_var_dim:gramjudg_len}{#1}% + \setlength{\lw_iln_var_dim:gramjudg_reserved_space}{\lw_iln_var_dim:gramjudg_len}% + \addtolength{\lw_iln_var_dim:gramjudg_reserved_space}{1ex}% +} +\NewDocumentCommand{\lw_iln_fun_print:gramjudg}{}{% + \ifthenelse{\equal{\lw_iln_var_stored:gramjudg_text}{}}{}{% + {\normalfont\lw_iln_var_stored:gramjudg_text}% + }% +} +\def\lw_iln_var_stored:extranote_text{} +\def\lw_iln_var_token:extranote_left_punct{{(}}% +\def\lw_iln_fun_format:extranote{\normalfont} +\def\lw_iln_var_token:extranote_right_punct{{)}}% +\NewDocumentCommand{\lw_iln_fun_add:extranote}{m}{% + \def\lw_iln_var_stored:extranote_text{#1}% + \settowidth{\lw_iln_var_dim:extranote_box_width}{#1} + \ifdimgreater{\lw_iln_var_dim:extranote_box_width}{113.2pt}% + {\setlength{\lw_iln_var_dim:extranote_box_width}{113.2pt}}% + {\settowidth{\lw_iln_var_dim:extranote_box_width}{#1}}% + \setlength{\lw_iln_var_dim:extranote_reserved_space}{\lw_iln_var_dim:extranote_box_width}% + \addtolength{\lw_iln_var_dim:extranote_reserved_space}{\lw_iln_var_dim:extranote_box_left_sep} + \addtolength{\lw_iln_var_dim:extranote_reserved_space}{\lw_iln_var_dim:extranote_box_right_sep}% +} +\NewDocumentCommand{\lw_iln_fun_make:extranote_box}{}{% + \IfValueArgTF{\lw_iln_var_stored:extranote_text}{}% + {}% + {\lw_iln_fun_open:extra_note_box% + \lw_iln_var_token:extranote_left_punct% + \lw_iln_fun_format:extranote% + \lw_iln_var_stored:extranote_text% + \normalfont% + \lw_iln_var_token:extranote_right_punct% + \lw_iln_fun_close:extranote_box} +} + +\def\lw_iln_var_stored:free_trans_text{} +\NewDocumentCommand{\lw_iln_fun_set:free_translation}{m}{% + \def\lw_iln_var_stored:free_trans_text{#1} +} +\def\lw_iln_var_stored:literal_trans_text{} +\NewDocumentCommand{\lw_iln_fun_set:literal_trans_text}{m}{% + \def\lw_iln_var_stored:literal_trans_text{#1} +} +\def\lw_iln_var_stored:reference_text{} +\NewDocumentCommand{\lw_iln_fun_set:reference}{m}{% + \def\lw_iln_var_stored:reference_text{#1} +} +\NewDocumentCommand{\lw_iln_fun_print:free_trans}{}{% + \IfValueArgTF{\lw_iln_var_stored:free_trans_text}{}{}% + {`\lw_iln_var_stored:free_trans_text'}} +\NewDocumentCommand{\lw_iln_fun_print:literal_trans}{}{% + \IfValueArgTF{\lw_iln_var_stored:literal_trans_text}{}{}% + {(Lit.: `\lw_iln_var_stored:literal_trans_text')}} +\NewDocumentCommand{\lw_iln_fun_print:reference}{}{% + \IfValueArgTF{\lw_iln_var_stored:reference_text}{}{}% + {{[}\lw_iln_var_stored:reference_text{]}}} +% +\NewDocumentCommand{\lw_iln_fun_make:trans_box}{}{% + \IfValueArgTF{\lw_iln_var_stored:extranote_text}{}% + {\lw_iln_fun_open:trans_box% + \lw_iln_fun_print:free_trans\space % + \lw_iln_fun_print:literal_trans\space % + \lw_iln_fun_print:reference\space % + \lw_iln_fun_close:trans_box}% + {\lw_iln_fun_open:trans_box% + \raggedright + \lw_iln_fun_print:free_trans\space % + \lw_iln_fun_print:literal_trans\space % + \lw_iln_fun_print:reference\space % + \lw_iln_fun_close:trans_box} +} + +\def\lw_iln_fun_format:context_label{\normalfont} +\def\lw_iln_var_name:context{Context:} +\def\lw_iln_fun_insert:context#1{% + \IfValueArgTF{#1}{}{}% + {\lw_iln_fun_format:context_label\lw_iln_var_name:context\normalfont~#1\\[-1.3\baselineskip]} +} + +\def\lw_iln_fun_reinitialize:markers_value{% + \def\lw_iln_var_stored:extranote_text{} + \def\lw_iln_var_stored:free_trans_text{} + \def\lw_iln_var_stored:gramjudg_text{} + \def\lw_iln_var_stored:langinfo_text{} + \def\lw_iln_var_stored:literal_trans_text{} + \def\lw_iln_var_stored:reference_text{} +} + +% todo v. Defining long (internal commands) +\def\lw_iln_var_num:interlinear_lines{2} + +\def\lw_iln_tag:line_one_marker{% LEV version + \IfValueArgTF{\lw_iln_var_num:interlinear_lines}{2}% + {\lw_iln_fun_open:iln_box + \lw_iln_fun_enter:two_lines_interlinearization}{}% + \IfValueArgTF{\lw_iln_var_num:interlinear_lines}{3}% + {\lw_iln_fun_open:iln_box + \lw_iln_fun_enter:three_lines_interlinearization}{}% + \IfValueArgTF{\lw_iln_var_num:interlinear_lines}{4}% + {\lw_iln_fun_open:iln_box + \lw_iln_fun_enter:four_lines_interlinearization}{}% +}% + +\let\lw_iln_tag:Text_marker\lw_iln_tag:line_one_marker% ^rem is typeset in italics by default. The starred version introduces a two-line interlinear gloss text. ^caution Do not use it together with \lw_iln_MorphBreak_marker : they mean the same thing. So you will get error messages. _caution _rem +% +\def\lw_iln_tag:Morpheme_Break_marker% ^rem typeset in roman -- by default -- (intended to host API translations). Introduces a 2-line interlinear gloss text. _rem +{\IfValueArgTF{\lw_iln_var_num:interlinear_lines}{2}% + {\lw_iln_tag:line_one_marker}% + {\relax}% +}% + +\def\lw_iln_tag:Gloss_marker% ^rem \ge is already defined in LaTeX. \lw_iln_tag:Gloss_marker introduces a two-line interlinear gloss text. _rem +{\relax}% +% +\def\lw_iln_tag:Part_of_speech_marker{\relax} + +% LEV Syntax sensitive CS +\def\lw_iln_tag:Free_translation_marker#1\\% + {\IfValueArgTF{\lw_iln_var_num:interlinear_lines}{0} + {\lw_iln_fun_set:free_translation{#1}} + {\lw_iln_fun_close:iln_box% + \lw_iln_fun_set:free_translation{#1}}}% ^rem CAUTION: The Free Translation marker should be present even if there is actually no free translation provided. _rem +% +\def\lw_iln_tag:Literal_translation_marker#1\\% +{\lw_iln_fun_set:literal_trans_text{#1}} +\def\lw_iln_tag:Reference_marker#1\\% +{\lw_iln_fun_set:reference{#1}} +\def\lw_iln_tag:Language_information_marker#1\\% +{\lw_iln_fun_set:langinfo{#1}} +\def\lw_iln_tag:Grammaticality_Judgment_marker#1\\% +{\lw_iln_fun_set:gramjudg{#1}} +\newlength{\lw_iln_var_dim:context_voffset} +\setlength{\lw_iln_var_dim:context_voffset}{-1em} +\def\lw_iln_tag:Context_marker#1\\% +{\lw_iln_fun_insert:context{#1}\\[\lw_iln_var_dim:context_voffset]} +\def\lw_iln_tag:Extra_note_marker#1\\% + {\lw_iln_fun_add:extranote{#1}} + + +% _cs-definitions + +% todo vi. Low-level commands + +% ^section_title="User Commands and Envs to Typeset Interlinear Gloss Texts" +% DEFINE: interlinear environment +% DEFINE: Text tagging cs +% The cs are named after the standard tags used in Linguist's Field's Toolbox by SIL (see Interlinear macro in ToolboxInterlinearMacroText.docm) +% ^important Please use the short versions (in brackets). The long versions are internal commands to be use for later eventual modifications _important +% \lw_iln_tag:Text_marker (\tx) ^rem is typeset in italic either in tri-gloss or in di-gloss envs. In di-gloss env, \tx and \mb mean the same thing. _rem +%\lw_iln_tag:MorphBreak_marker (\mb) ^rem typeset in roman -- by default -- (intended to host API translations) _rem +%\lw_iln_tag:Gloss_marker (\gl) % \ge is already defined in LaTeX +%\lw_iln_tag:FreeTranslation_marker (\ft) +% \lw_iln_tag:Reference_marker (\rf) ^rem \ref is a primitive _rem +% -------------------------------- +% Markers not present in Toolbox defaults +% -------------------------------- +% \lw_iln_tag:Language_information_marker (\li) +% \lw_iln_tag:Grammaticality_Judgment_marker (\gj) +% \lw_iln_tag:Context_marker (\ct) +% +% \lw_iln_tag:Literal_translation_marker (\lt) +% \lw_iln_tag:Extra_note_marker (\nt) +% +% ^cs-definitions +%\let\tx\lw_iln_tag:Text_marker% ^rem is typeset in italic either in tri-gloss or in di-gloss envs. In di-gloss env, \tx and \mb mean the same thing. _rem +\let\mb\lw_iln_tag:Morpheme_Break_marker% ^rem typeset in roman -- by default -- (intended to host API translations) _rem +\let\gl\lw_iln_tag:Gloss_marker% ^rem \ge is already defined in LaTeX _rem +%\let\ft\lw_iln_tag:Free_translation_marker% +\let\ps\lw_iln_tag:Part_of_speech_marker +% +\NewCommandCopy{\li}% +{\lw_iln_tag:Language_information_marker}% +\NewCommandCopy{\rf}% +{\lw_iln_tag:Reference_marker}% +\NewCommandCopy{\gj}% +{\lw_iln_tag:Grammaticality_Judgment_marker} +\NewCommandCopy{\ct}% +{\lw_iln_tag:Context_marker} +\NewCommandCopy{\lt}% +{\lw_iln_tag:Literal_translation_marker}% +\NewCommandCopy{\nt}% + {\lw_iln_tag:Extra_note_marker} + +% todo c. Defining Interlinear Env. Options +% ---------------------- +% | Describing options | +% ---------------------- + +% # Options: + +% - argendchar: (not available for the moment) return, par, lineend +% return : takes the current line as argument, do not put anything else (e.g. {}, or \\) +% lineend : idem +% par : argument is ended by "\\" like e.g. in cgloss4e +% (NOTE: this option scopes over all the markers, not only interlinear text markers \tx, \mb, \gl, \ps) + +% - linesnumber: full, 2, 3 +% full : 4-lines (By default it is disabled in the main text) +% 2 : Only one gloss line is printed (\gl); \mb and \tx are then treated are incompatible to each other so +% that only of them should be used. If this option is used, you should specifiy the first-line of the +% interlinear text via first-line option +% 3 : only \ps is not printedand all the other lines \tx, \mb and \gl should be non-empty + +% * Setting markers * + +% Sets the marker used for the different parts. Actually tells lingwrit-interlinear to define the corresponding command so as to fit the definition of the +% default marker (e.g. text_marker=\ot tells lingwrit-interlinear to add the following: \let\ot\tx) +% - textmarker= +% - morphbreakmarker= +% - glossmarker= (You shouldn't set it to \ge. But if this happens, note that lingwrit-interlinear will redefine \ge to equal to \gl, define a new +% command \gteq to replace \ge and issue a warning message) +% - partofspeechmarker= +% - freetranslationmarker= +% - literaltranslationmarker= +% - grammaticalityjudgmentmarker= +% - contextmarker= +% - extranotemarker= +% - languageinfomarker= +% - referencemarker= + +% * Format specifications * + +% (May include font size, shape, series and color. If color command is used (e.g. \color{blue}), then make sure to have xcolor loaded) +% - lineoneformat={} +% - linetwoformat={} +% - linethreeformat={} +% - linefourformat={} +% - extranoteformat={} +% - contextnameformat={} + +% * Other specifications * + +% - contextname={} ^rem The displayed label for context. default value is "Context:" _rem +% - extranoteleftpunct= ^rem the punctuation preceding the extra note. Default value: ( _rem +% - extranoterightpunct= ^rem the punctuation following the extra note. Default value: ) _rem + +% todo i. Declaring Options +\NewCommandCopy{\lw_iln_var_opt:textmarker}{\lw_iln_tag:Text_marker} +\NewCommandCopy{\lw_iln_var_opt:morphbreakmarker}{\lw_iln_tag:Morpheme_Break_marker} +\NewCommandCopy{\lw_iln_var_opt:glossmarker}{\lw_iln_tag:Gloss_marker} +\NewCommandCopy{\lw_iln_var_opt:partofspeechmarker}{\lw_iln_tag:Part_of_speech_marker} +\NewCommandCopy{\lw_iln_var_opt:freetranslationmarker}{\lw_iln_tag:Free_translation_marker} +\NewCommandCopy{\lw_iln_var_opt:literaltranslationmarker}{\lw_iln_tag:Literal_translation_marker} +\NewCommandCopy{\lw_iln_var_opt:extranotemarker}{\lw_iln_tag:Extra_note_marker} +\NewCommandCopy{\lw_iln_var_opt:languageinfomarker}{\lw_iln_tag:Language_information_marker} +\NewCommandCopy{\lw_iln_var_opt:gramjudgmarker}{\lw_iln_tag:Grammaticality_Judgment_marker} +\NewCommandCopy{\lw_iln_var_opt:referencemarker}{\lw_iln_tag:Reference_marker} +\NewCommandCopy{\lw_iln_var_opt:contextmarker}{\lw_iln_tag:Context_marker} + +\NewDocumentCommand{\lw_iln_var_opt:languageinfopos}{m}{% + \IfValueArgTF{#1}{head}{\RenewDocumentCommand{\lw_iln_fun_set:langinfo}{m}{\langinfo/{##1}}}{} + \IfValueArgTF{#1}{margin}{\RenewDocumentCommand{\lw_iln_fun_set:langinfo}{m}{\langinfo{##1}}}{} +} + +\NewDocumentCommand{\lw_iln_var_opt:nointerlinear}{m}{% + \IfValueArgTF{#1}{true}% + {\def\lw_iln_var_num:interlinear_lines{0}}% + {\IfValueArgTF{#1}{false}% + {\relax}% + {\PackageWarning{interlinear}{nointerlinear option possible values: true, false}}% + } +} +\NewDocumentCommand{\lw_iln_var_opt:contextvoffset}{m}{\setlength{\lw_iln_var_dim:context_voffset}{#1}} + +% todo ii. Defining Default values + +%\def\lw_iln_var_opt:endchar{par}% possible values: par, lineend, return +\def\lw_iln_var_opt:linesnumber{2}% possible values: 2, 3, full +\def\lw_iln_var_num:interlinear_lines{\lw_iln_var_opt:linesnumber} +% Setting markers +\let\li\lw_iln_var_opt:languageinfomarker +\let\rf\lw_iln_var_opt:referencemarker +\let\gj\lw_iln_var_opt:gramjudgmarker +\let\tx\lw_iln_var_opt:textmarker +\let\mb\lw_iln_var_opt:morphbreakmarker +\let\gl\lw_iln_var_opt:glossmarker +\let\ps\lw_iln_var_opt:partofspeechmarker +\let\ft\lw_iln_var_opt:freetranslationmarker +\let\lt\lw_iln_var_opt:literaltranslationmarker +\let\nt\lw_iln_var_opt:extranotemarker +\def\lw_iln_var_opt:extranoteleftpunct#1{\def\lw_iln_var_token:extranote_left_punct{#1}} +\def\lw_iln_var_opt:extranoterightpunct#1{\def\lw_iln_var_token:extranote_right_punct{#1}} + +% Setting formats (only available for interlinear/gloss lines, context name and extra notes) +\def\lw_iln_var_opt:lineoneformat#1{\renewcommand{\lw_iln_fun_set:line_one_words_format}{#1}} +\def\lw_iln_var_opt:linetwoformat#1{\renewcommand{\lw_iln_fun_set:line_two_words_format}{#1}} +\def\lw_iln_var_opt:linethreeformat#1{\renewcommand{\lw_iln_fun_set:line_three_words_format}{#1}} +\def\lw_iln_var_opt:linefourformat#1{\renewcommand{\lw_iln_fun_set:line_four_words_format}{#1}} +\def\lw_iln_var_opt:exformat#1{\renewcommand{\lw_iln_fun_format:ex_text}{#1}} +\def\lw_iln_var_opt:extranoteformat#1{\def\lw_iln_fun_format:extranote{#1}} +\def\lw_iln_var_opt:contextnameformat#1{\def\lw_iln_fun_format:context_label{#1}} +% Context label/name +\def\lw_iln_var_opt:contextname#1{\def\lw_iln_var_name:context{#1}} + +% Defining CS for resetting default options (to be called at the begining of interlinear env)% ^rem the \setinterlinearstyle is meant to set globally the options for interlinear env. So don't use optional argument of interlinear env anymore since it will overwrite the values set up with this commands and the new values be considered the default ones. _rem +\def\lw_iln_fun_reinitialize:interlinear_options{% + %\def\lw_iln_var_opt:endchar{par}% possible values: par, lineend, return + \def\lw_iln_var_opt:linesnumber{2}% possible values: 2, 3, full + % Setting markers + \let\li\lw_iln_var_opt:languageinfomarker% + \let\rf\lw_iln_var_opt:referencemarker% + \let\gj\lw_iln_var_opt:gramjudgmarker% + \let\tx\lw_iln_var_opt:textmarker + \let\mb\lw_iln_var_opt:morphbreakmarker% + \let\gl\lw_iln_var_opt:glossmarker% + \let\ps\lw_iln_var_opt:partofspeechmarker% + \let\ft\lw_iln_var_opt:freetranslationmarker% + \let\lt\lw_iln_var_opt:literaltranslationmarker% + \let\nt\lw_iln_var_opt:extranotemarker% + % Setting formats (only available for interlinear/gloss lines, context name and extra notes) + \lw_iln_var_opt:lineoneformat{\normalfont}% + \lw_iln_var_opt:linetwoformat{\normalfont}% + \lw_iln_var_opt:linethreeformat{\normalfont}% + \lw_iln_var_opt:linefourformat{\normalfont}% + \lw_iln_var_opt:exformat{\normalfont} + \lw_iln_var_opt:extranoteformat{\normalfont}% + \lw_iln_var_opt:contextnameformat{\normalfont}% + % Context label/name + \lw_iln_var_opt:contextname{Context:}% + \lw_iln_var_opt:extranoteleftpunct{{(}}% + \lw_iln_var_opt:extranoterightpunct{{)}}% + \lw_iln_var_opt:languageinfopos{margin}% + \lw_iln_var_opt:nointerlinear{false}% + \lw_iln_var_opt:contextvoffset{-1em} +} + +% todo iii. Setting Options + +% Setting Ending Character for arguments (not yet available) +%\define@key{interlinear}{endchar}{% + % ^action_name="Setting the value" +% \def\lw_iln_var_opt:endchar{#1} + % _action + % ^action_name="Processing the option" + % + % _action +%} + +% Setting the numbers of interlinear/gloss lines +\define@key{interlinear}{linesnumber}{% + % ^action_name="Setting the value" + \def\lw_iln_var_opt:linesnumber{#1} + % _action +} +\define@key{interlinear}{nointerlinear}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:nointerlinear{#1} + % _action +} + +% Setting the markers +\define@key{interlinear}{textmarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:textmarker}} +\define@key{interlinear}{morphbreakmarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:morphbreakmarker}} +\define@key{interlinear}{glossmarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:glossmarker}} + +\define@key{interlinear}{partofspeechmarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:partofspeechmarker}} + +\define@key{interlinear}{freetranslationmarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:freetranslationmarker}} + +\define@key{interlinear}{literaltranslationmarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:literaltranslationmarker}} + +\define@key{interlinear}{extranotemarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:extranotemarker}} + +\define@key{interlinear}{languageinfomarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:languageinfomarker}} + +\define@key{interlinear}{gramjudgmarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:gramjudgmarker}} + +\define@key{interlinear}{referencemarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:referencemarker}} + +\define@key{interlinear}{contextmarker}{% + \NewCommandCopy{#1}{\lw_iln_var_opt:contextmarker}} + + +% Setting formats +\define@key{interlinear}{lineoneformat}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:lineoneformat{#1} + % _action +} +\define@key{interlinear}{linetwoformat}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:linetwoformat{#1} + % _action +} +\define@key{interlinear}{linethreeformat}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:linethreeformat{#1} + % _action +} +\define@key{interlinear}{linefourformat}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:linefourformat{#1} + % _action +} +\define@key{interlinear}{exformat}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:exformat{#1} + % _action +} +\define@key{interlinear}{extranoteformat}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:extranoteformat{#1} + % _action +} +\define@key{interlinear}{contextnameformat}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:contextnameformat{#1} + % _action +} + +% Other specifications +\define@key{interlinear}{contextname}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:contextname{#1} + % _action +} +\define@key{interlinear}{contextvoffset}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:contextvoffset{#1} + % _action +} +\define@key{interlinear}{extranoteleftpunct}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:extranoteleftpunct{#1} + % _action +} +\define@key{interlinear}{extranoterightpunct}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:extranoterightpunct{#1} + % _action +} +\define@key{interlinear}{languageinfopos}{% + % ^action_name="Setting the value" + \lw_iln_var_opt:languageinfopos{#1} + % _action +} + +\newcommand{\interlinearstyle}[1]{% + \setkeys{interlinear}{#1}% + \lw_fun_helper:clear{\lw_iln_fun_reinitialize:interlinear_options} +} +\def\DeclareInterlinearStyle#1#2{% + \expandafter\def\csname lw_iln_var_sty:#1\endcsname{\interlinearstyle{#2}}} +\def\UseInterlinearStyle#1{% + \expandafter\csname lw_iln_var_sty:#1\endcsname} +\DeclareInterlinearStyle{default}{% + linesnumber=2,% + lineoneformat=\upshape,% + linetwoformat=\normalfont,% + linethreeformat=\normalfont,% + linefourformat=\normalfont,% + contextnameformat=\normalfont,% + extranoteformat=\normalfont,% + contextname={Context:},% + extranoteleftpunct={(},% + extranoterightpunct={)}% +} +\DeclareInterlinearStyle{nointerlinear}{% + nointerlinear=true,% + languageinfopos=head,% + freetranslationmarker=\ot,% + contextvoffset=.5em% +} +\DeclareInterlinearStyle{gsr}{% + linesnumber=2,% + lineoneformat=\itshape,% + linetwoformat=\normalfont,% + linethreeformat=\normalfont% +} +\DeclareInterlinearStyle{gsrnointerlinear}{% + nointerlinear=true,% + exformat=\itshape,% + languageinfopos=head,% + freetranslationmarker=\ot,% + contextvoffset=.5em% +} + +\UseInterlinearStyle{gsr}% ^rem setting the default style to fit the GSR _rem + +\define@key{interlinear}{style}{% + % ^action_name="Setting the value" + \UseInterlinearStyle{#1} + % _action +} + + +% todo d. Defining Interlinear Env. +\NewDocumentCommand{\lw_iln_fun_enter:interlinear}{}{\relax}% ^rem no_op command _rem +\NewDocumentCommand{\lw_iln_fun_exit:interlinear}{}{% + \IfValueArgTF{\lw_iln_var_num:interlinear_lines}{0}% + {\lw_iln_fun_close:ex_box}% + {\lw_iln_fun_make:trans_box% + \lw_iln_fun_make:extranote_box% + \lw_iln_fun_reinitialize:markers_value}% + } + +\NewDocumentEnvironment{interlinear}{O{}}% + {% ^rem Beginning of the internlinear env _rem + \lw_iln_fun_enter:interlinear% + \lw_iln_fun_reinitialize:interlinear_options% + \setkeys{interlinear}{#1} + }% + {% ^rem End of the interlinear env _rem + \lw_iln_fun_exit:interlinear% + } + +\makeatother% + +% ^action_name="Disabling LingWrit Syntax" +\switchlwsyntaxoff +% _action +% ^action_name="Ending the code" +\endinput% +% _action + +% _code + +% ^_* + +% _package diff --git a/macros/latex/contrib/tutodoc/code/tutodoc.sty b/macros/latex/contrib/tutodoc/code/tutodoc.sty index a27e1a7ac6..a1e0acdd13 100644 --- a/macros/latex/contrib/tutodoc/code/tutodoc.sty +++ b/macros/latex/contrib/tutodoc/code/tutodoc.sty @@ -9,8 +9,8 @@ \ProvidesExplPackage {tutodoc} - {2024-01-06} % Creation: 2023-11-29 - {1.1.0} + {2024-08-23} % Creation: 2023-11-29 + {1.2.0-a} {This package proposes tools for writing "human friendly" documentations of LaTeX packages.} \RequirePackage[ diff --git a/macros/latex/contrib/tutodoc/doc/tutodoc-en.pdf b/macros/latex/contrib/tutodoc/doc/tutodoc-en.pdf Binary files differindex 84a98f1e35..506a75b5d2 100644 --- a/macros/latex/contrib/tutodoc/doc/tutodoc-en.pdf +++ b/macros/latex/contrib/tutodoc/doc/tutodoc-en.pdf diff --git a/macros/latex/contrib/tutodoc/doc/tutodoc-en.tex b/macros/latex/contrib/tutodoc/doc/tutodoc-en.tex index 371b905d97..a66ebc0ea8 100644 --- a/macros/latex/contrib/tutodoc/doc/tutodoc-en.tex +++ b/macros/latex/contrib/tutodoc/doc/tutodoc-en.tex @@ -345,7 +345,7 @@ ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble... \title{The \texttt{tutodoc} package - Tutorial-type documentation} \author{Christophe BAL} -\date{23 Aug. 2024 - Version 1.2.0} +\date{23 Aug. 2024 - Version 1.2.0-a} \maketitle @@ -1149,7 +1149,7 @@ Blu, blu, blu... \end{tdoclatex} \section{History} -\tdocversion{1.2.0}[2024-08-23] +\tdocversion{1.2.0-a}[2024-08-23] \begin{tdocupdate} \item \tdocmacro{tdocversion} diff --git a/macros/latex/contrib/tutodoc/doc/tutodoc-fr.pdf b/macros/latex/contrib/tutodoc/doc/tutodoc-fr.pdf Binary files differindex d0a970abec..070a6b3f5a 100644 --- a/macros/latex/contrib/tutodoc/doc/tutodoc-fr.pdf +++ b/macros/latex/contrib/tutodoc/doc/tutodoc-fr.pdf diff --git a/macros/latex/contrib/tutodoc/doc/tutodoc-fr.tex b/macros/latex/contrib/tutodoc/doc/tutodoc-fr.tex index 8291ce4b4a..011e390f25 100644 --- a/macros/latex/contrib/tutodoc/doc/tutodoc-fr.tex +++ b/macros/latex/contrib/tutodoc/doc/tutodoc-fr.tex @@ -341,7 +341,7 @@ ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble, ble... \title{Le package \texttt{tutodoc} - Documentation de type tutoriel} \author{Christophe BAL} -\date{23 Août 2024 - Version 1.2.0} +\date{23 Août 2024 - Version 1.2.0-a} \maketitle @@ -1170,7 +1170,7 @@ Blu, blu, blu... \end{tdoclatex} \section{Historique} -\tdocversion{1.2.0}[2024-08-23] +\tdocversion{1.2.0-a}[2024-08-23] \begin{tdocupdate} \item \tdocmacro{tdocversion} |