Debian Codegraph @

texmf-dist/source/latex/linguistix/linguistix.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: linguistix.dtx
4 %
5 % ----------------------------------------------------------
6 % The LaTeX bundle LinguisTiX v1.0
7 % Copyright © 2025, 2026 निरंजन
8 %
9 % This program is free software: you can redistribute it
10 % and/or modify it under the terms of the GNU General Public
11 % License as published by the Free Software Foundation,
12 % either version 3 of the License, or (at your option) any
13 % later version.
14 %
15 % This program is distributed in the hope that it will be
16 % useful, but WITHOUT ANY WARRANTY; without even the implied
17 % warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 % PURPOSE. See the GNU General Public License for more
19 % details.
20 %
21 % You should have received a copy of the GNU General Public
22 % License along with this program. If not, see
23 % <https://www.gnu.org/licenses/>.
24 % ----------------------------------------------------------
25 %
26 % \fi
27 % \iffalse
28 %<*internal>
29 \iffalse
30 %</internal>
31 %<*readme>
32 ------------------------------------------------------------
33 Bundle: LinguisTiX
34 Version: v1.0
35 Author: निरंजन
36 Description: Enhanced support for linguistics.
37 Repository: puszcza.gnu.org.ua/projects/linguistix
38 License: GPLv3+
39 ------------------------------------------------------------
40 %</readme>
41 %<*internal>
42 \fi
43 %</internal>
44 %<*driver>
45 \begin{filecontents}[overwrite]{\jobname.bib}
46 @book{bringhurst,
47 title = {The elements of typographic style},
48 author = {Bringhurst, Robert},
49 date = {2004},
50 publisher = {Point Roberts, WA: Hartley \& Marks,
51 Publishers},
52 edition = {4}
53 }
54 @online{alan,
55 author = {Munn, Alan and Gregorio, Enrico},
56 title = {{\textsf{ExPex} fails with
57 \textsf{unicode-math}. How to avoid the clash?}},
58 url = {https://tex.stackexchange.com/q/703094},
59 date = {2023-12-05},
60 urldate = {2025-12-21}
61 }
62 \end{filecontents}
63 \documentclass{l3doc}
64 \usepackage{unicode-math}
65 \usepackage{linguistix}
66 \usepackage{xcolor}
67 \usepackage{longtable}
68 \usepackage{fontawesome5}
69 \usepackage{hyperxmp}
70 \usepackage[verbose=silent]{microtype}
71 \usepackage{cleveref}
72 \usepackage{hologo}
73 \linguistix{old style one,languages={british,marathi}}
74 \usepackage[style=authoryear,backend=biber]{biblatex}
75 \addbibresource{\jobname.bib}
76
77 \setlength{\LTpost}{0pt}
78 \setlength{\LTcapwidth}{4.5in}
79
80 \DeclareMicrotypeAlias{NewCMUncial10-Book.otf}{TU-basic}
81 \setquotestyle{british}
82
83 \colorlet{lngxredcolor}{red!50!black}
84 \colorlet{lngxyellowcolor}{yellow!50!black}
85 \colorlet{lngxgreencolor}{green!50!black}
86 \colorlet{lngxbluecolor}{blue!50!black}
87
88 \setmathfont[%
89 CharacterVariant = {1},%
90 version = {emptyset}%
91 ]{NewCMMath-Book.otf}
92
93 \IfPackageLoadedT{lua-unicode-math}{%
94 \DeclareMathVersion{emptyset}%
95 }
96
97 \urlstyle{tt}
98
99 \hypersetup{%
100 unicode,%
101 colorlinks,%
102 linkcolor = {lngxredcolor},%
103 citecolor = {lngxgreencolor},%
104 urlcolor = {lngxbluecolor},%
105 pdftitle = {The LinguisTiX bundle},%
106 pdfauthor = {निरंजन},%
107 pdfsubject = {%
108 Enhanced support for linguistics.%
109 },%
110 pdfcreator = {निरंजन},%
111 pdfkeywords = {Linguistics, LaTeX},%
112 pdfcopyright = {%
113 The LaTeX bundle LinguisTiX\textLF
114 Copyright © 2025, 2026 निरंजन\textLF
115 This program is free software: you can redistribute it
116 and/or modify it under the terms of the GNU General
117 Public License as published by the Free Software
118 Foundation, either version 3 of the License, or (at your
119 option) any later version.%
120 },%
121 pdflicenseurl = {gnu.org/licenses/gpl-3.0.html}%
122 }%
123
124 \newfontfamily\newcmnewone[%
125 IgnoreFontspecFile,%
126 Numbers = {OldStyle}%
127 ]{NewCM10-Book.otf}
128
129 \newfontfamily\newcmnewnum[%
130 IgnoreFontspecFile%
131 ]{NewCM10-Book.otf}
132
133 \newfontfamily\mrfnt[%
134 IgnoreFontspecFile,%
135 Script = {Devanagari},%
136 Language = {Marathi},%
137 Renderer = {HarfBuzz}%
138 ]{Mukta-Light.ttf}
139
140 \newfontfamily\lngxcondensed[%
141 IgnoreFontspecFile,%
142 FakeStretch = {0.6},%
143 BoldFont = {NewCMMono10-Bold.otf},%
144 ItalicFont = {NewCMMono10-BookItalic.otf},%
145 Renderer = {HarfBuzz}%
146 ]{NewCMMono10-Book.otf}
147
148 \makeatletter
149
150 \setlength{\columnsep}{2pc}
151 \setlength{\columnseprule}{0.2pt}
152
153 \NewDocumentCommand \lngxtoc { } {%
154 %% Courtesy: John Kormylo
155 %% https://tex.stackexchange.com/a/606678
156 %% CC-BY-SA 4.0 International
157 \setcounter{tocdepth}{1}%
158 \section*{%
159 \makebox[\linewidth][l]{\contentsname}%
160 \@mkboth{%
161 \MakeUppercase{\contentsname}%
162 }{%
163 \MakeUppercase{\contentsname}%
164 }%
165 }%
166 \begin{multicols}{2}%
167 \small
168 \begingroup
169 \hypersetup{hidelinks}%
170 \@starttoc{toc}%
171 \endgroup
172 \end{multicols}%
173 }
174
175 \NewDocumentCommand \lngxdocumentation { m } {%
176 \section[\csname lngx#1logo\endcsname]{%
177 \csname lngx#1logo\endcsname\hfill
178 \hyperref[lngx#1l3]{%
179 \footnotesize\LaTeX3-interface%
180 } \textbar{}
181 \hyperref[lngx#1imp]{%
182 \footnotesize Implementation%
183 }%
184 }%
185 \label{lngx#1doc}%
186 \addtocontents{toc}{%
187 % Courtesy: samcarter
188 % https://topanswers.xyz/tex?q=8120
189 % LPPL 1.3c+
190 \hspace*{0.5em}%
191 \texorpdfstring{%
192 \begingroup
193 \scriptsize
194 Interface\dots\
195 \hyperref[lngx#1l3]{%
196 \color{lngxredcolor}%
197 \textsf{%
198 \pageref{lngx#1l3}%
199 }%
200 };
201 \scriptsize
202 Implementation\dots\
203 \hyperref[lngx#1l3]{%
204 \color{lngxredcolor}%
205 \texttt{%
206 \addfontfeatures{%
207 Numbers=OldStyle,CharacterVariant={6}%
208 }%
209 \pageref{lngx#1imp}%
210 }%
211 }%
212 \endgroup
213 }{%
214 \csname lngx#1logo\endcsname
215 }%
216 }%
217 }
218
219 \NewDocumentCommand \lngxinterface { m } {%
220 \phantomsection
221 \subsection*{%
222 \csname lngx#1logo\endcsname\hfill
223 \hyperref[lngx#1doc]{%
224 \footnotesize Documentation%
225 } \textbar{}
226 \hyperref[lngx#1imp]{%
227 \footnotesize Implementation%
228 }%
229 }%
230 \label{lngx#1l3}%
231 }
232
233 \NewDocumentCommand \lngximplementation { m } {%
234 \phantomsection
235 \subsection*{%
236 \csname lngx#1logo\endcsname\hfill
237 \hyperref[lngx#1doc]{%
238 \footnotesize Documentation%
239 } \textbar{}
240 \hyperref[lngx#1l3]{%
241 \footnotesize\LaTeX3-interface%
242 }%
243 }%
244 \label{lngx#1imp}%
245 }
246
247 \NewDocumentCommand \bLaTeX { } {%
248 (\kern-0.035em\relax
249 L\kern-.81ex\relax
250 \raisebox{.6ex}{\textsc{a}}\kern-.23ex\relax
251 )\kern-0.065em\relax
252 \hbox{T}\kern-.4ex\relax
253 \raisebox{-.5ex}{E}\kern-.3ex\relax
254 X%
255 }
256 \makeatother
257
258 \colorlet{lngxpurplecolor}{blue!50!red}
259
260 \def\lngxtval{%
261 \begingroup
262 \color{lngxredcolor}%
263 true%
264 \endgroup
265 \,|\,false%
266 }
267
268 \def\lngxfval{%
269 true%
270 \,|\,%
271 \begingroup
272 \color{lngxredcolor}%
273 false%
274 \endgroup
275 }
276
277 \def\lngxbothval{
278 \begingroup
279 \color{lngxyellowcolor}%
280 true%
281 \,|\,%
282 false%
283 \endgroup
284 }
285
286 \ExplSyntaxOn
287 \cs_new_protected:Npn \lngx_plain_logo:n #1 {
288 \group_begin:
289 \lngx_logo_font:
290 LinguisTi
291 \color_group_begin:
292 \color_select:n { lngx_purple_color }
293 X
294 \color_group_end:
295 -
296 #1
297 \group_end:
298 }
299
300 \cs_gset_eq:NN \plainlngxlogo \lngx_plain_logo:n
301
302 \msg_redirect_name:nnn { l3doc }
303 { foreign-internal }
304 { none }
305
306 \RenewDocumentCommand \lngxlogo { O{} } {%
307 \group_begin:
308 \hypersetup { hidelinks }
309 \hyperref [
310 lngx
311 \IfBlankTF { #1 } { } { #1 doc }
312 ] {
313 \lngx_logo_font:
314 LinguisTi
315 \color_group_begin:
316 \color_select:n { lngx_purple_color }
317 X
318 \color_group_end:
319 \IfBlankF { #1 } { - #1 }
320 }
321 \group_end:
322 }
323
324 \NewDocumentCommand \fn { v }{
325 \phantomsection
326 \__codedoc_function_index:n { #1 }
327 \__codedoc_function_label:nN { #1 } \c_false_bool
328 #1
329 }
330
331 \RenewDocumentCommand \MacroLongFont { } {
332 \lngxcondensed
333 }
334 \ExplSyntaxOff
335
336 \makeatletter
337 \NewDocumentCommand \supportfootnote { +m } {%
338 \begingroup
339 \def\thefootnote{}%
340 \let\@makefnmark\relax
341 \let\@makefntext\relax
342 \let\hyper@makecurrent\@empty
343 \footnotetext{%
344 \hspace*{-\parindent}%
345 #1%
346 }%
347 \endgroup
348 }
349
350 \renewenvironment{theindex}{%
351 \index@prologue
352 \medskip
353
354 \let\item\@idxitem \ignorespaces
355 }{}
356 \makeatother
357
358 \begin{document}
359 \DocInput{\jobname.dtx}
360 \end{document}
361 %</driver>
362 % \fi
363 % \title{^^A
364 % \phantomsection\label{lngx}^^A
365 % The \lngxpkg\ bundle^^A
366 % }
367 % \author{निरंजन}
368 % \date{^^A
369 % \today\ (v1.0)\\[1ex]^^A
370 % {^^A
371 % \small\faIcon{home}\quad
372 % \url{^^A
373 % https://ctan.org/pkg/linguistix^^A
374 % }\\[0.5ex]^^A
375 % \small\faIcon{git-alt}\quad
376 % \url{^^A
377 % https://puszcza.gnu.org.ua/projects/linguistix^^A
378 % }\\[0.5ex]^^A
379 % \small\faIcon[regular]{comments}\quad
380 % \url{^^A
381 % https://matrix.to/\#/\#linguistix:matrix.org^^A
382 % }^^A
383 % }^^A
384 % }
385 %
386 % \maketitle
387 %
388 % \supportfootnote{^^A
389 % The \lngxpkg\ bundle
390 %
391 % \noindent
392 % Copyright © 2025, 2026 निरंजन
393 %
394 % This program is free software: you can redistribute it
395 % and/or modify it under the terms of the \textsc{gnu}
396 % General Public License as published by the Free Software
397 % Foundation, either version 3 of the License, or (at your
398 % option) any later version.
399 %
400 % This program is distributed in the hope that it will be
401 % useful, but \emph{\textbf{without any warranty}};
402 % without even the implied warranty of
403 % \emph{\textbf{merchantability}} or \emph{\textbf{fitness
404 % for a particular purpose}}. See the \textsc{gnu} General
405 % Public License for more details.
406 %
407 % You should have received a copy of the \textsc{gnu}
408 % General Public License along with this program. If not,
409 % see \url{https://www.gnu.org/licenses/}.^^A
410 % }
411 %
412 % \begin{documentation}
413 %
414 % \begin{abstract}
415 % There are quite a few \LaTeX\ packages that support
416 % typesetting in linguistics, but most of them lack a
417 % modern \LaTeX-like users syntax as well as a programming
418 % interface. The \lngxpkg\ bundle fills this gap. It
419 % contains several packages enhancing the general support
420 % for linguistics in \LaTeX. This is a comprehensive
421 % documentation of the same comprising of three parts. The
422 % first one is the general users manual, the second one
423 % documents the programming interface of the bundle,
424 % whereas the last one is the documented implementation of
425 % all the packages.
426 % \end{abstract}
427 %
428 % \lngxtoc ^^A Custom command defined in the preamble.
429 %
430 % \newpage
431 %
432 % ^^A Based on egreg’s answer:
433 % ^^A https://tex.stackexchange.com/a/102849
434 % \begingroup
435 % \thispagestyle{empty}^^A no header and footer.
436 % \vspace*{\stretch{1}}^^A some space at the top.
437 % \itshape ^^A to get the text in italics.
438 % \raggedleft ^^A flush to the right margin.
439 % Dedicated to Renuka who taught me rigour under the guise
440 % of linguistics\dots
441 % \par ^^A end the paragraph
442 % \vspace{\stretch{3}} ^^A space at bottom is thrice that
443 % \endgroup
444 % \newpage
445 %
446 % \section{Introduction}
447 %
448 % Linguistics is a discipline that studies the phenomenon of
449 % language and for this linguists analyse data from
450 % languages across the globe. In order to be able to present
451 % the data that is collected for this, linguists use several
452 % representational methods that lead to a fiasco when their
453 % typesetting is considered. In order to understand the
454 % complexity of the task at hand, first, let’s have a look
455 % at some of the problem cases. If you are an impatient
456 % reader and are just willing to read the users manual, you
457 % may skip reading the current section and start with
458 % \cref{lngxbasedoc} and the ones following it.
459 %
460 % \subsection{Phonetic symbols}
461 %
462 % Speech sounds are the building blocks of many human
463 % languages and the data collected from languages demands an
464 % unambiguous method of representation which is served by
465 % the International Phonetic Alphabet. For the longest time,
466 % the \textsc{tipa} package
467 % (\url{https://ctan.org/pkg/tipa}) was the one that
468 % produced phonetic symbols in \bLaTeX. Visually, it matches
469 % the default Computer Modern design of \bLaTeX, but
470 % \textsc{tipa} is not Unicode. It is set in a legacy
471 % encoding. With the recent developments, the New Computer
472 % Modern family supports all the \textsc{ipa} characters
473 % (even the ones that are missing in \textsc{tipa}). They
474 % are created keeping in mind the principles of Knuth’s
475 % Computer Modern. Additionally, the family also supports
476 % sans serif (recommended in presentations) and mono
477 % (recommended in coding context) families. It supports two
478 % weights, i.e., book and regular respectively. The book
479 % weight is slightly thicker than the regular weight, but
480 % the regular one matches the thickness of the Computer
481 % Modern design. Because of the increased thickness, the
482 % former looks better. The current document, for example, is
483 % typeset in the book weight of New Computer Modern. If you
484 % are like me, you probably don’t like using
485 % non-\LaTeX-fonts. The good news is that the requirements
486 % of linguistics are very well fulfilled by the recent
487 % developments in the New Computer modern family and it
488 % \emph{does} belong to the fraternity of \LaTeX-fonts.
489 %
490 % Apart from this, there are some other advantages of the
491 % New Computer Modern fonts. The \textsc{ipa} distinguishes
492 % between \ipatext{a} and \ipatext{ɑ}, but unfortunately, in
493 % Italic shape, the latter is a variant of the former. E.g.,
494 % |[a\textit{a}]| produces \enquote{[a\textit{a}]}. Whenever
495 % an author uses Italic shape for their transcription and
496 % use |a|, a wrong \textsc{ipa} symbol is printed with most
497 % fonts. This problem was kindly acknowledged by Antonis
498 % Tsolomitis, the developer of New Computer Modern. In the
499 % stylistic set dedicated for linguistics, the correct shape
500 % was added to the Italic shape by him. Thus,
501 % |\ipatext{a\textit{a}}| (a command from \lngxipalogo)
502 % renders \enquote{\ipatext{a\textit{a}}}. The package
503 % enables New Computer Modern family with stylistic set 05
504 % dedicated for \textsc{ipa}. It also adds the brackets or
505 % slashes around the argument as explained in
506 % \cref{lngxipadoc}.
507 %
508 % A similar problem is with the character |g|. E.g.,
509 % |[g\textit{g}]| produces \enquote{[g\textit{g}]}. Here,
510 % the situation is the other way round. The upright
511 % \enquote{g} is not recognised by the \textsc{ipa}. The
512 % \textsc{ipa} charts generally have the upright version of
513 % the Italic shape. To see what this means, try
514 % |\ipatext{g\textit{g}}|. It produces
515 % \ipatext{g\textit{g}} and not [g\textit{g}].
516 %
517 % In order to avail all of these features, I have set New
518 % Computer Modern as the default font-family of \lngxpkg.
519 % The bundle provides options to control these defaults.
520 % Users can use their preferred text and \textsc{ipa} fonts.
521 % There also is an option to use the regular weight of NewCM
522 % instead of the book weight.
523 %
524 % \section{Funding}
525 %
526 % I am a doctorate student without a fellowship (thanks to
527 % our education policies!) currently sustaining only with a
528 % full time job unrelated to linguistics that consumes most
529 % of my working hours. At times, it becomes difficult to
530 % continue the research, the job and the passion development
531 % projects. \lngxpkg\ needs funding in order to sustain. If
532 % you think you can support it, you can contact me on the
533 % email \textsc{id} found on the front page.
534 %
535 % As of 2025-05-29, I have recieved funding from the \TeX\
536 % users group’s \TeX\ development fund. They have decided to
537 % support the development of \enquote{linguistix-glossing}
538 % (the logo will be available once the package is ready).
539 %
540 % An experimental version of \lngxglossinglogo\ is released
541 % on 2026-01-19. This version is for testing and getting
542 % feedback from the community. This marks the completion of
543 % the first grant provided by the \TeX\ users group’s. The
544 % project will still continue to develop further, so funding
545 % initiatives will be highly appreciated.
546 %
547 % \section{Acknowledgements}
548 %
549 % This package relies the most on the New Computer Modern
550 % font family. I would like to express my gratitude to
551 % Antonis Tsolomitis who tirelessly worked on the set of
552 % \textsc{ipa} symbols and brought back the good old charm
553 % of \textsc{tipa}’s design in the modern Unicode world. I
554 % would like to thank Renuka and Avinash who taught me
555 % linguistics. They nourished my passion, helped me pursue
556 % my love for the subject as well as the computation that
557 % came along with it. I could have never imagined myself
558 % working on a package written in \LaTeX3’s syntax. Not so
559 % long ago, I used to find it very complicated. It’s mostly
560 % Jonathan Spratte and Florent Rougon’s help (and, at times,
561 % scolding :P) that helped me get used to it. I would also
562 % like to mention C.V.\ Radhakrishnan for being an important
563 % part of my journey in \LaTeX. Lastly, to all the free
564 % software people who have created this friendly and
565 % supportive world for people by investing their precious
566 % time and resources!
567 %
568 % Hardly in a week after the initial release, the \TeX\
569 % users group decided to financially support the development
570 % of a planned package in the bundle. I am grateful to them
571 % for their support.
572 %
573 % Throughout the development of \lngxglossinglogo, Shireen
574 % Irani helped me with her valuable comments regarding the
575 % accessibility needs in the field of linguistics. I thank
576 % her for her constant support.
577 % \section*{Documentation}
578 %
579 % The bundle is comprised of several packages that are
580 % developed for different purposes. In order to load all the
581 % packages of the bundle, one can issue:
582 %
583 % \begin{verbatim}
584 % \usepackage{linguistix}
585 % \end{verbatim}
586 %
587 % This is the easiest method for getting all of
588 % \lngxpkg\ in one go. But, if you don’t need all the
589 % packages of the bundle, you may load the required packages
590 % separately. We will start with the elementary package that
591 % sets up things for other packages of the bundle.
592 %
593 % \lngxdocumentation{base}
594 %
595 % This package provides a single command that is used in all
596 % the other packages of the bundle. The command is:
597 %
598 % \begin{function}{\linguistix}
599 % \begin{syntax}
600 % \marg{key-value-list}
601 % \end{syntax}
602 % We have a single set of keys for the entire bundle. Each
603 % package appends keys to the same set. The argument of this
604 % central processor command is the comma-separated
605 % \meta{key-value-list}. So you can load any package of
606 % \lngxpkg\ and use the \cs[no-index]{linguistix} command.
607 % The only exception to this is \lngxnfsslogo. We will see
608 % how it is different in its section.
609 % \end{function}
610 %
611 % \lngxdocumentation{fixpex}
612 %
613 % This package offers a fix for the clash between
614 % \pkg{expex} and \pkg{(lua)-unicode-math}. It provides a
615 % single command.
616 %
617 % \begin{function}{\umgla}
618 % This is a replica of the \pkg{(lua)-unicode-math}-|\gla|.
619 % Since the \pkg{expex}-|\gla| is more relevant in
620 % linguistics, I set it as the default. If one needs to use
621 % \pkg{(lua)-unicode-math}-|\gla|, they can use this
622 % command.
623 % \end{function}
624 %
625 % \lngxdocumentation{fonts}
626 %
627 % This is a package that loads the New Computer Modern
628 % family for the entire document. The package sets fonts for
629 % both text and math. It has keys for customisation for
630 % both. Note that just loading this package does \emph{not}
631 % provide any support for \textsc{ipa}. For that one needs
632 % \lngxipalogo\ separately.
633 %
634 % Antonis suggested a typographic enhancement for the logo
635 % of \LaTeX. The default logo scales the \enquote{A} and
636 % that affects the \enquote{colour} of the font. This is why
637 % I renew the logo with the code given by Antonis. The
638 % original logo is also available with an alternative
639 % command.
640 %
641 % \begin{function}{\LaTeX,\ogLaTeX}
642 % \begin{syntax}
643 % {\normalfont\LaTeX}
644 % {\normalfont\ogLaTeX}
645 % \end{syntax}
646 % \end{function}
647 %
648 % The package provides only these commands. Let’s now have a
649 % look at the keys provided for the text.
650 %
651 % \subsection{Text}
652 %
653 % Most keys of this package are prefixed with the |text| in
654 % order to distinguish them from the maths and \textsc{ipa}
655 % ones. There aren’t any commands provided by the package.
656 % Most of the important features of the \pkg{fontspec}
657 % packakge are variablised with \pkg{l3keys}.
658 %
659 % The \enquote{old style numbers} have varying heights. Some
660 % numbers have ascenders and some have descenders (e.g.,
661 % 6789). According to \cite{bringhurst}, this makes them
662 % easier to read in running text. Lining numbers, on the
663 % other hand have uniform heights. They go well with all
664 % capital text (rare). Thus, for the general text, I enable
665 % this setting by default in \lngxfontslogo.
666 %
667 % Apart from that, the New Computer Modern font family
668 % provides an old-style shape for the number \enquote{1}
669 % (this exact shape!), but it is provided as a character
670 % variant. Different fonts may use these arbitrary slots for
671 % any character’s alternation. Therefore this setting should
672 % not be loaded blindly. Let’s have a look at the keys that
673 % can be employed to change these behaviours. The possible
674 % and the default values of keys are given at the right side
675 % in the documentation and the defaults are highlighted in
676 % red.
677 %
678 % \begin{function}{old style numbers,old style one}
679 % \begin{syntax}
680 % = \marg{truth value}\hfill\lngxbothval
681 % = \marg{truth value}\hfill\lngxfval
682 % \end{syntax}
683 % Note that the colour of the available options for the
684 % |old style numbers| key is yellow. It is on purpose like
685 % that to suggest that the default selection of its truth
686 % value is not unconditional. Let’s look into why it is so.
687 % \end{function}
688 %
689 % Old style numbers are among the peculiar features of the
690 % Latin script. It has many letters that have ascenders and
691 % many that have descenders. Although, this is observed in
692 % the Latin script, it is not a robust feature seen in all
693 % the scripts. E.g., Cyrillic script has very sparse number
694 % of them or scripts like Japanese do not have any of them
695 % at all. The languages that use non-Latin script seem to
696 % prefer to avoid old style numbers as they may create an
697 % obstacle in the natural reading flow. This was brought to
698 % my notice by Alexey Kuznetsov while developing the
699 % language package of Russian and I thank him very much for
700 % raising this important issue. Starting from version 0.9c,
701 % old style numbers are \emph{not} set by default. But this
702 % is mostly not a breaking change, at least for English
703 % documents. They still are set globally with the English
704 % language packages. They also are set if
705 % \lngxlanguageslogo\ package is not loaded till the end of
706 % the document. So, if you were just using \lngxfontslogo\
707 % package, there is no change for you, but if your document
708 % was written in any other language supported by \lngxpkg,
709 % then you won’t see the default old style numbers that you
710 % used to see prior to this version. This is why the colour
711 % of the available options is yellow as the default value is
712 % not fixed.
713 %
714 % Note that printing old style numbers also depends on
715 % whether the font you select has old style numbers or not.
716 % The relevant settings are added by the package to the font
717 % automatically, but while selecting the font, make sure
718 % whether the old style table is present in the font or not.
719 % Otherwise you may get a (harmless) warning.
720 %
721 % Suppose one wants the alternative shape of number
722 % \enquote{1} from the New Computer Modern family, they may
723 % use the key |old style one| (default is false; adding
724 % |true| is optional).
725 %
726 % Let’s have a look at the three way distinction we get
727 % because of this.
728 %
729 % \begin{quote}
730 % {\newcmnewone 0123456789}\hfill
731 % \begingroup
732 % \ttfamily\footnotesize\color{lngxredcolor}^^A
733 % Old style with default 1^^A
734 % \endgroup
735 %
736 % 0123456789\hfill
737 % \texttt{\footnotesize Old style with the old 1}^^A
738 %
739 % {\newcmnewnum 0123456789}\hfill
740 % \texttt{\footnotesize Lining}^^A
741 % \end{quote}
742 %
743 % \begin{function}{^^A
744 % newcm,newcm sans,newcm mono,^^A
745 % newcm regular,newcm regular sans,newcm regular mono^^A
746 % }
747 % These are some keys that come in handy for setting New
748 % Computer Modern defaults. All the necessary values are
749 % stored in these. The keys that have |regular| in their
750 % names refer to the \enquote{regular} variants of New
751 % Computer Modern fonts. These variants match the colour and
752 % widths of the Latin Modern fonts. One may use these keys
753 % to override the defaults.
754 % \end{function}
755 %
756 % \subsection{Maths}
757 %
758 % \lngxfontslogo\ sets maths fonts also. I have used
759 % \pkg{lua-unicode-math} package which is faster and which
760 % is said to be the future of maths in \LaTeX. But, as of
761 % now it is highly experimental. If you want to stick to the
762 % stable \pkg{unicode-math} package. The trick is simply to
763 % load the same before loading \lngxpkg. That will suppress
764 % the loading of \pkg{lua-unicode-math}. In order to control
765 % the settings related to maths, the following keys can be
766 % used.
767 %
768 % \begin{function}{^^A
769 % math,math features,math bold,math bold features^^A
770 % }
771 % \begin{syntax}
772 % = \marg{math font}
773 % = \marg{math font features}
774 % = \marg{bold math font}
775 % = \marg{bold math font features}
776 % \end{syntax}
777 % The |math| and |math bold| keys set the respective fonts
778 % (i.e., regular and bold fonts for mathematics
779 % respectively). The keys suffixed with |features| set the
780 % font features of the same.
781 % \end{function}
782 %
783 % \begin{function}{bourbaki's empty set}
784 % \begin{syntax}
785 % = \marg{truth value}\hfill\lngxtval
786 % \end{syntax}
787 % In \bLaTeX, the default shape of the \enquote{empty set}
788 % symbol is: \enquote{\mathversion{emptyset}$\emptyset$},
789 % but the symbol used by the Bourbaki group is still
790 % considered more correct and preferred by many (including
791 % me). New Computer Modern Math fonts provide it by default
792 % and the slashed zero is provided as a character variant.
793 % Since the Unicode-correct |$\emptyset$| is activated by
794 % the package, it always renders: \enquote{$\emptyset$} and
795 % not: \enquote{\mathversion{emptyset}$\emptyset$}. In order
796 % to change this behaviour, one may use this key and set it
797 % to false for getting the slashed-zero of original \bLaTeX.
798 % Hail plumbers union, \emph{\textsc{iykyk}! ;-)}
799 % \end{function}
800 %
801 % \newpage
802 %
803 % \lngxdocumentation{glossing}
804 %
805 % This package provides a suit for creating interlinear
806 % glosses. It is supported by \TeX\ users group’s devfund.
807 % The package attempts to be an all-in-one solution for
808 % glossing. It doesn’t provide any particular glosses. It
809 % only provides a method to create them. Using it, one may
810 % easily create packages like \plainlngxlogo{leipzig} to
811 % support a set of glosses. The glosses created by the
812 % package use the new code of the \LaTeX\ project as they
813 % are created in a tagging aware manner. Each gloss sets a
814 % hyperlink to its position in the list of glosses. Let’s
815 % take a look at its commands and options.
816 %
817 % \begin{function}{\glx,\glx*}
818 % \begin{syntax}
819 % \marg{comma separated list of glosses}
820 % \marg{comma separated list of glosses}
821 % \end{syntax}
822 % These simple commands take a comma separated list as their
823 % argument. All the items from the list are glosses (either
824 % created by the user or provided by a package). Cases of
825 % the items given in the list are ignored. Spaces around the
826 % items are ignored. The regular unstarred command prints
827 % the glosses related to each of the item in the comma
828 % separated list, whereas the starred variant prints their
829 % expansions. Have a look at the following example.
830 % \end{function}
831 %
832 % \rule{0.7\linewidth}{0.5pt}
833 %
834 % \begin{verbatim}
835 % \DocumentMetadata{tagging=on,lang={en-GB}}
836 % \documentclass{article}
837 % \usepackage{linguistix}
838 %
839 % \begin{document}
840 % \glx{prs,pst}\par
841 % \glx{ prs, pst }\par
842 % \glx{ Prs,pSt}
843 %
844 % \glx*{prs,pst}\par
845 % \glx*{ prs, pst }\par
846 % \glx*{ Prs,pST}
847 % \end{document}
848 % \end{verbatim}
849 %
850 % \rule{0.7\linewidth}{0.5pt}
851 %
852 % \medskip
853 %
854 % The expansions of \glx{pst} and \glx{prs} (from
855 % \plainlngxlogo{leipzig} package) are \glx*{pst} and
856 % \glx*{prs} respectively. This example produces identical
857 % output in three lines for glosses and the same for its
858 % expansions. Notice that there is no format to the cases of
859 % the glosses and similarly one level of spaces are trimmed.
860 %
861 % \begin{function}{\newgloss,\renewgloss}
862 % \begin{syntax}
863 % \marg{gloss} \marg{expansion}
864 % \marg{gloss} \marg{expansion}
865 % \end{syntax}
866 % These commands create a new gloss or renew an existing
867 % one. They can be accessed with the \cs{glx} command as
868 % explained above. Using \cs{renewgloss} mid-document is not
869 % recommended as it will erase the data of page numbers for
870 % the previous (renewed) version of it.
871 % \end{function}
872 %
873 % \begin{function}{\listofglosses}
874 % \begin{syntax}
875 % \oarg{setup keys}
876 % \end{syntax}
877 % This command prints the list of glosses using the default
878 % settings. If the optional argument is used, the
879 % adjustments are made locally only for a single run. E.g.:
880 % \end{function}
881 %
882 % \listofglosses
883 %
884 % \begin{function}{\setupglossing}
885 % \begin{syntax}
886 % \marg{keys for formatting glosses}
887 % \end{syntax}
888 % This command takes one argument, i.e., the keys that
889 % control everything regarding the use of glosses and their
890 % expansions. The keys it takes are described in the section
891 % that follows.
892 % \end{function}
893 %
894 % \subsection{Setting up the glosses}
895 %
896 % The following keys can be passed to the command
897 % \cs{setupglossing}. They control the printing along with a
898 % lot of other things regarding glosses. All the
899 % customisation offered by the package can be accessed via
900 % this command.
901 %
902 % \begin{function}{format}
903 % \begin{syntax}
904 % = \marg{formatted element gloss/expansion}\hfill^^A
905 % gloss\,\textbar\,expansion
906 % \end{syntax}
907 % The |format| key is used for setting the format of either
908 % the gloss or the expansion. It’s a meta key that takes
909 % other key-val pair in the argument. The nested keys
910 % control the formatting of the respective elements.
911 % \end{function}
912 %
913 % \begin{function}{gloss,expansion}
914 % \begin{syntax}
915 % = \marg{formatting commands for glosses}\hfill^^A
916 % {\color{lngxredcolor}|\textsc{#1}|}
917 % = \marg{formatting commands for glosses}
918 % \end{syntax}
919 % These keys only work inside the meta key |format|. They
920 % set the commands that print either the gloss or the
921 % expansion. |#1| refers to the printed text of them. No
922 % special formatting is applied to expansions by default,
923 % but glosses are by default printed in \cs{textsc}.
924 % \end{function}
925 %
926 % \begin{function}{link color}
927 % \begin{syntax}
928 % = \marg{link color}\hfill{\color{lngxredcolor}black}
929 % \end{syntax}
930 % This option locally sets the colour for the hyperlinks. By
931 % default they are set to the black colour.
932 % \end{function}
933 %
934 % \begin{function}{sort}
935 % \begin{syntax}
936 % = \marg{sorting style}\hfill^^A
937 % {\color{lngxredcolor}alphabetical}\,\textbar\,use
938 % \end{syntax}
939 % This key controls how the keys printed in the list of
940 % glosses are ordered. They may be ordered alphabetically or
941 % following the sequence in which they were used, the former
942 % being the default.
943 % \end{function}
944 %
945 % \begin{function}{expansion case}
946 % \begin{syntax}
947 % = \marg{case}\hfill{\color{lngxredcolor}lowercase}^^A
948 %\,\textbar\,title case all\,\textbar\,title case first
949 % \end{syntax}
950 % The expansion can be printed in one of these three cases.
951 % The default printing happens in lowercase.
952 % \end{function}
953 %
954 % \begin{function}{style}
955 % \begin{syntax}
956 % = \marg{glossary style}\hfill^^A
957 % {\color{lngxredcolor}block}\,\textbar\,inline
958 % \end{syntax}
959 % The package offers two styles. The |inline| style prints
960 % the glosses and their expansions without page numbers in
961 % the flowing text, whereas the |block| style, in default
962 % settings prints them in a multicolumn block with an
963 % unnumbered section with the glossary name.
964 % \end{function}
965 %
966 % \begin{function}{columns}
967 % \begin{syntax}
968 % = \marg{number of columns}\hfill{\color{lngxredcolor}2}
969 % \end{syntax}
970 % The block style of glosses is printed in multicolumn
971 % layout by default. If the number of columns has to be
972 % adjusted, this key shall be used. The default value of it
973 % is 2. It works with only one column too.
974 % \end{function}
975 %
976 % \begin{function}{page numbers}
977 % \begin{syntax}
978 % = \marg{truth value}\hfill\lngxtval
979 % \end{syntax}
980 % By default, page numbers on which a particular gloss was
981 % used are printed in the |block| style. This can be turned
982 % off with this bool key.
983 % \end{function}
984 %
985 % \begin{function}{sectioning}
986 % \begin{syntax}
987 % = \marg{section level}\hfill{\color{lngxredcolor}section}
988 % \end{syntax}
989 % In |block| style, a section heading is printed. In order
990 % to choose the level of sectioning, this command can be
991 % used. The default is |section| which can be changed to any
992 % other desired level. In addition the key allows an option
993 % |null| which suppresses the use of any section heading.
994 % \end{function}
995 %
996 % \begin{function}{section number}
997 % \begin{syntax}
998 % = \marg{truth value}\hfill\lngxfval
999 % \end{syntax}
1000 % By default, the section number for the glossary is turned
1001 % off, but if one wants to print it, this bool key can be
1002 % used with the |true| value.
1003 % \end{function}
1004 %
1005 % \begin{function}{no bold}
1006 % \begin{syntax}
1007 % = \marg{truth value}\hfill\lngxfval
1008 % \end{syntax}
1009 % Generally, the glosses are printed in bold inside
1010 % glossary. Some fonts don’t have bold small caps (e.g.,
1011 % Latin Modern). If you need to stick to them, you can use
1012 % this inverse bool key with true value in order to obtain
1013 % non-bold glosses.
1014 % \end{function}
1015 %
1016 % \begin{function}{separator}
1017 % \begin{syntax}
1018 % = \marg{separator between glosses or expansions}
1019 % \end{syntax}
1020 % This is a context-sensitive key. If used with \cs{glx},
1021 % then it sets the separator between the glosses (|,␣|~is
1022 % the default). If used with \cs{glx*}, it sets the
1023 % separator between the expansions (|,␣|~is the default) and
1024 % if used with the \cs{listofglosses}, it sets the separator
1025 % between glosses and their expansions (|:␣|~is the
1026 % default).
1027 % \end{function}
1028 %
1029 % \begin{function}{entry separator}
1030 % \begin{syntax}
1031 % = \marg{separator between pairs of glosses and expansions}
1032 % \end{syntax}
1033 % Each pair of gloss and its expansion is separated using a
1034 % token list controlled by this key. The default is |\par|.
1035 % \end{function}
1036 %
1037 % \newpage
1038 %
1039 % \lngxdocumentation{ipa}
1040 %
1041 % This package sets the fonts exclusively for the
1042 % \textsc{ipa}. The commands provided for switching to the
1043 % \textsc{ipa} control all serif, sans serif and typewriter
1044 % families. This package can be loaded standalone for
1045 % loading \textsc{ipa} fonts as well as some switch commands
1046 % useful in running text. New Computer Modern provides a
1047 % special stylistic set dedicated for linguistics. It is
1048 % enabled for \textsc{ipa} fonts automatically with this
1049 % package. Only the legally marked up \textsc{ipa} is
1050 % affected by the customisation provided by this package.
1051 % For switching to the \textsc{ipa}, \lngxipalogo\ provides
1052 % one command with a starred variant.
1053 %
1054 % \begin{function}{\ipatext,\ipatext*}
1055 % \begin{syntax}
1056 % \marg{phonetic transcription}
1057 % \marg{phonemic transcription}
1058 % \end{syntax}
1059 % This is a command that resembles with the
1060 % \pkg{\textsc{tipa}} command \cs[no-index]{textipa}. I have
1061 % deliberately kept it distinct from it so that just in case
1062 % somebody wants to use their old \textsc{tipa} code in a
1063 % Unicode document, the commands won’t clash (I highly
1064 % discourage doing this, though). The command comes with a
1065 % starred variant. The behaviour of the un-starred command
1066 % is to print the argument in brackets for phonetic
1067 % transcription, e.g.: |\ipatext{aɪ̯ pʰiː eɪ̯}|^^A
1068 % \,$\longrightarrow$\,\ipatext{aɪ̯ pʰiː eɪ̯} whereas the
1069 % starred version prints it in slashes for phonemic
1070 % transcription, e.g.: |\ipatext*{aɪ̯ pʰiː eɪ̯}|^^A
1071 % \,$\longrightarrow$\,\ipatext*{aɪ̯ pʰiː eɪ̯}.
1072 % \end{function}
1073 %
1074 % Suppose someone just wants to load the font without the
1075 % brackets or slashes, they can use the following command
1076 % for switching to the \textsc{ipa} without adding the
1077 % aforementioned.
1078 %
1079 % \begin{function}{\lngxipa}
1080 % This also is a command that switches to the
1081 % \textsc{ipa}-only features (default as well as user
1082 % added). This command, of course, leaks and that’s why
1083 % \emph{should} be delimited. E.g., the following code
1084 % lines produce {\lngxipa [aɪ̯ pʰiː eɪ̯]} and {\lngxipa /aɪ̯
1085 % pʰiː eɪ̯/} respectively:
1086 %
1087 % \begin{verbatim}
1088 % {\lngxipa [aɪ̯ pʰiː eɪ̯]}
1089 % {\lngxipa /aɪ̯ pʰiː eɪ̯/}
1090 % \end{verbatim}
1091 % \end{function}
1092 %
1093 % \begin{function}{^^A
1094 % ipa newcm,ipa newcm sans,ipa newcm mono,^^A
1095 % ipa newcm regular,ipa newcm regular sans,^^A
1096 % ipa newcm regular mono^^A
1097 % }
1098 % These keys reset the \textsc{ipa}-only fonts to New
1099 % Computer Modern. They can be used even for resetting to
1100 % New Computer Modern from another \textsc{ipa} font. In
1101 % order to change or reset to the \textsc{ipa} defaults
1102 % these keys can be used. They store the names of the New
1103 % Computer Modern font family in the variables concerning
1104 % \textsc{ipa}. The keys that contain |regular| in their
1105 % name use the regular version of New Computer Modern that
1106 % matches the colour of Latin Modern.
1107 % \end{function}
1108 %
1109 % Let’s now see the combined table of font keys provided by
1110 % both \lngxfontslogo\ and \lngxipalogo.
1111 %
1112 % \begingroup
1113 % \begin{longtable}{%
1114 % l%
1115 % >{%
1116 % \lngxcondensed
1117 % \addfontfeature{FakeStretch=0.8}%
1118 % }l%
1119 % >{%
1120 % \lngxcondensed
1121 % \addfontfeature{FakeStretch=0.8}%
1122 % }l%
1123 % }
1124 % \toprule
1125 % Family
1126 % & \lngxfontslogo
1127 % & \lngxipalogo \\
1128 % \midrule
1129 % \endfirsthead
1130 % \toprule
1131 % Family
1132 % & \lngxfontslogo
1133 % & \lngxipalogo \\
1134 % \midrule
1135 % \endhead
1136 % \midrule
1137 % \multicolumn{3}{r}{^^A
1138 % \small
1139 % \emph{Continued on the next page\dots}^^A
1140 % } \\
1141 % \bottomrule
1142 % \endfoot
1143 % \midrule
1144 % \multicolumn{3}{r}{^^A
1145 % \small
1146 % \emph{End of the table\dots}^^A
1147 % } \\
1148 % \bottomrule
1149 % \addlinespace
1150 % \caption{^^A
1151 % Font keys provided by \lngxfontslogo\ and \lngxipalogo
1152 % }\label{lngxfontstable}\\
1153 % \endlastfoot
1154 % Serif
1155 % & \fn{text main font}
1156 % & \fn{ipa main font} \\
1157 % & \fn{text upright}
1158 % & \fn{ipa upright} \\
1159 % & \fn{text upright features}
1160 % & \fn{ipa upright features} \\
1161 % & \fn{text bold}
1162 % & \fn{ipa bold} \\
1163 % & \fn{text bold features}
1164 % & \fn{ipa bold features} \\
1165 % & \fn{text italic}
1166 % & \fn{ipa italic} \\
1167 % & \fn{text italic features}
1168 % & \fn{ipa italic features} \\
1169 % & \fn{text bold italic}
1170 % & \fn{ipa bold italic} \\
1171 % & \fn{text bold italic features}
1172 % & \fn{ipa bold italic features} \\
1173 % & \fn{text slanted}
1174 % & \fn{ipa slanted} \\
1175 % & \fn{text slanted features}
1176 % & \fn{ipa slanted features} \\
1177 % & \fn{text bold slanted}
1178 % & \fn{ipa bold slanted} \\
1179 % & \fn{text bold slanted features}
1180 % & \fn{ipa bold slanted features} \\
1181 % & \fn{text swash}
1182 % & \fn{ipa swash} \\
1183 % & \fn{text swash features}
1184 % & \fn{ipa swash features} \\
1185 % & \fn{text bold swash}
1186 % & \fn{ipa bold swash} \\
1187 % & \fn{text bold swash features}
1188 % & \fn{ipa bold swash features} \\
1189 % & \fn{text small caps}
1190 % & \fn{ipa small caps} \\
1191 % & \fn{text small caps features}
1192 % & \fn{ipa small caps features} \\
1193 % \midrule
1194 % Sans serif
1195 % & \fn{text sans font}
1196 % & \fn{ipa sans font} \\
1197 % & \fn{text sans upright}
1198 % & \fn{ipa sans upright} \\
1199 % & \fn{text sans upright features}
1200 % & \fn{ipa sans upright features} \\
1201 % & \fn{text sans bold}
1202 % & \fn{ipa sans bold} \\
1203 % & \fn{text sans bold features}
1204 % & \fn{ipa sans bold features} \\
1205 % & \fn{text sans italic}
1206 % & \fn{ipa sans italic} \\
1207 % & \fn{text sans italic features}
1208 % & \fn{ipa sans italic features} \\
1209 % & \fn{text sans bold italic}
1210 % & \fn{ipa sans bold italic} \\
1211 % & \fn{text sans bold italic features}
1212 % & \fn{ipa sans bold italic features} \\
1213 % & \fn{text sans slanted}
1214 % & \fn{ipa sans slanted} \\
1215 % & \fn{text sans slanted features}
1216 % & \fn{ipa sans slanted features} \\
1217 % & \fn{text sans bold slanted}
1218 % & \fn{ipa sans bold slanted} \\
1219 % & \fn{text sans bold slanted features}
1220 % & \fn{ipa sans bold slanted features} \\
1221 % & \fn{text sans swash}
1222 % & \fn{ipa sans swash} \\
1223 % & \fn{text sans swash features}
1224 % & \fn{ipa sans swash features} \\
1225 % & \fn{text sans bold swash}
1226 % & \fn{ipa sans bold swash} \\
1227 % & \fn{text sans bold swash features}
1228 % & \fn{ipa sans bold swash features} \\
1229 % & \fn{text sans small caps}
1230 % & \fn{ipa sans small caps} \\
1231 % & \fn{text sans small caps features}
1232 % & \fn{ipa sans small caps features} \\
1233 % \midrule
1234 % Monospaced
1235 % & \fn{text mono font}
1236 % & \fn{ipa mono font} \\
1237 % & \fn{text mono upright}
1238 % & \fn{ipa mono upright} \\
1239 % & \fn{text mono upright features}
1240 % & \fn{ipa mono upright features} \\
1241 % & \fn{text mono bold}
1242 % & \fn{ipa mono bold} \\
1243 % & \fn{text mono bold features}
1244 % & \fn{ipa mono bold features} \\
1245 % & \fn{text mono italic}
1246 % & \fn{ipa mono italic} \\
1247 % & \fn{text mono italic features}
1248 % & \fn{ipa mono italic features} \\
1249 % & \fn{text mono bold italic}
1250 % & \fn{ipa mono bold italic} \\
1251 % & \fn{text mono bold italic features}
1252 % & \fn{ipa mono bold italic features} \\
1253 % & \fn{text mono slanted}
1254 % & \fn{ipa mono slanted} \\
1255 % & \fn{text mono slanted features}
1256 % & \fn{ipa mono slanted features} \\
1257 % & \fn{text mono bold slanted}
1258 % & \fn{ipa mono bold slanted} \\
1259 % & \fn{text mono bold slanted features}
1260 % & \fn{ipa mono bold slanted features} \\
1261 % & \fn{text mono swash}
1262 % & \fn{ipa mono swash} \\
1263 % & \fn{text mono swash features}
1264 % & \fn{ipa mono swash features} \\
1265 % & \fn{text mono bold swash}
1266 % & \fn{ipa mono bold swash} \\
1267 % & \fn{text mono bold swash features}
1268 % & \fn{ipa mono bold swash features} \\
1269 % & \fn{text mono small caps}
1270 % & \fn{ipa mono small caps} \\
1271 % & \fn{text mono small caps features}
1272 % & \fn{ipa mono small caps features} \\
1273 % \end{longtable}
1274 % \endgroup
1275 %
1276 % Apart from these, both the packages provide the following
1277 % keys for appending to the extra features for the
1278 % respective fonts:
1279 %
1280 % \begin{itemize}
1281 % \ttfamily
1282 % \item \fn{text main extra features}
1283 % \item \fn{text sans extra features}
1284 % \item \fn{text mono extra features}
1285 % \item \fn{ipa main extra features}
1286 % \item \fn{ipa sans extra features}
1287 % \item \fn{ipa mono extra features}
1288 % \end{itemize}
1289 %
1290 % \newpage
1291 %
1292 % \lngxdocumentation{languages}
1293 %
1294 % This package is intended to provide support for loading
1295 % Unicode fonts as well as other necessary settings for
1296 % using languages. It is a wrapper around the \textsf{babel}
1297 % package, but it provides some other useful settings which
1298 % \textsf{babel} doesn’t agree to add. This package is a
1299 % little opinionated and pushes for \enquote{modern}
1300 % practices e.g., Unicode, Lua\LaTeX, no-markup multilingual
1301 % text etc. As of now, only a little support is available.
1302 % If you want your language to be supported, you can ask for
1303 % support at the bug tracker of the repository or you can
1304 % send an email in the public mailing list for the project.
1305 % You may subscribe to the mailing list at:
1306 % \url{mail.gnu.org.ua/mailman/listinfo/linguistix-languages}.
1307 % Here, I list down some \LaTeX-aspects that may demand some
1308 % modifications in the default settings.
1309 %
1310 % \begin{description}
1311 % \item[Fonts:] The package works with Unicode and does not
1312 % worry about legacy methods. If you want support for your
1313 % language, first and foremost, you should let me know
1314 % standard OpenType fonts suitable for your language. Note
1315 % that they should be freely licensed. I won’t support
1316 % proprietary software with \lngxpkg.
1317 % \item[\pkg{babel} support:] As mentioned before, the
1318 % package adds on to the support provided by package
1319 % \pkg{babel}. So check if the language files\,--\,^^A
1320 % specifically the modern |.ini| files\,--\,have the
1321 % correct settings. Sometimes they may need to undergo
1322 % native-speakers scrutiny. Whatever is wrong in
1323 % \pkg{babel}, may not get corrected in \lngxpkg.
1324 % \item[Numbers:] \LaTeX\ uses a lot of counters and all of
1325 % them, by default, print Latin numerals/characters. E.g.,
1326 % |\arabic{page}| prints the page number in Latin, but
1327 % |\roman{page}| prints the same in Roman convention,
1328 % i.e., ‘i, ii, \dots’. Does your language allow them?
1329 % E.g., Greek doesn’t like Latin alphabets, but doesn’t
1330 % mind Roman numerals. Instead of Latin alphabets, Greek
1331 % prefers to use its own numeral system. Marathi doesn’t
1332 % like any of these, but it doesn’t have alternative forms
1333 % of numeration, so it changes certain cases drastically.
1334 % E.g., in nested |enumerate| environment, Marathi renews
1335 % the printing of nested |\item|s as 1, 1.1, 1.1.1 and
1336 % 1.1.1.1. This is reset to defaults when the language is
1337 % changed. Keeping this in mind, I am listing down some
1338 % places where I found non-native numbering (I might have
1339 % missed something in which case it deserves to be
1340 % reported as a bug, so feel free to do so!).
1341 % \begin{enumerate}
1342 % \item Page numbers (in front matter, main matter).
1343 % \item Part numbers.
1344 % \item Second, third and fourth levels of enumeration.
1345 % \end{enumerate}
1346 % \item[\pkg{ExPex}:] Labels provided by \pkg{ExPex} package
1347 % (see: \url{tex.stackexchange.com/a/548668}).
1348 % \item[Typography:] Language-specific conventions like
1349 % using Italic for emphasis. It is a Latin-script specific
1350 % convention (note that I don’t mean slanted when I say
1351 % Italic). Different languages have different conventions
1352 % of emphasising (e.g., Marathi uses bold font for
1353 % emphasis).
1354 % \item[Miscellaneous:] Anything other than these.
1355 % \end{description}
1356 %
1357 % I am very much willing to support multilingual typesetting
1358 % for multiple languages, but I need to know the things
1359 % mentioned in this list in order to provide the best suited
1360 % output. Please consider submitting a detailed feature
1361 % request. The documentation of supported languages is in
1362 % separate \textsc{pdf}s. This documentation only describes
1363 % the user-side commands provided by the package.
1364 %
1365 % \begin{function}{languages,\loadlanguages}
1366 % \begin{syntax}
1367 % \marg{list of languages}
1368 % \marg{list of languages}
1369 % \end{syntax}
1370 % This key works with the central key-parser of \lngxpkg,
1371 % i.e., |\linguistix|. It accepts one argument that is a
1372 % list of languages user wants to load. Unlike
1373 % \textsf{babel}, the first element of this list is set as
1374 % the main language for the document. The command
1375 % |\loadlanguages| has the identical behaviour. In fact, it
1376 % is a wrapper around the key.
1377 % \end{function}
1378 % \begin{function}{\providelanguage}
1379 % \begin{syntax}
1380 % \marg{language options} \marg{language name}
1381 % \end{syntax}
1382 % This is a wrapper command over |\babelprovide|. The first
1383 % argument is passed to the optional argument of
1384 % |\babelprovide| and the second one to the mandatory
1385 % argument of the same. For more information, please read
1386 % \textsf{babel}’s manual.
1387 %
1388 % Languages supported by \lngxlanguageslogo\ are loaded with
1389 % a package with that language’s name. If it is absent, the
1390 % package produces a warning.
1391 % \end{function}
1392 %
1393 % \begin{function}{native numbering}
1394 % \begin{syntax}
1395 % = \marg{strict/logical/off}
1396 % \end{syntax}
1397 % Many languages need native digits. Adding them in a
1398 % multilingual document is quite complicated. This key sets
1399 % the plugs provided for the socket of the same name.
1400 % Language packages already take care of them, but if you
1401 % want to change anything mid-document, you can use this
1402 % key. It has three choices available as its value as seen
1403 % below.
1404 % \end{function}
1405 %
1406 % \begin{function}{strict}
1407 % The ‘strict’ plug changes the \cs{lngx_counter:n} command
1408 % to the counter of the main language of the document. That
1409 % way all the counters are printed in the main language.
1410 % \end{function}
1411 %
1412 % \begin{function}{logical}
1413 % This plug changes the meaning of \cs{lngx_counter:n} to
1414 % the |\localecounter| command provided by \pkg{babel}. It
1415 % picks up the surrounding language and uses its native
1416 % digits. E.g., when Marathi is being typeset, it will print
1417 % counters in Marathi. When it is changed to English, it
1418 % will start printing the same in English. Note that this
1419 % will reflect in table of contents/tables/figures too. It
1420 % is called logical numbering because it obeys \TeX’s logic
1421 % more than what is generally considered the standard. E.g.,
1422 % imagine you have an English section followed by a Marathi
1423 % section on the same page. Both of them will follow their
1424 % own numerals for default \TeX\ counters. Since both of
1425 % them are on the same page, while shipping out, the last
1426 % active language will be used for processing the page
1427 % number (Marathi in this case). This creates a table of
1428 % contents with Latin numeral as the section counter, but
1429 % Marathi numeral as the page number. Only experiments can
1430 % determine if an option like this can have valid use-cases,
1431 % so it is provided. If you use it, be aware that the
1432 % results might not be the most pleasant to your aesthetic
1433 % values. They are so because of the logic of \TeX.
1434 % \end{function}
1435 %
1436 % \begin{function}{off}
1437 % It is equivalent of the |noop| plug when the other two are
1438 % not used at all. It is only required when you want to go
1439 % back to \LaTeX\ defaults. E.g., if you have turned strict
1440 % native numbering in some language and you want it to go
1441 % back to \LaTeX\ defaults, you may use this.
1442 % \end{function}
1443 %
1444 % \newpage
1445 %
1446 % \lngxdocumentation{logos}
1447 %
1448 % This is a small package that provides commands for
1449 % printing logos of the \lngxpkg\ bundle. The logo is
1450 % printed in New Computer Modern Uncial font. It uses purple
1451 % colour for the \enquote{X} in it and it is defined using
1452 % \pkg{l3color} module. It provides one command that takes
1453 % an optional argument. Obviously it is ‘|protect|ed’. It is
1454 % as follows:
1455 %
1456 % \begin{function}{\lngxlogo}
1457 % \begin{syntax}
1458 % \oarg{package name}
1459 % \end{syntax}
1460 % The logo of the \meta{package name} from the \lngxpkg\
1461 % bundle is printed with this command, e.g.,
1462 % |\lngxlogo[fonts]|\,$\longrightarrow$\,\lngxfontslogo.
1463 % \end{function}
1464 %
1465 % Sometimes, the logos might be required to be used in an
1466 % expandable way, but optional arguments are not supported
1467 % in expandable commands. Thus we create separate commands
1468 % for separate packages. Even these ones have the |lngx|
1469 % prefix. It is followed by the package name, e.g., |fonts|
1470 % or |ipa| and finally the suffix |logo|. In the context of
1471 % \pkg{hyperref}, their behaviour is different than in the
1472 % context of normal text.
1473 %
1474 % \newpage
1475 %
1476 % \lngxdocumentation{nfss}
1477 %
1478 % This is an extension package to the existing \textsc{nfss}
1479 % scheme of \LaTeX. The \textsc{nfss} mainly works on the
1480 % four facets of the text, i.e., encoding, family, shape and
1481 % series. These facets are reset to default by the
1482 % |\normalfont| and |\selectfont| commands. These commands
1483 % work on some internals that are reset with every usage of
1484 % some commands that set them, e.g., |\rmfamily|,
1485 % |\bfseries|. There isn’t any way to control this unless
1486 % some internals are touched and there might be incidences
1487 % where one does want to control them, e.g., try compiling
1488 % the following code in Lua\LaTeX.
1489 %
1490 % \rule{0.7\linewidth}{0.5pt}
1491 %
1492 % \begin{verbatim}
1493 % \documentclass{article}
1494 %
1495 % \begin{document}
1496 % \makeatletter
1497 % \fontencoding{OT1}\sffamily\itshape\bfseries
1498 % \selectfont
1499 % \f@encoding\ | \f@family\ | \f@series\ | \f@shape\quad
1500 % \normalfont
1501 % \f@encoding\ | \f@family\ | \f@series\ | \f@shape
1502 % \end{document}
1503 % \end{verbatim}
1504 %
1505 % \rule{0.7\linewidth}{0.5pt}
1506 %
1507 % \medskip
1508 %
1509 % As can be seen in the output, the first line shows the
1510 % text in \textsc{ot}1 encoding, sans family, bold series
1511 % and Italic shape. After |\normalfont|, every aspect of the
1512 % text is reset to the default one. The default encoding is
1513 % \textsc{tu}. We can see \textsc{tu} instead of
1514 % \textsc{ot}1 after |\normalfont|. So is the case with
1515 % family (default: |\rmfamily|), series (default:
1516 % |\mdseries|) and shape (default: |\upshape|). This usually
1517 % is okay, but sometimes it doesn’t fit the requirement.
1518 % E.g., the following might be used with the intention of
1519 % switching from the \textsc{ipa} font to the text font, but
1520 % as can be seen, it doesn’t really change anything.
1521 %
1522 % \rule{0.7\linewidth}{0.5pt}
1523 %
1524 % \begin{verbatim}
1525 % \documentclass{article}
1526 % \usepackage{linguistix-fonts}
1527 % \usepackage{linguistix-ipa}
1528 % \linguistix{%
1529 % text upright = {KpRoman-Regular.otf},%
1530 % text upright features = {Color={green}},%
1531 % ipa upright = {KpSans-Regular.otf},%
1532 % ipa upright features = {Color={red}}%
1533 % }
1534 %
1535 % \begin{document}
1536 % test \lngxipa test \normalfont test
1537 % \end{document}
1538 % \end{verbatim}
1539 %
1540 % \rule{0.7\linewidth}{0.5pt}
1541 %
1542 % \medskip
1543 %
1544 % The reason for this is the way \cs{lngxipa} is defined. It
1545 % resets |\rmdefault|, |\sfdefault| and |\ttdefault| and
1546 % uses |\normalfont| to initialise this new super font
1547 % family (see:
1548 % \url{https://tex.stackexchange.com/a/729805}). Setting a
1549 % \enquote{super} font family effectively changes the
1550 % behaviour of |\normalfont| permanently. By the way, this
1551 % is not just something that \lngxpkg\ has to deal with.
1552 % This situation may arise whenever one wants to have a font
1553 % family command that sets all serif, sans serif and
1554 % monospaced font families. \lngxnfsslogo\ is useful in such
1555 % cases. It introduces the concept of \enquote{super} font
1556 % family. It shouldn’t be confused with
1557 % \hologo{LaTeX2e}’s \enquote{meta} font family. It refers
1558 % to |rm|, |sf| or |tt| in the kernel. This package provides
1559 % control over these facets. Let’s have a look at the macros
1560 % it provides.
1561 %
1562 % \begin{function}[EXP]{^^A
1563 % \IfEncodingTF,\IfEncodingT,\IfEncodingF,\CurrentEncoding
1564 % }
1565 % \begin{syntax}
1566 % \marg{encoding} \marg{true code} \marg{false code}
1567 % \marg{encoding} \marg{true code}
1568 % \marg{encoding} \marg{false code}
1569 % \end{syntax}
1570 % If the current encoding matches with the given
1571 % \meta{encoding}, it selects the true branch; false
1572 % otherwise. The \cs{CurrentEncoding} macro expands to the
1573 % current encoding.
1574 % \end{function}
1575 %
1576 % \begin{function}[EXP]{^^A
1577 % \IfMetaFamilyTF,\IfMetaFamilyT,\IfMetaFamilyF,^^A
1578 % \CurrentMetaFamily
1579 % }
1580 % \begin{syntax}
1581 % \marg{meta family} \marg{true code} \marg{false code}
1582 % \marg{meta family} \marg{true code}
1583 % \marg{meta family} \marg{false code}
1584 % \end{syntax}
1585 % If the current meta family matches with the given
1586 % \meta{meta family}, it selects the true branch; false
1587 % otherwise. The \cs{CurrentMetaFamily} macro expands to the
1588 % current meta family.
1589 % \end{function}
1590 %
1591 % \begin{function}[EXP]{^^A
1592 % \IfSuperFamilyTF,\IfSuperFamilyT,\IfSuperFamilyF,^^A
1593 % \CurrentSuperFamily
1594 % }
1595 % \begin{syntax}
1596 % \marg{super family} \marg{true code} \marg{false code}
1597 % \marg{super family} \marg{true code}
1598 % \marg{super family} \marg{false code}
1599 % \end{syntax}
1600 % If the current super family matches with the given
1601 % \meta{super family}, it selects the true branch; false
1602 % otherwise. The \cs{CurrentSuperFamily} macro expands to
1603 % the current super family.
1604 % \end{function}
1605 %
1606 % \begin{function}[EXP]{^^A
1607 % \IfSeriesTF,\IfSeriesT,\IfSeriesF,\CurrentSeries
1608 % }
1609 % \begin{syntax}
1610 % \marg{series} \marg{true code} \marg{false code}
1611 % \marg{series} \marg{true code}
1612 % \marg{series} \marg{false code}
1613 % \end{syntax}
1614 % If the current series matches with the given
1615 % \meta{series}, it selects the true branch and false
1616 % otherwise. The \cs{CurrentSeries} macro expands to the
1617 % current series.
1618 % \end{function}
1619 %
1620 % \begin{function}[EXP]{^^A
1621 % \IfShapeTF,\IfShapeT,\IfShapeF,\CurrentShape
1622 % }
1623 % \begin{syntax}
1624 % \marg{shape} \marg{true code} \marg{false code}
1625 % \marg{shape} \marg{true code}
1626 % \marg{shape} \marg{false code}
1627 % \end{syntax}
1628 % If the current series matches with the given \meta{shape},
1629 % it selects the true branch and false otherwise. The
1630 % \cs{CurrentShape} macro expands to the current shape.
1631 % \end{function}
1632 %
1633 % \begin{function}{\superfontfamily}
1634 % \begin{syntax}
1635 % \marg{family \textsc{id}}^^A
1636 % \marg{rm=\marg{rm \textsc{nfss}},\ignorespaces^^A
1637 % sf=\marg{sf \textsc{nfss}},tt=\marg{tt \textsc{nfss}}}
1638 % \end{syntax}
1639 % Every super font family has a \meta{family \textsc{id}},
1640 % even the default one (i.e., |default|). This command
1641 % creates a super family with the given \meta{family
1642 % \textsc{id}}s. The \meta{meta family keys} argument
1643 % accepts a list of specific keys, |rm|, |sf| and |tt|. They
1644 % take the \textsc{nfss} family names of these meta families
1645 % as arguments. One may define a font with, say,
1646 % |\newfontfamily|, pass the |NFSSkeys=|\marg{key} option to
1647 % it and use the \meta{key} in the suitable \meta{meta
1648 % family key}. Note that using all these keys is \emph{not}
1649 % mandatory. A super family may have $\leq 3$ keys.
1650 % \end{function}
1651 %
1652 % \begin{function}{^^A
1653 % \softsuperfontfamily,\softersuperfontfamily,^^A
1654 % \softestsuperfontfamily
1655 % }
1656 % \begin{syntax}
1657 % \marg{\textsc{id}}\ignorespaces^^A
1658 % \marg{encoding,family,series,shape}
1659 % \marg{\textsc{id}}
1660 % \marg{\textsc{id}}
1661 % \end{syntax}
1662 % These commands loads the super font family with the given
1663 % \meta{\textsc{id}}. The attributes listed in the second
1664 % argument are the only choices available. The required
1665 % super font family is loaded and the listed attributes are
1666 % reset to the ones that were active before. All the four
1667 % are not required. The number of attributes may be $\leq
1668 % 4$. The \cs{softernormalfont} command excludes encoding
1669 % and reactivates all the other attributes, whereas the
1670 % \cs{softestnormalfont} command reactivates all of them.
1671 % \end{function}
1672 %
1673 % \begin{function}{^^A
1674 % \softnormalfont,\softernormalfont,\softestnormalfont
1675 % }
1676 % \begin{syntax}
1677 % \marg{encoding,family,series,shape}
1678 % \end{syntax}
1679 % Similar to \cs{softsuperfontfamily} and friends, these
1680 % commands switch back to the default super font family, but
1681 % reactivate the previously active font attributes. The
1682 % argument to \cs{softnormalfont} takes the list of the
1683 % required font attributes. It can have $\leq 4$ values. Now
1684 % try the following example:
1685 % \end{function}
1686 %
1687 % \rule{0.7\linewidth}{0.5pt}
1688 %
1689 % \begin{verbatim}
1690 % \documentclass{article}
1691 % \usepackage{linguistix}
1692 % \linguistix{%
1693 % text upright features = {Color={green}},%
1694 % ipa upright features = {Color={red}}%
1695 % }
1696 %
1697 % \begin{document}
1698 % test \lngxipa test \softernormalfont test\par
1699 % \makeatletter
1700 % \sffamily\itshape\bfseries
1701 % \f@family\ | \f@series\ | \f@shape\quad
1702 % \softnormalfont{series}
1703 % \f@family\ | \f@series\ | \f@shape
1704 % \end{document}
1705 % \end{verbatim}
1706 %
1707 % \rule{0.7\linewidth}{0.5pt}
1708 %
1709 % \medskip
1710 %
1711 % Better? :-)
1712 %
1713 % \section*{^^A
1714 % \texorpdfstring{^^A
1715 % \LaTeX3 interface for programmers^^A
1716 % }{^^A
1717 % LaTeX3 interface for programmers^^A
1718 % }^^A
1719 % }
1720 %
1721 % In this section, we take a look at the public \LaTeX3
1722 % commands of the bundle. These can be considered stable and
1723 % can be used in production code.
1724 %
1725 % \lngxinterface{base}
1726 %
1727 % \begin{function}{\lngx_set_keys:n}
1728 % \begin{syntax}
1729 % \meta{keyval list}
1730 % \end{syntax}
1731 % This is the base command for \cs{linguistix}. It takes a
1732 % comma separated list of \meta{keyval list} and parses it.
1733 % \end{function}
1734 %
1735 % \lngxinterface{fixpex}
1736 %
1737 % No \LaTeX3 function provided by this package.
1738 %
1739 % \lngxinterface{fonts}
1740 %
1741 % \begin{function}{^^A
1742 % \g_lngx_old_style_bool,\g_lngx_old_style_one_bool,^^A
1743 % \g_lngx_bourbaki_bool
1744 % }
1745 % \begin{syntax}
1746 % These are the booleans that are used to check if old style
1747 % numbers, old style one (i.e., \enquote{1}) and Bourbaki’s
1748 % emtpy set symbol (i.e., \enquote{$\emptyset$}) are asked
1749 % by the user.
1750 % \end{syntax}
1751 % \end{function}
1752 %
1753 % \begin{function}{^^A
1754 % \lngx_set_main_font:nn,\lngx_set_main_font:VV,^^A
1755 % \lngx_set_sans_font:nn,\lngx_set_sans_font:VV,^^A
1756 % \lngx_set_mono_font:nn,\lngx_set_mono_font:VV,^^A
1757 % \lngx_set_math_font:nn,\lngx_set_math_font:VV^^A
1758 % }
1759 % \begin{syntax}
1760 % \marg{features} \marg{font}
1761 % \marg{features} \marg{font}
1762 % \marg{features} \marg{font}
1763 % \marg{features} \marg{font}
1764 % \end{syntax}
1765 % These commands take two arguments, retrieve the values of
1766 % the data variables if |:VV| variants are used. These are
1767 % wrapper commands around the font-setting commands of
1768 % \pkg{fontspec} and \pkg{(lua)-unicode-math}, i.e.,
1769 % |\setmainfont|, |\setsansfont|, |\setmonofont| and
1770 % |\setmathfont|. The \meta{features} are passed to the
1771 % optional argument and the \meta{font} is passed to the
1772 % mandatory argument of the respective command from the
1773 % aforementioned list.
1774 % \end{function}
1775 %
1776 % \begin{function}{^^A
1777 % \lngx_other_main_font:nnn,\lngx_other_main_font:nee,^^A
1778 % \lngx_other_sans_font:nnn,\lngx_other_sans_font:nee,^^A
1779 % \lngx_other_mono_font:nnn,\lngx_other_mono_font:nee^^A
1780 % }
1781 % \begin{syntax}
1782 % \marg{language} \marg{features} \marg{font}
1783 % \marg{language} \marg{features} \marg{font}
1784 % \marg{language} \marg{features} \marg{font}
1785 % \end{syntax}
1786 % These commands take three arguments. These are wrapper
1787 % commands around the font-setting commands of \pkg{babel}.
1788 % The \meta{features} are passed to the optional argument
1789 % and the \meta{font} is passed to the mandatory argument of
1790 % the respective command from the aforementioned list.
1791 % \end{function}
1792 %
1793 % \lngxinterface{glossing}
1794 %
1795 % \begin{function}{^^A
1796 % \lngx_gloss_format:n,\lngx_expansion_format:n
1797 % }
1798 % \begin{syntax}
1799 % \marg{gloss}
1800 % \marg{expansion}
1801 % \end{syntax}
1802 % This function is controlled by the key |format|. Its
1803 % argument is the gloss or the expansion itself. According
1804 % to the definition set in the key, the argument gets
1805 % printed.
1806 % \end{function}
1807 %
1808 % \begin{function}{\lngx_gloss_new:nn}
1809 % \begin{syntax}
1810 % \marg{gloss} \marg{expansion}
1811 % \end{syntax}
1812 % This function creates a new gloss. It is later equated
1813 % with the \cs{newgloss} command.
1814 % \end{function}
1815 %
1816 % \begin{function}{\lngx_gloss_list:}
1817 % This functions prints the list of glosses and is equated
1818 % with \cs{listofglosses}.
1819 % \end{function}
1820 %
1821 % \begin{function}{lngx_multicols}
1822 % \begin{syntax}
1823 % \marg{section title}
1824 % \end{syntax}
1825 % This environment reads an integer variable, i.e.,
1826 % \cs{l__lngx_glossary_columns_int}. It is controlled by the
1827 % |columns| key. If its number is more than one (which, by
1828 % default \emph{is} more than one), the |multicols|
1829 % environment is used around the content that comes in
1830 % between, or else no action is taken. It takes one
1831 % compulsory argument, i.e., the content of the section
1832 % title material. This environment should not be used
1833 % outside this package.
1834 % \end{function}
1835 %
1836 % \lngxinterface{ipa}
1837 %
1838 % This package provides a few wrapper functions around
1839 % \pkg{fontspec}’s commands.
1840 %
1841 % \begin{function}{^^A
1842 % \lngx_set_main_ipa_font:nn,^^A
1843 % \lngx_set_main_ipa_font:VV,^^A
1844 % \lngx_main_ipa:,lngx_ipa_rm_nfss^^A
1845 % }
1846 % \begin{syntax}
1847 % \marg{features} \marg{font}
1848 % \end{syntax}
1849 % These functions set the \textsc{ipa} fonts for the serif
1850 % variants. The \meta{font} is set with \meta{features} for
1851 % the serif \textsc{ipa}. The command to switch to this
1852 % family is \cs{lngx_main_ipa:}. It can be accessed with the
1853 % \textsc{nfss} family |lngx_ipa_rm_nfss|.
1854 % \end{function}
1855 %
1856 % \begin{function}{^^A
1857 % \lngx_set_sans_ipa_font:nn,^^A
1858 % \lngx_set_sans_ipa_font:VV,^^A
1859 % \lngx_sans_ipa:,lngx_ipa_sf_nfss^^A
1860 % }
1861 % \begin{syntax}
1862 % \marg{features} \marg{font}
1863 % \end{syntax}
1864 % These functions set the \textsc{ipa} fonts for the sans
1865 % variants. The \meta{font} is set with \meta{features} for
1866 % the sans \textsc{ipa}. The command to switch to this
1867 % family is \cs{lngx_sans_ipa:}. It can be accessed with the
1868 % \textsc{nfss} family |lngx_ipa_sf_nfss|.
1869 % \end{function}
1870 %
1871 % \begin{function}{^^A
1872 % \lngx_set_mono_ipa_font:nn,^^A
1873 % \lngx_set_mono_ipa_font:VV,^^A
1874 % \lngx_mono_ipa:,lngx_ipa_tt_nfss^^A
1875 % }
1876 % \begin{syntax}
1877 % \marg{features} \marg{font}
1878 % \end{syntax}
1879 % These functions set the \textsc{ipa} fonts for the mono
1880 % variants. The \meta{font} is set with \meta{features} for
1881 % the mono \textsc{ipa}. The command to switch to this
1882 % family is \cs{lngx_mono_ipa:}. It can be accessed with the
1883 % \textsc{nfss} family |lngx_ipa_nfss_nfss|.
1884 % \end{function}
1885 %
1886 % \begin{function}{\lngx_ipa:,lngx_ipa}
1887 % The \cs{lngx_ipa:} command loads the super family
1888 % |lngx_ipa| (see the documentation of \lngxnfsslogo). The
1889 % \cs{lngx_ipa:} function has a user-side command
1890 % \cs{lngxipa} too.
1891 % \end{function}
1892 %
1893 % \lngxinterface{languages}
1894 %
1895 % Here are the L3 functions defined for \lngxlanguageslogo.
1896 %
1897 % \begin{function}{\g_lngx_main_language_tl}
1898 % A |tl| that globally stores the main language of the
1899 % document.
1900 % \end{function}
1901 %
1902 % \begin{function}{\g_lngx_languages_clist}
1903 % A |clist| that globally stores the languages that are
1904 % used.
1905 % \end{function}
1906 %
1907 % \begin{function}{\lngx_languages:nn,\lngx_languages:VV}
1908 % \begin{syntax}
1909 % \marg{language options} \marg{language name}
1910 % \meta{language options tl} \meta{language tl}
1911 % \end{syntax}
1912 % These functions read the |V|-type argument provided to
1913 % them and pass it to the |\babelprovide| command for
1914 % loading languages.
1915 % \end{function}
1916 %
1917 % \begin{function}{\lngx_load_languages:n}
1918 % \begin{syntax}
1919 % \marg{list of languages}
1920 % \end{syntax}
1921 % This function loads the languages in \lngxpkg\ sense.
1922 % \end{function}
1923 %
1924 % \begin{function}{\lngx_counter:n}
1925 % This is a developers function provided for printing the
1926 % counter based on the plug selected. It changes the meaning
1927 % according to the active value of |native-numbering|
1928 % socket.
1929 % \end{function}
1930 %
1931 % \begin{function}{\lngx_misc_reset:}
1932 % This function resets a lot of custom settings done by
1933 % some languages. It has to be used inside \cs{addto} macro
1934 % provided by the \pkg{babel} package.
1935 % \end{function}
1936 %
1937 % \lngxinterface{logos}
1938 %
1939 % There are only two \LaTeX3 functions provided by this
1940 % package.
1941 %
1942 % \begin{function}{\lngx_logo_font:}
1943 % This function switches to the New Computer Modern Uncial
1944 % font family.
1945 % \end{function}
1946 %
1947 % \begin{function}{lngx_purple_color}
1948 % I don’t like the default purple colour of the \pkg{xcolor}
1949 % package (i.e., \colorbox{purple}{\phantom{x}}\,). Thus I
1950 % have created a new colour using \pkg{l3color} module. It
1951 % can be accessed using this variable. The color looks like:
1952 % \colorbox{lngxpurplecolor}{\phantom{x}}.
1953 % \end{function}
1954 %
1955 % \lngxinterface{nfss}
1956 %
1957 % This subsection discusses the programming interface
1958 % \lngxnfsslogo\ provides.
1959 %
1960 % \begin{function}[EXP]{^^A
1961 % \c_lngx_default_rmdefault_tl,^^A
1962 % \c_lngx_default_sfdefault_tl,^^A
1963 % \c_lngx_default_ttdefault_tl
1964 % }
1965 % \begin{syntax}
1966 % \normalfont\normalsize^^A
1967 % These |tl|s expand to the default values of the fonts^^A
1968 % set at the |begindocument/end| hook. These are not^^A
1969 % supposed to be changed and hence they are set with^^A
1970 % the |c| prefix.
1971 % \end{syntax}
1972 % \end{function}
1973 %
1974 % \begin{function}[EXP]{^^A
1975 % \l_lngx_current_encoding_tl,^^A
1976 % \l_lngx_current_meta_family_tl,^^A
1977 % \l_lngx_current_super_family_tl,^^A
1978 % \l_lngx_current_series_tl,^^A
1979 % \l_lngx_current_shape_tl
1980 % }
1981 % \begin{syntax}
1982 % \normalfont\normalsize^^A
1983 % These |tl|s expand to the current values of encoding,^^A
1984 % meta family, super family, series and shape^^A
1985 % respectively. Note that these are updated time to time^^A
1986 % by the commands that change them (package-internal or^^A
1987 % \LaTeX-internal).
1988 % \end{syntax}
1989 % \end{function}
1990 %
1991 % \begin{function}[EXP,pTF]{^^A
1992 % \lngx_if_encoding:n,\lngx_if_meta_family:n,^^A
1993 % \lngx_if_super_family:n,\lngx_if_series:n,\lngx_if_shape:n
1994 % }
1995 % \begin{syntax}
1996 % \marg{encoding}
1997 % \marg{encoding}\marg{true code}\marg{false code}
1998 % \marg{meta font family}
1999 % \marg{meta font family}\marg{true code}\marg{false code}
2000 % \marg{super font family}
2001 % \marg{super font family}\marg{true code}\marg{false code}
2002 % \marg{series}
2003 % \marg{series}\marg{true code}\marg{false code}
2004 % \marg{shape}
2005 % \marg{shape}\marg{true code}\marg{false code}
2006 % \end{syntax}
2007 % \end{function}
2008 %
2009 % \begin{function}[EXP,pTF]{^^A
2010 % \lngx_if_meta_family_rm:,\lngx_if_meta_family_sf:,^^A
2011 % \lngx_if_meta_family_tt:
2012 % }
2013 % \begin{syntax}
2014 % \phantom{x}
2015 % \marg{true code}\marg{false code}
2016 % \phantom{x}
2017 % \marg{true code}\marg{false code}
2018 % \phantom{x}
2019 % \marg{true code}\marg{false code}
2020 % \end{syntax}
2021 % These conditionals select the true branch if the |rm|,
2022 % |sf|, |tt| families (respectively) are active, false
2023 % otherwise.
2024 % \end{function}
2025 %
2026 % \begin{function}[EXP,pTF]{^^A
2027 % \lngx_if_series_md:,\lngx_if_series_bf:
2028 % }
2029 % \begin{syntax}
2030 % \phantom{x}
2031 % \marg{true code}\marg{false code}
2032 % \phantom{x}
2033 % \marg{true code}\marg{false code}
2034 % \end{syntax}
2035 % These conditionals select the true branch if the |md|,
2036 % |bf| series (respectively) are active, false otherwise.
2037 % \end{function}
2038 %
2039 % \begin{function}[EXP,pTF]{^^A
2040 % \lngx_if_shape_up:,\lngx_if_shape_it:,^^A
2041 % \lngx_if_shape_sc:,\lngx_if_shape_ssc:,^^A
2042 % \lngx_if_shape_sl:,\lngx_if_shape_sw:,^^A
2043 % \lngx_if_shape_ulc:
2044 % }
2045 % \begin{syntax}
2046 % \phantom{x}
2047 % \marg{true code}\marg{false code}
2048 % \phantom{x}
2049 % \marg{true code}\marg{false code}
2050 % \phantom{x}
2051 % \marg{true code}\marg{false code}
2052 % \phantom{x}
2053 % \marg{true code}\marg{false code}
2054 % \phantom{x}
2055 % \marg{true code}\marg{false code}
2056 % \phantom{x}
2057 % \marg{true code}\marg{false code}
2058 % \phantom{x}
2059 % \marg{true code}\marg{false code}
2060 % \end{syntax}
2061 % These conditionals select the true branch if the |up|,
2062 % |it|, |sc|, |ssc|, |sl|, |sw|, |ulc| shapes (respectively)
2063 % are active, false otherwise.
2064 % \end{function}
2065 %
2066 % \begin{function}{\lngx_super_font_family:nn}
2067 % \begin{syntax}
2068 % \marg{family \textsc{id}}^^A
2069 % \marg{rm=\marg{rm \textsc{nfss}},\ignorespaces^^A
2070 % sf=\marg{sf \textsc{nfss}},tt=\marg{tt \textsc{nfss}}}
2071 % \end{syntax}
2072 % This function takes an \meta{\textsc{id}} and sets the
2073 % |rm|, |sf|, |tt| values as requested by the user and
2074 % creates a super font family.
2075 % \end{function}
2076 %
2077 % \begin{function}{^^A
2078 % \lngx_soft_super_font_family:nn,^^A
2079 % \lngx_softer_super_font_family:n,^^A
2080 % \lngx_softest_super_font_family:n
2081 % }
2082 % \begin{syntax}
2083 % \marg{\textsc{id}}\ignorespaces^^A
2084 % \marg{encoding,family,series,shape}
2085 % \marg{\textsc{id}}
2086 % \marg{\textsc{id}}
2087 % \end{syntax}
2088 % The \cs{lngx_soft_super_font_family:nn} sets super family
2089 % marked by the \meta{\textsc{id}} and reactivates the
2090 % currently active font attributes listed in the second
2091 % argument. The other two do the same, but without the list.
2092 % the |softer| one omits the encoding and the |softest| one
2093 % reactivate all of them.
2094 % \end{function}
2095 %
2096 % \begin{function}{^^A
2097 % \lngx_soft_normal_font:n,^^A
2098 % \lngx_softer_normal_font:,^^A
2099 % \lngx_softest_normal_font:
2100 % }
2101 % \begin{syntax}
2102 % \marg{\textsc{id}}
2103 % \end{syntax}
2104 % Quite similar to the soft super family functions, these
2105 % ones set the default font family and reactivate the font
2106 % attributes. The |soft| one sets the attributes listed in
2107 % the argument. The |softer| one omits encoding and
2108 % reactivates the rest and the |softest| one reactivates
2109 % all.
2110 % \end{function}
2111 % \end{documentation}
2112 %
2113 % \newpage
2114 %
2115 % \begin{implementation}
2116 % \section*{Implementation}
2117 %
2118 % In this section the code of this bundle is documented.
2119 % Each package in the bundle is documented in a separate
2120 % subsection.
2121 %
2122 % \subsection*{\lngxpkg}
2123 %
2124 % Provide the package with its basic information.
2125 % \begin{macrocode}
2126 %<*package>
2127 \ProvidesExplPackage{linguistix}
2128 {2026-05-15}
2129 {v1.0}
2130 {%
2131 The ‘LinguisTiX’ bundle: Enhanced
2132 support for linguistics.%
2133 }
2134 % \end{macrocode}
2135 % When one loads \lngxpkg, all the packages of the bundle
2136 % are loaded automatically. That’s the only content of the
2137 % umbrella package \lngxpkg. All the packages are loaded
2138 % conditionally (i.e., only if not loaded already).
2139 % \begin{macrocode}
2140
2141 \IfPackageLoadedF { linguistix-base } {
2142 \RequirePackage { linguistix-base }
2143 }
2144 \IfPackageLoadedF { linguistix-fonts } {
2145 \RequirePackage { linguistix-fonts }
2146 }
2147 \IfPackageLoadedF { linguistix-glossing } {
2148 \RequirePackage { linguistix-glossing }
2149 }
2150 \IfPackageLoadedF { linguistix-ipa } {
2151 \RequirePackage { linguistix-ipa }
2152 }
2153 \IfPackageLoadedF { linguistix-languages } {
2154 \RequirePackage { linguistix-languages }
2155 }
2156 \IfPackageLoadedF { linguistix-leipzig } {
2157 \RequirePackage { linguistix-leipzig }
2158 }
2159 \IfPackageLoadedF { linguistix-logos } {
2160 \RequirePackage { linguistix-logos }
2161 }
2162 \IfPackageLoadedF { linguistix-nfss } {
2163 \RequirePackage { linguistix-nfss }
2164 }
2165 %</package>
2166 % \end{macrocode}
2167 % \newpage
2168 % \lngximplementation{base}
2169 % Set the essentials of the package.
2170 % \begin{macrocode}
2171 %<*base>
2172 \ProvidesExplPackage{linguistix-base}
2173 {2026-05-15}
2174 {v1.0}
2175 {%
2176 The base package of the ‘LinguisTiX’
2177 bundle.%
2178 }
2179 % \end{macrocode}
2180 % \begin{macro}{\lngx_set_keys:n}
2181 % I use the \pkg{l3keys} module of \LaTeX3 for creating the
2182 % key-values used in this bundle. In order to get a
2183 % singleton parser for all the packages of the bundle, I
2184 % have create this parsing command that is used throughout
2185 % the bundle.
2186 % \begin{macrocode}
2187
2188 \cs_new_protected:Npn \lngx_set_keys:n #1 {
2189 \keys_set:nn { lngx_keys } { #1 }
2190 }
2191 % \end{macrocode}
2192 % \end{macro}
2193 % \begin{macro}{\linguistix}
2194 % I equate this command with a user-side macro here and end
2195 % the \lngxbaselogo\ package.
2196 % \begin{macrocode}
2197
2198 \cs_gset_eq:NN \linguistix \lngx_set_keys:n
2199 %</base>
2200 % \end{macrocode}
2201 % \end{macro}
2202 % \newpage
2203 % \lngximplementation{fixpex}
2204 % The \pkg{unicode-math} and \pkg{lua-unicode-math} packages
2205 % define |\gla| command which clashes with the same command
2206 % defined by the \pkg{expex} package. Of course, the
2207 % \pkg{expex}-|\gla| is more relevant in linguistics. Thus I
2208 % will save that and provide a new command for the
2209 % \pkg{(lua)-unicode-math}-|\gla|. This is not relevant to
2210 % people who are not using \pkg{expex}. Thus, the settings
2211 % are loaded only conditionally.
2212 % \begin{macrocode}
2213 %<*fixpex>
2214 \ProvidesExplPackage{linguistix-fixpex}
2215 {2026-05-15}
2216 {v1.0}
2217 {%
2218 To fix the clash between ‘expex’ and
2219 (lua-unicode-math).%
2220 }
2221 % \end{macrocode}
2222 % This package is useful only if either \pkg{expex} or
2223 % \pkg{(lua)-unicode-math} is loaded. Otherwise, it is of no
2224 % use. Thus, I create a message when either of them is not
2225 % loaded.
2226 % \begin{macrocode}
2227
2228 \msg_new:nnn { linguistix-fixpex } { pkg_not_loaded } {
2229 This~ package~ is~ a~ first-aid~ for~ resolving~ the\\
2230 clash~ between~ ‘(lua)-unicode-math’~ and~ ‘expex’.\\
2231 It~ should~ only~ be~ used~ if~ at~ least~ one~ of\\
2232 these~ two~ is~ loaded.~ Here~ it~ is~ not~ needed~ as\\
2233 ‘#1’~ is~ not~ loaded.
2234 }
2235 % \end{macrocode}
2236 % I first start the hook |begindocument/before|.
2237 % \begin{macrocode}
2238
2239 \hook_gput_code:nnn { begindocument / before } { . } {
2240 % \end{macrocode}
2241 % The \pkg{(lua)-unicode-math} package defines |\gla| after
2242 % |\begin{document}|, so the fix needs to be added after
2243 % that is done. For that, I start the |begindocument/end|
2244 % hook.
2245 % \begin{macrocode}
2246 \IfPackageLoadedTF { expex } {
2247 \exp_args:Ne
2248 \IfPackageLoadedTF {
2249 \sys_if_engine_luatex:TF {
2250 \IfPackageLoadedF { unicode-math } {
2251 unicode-math
2252 } {
2253 lua-unicode-math
2254 }
2255 } {
2256 unicode-math
2257 }
2258 } {
2259 \hook_gput_code:nnn { begindocument / end } { . } {
2260 % \end{macrocode}
2261 % \begin{macro}{\umgla}
2262 % This replicates the \pkg{(lua)-unicode-math}-|\gla| for
2263 % future use.
2264 % \begin{macrocode}
2265 \cs_gset_eq:NN \umgla \gla
2266 % \end{macrocode}
2267 % \end{macro}
2268 % The \pkg{expex}-|\gla| is then equated to the internal
2269 % function of the package that does the actual function
2270 % \parencite{alan}.
2271 % \begin{macrocode}
2272 \cs_gset_eq:NN \gla \glw@gla
2273 }
2274 % \end{macrocode}
2275 % In the false branch of \pkg{(lua)-unicode-math}, I issue
2276 % an info message that is not visible on the terminal, but
2277 % is printed in the log file.
2278 % \begin{macrocode}
2279 } {
2280 \msg_info:nnn { linguistix-fixpex }
2281 { pkg_not_loaded }
2282 { (lua)-unicode-math }
2283 }
2284 % \end{macrocode}
2285 % Similarly, I do it for \pkg{expex}.
2286 % \begin{macrocode}
2287 } {
2288 \msg_info:nnn { linguistix-fixpex } { pkg_not_loaded } {
2289 expex
2290 }
2291 }
2292 }
2293 %</fixpex>
2294 % \end{macrocode}
2295 % \newpage
2296 % \lngximplementation{fonts}
2297 % Package essentials first.
2298 % \begin{macrocode}
2299 %<*font>
2300 \ProvidesExplPackage{linguistix-fonts}
2301 {2026-05-15}
2302 {v1.0}
2303 {%
2304 The font-assistant package of the
2305 ‘LinguisTiX’ bundle.%
2306 }
2307 % \end{macrocode}
2308 % Then, I load \pkg{unicode-math} or \pkg{lua-unicode-math}
2309 % (depending on the engine used), \lngxnfsslogo\ and
2310 % \lngxbaselogo\ (if they are not already loaded).
2311 % \begin{macrocode}
2312
2313 \IfPackageLoadedF { linguistix-base } {
2314 \RequirePackage { linguistix-base }
2315 }
2316
2317 \sys_if_engine_luatex:TF {
2318 \IfPackageLoadedF { unicode-math } {
2319 \IfPackageLoadedF { lua-unicode-math } {
2320 \RequirePackage { fontspec, lua-unicode-math }
2321 }
2322 }
2323 } {
2324 \IfPackageLoadedF { unicode-math } {
2325 \RequirePackage { unicode-math }
2326 }
2327 }
2328
2329 \IfPackageLoadedF { linguistix-fixpex } {
2330 \RequirePackage { linguistix-fixpex }
2331 }
2332 % \end{macrocode}
2333 % \begin{macro}{\LaTeX,\ogLaTeX}
2334 % We save the original code for the |\LaTeX| logo and then
2335 % renew the command.
2336 % \begin{macrocode}
2337
2338 \NewCommandCopy \ogLaTeX \LaTeX
2339
2340 \RenewDocumentCommand \LaTeX { } {%
2341 L\kern-.81ex\relax
2342 \raisebox{.6ex}{\textsc{a}}\kern-.23ex\relax
2343 \hbox{T}\kern-.4ex\relax
2344 \raisebox{-.5ex}{E}\kern-.3ex\relax
2345 X%
2346 }
2347 % \end{macrocode}
2348 % \end{macro}
2349 % \begin{macro}{^^A
2350 % old style numbers,\g_lngx_old_style_bool,^^A
2351 % old style one,\g_lngx_old_style_one_bool,^^A
2352 % bourbaki's empty set,\g_lngx_bourbaki_bool,^^A
2353 % \g__lngx_old_style_user_choice_bool
2354 % }
2355 % I used to set the |old style numbers| key to true, but
2356 % starting from version 0.9c, I have made this selection
2357 % conditional. Only when the language package is not loaded
2358 % (till the end of the preamble), I do that. Otherwise
2359 % respective language packages set it. If the user
2360 % explicitly decides to set it to some value, then the
2361 % package shouldn’t change the value with the hook. In order
2362 % to check that, we develop an internal boolean.
2363 % \begin{macrocode}
2364
2365 \bool_new:N \g_lngx_old_style_bool
2366 \bool_new:N \g__lngx_old_style_user_choice_bool
2367
2368 \keys_define:nn { lngx_keys } {
2369 old~ style~ numbers
2370 .choices:nn = { true,false } {
2371 \bool_gset_true:N \g__lngx_old_style_user_choice_bool
2372 \use:c { bool_gset_ \l_keys_choice_str :N }
2373 \g_lngx_old_style_bool
2374 },
2375 old~ style~ numbers
2376 .default:n = { true },
2377 old~ style~ one
2378 .bool_gset:N = \g_lngx_old_style_one_bool,
2379 bourbaki's~ empty~ set
2380 .bool_gset:N = \g_lngx_bourbaki_bool
2381 }
2382 % \end{macrocode}
2383 % \end{macro}
2384 % \begin{macro}{^^A
2385 % \g__lngx_text_main_fonts_prop,^^A
2386 % \g__lngx_text_main_font_features_tl,^^A
2387 % text upright,text upright features,text bold,text bold
2388 % features,text italic,text italic features,text bold
2389 % italic,text bold italic features,text slanted,text slanted
2390 % features,text bold slanted,text bold slanted features,text
2391 % swash,text swash features,text bold swash,text bold swash
2392 % features,text small caps,text small caps features^^A
2393 % }
2394 % In the first few versions of the package, I used to save
2395 % the font-names and their features in token lists, but I
2396 % found a better way to deal with this later which was using
2397 % |prop| lists. I had released the |tl|s publicly (with a
2398 % single |_| after the scope marker), which means ideally
2399 % they should be available forever, but for performance and
2400 % maintenance the newer approach is much preferred and hence
2401 % I decided to shift to |prop| lists from v0.6. This time, I
2402 % am correcting the mistake I made before. The |prop| lists
2403 % that save the keys is not public. It need not be. Only the
2404 % key-value pairs are public. They are unchanged anyway.
2405 % This section describes the implementation of serif text
2406 % fonts. All these keys have a common pattern of code. For
2407 % the convenience of maintenance, I have created a
2408 % comma-separated-list and used the elements of this list
2409 % inside the common code.
2410 % (See: \url{https://topanswers.xyz/tex?q=8074#a7689}.)
2411 % \begin{macrocode}
2412
2413 \prop_gclear_new:N \g__lngx_text_main_fonts_prop
2414 \tl_gclear_new:N \g__lngx_text_main_font_features_tl
2415
2416 \clist_map_inline:nn {
2417 upright,
2418 bold,
2419 italic,
2420 bold~ italic,
2421 slanted,
2422 bold~ slanted,
2423 swash,
2424 bold~ swash,
2425 small~ caps
2426 } {
2427 % \end{macrocode}
2428 % All the keys listed here use a global token list to have
2429 % an appending list of features. The variables are declared
2430 % here.
2431 % \begin{macrocode}
2432 \group_begin:
2433 \str_clear:N \l_tmpa_str
2434 \str_set:Nn \l_tmpa_str { #1 }
2435 \str_replace_all:Nnn \l_tmpa_str { ~ } { _ }
2436 \tl_gclear_new:c {
2437 g__lngx_text_main_features_ \l_tmpa_str _tl
2438 }
2439 \group_end:
2440 % \end{macrocode}
2441 % All the keys here are prefixed with the word |text| in
2442 % order to distinguish them from the keys provided by the
2443 % \lngxipalogo\ package. The argument of these keys should
2444 % be expanded for which I use |\prop_gput:Nne| function.
2445 % Each |#1| is replaced by the items from clist and the loop
2446 % is repeated, whereas |##1| is the argument passed to the
2447 % key by user.
2448 % \begin{macrocode}
2449 \keys_define:nn { lngx_keys } {
2450 text~ #1
2451 .code:n = {
2452 % \end{macrocode}
2453 % I start a group first. Then clear and set a temporary
2454 % string variable. I make the text of the key titlecased as
2455 % required by \pkg{fontspec} and remove the spaces. Lastly,
2456 % the word |Font| is appended. So, |bold italic| becomes
2457 % |BoldItalicFont|.
2458 % \begin{macrocode}
2459 \group_begin:
2460 \str_clear:N \l_tmpa_str
2461 \str_set:Ne \l_tmpa_str {
2462 \text_titlecase_all:n { #1 }
2463 Font
2464 }
2465 \str_replace_all:Nnn \l_tmpa_str { ~ } { }
2466 % \end{macrocode}
2467 % The string is used inside the relevant |prop|-key and
2468 % group is ended.
2469 % \begin{macrocode}
2470 \prop_gput:Nne \g__lngx_text_main_fonts_prop
2471 { text~ #1 }
2472 { \str_use:N \l_tmpa_str = { ##1 } }
2473 \group_end:
2474 },
2475 % \end{macrocode}
2476 % Same is repeated for features, but we add the value of the
2477 % keys to a continuously appending token list first and then
2478 % expand it in the prop variable.
2479 % \begin{macrocode}
2480 text~ #1~ features
2481 .code:n = {
2482 \group_begin:
2483 \str_clear:N \l_tmpa_str
2484 \str_clear:N \l_tmpb_str
2485 \str_set:Ne \l_tmpa_str {
2486 \text_titlecase_all:n { #1 }
2487 Features
2488 }
2489 \str_set:Nn \l_tmpb_str { #1 }
2490 \str_replace_all:Nnn \l_tmpa_str { ~ } { }
2491 \str_replace_all:Nnn \l_tmpb_str { ~ } { _ }
2492 \tl_gput_right:ce {
2493 g__lngx_text_main_features_ \l_tmpb_str _tl
2494 } {
2495 \tl_if_empty:cF {
2496 g__lngx_text_main_features_ \l_tmpb_str _tl
2497 } { , }
2498 \exp_not:n { ##1 }
2499 }
2500 \prop_gput:Nne \g__lngx_text_main_fonts_prop
2501 { text~ #1~ features } {
2502 \str_use:N \l_tmpa_str = {
2503 \exp_not:v {
2504 g__lngx_text_main_features_ \l_tmpb_str _tl
2505 }
2506 }
2507 }
2508 \group_end:
2509 }
2510 }
2511 }
2512 % \end{macrocode}
2513 % \end{macro}
2514 % \begin{macro}{text main extra features}
2515 % This key adds to the property that stores the extra
2516 % features for the serif fonts.
2517 % \begin{macrocode}
2518
2519 \tl_gclear_new:N \g__lngx_text_main_features_extra_tl
2520
2521 \keys_define:nn { lngx_keys } {
2522 text~ main~ extra~ features
2523 .code:n = {
2524 \tl_gput_right:Ne \g__lngx_text_main_features_extra_tl {
2525 \tl_if_empty:NF \g__lngx_text_main_features_extra_tl {
2526 ,
2527 }
2528 \exp_not:n { #1 }
2529 }
2530 \prop_gput:Nne \g__lngx_text_main_fonts_prop
2531 { text~ main~ extra~ features } {
2532 \exp_not:V \g__lngx_text_main_features_extra_tl
2533 }
2534 }
2535 }
2536 % \end{macrocode}
2537 % \end{macro}
2538 % \newpage
2539 % \begin{macro}{^^A
2540 % \g__lngx_text_sans_fonts_prop,^^A
2541 % \g__lngx_text_sans_font_features_tl,^^A
2542 % \g__lngx_text_mono_fonts_prop,^^A
2543 % \g__lngx_text_mono_font_features_tl,^^A
2544 % text sans extra features,text sans upright,text sans
2545 % upright features,text sans bold,text sans bold
2546 % features,text sans italic,text sans italic features,text
2547 % sans bold italic,text sans bold italic features,text sans
2548 % slanted,text sans slanted features,text sans bold
2549 % slanted,text sans bold slanted features,text sans
2550 % swash,text sans swash features,text sans bold swash,text
2551 % sans bold swash features,text sans small caps,text sans
2552 % small caps features,text mono extra features,text mono
2553 % upright,text mono upright features,text mono bold,text
2554 % mono bold features,text mono italic,text mono italic
2555 % features,text mono bold italic,text mono bold italic
2556 % features,text mono slanted,text mono slanted features,text
2557 % mono bold slanted,text mono bold slanted features,text
2558 % mono swash,text mono swash features,text mono bold
2559 % swash,text mono bold swash features,text mono small
2560 % caps,text mono small caps features^^A
2561 % }
2562 % Since the only difference between the upcoming keys is
2563 % that of the word |sans| and |mono|, we combine them
2564 % together and use a nested |clist|. The rest of the
2565 % mechanism is identical.
2566 % \begin{macrocode}
2567
2568 \prop_gclear_new:N \g__lngx_text_sans_fonts_prop
2569 \tl_gclear_new:N \g__lngx_text_sans_font_features_tl
2570
2571 \prop_gclear_new:N \g__lngx_text_mono_fonts_prop
2572 \tl_gclear_new:N \g__lngx_text_mono_font_features_tl
2573
2574 \clist_map_inline:nn {
2575 sans,
2576 mono
2577 } {
2578 \tl_gclear_new:c {
2579 g__lngx_text_ #1 _features_extra_tl
2580 }
2581 \clist_map_inline:nn {
2582 upright,
2583 bold,
2584 italic,
2585 bold~ italic,
2586 slanted,
2587 bold~ slanted,
2588 swash,
2589 bold~ swash,
2590 small~ caps
2591 } {
2592 \group_begin:
2593 \str_clear:N \l_tmpa_str
2594 \str_set:Nn \l_tmpa_str { ##1 }
2595 \str_replace_all:Nnn \l_tmpa_str { ~ } { _ }
2596 \tl_gclear_new:c {
2597 g__lngx_text_ #1 _features_ \l_tmpa_str _tl
2598 }
2599 \group_end:
2600 \keys_define:nn { lngx_keys } {
2601 text~ #1~ ##1
2602 .code:n = {
2603 \group_begin:
2604 \str_clear:N \l_tmpa_str
2605 \str_set:Ne \l_tmpa_str {
2606 \text_titlecase_all:n { ##1 }
2607 Font
2608 }
2609 \str_replace_all:Nnn \l_tmpa_str { ~ } { }
2610 \prop_gput:cne { g__lngx_text_ #1 _fonts_prop }
2611 { text~ #1~ ##1 } {
2612 \str_use:N \l_tmpa_str = {
2613 \exp_not:n { ####1 }
2614 }
2615 }
2616 \group_end:
2617 },
2618 text~ #1~ ##1~ features
2619 .code:n = {
2620 \group_begin:
2621 \str_clear:N \l_tmpa_str
2622 \str_clear:N \l_tmpb_str
2623 \str_set:Ne \l_tmpa_str {
2624 \text_titlecase_all:n { ##1 }
2625 Features
2626 }
2627 \str_set:Nn \l_tmpb_str { ##1 }
2628 \str_replace_all:Nnn \l_tmpa_str { ~ } { }
2629 \str_replace_all:Nnn \l_tmpb_str { ~ } { _ }
2630 \tl_gput_right:ce {
2631 g__lngx_text_ #1 _features_ \l_tmpb_str _tl
2632 } {
2633 \tl_if_empty:cF {
2634 g__lngx_text_ #1 _features_ \l_tmpb_str _tl
2635 } { , }
2636 \exp_not:n { ####1 }
2637 }
2638 \prop_gput:cne { g__lngx_text_ #1 _fonts_prop }
2639 { text~ #1~ ##1~ features } {
2640 \str_use:N \l_tmpa_str = {
2641 \exp_not:v {
2642 g__lngx_text_ #1 _features_ \l_tmpb_str _tl
2643 }
2644 }
2645 }
2646 \group_end:
2647 }
2648 }
2649 }
2650 \keys_define:nn { lngx_keys } {
2651 text~ #1~ extra~ features
2652 .code:n = {
2653 \tl_gput_right:ce {
2654 g__lngx_text_ #1 _features_extra_tl
2655 } {
2656 \tl_if_empty:cF {
2657 g__lngx_text_ #1 _features_extra_tl
2658 } { , }
2659 \exp_not:n { ##1 }
2660 }
2661 \prop_gput:cne { g__lngx_text_ #1 _fonts_prop }
2662 { text~ #1~ extra~ features } {
2663 \exp_not:v { g__lngx_text_ #1 _features_extra_tl }
2664 }
2665 }
2666 }
2667 }
2668 % \end{macrocode}
2669 % \end{macro}
2670 % \begin{macro}{^^A
2671 % \g__lngx_text_main_font_tl,\g__lngx_text_sans_font_tl,^^A
2672 % \g__lngx_text_mono_font_tl,^^A
2673 % text main font,text sans font,text mono font^^A
2674 % }
2675 % These keys add the parameter that sets the main font for
2676 % text. They set an internal token list which is retrieved
2677 % later by font setting command.
2678 % \begin{macrocode}
2679
2680 \clist_map_inline:nn {
2681 main,
2682 sans,
2683 mono
2684 } {
2685 \keys_define:nn { lngx_keys } {
2686 text~ #1~ font
2687 .tl_gset:c = { g__lngx_text_ #1 _font_tl }
2688 }
2689 }
2690 % \end{macrocode}
2691 % \end{macro}
2692 % \begin{macro}{^^A
2693 % \g__lngx_math_fonts_prop,^^A
2694 % \g__lngx_math_features_tl,^^A
2695 % \g__lngx_math_bold_fonts_prop,^^A
2696 % \g__lngx_math_bold_features_tl,^^A
2697 % math,math features,math bold,math bold features^^A
2698 % }
2699 % The following are the keys set for math. They use the same
2700 % mechanism as before.
2701 % \begin{macrocode}
2702
2703 \prop_gclear_new:N \g__lngx_math_fonts_prop
2704 \tl_gclear_new:N \g__lngx_math_features_tl
2705
2706 \prop_gclear_new:N \g__lngx_math_bold_fonts_prop
2707 \tl_gclear_new:N \g__lngx_math_bold_features_tl
2708
2709 \keys_define:nn { lngx_keys } {
2710 math
2711 .tl_gset:N = \g__lngx_math_font_tl,
2712 math~ bold
2713 .tl_gset:N = \g__lngx_math_bold_font_tl,
2714 math~ features
2715 .prop_gput:N = \g__lngx_math_fonts_prop,
2716 math~ bold~ features
2717 .prop_gput:N = \g__lngx_math_bold_fonts_prop
2718 }
2719 % \end{macrocode}
2720 % \end{macro}
2721 % \begin{macro}{newcm}
2722 % This key is of type |.meta:n|. It sets certain other keys
2723 % that enable the New Computer Modern fonts in book weight
2724 % and in all of the serif, sans serif and monospaced
2725 % families.
2726 % \begin{macrocode}
2727
2728 \keys_define:nn { lngx_keys } {
2729 newcm
2730 .meta:n = {
2731 text~ main~ font = { NewCM10-Book.otf },
2732 text~ sans~ font = { NewCMSans10-Book.otf },
2733 text~ mono~ font = { NewCMMono10-Book.otf },
2734 math = { NewCMMath-Book.otf },
2735 math~ bold = { NewCMMath-Bold.otf }
2736 }
2737 }
2738 % \end{macrocode}
2739 % \end{macro}
2740 % \begin{macro}{newcm sans}
2741 % This is a |.meta:n| key that sets the default fonts to the
2742 % sans family.
2743 % \begin{macrocode}
2744
2745 \keys_define:nn { lngx_keys } {
2746 newcm~ sans
2747 .meta:n = {
2748 text~ main~ font = { NewCMSans10-Book.otf },
2749 text~ sans~ font = { NewCMSans10-Book.otf },
2750 text~ mono~ font = { NewCMMono10-Book.otf },
2751 math = { NewCMSansMath-Regular.otf },
2752 math~ bold = { NewCMSansMath-Regular.otf }
2753 }
2754 }
2755 % \end{macrocode}
2756 % \end{macro}
2757 % \begin{macro}{newcm mono}
2758 % This is a |.meta:n| key that sets the default fonts to the
2759 % monospaced family.
2760 % \begin{macrocode}
2761
2762 \keys_define:nn { lngx_keys } {
2763 newcm~ mono
2764 .meta:n = {
2765 text~ main~ font = { NewCMMono10-Book.otf },
2766 text~ sans~ font = { NewCMSans10-Book.otf },
2767 text~ mono~ font = { NewCMMono10-Book.otf },
2768 math = { NewCMSansMath-Regular.otf },
2769 math~ bold = { NewCMSansMath-Regular.otf }
2770 }
2771 }
2772 % \end{macrocode}
2773 % \end{macro}
2774 % \begin{macro}{newcm regular}
2775 % This is a |.meta:n| key that sets the default fonts to the
2776 % regular variant of the New Computer Modern family.
2777 % \begin{macrocode}
2778
2779 \keys_define:nn { lngx_keys } {
2780 newcm~ regular
2781 .meta:n = {
2782 text~ main~ font = { NewCM10-Regular.otf },
2783 text~ sans~ font = { NewCMSans10-Regular.otf },
2784 text~ mono~ font = { NewCMMono10-Regular.otf },
2785 math = { NewCMMath-Regular.otf },
2786 math~ bold = { NewCMMath-Bold.otf }
2787 }
2788 }
2789 % \end{macrocode}
2790 % \end{macro}
2791 % \begin{macro}{newcm regular sans}
2792 % This is a |.meta:n| key that sets the default fonts to the
2793 % regular sans variant of the New Computer Modern family.
2794 % \begin{macrocode}
2795
2796 \keys_define:nn { lngx_keys } {
2797 newcm~ regular~ sans
2798 .meta:n = {
2799 text~ main~ font = { NewCMSans10-Regular.otf },
2800 text~ sans~ font = { NewCMSans10-Regular.otf },
2801 text~ mono~ font = { NewCMMono10-Regular.otf },
2802 math = { NewCMMath-Regular.otf },
2803 math~ bold = { NewCMMath-Bold.otf }
2804 }
2805 }
2806 % \end{macrocode}
2807 % \end{macro}
2808 % \begin{macro}{newcm regular mono}
2809 % This is a |.meta:n| key that sets the default fonts to the
2810 % regular monospaced variant of the New Computer Modern
2811 % family.
2812 % \begin{macrocode}
2813
2814 \keys_define:nn { lngx_keys } {
2815 newcm~ regular~ mono
2816 .meta:n = {
2817 text~ main~ font = { NewCMMono10-Regular.otf },
2818 text~ sans~ font = { NewCMSans10-Regular.otf },
2819 text~ mono~ font = { NewCMMono10-Regular.otf },
2820 math = { NewCMMath-Regular.otf },
2821 math~ bold = { NewCMMath-Bold.otf },
2822 }
2823 }
2824 % \end{macrocode}
2825 % \end{macro}
2826 % Then we load the |bourbaki's empty set| boolean. This gets
2827 % read later while setting the math font.
2828 % \begin{macrocode}
2829
2830 \lngx_set_keys:n {
2831 bourbaki's~ empty~ set,
2832 % \end{macrocode}
2833 % Then we load the |old style numbers| boolean.
2834 % \begin{macrocode}
2835 newcm
2836 }
2837 % \end{macrocode}
2838 % \begin{macro}{^^A
2839 % \lngx_set_main_font:nn,\lngx_set_sans_font:nn,^^A
2840 % \lngx_set_mono_font:nn,\lngx_set_math_font:nn^^A
2841 % }
2842 % If \lngxlanguageslogo\ package is loaded, I load the fonts
2843 % with |\babelfont| command. In case it is not loaded, the
2844 % fonts are set with |\setxxxxcommand|-type commands
2845 % provided by \pkg{fontspec}.
2846 % \begin{macrocode}
2847
2848 \IfPackageLoadedF { linguistix-languages } {
2849 \cs_new_protected:Npn \lngx_set_main_font:nn #1#2 {
2850 \setmainfont [ #1 ] { #2 }
2851 }
2852 \cs_new_protected:Npn \lngx_set_sans_font:nn #1#2 {
2853 \setsansfont [ #1 ] { #2 }
2854 }
2855 \cs_new_protected:Npn \lngx_set_mono_font:nn #1#2 {
2856 \setmonofont [ #1 ] { #2 }
2857 }
2858 }
2859 % \end{macrocode}
2860 % A wrapper command is provided for loading math fonts.
2861 % \begin{macrocode}
2862
2863 \cs_new_protected:Npn \lngx_set_math_font:nn #1#2 {
2864 \setmathfont [ #1 ] { #2 }
2865 }
2866 % \end{macrocode}
2867 % \begin{macrocode}
2868
2869 \cs_new_protected:Npn \lngx_set_math_bold_font:nn #1#2 {
2870 \IfPackageLoadedT { lua-unicode-math } {
2871 \DeclareMathVersion { bold }
2872 }
2873 \setmathfont [
2874 #1,
2875 version = { bold }
2876 ] { #2 }
2877 }
2878 % \end{macrocode}
2879 % All of these commands should expand their arguments, so I
2880 % provide the appropriate variants.
2881 % \begin{macrocode}
2882
2883 \cs_generate_variant:Nn \lngx_set_main_font:nn { VV }
2884 \cs_generate_variant:Nn \lngx_set_sans_font:nn { VV }
2885 \cs_generate_variant:Nn \lngx_set_mono_font:nn { VV }
2886 \cs_generate_variant:Nn \lngx_set_math_font:nn { VV }
2887 \cs_generate_variant:Nn \lngx_set_math_bold_font:nn { VV }
2888 % \end{macrocode}
2889 % \end{macro}
2890 % \begin{macro}{^^A
2891 % \__lngx_build_main_font_features:,^^A
2892 % \__lngx_build_sans_font_features:,^^A
2893 % \__lngx_build_mono_font_features:,^^A
2894 % \__lngx_build_math_font_features:,^^A
2895 % \__lngx_build_bold_math_font_features:,^^A
2896 % \g__lngx_text_main_font_features_tl,^^A
2897 % \g__lngx_text_sans_font_features_tl,^^A
2898 % \g__lngx_text_mono_font_features_tl,^^A
2899 % \g__lngx_math_font_features_tl,^^A
2900 % \g__lngx_bold_math_font_features_tl
2901 % }
2902 % These are some internal functions that basically iterate
2903 % on the |prop| list items and each of them is put to the
2904 % right of the respective token list. This way only the
2905 % functions that are added by the user are exported to the
2906 % font setting command.
2907 % \begin{macrocode}
2908
2909 \clist_map_inline:nn {
2910 main,
2911 sans,
2912 mono
2913 } {
2914 \cs_new_protected:cpn {
2915 __lngx_build_ #1 _font_features:
2916 } {
2917 \prop_map_inline:cn { g__lngx_text_ #1 _fonts_prop } {
2918 \tl_gput_right:cn {
2919 g__lngx_text_ #1 _font_features_tl
2920 } { ####2, }
2921 }
2922 }
2923 }
2924
2925 \cs_new_protected:Npn \__lngx_build_math_features: {
2926 \prop_map_inline:Nn \g__lngx_math_fonts_prop {
2927 \tl_gput_right:Nn \g__lngx_math_features_tl {
2928 { ##2 }
2929 }
2930 }
2931 }
2932
2933 \cs_new_protected:Npn \__lngx_build_math_bold_features: {
2934 \prop_map_inline:Nn \g__lngx_math_bold_fonts_prop {
2935 \tl_gput_right:Nn \g__lngx_math_bold_features_tl {
2936 { ##2 }
2937 }
2938 }
2939 }
2940 % \end{macrocode}
2941 % \end{macro}
2942 % Now I start the pre-|begindocument| hook.
2943 % \begin{macrocode}
2944
2945 \hook_gput_code:nnn { begindocument / before } { . } {
2946 % \end{macrocode}
2947 % Starting from v0.9c, I have decided to set the
2948 % |old style numbers| key conditionally. The reason for this
2949 % change is explained in the documentation of
2950 % |old style numbers| key. Here, I load this key only if
2951 % \lngxlanguageslogo\ is not loaded. In that case we can
2952 % assume that the author has no intention to write a
2953 % multilingual document. Thus, it can be assumed that the
2954 % document is supposed to be in English and there we can
2955 % make this mandatory. Also, if the user has set this option
2956 % themselves, that means the package shouldn’t tinker with
2957 % it. So we check it with the internal boolean that was set
2958 % along with the key.
2959 % \begin{macrocode}
2960 \IfPackageLoadedF { linguistix-languages } {
2961 \bool_if:NF \g__lngx_old_style_user_choice_bool {
2962 \lngx_set_keys:n { old~ style~ numbers }
2963 }
2964 }
2965 % \end{macrocode}
2966 % If the boolean for old style numbers is true, I set the
2967 % |Numbers| key to |OldStyle|. Similarly, if the
2968 % NewCM-specific old one is requested, I turn the
2969 % character-variant on.
2970 % \begin{macrocode}
2971 \lngx_set_keys:n {
2972 text~ main~ extra~
2973 features = {
2974 \bool_if:NT \g_lngx_old_style_bool {
2975 Numbers = { OldStyle },
2976 \bool_if:NT \g_lngx_old_style_one_bool {
2977 CharacterVariant = { 6 }
2978 }
2979 }
2980 },
2981 text~ sans~ extra~
2982 features = {
2983 \bool_if:NT \g_lngx_old_style_bool {
2984 Numbers = { OldStyle },
2985 \bool_if:NT \g_lngx_old_style_one_bool {
2986 CharacterVariant = { 6 }
2987 }
2988 }
2989 }
2990 }
2991 % \end{macrocode}
2992 % All the font features are built using the internal
2993 % functions and then fonts are set.
2994 % \begin{macrocode}
2995 \__lngx_build_main_font_features:
2996 \lngx_set_main_font:VV
2997 \g__lngx_text_main_font_features_tl
2998 \g__lngx_text_main_font_tl
2999 \__lngx_build_sans_font_features:
3000 \lngx_set_sans_font:VV
3001 \g__lngx_text_sans_font_features_tl
3002 \g__lngx_text_sans_font_tl
3003 \__lngx_build_mono_font_features:
3004 \lngx_set_mono_font:VV
3005 \g__lngx_text_mono_font_features_tl
3006 \g__lngx_text_mono_font_tl
3007 \__lngx_build_math_features:
3008 \lngx_set_math_font:VV \g__lngx_math_features_tl
3009 \g__lngx_math_font_tl
3010 \IfPackageLoadedT { unicode-math } {
3011 \__lngx_build_math_bold_features:
3012 \lngx_set_math_bold_font:VV
3013 \g__lngx_math_bold_features_tl
3014 \g__lngx_math_bold_font_tl
3015 }
3016 }
3017 %</font>
3018 % \end{macrocode}
3019 % \newpage
3020 % \lngximplementation{glossing}
3021 % \begin{macrocode}
3022 %<*glossing>
3023 \ProvidesExplPackage{linguistix-glossing}
3024 {2026-05-15}
3025 {v1.0}
3026 {%
3027 Accessible glossing with LinguisTiX%
3028 }
3029 % \end{macrocode}
3030 % In order to print the multi-column glossary, I load the
3031 % \cs{multicol} package.
3032 % \begin{macrocode}
3033
3034 \IfPackageLoadedF { multicol } {
3035 \RequirePackage { multicol }
3036 }
3037 % \end{macrocode}
3038 % Then I declare some variables that will be used for
3039 % generating the glossing-auxiliary.
3040 % \begin{macrocode}
3041
3042 \bool_new:N \l_lngx_expansion_bool
3043 \tl_clear_new:N \l_lngx_gloss_separator_tl
3044 \tl_clear_new:N \l_lngx_expansion_separator_tl
3045 \tl_clear_new:N \l_lngx_glossary_separator_tl
3046 \dim_zero_new:N \l_lngx_i_have_dim
3047 \dim_zero_new:N \l_lngx_i_need_dim
3048 \dim_zero_new:N \l_lngx_remain_dim
3049 \dim_zero_new:N \l_lngx_i_hack_dim
3050 \int_gzero_new:N \g__lngx_page_ref_int
3051 \str_clear_new:N \l_lngx_gls_language_str
3052 \str_clear_new:N \l__lngx_gls_sorting_order_str
3053 \str_clear_new:N \l__lngx_gls_expansion_case_str
3054 \str_clear_new:N \l__lngx_glossary_style_str
3055 \str_clear_new:N \l__lngx_separator_str
3056 \seq_gclear_new:N \g__lngx_gls_use_order_seq
3057
3058 \str_set:Nn \l__lngx_separator_str { gloss }
3059 % \end{macrocode}
3060 % Glossaries are hyperlinked with complex and cryptic
3061 % labels. Some readers read the labels loudly when using
3062 % assistive technology. In order to dodge that, I add the
3063 % text to the Contents key. It uses Ulrike’s ideas:
3064 % \url{tex.stackexchange.com/a/758083/174620}.
3065 % \begin{macrocode}
3066
3067 \IfPDFManagementActiveT {
3068 \socket_if_exist:nT { hyp / link / GoTo / Contents } {
3069 \socket_new_plug:nnn { hyp / link / GoTo / Contents }
3070 { text } {
3071 \pdfstringdef \__lngx_tmp_text: { #2 }
3072 \pdfannot_dict_put:nne { link / GoTo } { Contents } {
3073 ( \__lngx_tmp_text: )
3074 }
3075 }
3076 }
3077 }
3078 % \end{macrocode}
3079 % After these initial declarations, I move to the socket
3080 % that controls the description of the gloss. The socket
3081 % itself has no arguments.
3082 % \begin{macrocode}
3083
3084 \socket_new:nn { lngx / description / gloss } { 0 }
3085 % \end{macrocode}
3086 % \begin{macro}{\__lngx_gloss_description:}
3087 % When the socket is assigned the |on| plug, it defines the
3088 % expandable internal command for glossing description. It
3089 % is then used inside the tagging socket. The same command
3090 % is made inactive when the socket is assigned the |off|
3091 % plug. By default the |off| plug is assigned (this is
3092 % experimental and may change after reviews from the blind
3093 % people). The socket is activated by using it.
3094 % \begin{macrocode}
3095
3096 \socket_new_plug:nnn { lngx / description / gloss } { on } {
3097 \cs_set:Npn \__lngx_gloss_description: { Gloss~ }
3098 }
3099
3100 \socket_new_plug:nnn { lngx / description / gloss }
3101 { off } {
3102 \cs_set_eq:NN \__lngx_gloss_description: \prg_do_nothing:
3103 }
3104
3105 \socket_assign_plug:nn { lngx / description / gloss }
3106 { off }
3107
3108 \socket_use:n { lngx / description / gloss }
3109 % \end{macrocode}
3110 % \end{macro}
3111 % Then I declare the tagging socket for glossing which takes
3112 % two arguments. It should follow the default tagging which
3113 % is why I use the |default| plug (which is the only plug
3114 % the package does and will offer). The code is based on
3115 % suggestions by Ulrike Fischer
3116 % (\url{github.com/latex3/tagging-project/discussions/975}).
3117 % The |E| tag is used for ‘expansion’ which more or less
3118 % suits the nature of glosses. So it is used here. The
3119 % command \cs{__lngx_gloss_description:} is controlled by
3120 % the socket and is expandable.
3121 % \begin{macrocode}
3122
3123 \NewTaggingSocket { lngx / gloss } { 2 }
3124
3125 \NewTaggingSocketPlug { lngx / gloss } { default } {
3126 \mode_leave_vertical:
3127 \tag_mc_end:
3128 \exp_args:Ne
3129 \tag_struct_begin:n {
3130 tag = { Span },
3131 E = {
3132 \__lngx_gloss_description: #2
3133 }
3134 }
3135 \tag_mc_begin:n {
3136 tag = { Span }
3137 }
3138 % \end{macrocode}
3139 % The argument is printed with the package-controlled
3140 % formatting command. First I check if the \pkg{hyperref}
3141 % package is loaded. If it is loaded, the link colour is
3142 % changed to the one stored in the variable
3143 % \cs{g_lngx_gloss_link_color_str} (black, by default).
3144 % \begin{macrocode}
3145 \IfPackageLoadedTF { hyperref } {
3146 \group_begin:
3147 \str_clear:N \l_tmpa_str
3148 \str_set:Nn \l_tmpa_str { #1 }
3149 \exp_args:Ne \hypersetup {
3150 linkcolor = {
3151 \exp_not:V \g__lngx_gloss_link_color_str
3152 }
3153 }
3154 % \end{macrocode}
3155 % The socket for adding text into the Contents directory is
3156 % used here.
3157 % \begin{macrocode}
3158 \IfPDFManagementActiveT {
3159 \socket_if_exist:nT { hyp / link / GoTo / Contents } {
3160 \socket_assign_plug:nn {
3161 hyp / link / GoTo / Contents
3162 } { text }
3163 }
3164 }
3165 \lngx_gloss_format:n {
3166 \hyperlink { lngx_ #1 _glossary } { #1 }
3167 }
3168 \group_end:
3169 } {
3170 % \end{macrocode}
3171 % If \pkg{hyperref} is not loaded, the text is simply
3172 % printed with the formatting command.
3173 % \begin{macrocode}
3174 \lngx_gloss_format:n { #1 }
3175 }
3176 \tag_mc_end:
3177 \tag_struct_end:
3178 \tag_mc_begin:n { }
3179 }
3180 % \end{macrocode}
3181 % I assign the default tagging plug to the socket I just
3182 % defined.
3183 % \begin{macrocode}
3184
3185 \AssignTaggingSocketPlug { lngx / gloss } { default }
3186 % \end{macrocode}
3187 % \begin{macro}{format}
3188 % Now I define the key for adjusting the formatting of the
3189 % glosses. It controls several keys contained in a separate
3190 % set. In short, this key will take another keys as
3191 % arguments.
3192 % \begin{macrocode}
3193
3194 \keys_define:nn { lngx_glossing } {
3195 format
3196 .meta:nn = { lngx / gloss / format } { #1 },
3197 % \end{macrocode}
3198 % \end{macro}
3199 % \begin{macro}{link color,\g__lngx_gloss_link_color_str}
3200 % This option sets the colour used for glossing links. It is
3201 % set to |black| by default.
3202 % \begin{macrocode}
3203 link~ color
3204 .str_gset:N = \g__lngx_gloss_link_color_str,
3205 link~ color
3206 .initial:n = { black },
3207 % \end{macrocode}
3208 % \end{macro}
3209 % \begin{macro}{sort,\l__lngx_gls_sorting_order_str}
3210 % Glosses can be sorted alphabetically or as they are used.
3211 % The choice key for that is as follows. By default glosses
3212 % are sorted alphabetically.
3213 % \begin{macrocode}
3214 sort
3215 .choices:nn = { alphabetical, use } {
3216 \str_set_eq:NN \l__lngx_gls_sorting_order_str
3217 \l_keys_choice_str
3218 },
3219 sort
3220 .initial:n = { alphabetical },
3221 % \end{macrocode}
3222 % \end{macro}
3223 % \begin{macro}{^^A
3224 % expansion case,\l__lngx_gls_expansion_case_str
3225 % }
3226 % The expansion can be printed in lower case, title case
3227 % (with the first letter capitalised for all the words) or
3228 % title case (with the first letter capitalised only for the
3229 % first word). The default is lower case.
3230 % \begin{macrocode}
3231 expansion~ case
3232 .choices:nn = {
3233 lowercase, title~ case~ all, title~ case~ first
3234 } {
3235 \str_set_eq:NN \l__lngx_gls_expansion_case_str
3236 \l_keys_choice_str
3237 },
3238 expansion~ case
3239 .initial:n = { lowercase },
3240 % \end{macrocode}
3241 % \end{macro}
3242 % \begin{macro}{style,\l__lngx_glossary_style_str}
3243 % The glossary can be printed in two styles given below.
3244 % The default is |block|.
3245 % \begin{macrocode}
3246 style
3247 .choices:nn = { block, inline } {
3248 \str_set_eq:NN \l__lngx_glossary_style_str
3249 \l_keys_choice_str
3250 },
3251 style
3252 .initial:n = { block },
3253 % \end{macrocode}
3254 % \end{macro}
3255 % \begin{macro}{columns,\l__lngx_glossary_columns_int}
3256 % There is an option to change the number of columns used
3257 % for printing the glossary. It is controlled here. Default
3258 % is 2.
3259 % \begin{macrocode}
3260 columns
3261 .int_set:N = \l__lngx_glossary_columns_int,
3262 columns
3263 .initial:n = { 2 },
3264 % \end{macrocode}
3265 % \end{macro}
3266 % \begin{macro}{^^A
3267 % page numbers,\l__lngx_glosses_page_number_bool
3268 % }
3269 % Page numbers can be turned off with the following boolean.
3270 % By default, they are active.
3271 % \begin{macrocode}
3272 page~ numbers
3273 .bool_set:N =
3274 \l__lngx_glosses_page_number_bool,
3275 page~ numbers
3276 .initial:n = { true },
3277 % \end{macrocode}
3278 % \end{macro}
3279 % \begin{macro}{sectioning,\l__lngx_gls_sectioning_str}
3280 % The section used for printing the glossary title is
3281 % controlled by the following command. By default, I use
3282 % \cs{section} for printing the title.
3283 % \begin{macrocode}
3284 sectioning
3285 .str_set:N = \l__lngx_gls_sectioning_str,
3286 sectioning
3287 .initial:n = { section },
3288 % \end{macrocode}
3289 % \end{macro}
3290 % \begin{macro}{^^A
3291 % section number,\l__lngx_gls_section_number_bool
3292 % }
3293 % This controls if the sectioning level should be numbered
3294 % or unnumbered. The default is false.
3295 % \begin{macrocode}
3296 section~ number
3297 .bool_set:N = \l__lngx_gls_section_number_bool,
3298 section~ number
3299 .initial:n = { false },
3300 % \end{macrocode}
3301 % \end{macro}
3302 % \begin{macro}{no bold,\l__lngx_gls_bold_bool}
3303 % The |no bold| key is defined as an inverse boolean. By
3304 % default the key is set to false (resulting in the
3305 % controlled boolean being true).
3306 % \begin{macrocode}
3307 no~ bold
3308 .bool_set_inverse:N = \l__lngx_gls_bold_bool,
3309 no~ bold
3310 .initial:n = { false },
3311 % \end{macrocode}
3312 % \end{macro}
3313 % \begin{macro}{separator,\l__lngx_separator_tl}
3314 % The separator between the glosses is controlled using this
3315 % key. It controls the separator for inline glosses,
3316 % expansion of glosses as well as glosses seen in the
3317 % glossary. Each of these functions set a string variable
3318 % which is expanded when this key is used. The default value
3319 % of the string variable is gloss and the default value for
3320 % this key is |,~|, which means by default the separator
3321 % between glosses is a comma followed by a space.
3322 % \begin{macrocode}
3323 separator
3324 .code:n = {
3325 \tl_set:cn {
3326 l_lngx_
3327 \str_use:N \l__lngx_separator_str
3328 _separator_tl
3329 } { #1 }
3330 },
3331 separator
3332 .initial:n = { ,~ },
3333 % \end{macrocode}
3334 % \end{macro}
3335 % \begin{macro}{entry separator,\l__lngx_entry_separator_tl}
3336 % The separator between glossary entries is controlled using
3337 % this key. The default is a |\par| token.
3338 % \begin{macrocode}
3339 entry~ separator
3340 .tl_set:N = \l__lngx_entry_separator_tl,
3341 entry~ separator
3342 .initial:n = { \par }
3343 }
3344 % \end{macrocode}
3345 % \end{macro}
3346 % Sometimes language-specific settings are needed. I define
3347 % the language string variable with the information
3348 % retrieved from the lang key of the \textsc{pdf}.
3349 % \begin{macrocode}
3350
3351 \IfPDFManagementActiveT {
3352 \str_set:Ne \l_lngx_gls_language_str {
3353 \GetDocumentProperties { document / lang }
3354 }
3355 }
3356 % \end{macrocode}
3357 % \begin{macro}{gloss,\lngx_gloss_format:n}
3358 % The formatting of glosses is defined here. By default they
3359 % are printed in small caps.
3360 % \begin{macrocode}
3361
3362 \keys_define:nn { lngx / gloss / format } {
3363 gloss
3364 .cs_gset_protected:Np = \lngx_gloss_format:n #1,
3365 gloss
3366 .initial:n = { \textsc { #1 } },
3367 % \end{macrocode}
3368 % \end{macro}
3369 % \begin{macro}{expansion,\lngx_expansion_format:n}
3370 % The formatting of expansions is defined here. There is no
3371 % change in the printing in the defaults.
3372 % \begin{macrocode}
3373 expansion
3374 .cs_gset_protected:Np = \lngx_expansion_format:n #1,
3375 expansion
3376 .initial:n = { #1 }
3377 }
3378 % \end{macrocode}
3379 % \end{macro}
3380 % \begin{macro}{\setupglossing}
3381 % A wrapper around these options is provided.
3382 % \begin{macrocode}
3383
3384 \NewDocumentCommand \setupglossing { m } {
3385 \keys_set:nn { lngx_glossing } { #1 }
3386 }
3387 % \end{macrocode}
3388 % \end{macro}
3389 % \begin{macro}{\newgloss,\lngx_gloss_new:nn}
3390 % A function that creates new glosses starts here. It takes
3391 % 2 arguments.
3392 % \begin{macrocode}
3393
3394 \cs_new_protected:Npn \lngx_gloss_new:nn #1#2 {
3395 % \end{macrocode}
3396 % First and foremost, the string received as the first
3397 % argument should change its case to lowercase. It is done
3398 % by \cs{str_lowercase:n}. I will use a temporary string
3399 % variable for storing the converted value. This needs to be
3400 % done locally so I start a group and clear the local |str|
3401 % variable.
3402 % \begin{macrocode}
3403 \group_begin:
3404 \str_clear:N \l_tmpa_str
3405 \str_set:Ne \l_tmpa_str { \str_lowercase:n { #1 } }
3406 % \end{macrocode}
3407 % Every gloss has its expansion stored in a token list
3408 % associated to it. The token list is declared here and it
3409 % is set to the expansion (i.e., |#2|).
3410 % \begin{macrocode}
3411 \tl_gclear_new:c {
3412 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3413 }
3414 \seq_gclear_new:c {
3415 g_lngx_ \str_use:N \l_tmpa_str _pages_seq
3416 }
3417 \tl_gset:cn {
3418 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3419 } { #2 }
3420 % \end{macrocode}
3421 % Whenever a gloss is defined, an internal protected command
3422 % is defined. It doesn’t take any argument.
3423 % \begin{macrocode}
3424 \cs_new_protected:cpn {
3425 __lngx_gloss_ \str_use:N \l_tmpa_str :
3426 } {
3427 % \end{macrocode}
3428 % The arguments are passed to the tagging socket. Since the
3429 % tagging socket doesn’t expand everything, an exhaustive
3430 % expansion is performed with the help of \cs{exp_args:Nee}.
3431 % This is done only if the \cs{DocumentMetadata} command is
3432 % used.
3433 % \begin{macrocode}
3434 \IfDocumentMetadataTF {
3435 \exp_args:Nee \UseTaggingSocket
3436 { lngx / gloss }
3437 { \str_use:N \l_tmpa_str }
3438 { #2 }
3439 } {
3440 \IfPackageLoadedTF { hyperref } {
3441 \group_begin:
3442 \exp_args:Ne \hypersetup {
3443 linkcolor = {
3444 \exp_not:V \g__lngx_gloss_link_color_str
3445 }
3446 }
3447 \IfPDFManagementActiveT {
3448 \socket_if_exist:nT {
3449 hyp / link / GoTo / Contents
3450 } {
3451 \socket_assign_plug:nn {
3452 hyp / link / GoTo / Contents
3453 } { text }
3454 }
3455 }
3456 \lngx_gloss_format:n {
3457 \hyperlink { lngx_ #1 _glossary } { #1 }
3458 }
3459 \group_end:
3460 } {
3461 \lngx_gloss_format:n { #1 }
3462 }
3463 }
3464 % \end{macrocode}
3465 % I use \cs{label}-\cs{ref} mechanism for saving the page
3466 % numbers of the glosses. An internal integer called
3467 % \cs{g__lngx_page_ref_int} is used to generate unique
3468 % numbers. The kernel provides \cs{seq_remove_duplicates:N},
3469 % but as it iterates on each and every item, it is slow. The
3470 % duplicates can be avoided if the items are added to the
3471 % sequence conditionally and only when they don’t exist
3472 % already in the sequence. This way duplicates are not
3473 % generated at all. This method is used for adding to the
3474 % sequences that respectively store the page numbers of
3475 % glosses and the order in which they were used. Imagine if
3476 % a gloss is used twice on a page, it doesn’t make sense to
3477 % add the same page number twice. Similarly, if a gloss is
3478 % used, it is added to the sequence of used glosses. It
3479 % doesn’t make sense to add it 10 times again and removing
3480 % the 9 duplicates later.
3481 % \begin{macrocode}
3482 \int_gincr:N \g__lngx_page_ref_int
3483 \exp_args:Ne
3484 \label { lngx_gloss_ \int_use:N \g__lngx_page_ref_int }
3485 \cs_if_exist:cT {
3486 r @ lngx_gloss_ \int_use:N \g__lngx_page_ref_int
3487 } {
3488 \group_begin:
3489 \tl_clear:N \l_tmpa_tl
3490 \tl_set:Ne \l_tmpa_tl {
3491 \exp_not:N \use_ii:nnnnn
3492 \use:c {
3493 r @ lngx_gloss_ \int_use:N \g__lngx_page_ref_int
3494 }
3495 }
3496 \seq_if_in:cVF {
3497 g_lngx_ \str_use:N \l_tmpa_str _pages_seq
3498 } \l_tmpa_tl {
3499 \seq_gput_right:ce {
3500 g_lngx_ \str_use:N \l_tmpa_str _pages_seq
3501 } {
3502 \exp_not:N \use_ii:nnnnn
3503 \use:c {
3504 r @ lngx_gloss_ \int_use:N \g__lngx_page_ref_int
3505 }
3506 }
3507 }
3508 \group_end:
3509 }
3510 \seq_if_in:NeF \g__lngx_gls_use_order_seq {
3511 \str_use:N \l_tmpa_str
3512 } {
3513 \seq_gput_right:Ne \g__lngx_gls_use_order_seq
3514 { \str_use:N \l_tmpa_str }
3515 }
3516 }
3517 \group_end:
3518 }
3519
3520 \cs_gset_eq:NN \newgloss \lngx_gloss_new:nn
3521 % \end{macrocode}
3522 % \end{macro}
3523 % \begin{macro}{\renewgloss}
3524 % Implementing the \cs{renewgloss} command is actually quite
3525 % easy. The definition of \cs{lngx_gloss_new:nn} uses only a
3526 % single command that errors if the control sequence is
3527 % already defined, i.e., \cs{cs_new_protected:cpn}. In order
3528 % to renew a gloss, simply undefining the existing command
3529 % declared with \cs{lngx_gloss_new:nn} suffices. Later the
3530 % arguments are passed to the same command again. No \LaTeX3
3531 % equivalent for this is provided.
3532 % \begin{macrocode}
3533
3534 \NewDocumentCommand \renewgloss { m m } {
3535 \cs_undefine:c { __lngx_gloss_ #1 : }
3536 \lngx_gloss_new:nn { #1 } { #2 }
3537 }
3538 % \end{macrocode}
3539 % \end{macro}
3540 % \begin{macro}{\glx}
3541 % The command to use a gloss takes three arguments where the
3542 % first is an optional asterisk. If it is used, the
3543 % expansion of the gloss is printed without any special
3544 % tags, just as plain text. Otherwise the internal command
3545 % for printing the gloss is used with the third argument.
3546 % The third argument is a clist. Any number of glosses can
3547 % be added to the list. The action is then repeated on each
3548 % and every item of the list. The second argument is a list
3549 % of options for customising the output. Everything is
3550 % computed locally so that for the settings don’t leak. I
3551 % perform the action on the first item as desired, then the
3552 % same is applied to the remaining items with a preceding
3553 % separator. So that all the items are separated properly.
3554 % \begin{macrocode}
3555
3556 \NewDocumentCommand \glx { s O{ } m } {
3557 \group_begin:
3558 \IfBooleanT { #1 } {
3559 \bool_set_true:N \l_lngx_expansion_bool
3560 \str_set:Nn \l__lngx_separator_str { expansion }
3561 \keys_set:nn { lngx_glossing } {
3562 separator = { , \c_space_tl }
3563 }
3564 }
3565 \keys_set:nn { lngx_glossing } { #2 }
3566 \tl_clear:N \l_tmpa_tl
3567 \seq_clear:N \l_tmpa_seq
3568 \seq_set_from_clist:Nn \l_tmpa_seq { #3 }
3569 \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
3570 \str_set:Ne \l_tmpa_str {
3571 \exp_args:Ne \str_lowercase:n {
3572 \tl_use:N \l_tmpa_tl
3573 }
3574 }
3575 \bool_if:NTF \l_lngx_expansion_bool {
3576 \str_case:Vn \l__lngx_gls_expansion_case_str {
3577 { lowercase } {
3578 \text_lowercase:n {
3579 \tl_use:c {
3580 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3581 }
3582 }
3583 }
3584 { title~ case~ all } {
3585 \text_titlecase_all:n {
3586 \tl_use:c {
3587 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3588 }
3589 }
3590 }
3591 { title~ case~ first } {
3592 \text_titlecase_first:n {
3593 \tl_use:c {
3594 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3595 }
3596 }
3597 }
3598 }
3599 } {
3600 \use:c { __lngx_gloss_ \str_use:N \l_tmpa_str : }
3601 }
3602 \seq_if_empty:NF \l_tmpa_seq {
3603 \seq_map_inline:Nn \l_tmpa_seq {
3604 \group_begin:
3605 \str_clear:N \l_tmpa_str
3606 \str_set:Ne \l_tmpa_str {
3607 \exp_args:Ne \str_lowercase:n { ##1 }
3608 }
3609 \bool_if:NTF \l_lngx_expansion_bool {
3610 \str_case:Vn \l__lngx_gls_expansion_case_str {
3611 { lowercase } {
3612 \tl_use:N \l_lngx_expansion_separator_tl
3613 \text_lowercase:n {
3614 \tl_use:c {
3615 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3616 }
3617 }
3618 }
3619 { title~ case~ all } {
3620 \tl_use:N \l_lngx_expansion_separator_tl
3621 \text_titlecase_all:n {
3622 \tl_use:c {
3623 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3624 }
3625 }
3626 }
3627 { title~ case~ first } {
3628 \tl_use:N \l_lngx_expansion_separator_tl
3629 \text_titlecase_first:n {
3630 \tl_use:c {
3631 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3632 }
3633 }
3634 }
3635 }
3636 } {
3637 \tl_use:N \l_lngx_gloss_separator_tl
3638 \use:c { __lngx_gloss_ \str_use:N \l_tmpa_str : }
3639 }
3640 \group_end:
3641 }
3642 }
3643 \group_end:
3644 }
3645 % \end{macrocode}
3646 % \end{macro}
3647 % \begin{macro}{\__lngx_dotfill:nnn}
3648 % For the dotfill between the gloss and the expansion, I
3649 % create a custom internal command. The code is based on
3650 % user Jonathan P.\ Spratte’s answer seen here:
3651 % \url{topanswers.xyz/tex?q=8155#a7758}. The dotfill should
3652 % not be tagged at all and in fact it should be suppressed
3653 % so that the readers don’t go ‘dot, dot, dot, dot \dots’
3654 % (Frank has convinced us forever with his \textsc{tug} 2025
3655 % talk).
3656 % \begin{macrocode}
3657
3658 \cs_new_protected:Npn \__lngx_dotfill:nnn #1#2#3 {
3659 %% Courtesy: Jonathan P. Spratte
3660 %% topanswers.xyz/tex?q=8155#a7758 (LPPL)
3661 \l__lngx_entry_separator_tl
3662 \smallskip
3663 \group_begin:
3664 \rightskip = 0pt plus -1fil \prg_do_nothing:
3665 \parfillskip = 0pt plus 1fil \prg_do_nothing:
3666 \leftskip = 1em plus 1fil \prg_do_nothing:
3667 \finalhyphendemerits = 0 \prg_do_nothing:
3668 \parindent = -1em \prg_do_nothing:
3669 \bool_if:NT \l__lngx_gls_bold_bool { \textbf } {
3670 \lngx_gloss_format:n {
3671 #1
3672 }
3673 \tl_use:N \l_lngx_glossary_separator_tl
3674 }
3675 #2
3676 \bool_if:NT \l__lngx_glosses_page_number_bool {
3677 \mode_leave_vertical:
3678 \quad
3679 \IfDocumentMetadataT {
3680 \tag_mc_end:
3681 \tag_struct_begin:n {
3682 tag = { Span },
3683 actualtext = { }
3684 }
3685 \tag_mc_begin:n {
3686 tag = { Span }
3687 }
3688 }
3689 \cleaders
3690 \hbox to 0.44em { \hss . \hss }
3691 \hskip 0.5cm plus 1fill \prg_do_nothing:
3692 \IfDocumentMetadataT {
3693 \tag_mc_end:
3694 \tag_struct_end:
3695 \tag_mc_begin:n { }
3696 }
3697 \quad
3698 \kern 0pt \prg_do_nothing:
3699 \em #3
3700 }
3701 \l__lngx_entry_separator_tl
3702 \group_end:
3703 }
3704 % \end{macrocode}
3705 % \end{macro}
3706 % \begin{macro}{lngx_multicols}
3707 % Here I define the custom multicolumn environment which
3708 % does nothing if the number of columns is 1.
3709 % \begin{macrocode}
3710
3711 \NewDocumentEnvironment { lngx_multicols } { m } {
3712 \int_compare:nNnTF { 1 } < {
3713 \int_use:N \l__lngx_glossary_columns_int
3714 } {
3715 \begin { multicols } {
3716 \int_use:N \l__lngx_glossary_columns_int
3717 } [ #1 ]
3718 } { #1 }
3719 \noindent
3720 } {
3721 \int_compare:nNnT { 1 } < {
3722 \int_use:N \l__lngx_glossary_columns_int
3723 } {
3724 \end { multicols }
3725 }
3726 }
3727 % \end{macrocode}
3728 % \end{macro}
3729 % \begin{macro}{\lngx_gloss_list:}
3730 % Finally we come to the command that prints the glosses.
3731 % First it sets the boolean for creating the aux file to
3732 % false.
3733 % \begin{macrocode}
3734
3735 \cs_new_protected:Npn \lngx_gloss_list: {
3736 \bool_gset_false:N \g_lngx_trigger_aux_file_bool
3737 % \end{macrocode}
3738 % I start a group, clear a scratch sequence and set it equal
3739 % to the sequence that stores the order of the glosses. If
3740 % the aux file is read, the |aux| flag is added to the
3741 % variable, or else it is read on the fly.
3742 % \begin{macrocode}
3743 \group_begin:
3744 \seq_clear:N \l_tmpa_seq
3745 \seq_set_eq:NN \l_tmpa_seq \g__lngx_gls_use_order_seq
3746 % \end{macrocode}
3747 % If the sorting order is set to |alphabetical|, the
3748 % sequence needs to get sorted. For that, I use \LaTeX3’s
3749 % mechanism for sorting strings.
3750 % \begin{macrocode}
3751 \str_case:Vn \l__lngx_gls_sorting_order_str {
3752 { alphabetical } {
3753 \seq_sort:Nn \l_tmpa_seq {
3754 \str_compare:nNnTF { ##1 } > { ##2 } {
3755 \sort_return_swapped:
3756 } {
3757 \sort_return_same:
3758 }
3759 }
3760 }
3761 }
3762 % \end{macrocode}
3763 % If the style used is |inline|, the glosses come after the
3764 % each other. That means the default entry separator, i.e.,
3765 % |\par| must be changed. Here I set it to |,~| by default
3766 % (locally). The separator between the gloss and the entry
3767 % is defined as a colon followed by a space.
3768 % \begin{macrocode}
3769 \str_if_eq:VnTF \l__lngx_glossary_style_str { inline } {
3770 \group_begin:
3771 \keys_set:nn { lngx_glossing } {
3772 separator = { \c_colon_str \c_space_tl },
3773 entry~ separator = { ,~ }
3774 }
3775 % \end{macrocode}
3776 % Then each item from the sequence is popped (from the
3777 % left). It is then passed to a string variable to get rid
3778 % of the catcodes. The string variable is then used in
3779 % \cs{MakeLinkTarget*}. The gloss is then printed with its
3780 % separator in bold shape.
3781 % \begin{macrocode}
3782 \tl_clear:N \l_tmpa_tl
3783 \str_clear:N \l_tmpa_str
3784 \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
3785 \str_set:NV \l_tmpa_str \l_tmpa_tl
3786 \IfDocumentMetadataT {
3787 \tag_mc_end:
3788 \tag_struct_begin:n {
3789 tag = { Span },
3790 }
3791 \tag_mc_begin:n {
3792 tag = { Span }
3793 }
3794 }
3795 \MakeLinkTarget * {
3796 lngx_ \str_use:N \l_tmpa_str _glossary
3797 }
3798 \bool_if:NT \l__lngx_gls_bold_bool { \textbf } {
3799 \lngx_gloss_format:n {
3800 \tl_use:N \l_tmpa_tl
3801 \tl_use:N \l_lngx_glossary_separator_tl
3802 }
3803 }
3804 \IfDocumentMetadataT {
3805 \tag_mc_end:
3806 \tag_struct_end:
3807 }
3808 % \end{macrocode}
3809 % Then it is checked in which case the expansion is
3810 % requested. According to that the |tl| is printed.
3811 % \begin{macrocode}
3812 \str_case:Vn \l__lngx_gls_expansion_case_str {
3813 { lowercase } {
3814 \lngx_expansion_format:n {
3815 \text_lowercase:n {
3816 \tl_use:c {
3817 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3818 }
3819 }
3820 }
3821 }
3822 { title~ case~ all } {
3823 \lngx_expansion_format:n {
3824 \text_titlecase_all:n {
3825 \tl_use:c {
3826 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3827 }
3828 }
3829 }
3830 }
3831 { title~ case~ first } {
3832 \lngx_expansion_format:n {
3833 \text_titlecase_first:n {
3834 \tl_use:v {
3835 g_lngx_ \str_use:N \l_tmpa_str _expansion_tl
3836 }
3837 }
3838 }
3839 }
3840 }
3841 % \end{macrocode}
3842 % After printing one entry successfully, if there are any
3843 % more items left in the sequence, they are printed with the
3844 % same method, but with an entry separator at the beginning.
3845 % \begin{macrocode}
3846 \seq_if_empty:NF \l_tmpa_seq {
3847 \seq_map_inline:Nn \l_tmpa_seq {
3848 \group_begin:
3849 \tl_use:N \l__lngx_entry_separator_tl
3850 \MakeLinkTarget * { lngx_ ##1 _glossary }
3851 \textbf {
3852 \lngx_gloss_format:n {
3853 ##1
3854 \tl_use:N \l_lngx_glossary_separator_tl
3855 }
3856 }
3857 \str_case:Vn \l__lngx_gls_expansion_case_str {
3858 { lowercase } {
3859 \lngx_expansion_format:n {
3860 \text_lowercase:n {
3861 \exp_not:v { g_lngx_ ##1 _expansion_tl }
3862 }
3863 }
3864 }
3865 { title~ case~ all } {
3866 \lngx_expansion_format:n {
3867 \text_titlecase_all:n {
3868 \exp_not:v { g_lngx_ ##1 _expansion_tl }
3869 }
3870 }
3871 }
3872 { title~ case~ first } {
3873 \lngx_expansion_format:n {
3874 \text_titlecase_first:n {
3875 \exp_not:v { g_lngx_ ##1 _expansion_tl }
3876 }
3877 }
3878 }
3879 }
3880 \group_end:
3881 }
3882 }
3883 \group_end:
3884 } {
3885 % \end{macrocode}
3886 % If the style is not |inline|, then the default |block|
3887 % style is assumed and firstly the word ‘glossary’ is
3888 % printed in a sectioning command controlled by the keys.
3889 % The \cs{glossaryname} command is provided by \pkg{babel}.
3890 % If it is undefined, that means the user hasn’t loaded
3891 % \pkg{babel}. In that case, I define the command with the
3892 % string |Glossary|.
3893 % \begin{macrocode}
3894 \ProvideDocumentCommand \glossaryname { } { Glossary }
3895 % \end{macrocode}
3896 % Then the |lngx_multicols| environment starts which
3897 % doesn’t do anything if the number of columns is 1.
3898 % \begin{macrocode}
3899 \begin { lngx_multicols } {
3900 \str_if_eq:VnF \l__lngx_gls_sectioning_str { null } {
3901 \use:e {
3902 \exp_not:N \use:c
3903 { \str_use:N \l__lngx_gls_sectioning_str }
3904 \bool_if:NF \l__lngx_gls_section_number_bool { * }
3905 { \exp_not:N \glossaryname }
3906 }
3907 }
3908 }
3909 \seq_map_inline:Nn \l_tmpa_seq {
3910 % \end{macrocode}
3911 % In this style, even the page numbers are printed along
3912 % with glosses. We save the page numbers in a temporary
3913 % sequence which is locally cleared.
3914 % \begin{macrocode}
3915 \group_begin:
3916 \seq_clear:N \l_tmpb_seq
3917 \seq_map_inline:cn { g_lngx_ ##1 _pages_seq } {
3918 % \end{macrocode}
3919 % The pages are hyperlinked with the internal \textsc{pdf}
3920 % names.
3921 % \begin{macrocode}
3922 \seq_put_right:Ne \l_tmpb_seq { ####1 }
3923 }
3924 % \end{macrocode}
3925 % The page numbers are separated using dotfill. Before the
3926 % glosses, \cs{MakeLinkTarget*} is used.
3927 % \begin{macrocode}
3928 \__lngx_dotfill:nnn {
3929 \MakeLinkTarget * { lngx_ ##1 _glossary }
3930 ##1
3931 } {
3932 % \end{macrocode}
3933 % The case of expansion is checked and then the appropriate
3934 % casing commands are used for expansions.
3935 % \begin{macrocode}
3936 \str_case:Vn \l__lngx_gls_expansion_case_str {
3937 { lowercase } {
3938 \lngx_expansion_format:n {
3939 \text_lowercase:n {
3940 \exp_not:v { g_lngx_ ##1 _expansion_tl }
3941 }
3942 }
3943 }
3944 { title~ case~ all } {
3945 \lngx_expansion_format:n {
3946 \text_titlecase_all:n {
3947 \exp_not:v { g_lngx_ ##1 _expansion_tl }
3948 }
3949 }
3950 }
3951 { title~ case~ first } {
3952 \lngx_expansion_format:n {
3953 \text_titlecase_first:n {
3954 \exp_not:v { g_lngx_ ##1 _expansion_tl }
3955 }
3956 }
3957 }
3958 }
3959 } {
3960 % \end{macrocode}
3961 % The list of page numbers is printed.
3962 % \begin{macrocode}
3963 \seq_use:Nn \l_tmpb_seq { ,~ }
3964 }
3965 \group_end:
3966 }
3967 \end { lngx_multicols }
3968 }
3969 \group_end:
3970 }
3971 % \end{macrocode}
3972 % \end{macro}
3973 % \begin{macro}{\listofglosses}
3974 % Here is the command that defines the user-side command for
3975 % printing the glosses. It defines the separator by default
3976 % if not provided. All settings are local in order to avoid
3977 % leaking. \cs{l_lngx_separator_tl} is the generic string
3978 % that is used inside the |separator| key that sets the
3979 % separator contextually. This command uses the \LaTeX3
3980 % function for printing the glosses.
3981 % \begin{macrocode}
3982
3983 \NewDocumentCommand \listofglosses { O { } } {
3984 \group_begin:
3985 \str_set:Nn \l__lngx_separator_str { glossary }
3986 \keys_set:nn { lngx_glossing } {
3987 separator = { \c_colon_str \c_space_tl }
3988 }
3989 \keys_set:nn { lngx_glossing } { #1 }
3990 \lngx_gloss_list:
3991 \group_end:
3992 }
3993 %</glossing>
3994 % \end{macrocode}
3995 % \end{macro}
3996 % \newpage
3997 % \lngximplementation{ipa}
3998 % \begin{macrocode}
3999 %<*ipa>
4000 \ProvidesExplPackage{linguistix-ipa}
4001 {2026-05-15}
4002 {v1.0}
4003 {%
4004 A package for typesetting the IPA
4005 (International Phonetic Alphabet) from
4006 the ‘LinguisTiX’ bundle.%
4007 }
4008 % \end{macrocode}
4009 % Then, I load \pkg{unicode-math} or \pkg{lua-unicode-math}
4010 % (depending on the engine used), \lngxnfsslogo\ and
4011 % \lngxbaselogo\ (if they are not already loaded).
4012 % \begin{macrocode}
4013
4014 \sys_if_engine_luatex:TF {
4015 \IfPackageLoadedF { unicode-math } {
4016 \IfPackageLoadedF { lua-unicode-math } {
4017 \RequirePackage { fontspec, lua-unicode-math }
4018 }
4019 }
4020 } {
4021 \IfPackageLoadedF { unicode-math } {
4022 \RequirePackage { unicode-math }
4023 }
4024 }
4025
4026 \IfPackageLoadedF { linguistix-base } {
4027 \RequirePackage { linguistix-base }
4028 }
4029
4030 \IfPackageLoadedF { linguistix-nfss } {
4031 \RequirePackage { linguistix-nfss }
4032 }
4033
4034 \IfPackageLoadedF { linguistix-fixpex } {
4035 \RequirePackage { linguistix-fixpex }
4036 }
4037 % \end{macrocode}
4038 % \begin{macro}{\ipatext,\ipatext*}
4039 % The |\ipatext| command along with its starred variant is
4040 % developed here.
4041 % \begin{macrocode}
4042
4043 \NewDocumentCommand \ipatext { s m } {
4044 \IfBooleanTF { #1 } {
4045 {
4046 \lngxipa
4047 / #2 /
4048 }
4049 } {
4050 {
4051 \lngxipa
4052 [ #2 ]
4053 }
4054 }
4055 }
4056 % \end{macrocode}
4057 % \end{macro}
4058 % \newpage
4059 % \begin{macro}{^^A
4060 % \g__lngx_ipa_main_fonts_prop,^^A
4061 % \g__lngx_ipa_main_font_features_tl,^^A
4062 % ipa upright,ipa upright features,ipa bold,ipa bold
4063 % features,ipa italic,ipa italic features,ipa bold
4064 % italic,ipa bold italic features,ipa slanted,ipa slanted
4065 % features,ipa bold slanted,ipa bold slanted features,ipa
4066 % swash,ipa swash features,ipa bold swash,ipa bold swash
4067 % features,ipa small caps,ipa small caps features,^^A
4068 % }
4069 % These variables store the values for fonts and features
4070 % for the serif \textsc{ipa}.
4071 % \begin{macrocode}
4072
4073 \prop_gclear_new:N \g__lngx_ipa_main_fonts_prop
4074 \tl_gclear_new:N \g__lngx_ipa_main_font_features_tl
4075
4076 \clist_map_inline:nn {
4077 upright,
4078 bold,
4079 italic,
4080 bold~ italic,
4081 slanted,
4082 bold~ slanted,
4083 swash,
4084 bold~ swash,
4085 small~ caps
4086 } {
4087 % \end{macrocode}
4088 % All the keys here are prefixed with the word |ipa| in
4089 % order to distinguish them from the keys provided by the
4090 % \lngxfontslogo\ package. These keys have identical method
4091 % as their text counterparts, though.
4092 % \begin{macrocode}
4093 \group_begin:
4094 \str_clear:N \l_tmpa_str
4095 \str_set:Nn \l_tmpa_str { #1 }
4096 \str_replace_all:Nnn \l_tmpa_str { ~ } { _ }
4097 \tl_gclear_new:c {
4098 g__lngx_ipa_main_features_ \l_tmpa_str _tl
4099 }
4100 \group_end:
4101 \keys_define:nn { lngx_keys } {
4102 ipa~ #1
4103 .code:n = {
4104 \group_begin:
4105 \str_clear:N \l_tmpa_str
4106 \str_set:Ne \l_tmpa_str {
4107 \text_titlecase_all:n { #1 }
4108 Font
4109 }
4110 \str_replace_all:Nnn \l_tmpa_str { ~ } { }
4111 \prop_gput:Nne \g__lngx_ipa_main_fonts_prop
4112 { ipa~ #1 }
4113 { \str_use:N \l_tmpa_str = { ##1 } }
4114 \group_end:
4115 },
4116 ipa~ #1~ features
4117 .code:n = {
4118 \group_begin:
4119 \str_clear:N \l_tmpa_str
4120 \str_clear:N \l_tmpb_str
4121 \str_set:Ne \l_tmpa_str {
4122 \text_titlecase_all:n { #1 }
4123 Features
4124 }
4125 \str_set:Nn \l_tmpb_str { #1 }
4126 \str_replace_all:Nnn \l_tmpa_str { ~ } { }
4127 \str_replace_all:Nnn \l_tmpb_str { ~ } { _ }
4128 \tl_gput_right:ce {
4129 g__lngx_ipa_main_features_ \l_tmpb_str _tl
4130 } {
4131 \tl_if_empty:cF {
4132 g__lngx_ipa_main_features_ \l_tmpb_str _tl
4133 } { , }
4134 \exp_not:n { ##1 }
4135 }
4136 \prop_gput:Nne \g__lngx_ipa_main_fonts_prop
4137 { ipa~ #1~ features } {
4138 \str_use:N \l_tmpa_str = {
4139 \exp_not:v {
4140 g__lngx_ipa_main_features_ \l_tmpb_str _tl
4141 }
4142 }
4143 }
4144 \group_end:
4145 }
4146 }
4147 }
4148 % \end{macrocode}
4149 % \end{macro}
4150 % \begin{macro}{ipa main extra features}
4151 % This key adds to the property that stores the extra
4152 % features for the serif fonts.
4153 % \begin{macrocode}
4154
4155 \tl_gclear_new:N \g__lngx_ipa_main_features_extra_tl
4156
4157 \keys_define:nn { lngx_keys } {
4158 ipa~ main~ extra~ features
4159 .code:n = {
4160 \tl_gput_right:Ne \g__lngx_ipa_main_features_extra_tl {
4161 \tl_if_empty:NF \g__lngx_ipa_main_features_extra_tl {
4162 ,
4163 }
4164 \exp_not:n { #1 }
4165 }
4166 \prop_gput:Nne \g__lngx_ipa_main_fonts_prop
4167 { ipa~ main~ extra~ features } {
4168 \exp_not:V \g__lngx_ipa_main_features_extra_tl
4169 }
4170 }
4171 }
4172 % \end{macrocode}
4173 % \end{macro}
4174 % \newpage
4175 % \begin{macro}{^^A
4176 % \g__lngx_ipa_sans_fonts_prop,^^A
4177 % \g__lngx_ipa_sans_font_features_tl,^^A
4178 % \g__lngx_ipa_mono_fonts_prop,^^A
4179 % \g__lngx_ipa_mono_font_features_tl,^^A
4180 % ipa sans extra features,ipa sans upright,ipa sans upright
4181 % features,ipa sans bold,ipa sans bold features,ipa sans
4182 % italic,ipa sans italic features,ipa sans bold italic,ipa
4183 % sans bold italic features,ipa sans slanted,ipa sans
4184 % slanted features,ipa sans bold slanted,ipa sans bold
4185 % slanted features,ipa sans swash,ipa sans swash
4186 % features,ipa sans bold swash,ipa sans bold swash
4187 % features,ipa sans small caps,ipa sans small caps
4188 % features,ipa mono extra features,ipa mono upright,ipa mono
4189 % upright features,ipa mono bold,ipa mono bold features,ipa
4190 % mono italic,ipa mono italic features,ipa mono bold
4191 % italic,ipa mono bold italic features,ipa mono slanted,ipa
4192 % mono slanted features,ipa mono bold slanted,ipa mono bold
4193 % slanted features,ipa mono swash,ipa mono swash
4194 % features,ipa mono bold swash,ipa mono bold swash
4195 % features,ipa mono small caps,ipa mono small caps
4196 % features^^A
4197 % }
4198 % Since the only difference between the upcoming keys is
4199 % that of the word |sans| and |mono|, we combine them
4200 % together and use a nested |clist|. The rest of the
4201 % mechanism is identical.
4202 % \begin{macrocode}
4203
4204 \prop_gclear_new:N \g__lngx_ipa_sans_fonts_prop
4205 \tl_gclear_new:N \g__lngx_ipa_sans_font_features_tl
4206
4207 \prop_gclear_new:N \g__lngx_ipa_mono_fonts_prop
4208 \tl_gclear_new:N \g__lngx_ipa_mono_font_features_tl
4209
4210 \clist_map_inline:nn {
4211 sans,
4212 mono
4213 } {
4214 \tl_gclear_new:c {
4215 g__lngx_ipa_ #1 _features_extra_tl
4216 }
4217 \clist_map_inline:nn {
4218 upright,
4219 bold,
4220 italic,
4221 bold~ italic,
4222 slanted,
4223 bold~ slanted,
4224 swash,
4225 bold~ swash,
4226 small~ caps
4227 } {
4228 \group_begin:
4229 \str_clear:N \l_tmpa_str
4230 \str_set:Nn \l_tmpa_str { ##1 }
4231 \str_replace_all:Nnn \l_tmpa_str { ~ } { _ }
4232 \tl_gclear_new:c {
4233 g__lngx_ipa_ #1 _features_ \l_tmpa_str _tl
4234 }
4235 \group_end:
4236 \keys_define:nn { lngx_keys } {
4237 ipa~ #1~ ##1
4238 .code:n = {
4239 \group_begin:
4240 \str_clear:N \l_tmpa_str
4241 \str_set:Ne \l_tmpa_str {
4242 \text_titlecase_all:n { ##1 }
4243 Font
4244 }
4245 \str_replace_all:Nnn \l_tmpa_str { ~ } { }
4246 \prop_gput:cne { g__lngx_ipa_ #1 _fonts_prop }
4247 { ipa~ #1~ ##1 } {
4248 \str_use:N \l_tmpa_str = {
4249 \exp_not:n { ####1 }
4250 }
4251 }
4252 \group_end:
4253 },
4254 ipa~ #1~ ##1~ features
4255 .code:n = {
4256 \group_begin:
4257 \str_clear:N \l_tmpa_str
4258 \str_clear:N \l_tmpb_str
4259 \str_set:Ne \l_tmpa_str {
4260 \ipa_titlecase_all:n { ##1 }
4261 Features
4262 }
4263 \str_set:Nn \l_tmpb_str { ##1 }
4264 \str_replace_all:Nnn \l_tmpa_str { ~ } { }
4265 \str_replace_all:Nnn \l_tmpb_str { ~ } { _ }
4266 \tl_gput_right:ce {
4267 g__lngx_ipa_ #1 _features_ \l_tmpb_str _tl
4268 } {
4269 \tl_if_empty:cF {
4270 g__lngx_ipa_ #1 _features_ \l_tmpb_str _tl
4271 } { , }
4272 \exp_not:n { ####1 }
4273 }
4274 \prop_gput:cne { g__lngx_ipa_ #1 _fonts_prop }
4275 { ipa~ #1~ ##1~ features } {
4276 \str_use:N \l_tmpa_str = {
4277 \exp_not:v {
4278 g__lngx_ipa_ #1 _features_ \l_tmpb_str _tl
4279 }
4280 }
4281 }
4282 \group_end:
4283 }
4284 }
4285 }
4286 \keys_define:nn { lngx_keys } {
4287 ipa~ #1~ extra~ features
4288 .code:n = {
4289 \tl_gput_right:ce {
4290 g__lngx_ipa_ #1 _features_extra_tl
4291 } {
4292 \tl_if_empty:cF {
4293 g__lngx_ipa_ #1 _features_extra_tl
4294 } { , }
4295 \exp_not:n { ##1 }
4296 }
4297 \prop_gput:cne { g__lngx_ipa_ #1 _fonts_prop }
4298 { ipa~ #1~ extra~ features } {
4299 \exp_not:v { g__lngx_ipa_ #1 _features_extra_tl }
4300 }
4301 }
4302 }
4303 }
4304 % \end{macrocode}
4305 % \end{macro}
4306 % \begin{macro}{^^A
4307 % \g__lngx_ipa_main_font_tl,\g__lngx_ipa_sans_font_tl,^^A
4308 % \g__lngx_ipa_mono_font_tl,ipa main font,ipa sans font,ipa
4309 % mono font^^A
4310 % }
4311 % These keys provide keys to set fonts for \textsc{ipa}.
4312 % \begin{macrocode}
4313
4314 \clist_map_inline:nn {
4315 main,
4316 sans,
4317 mono
4318 } {
4319 \keys_define:nn { lngx_keys } {
4320 ipa~ #1~ font
4321 .tl_gset:c = { g__lngx_ipa_ #1 _font_tl }
4322 }
4323 }
4324 % \end{macrocode}
4325 % \end{macro}
4326 % \begin{macro}{ipa newcm}
4327 % This key is of type |.meta:n|. It sets certain other keys
4328 % that enable the New Computer Modern fonts in book weight
4329 % and in all of the serif, sans serif and monospaced
4330 % families for \textsc{ipa}.
4331 % \begin{macrocode}
4332
4333 \keys_define:nn { lngx_keys } {
4334 ipa~ newcm
4335 .meta:n = {
4336 ipa~ main~ font = { NewCM10-Book.otf },
4337 ipa~ sans~ font = { NewCMSans10-Book.otf },
4338 ipa~ mono~ font = { NewCMMono10-Book.otf }
4339 }
4340 }
4341 % \end{macrocode}
4342 % \end{macro}
4343 % \begin{macro}{ipa newcm sans}
4344 % This is a |.meta:n| key that sets the default \textsc{ipa}
4345 % font to the sans family.
4346 % \begin{macrocode}
4347
4348 \keys_define:nn { lngx_keys } {
4349 ipa~ newcm~ sans
4350 .meta:n = {
4351 ipa~ main~ font = { NewCMSans10-Book.otf },
4352 ipa~ sans~ font = { NewCMSans10-Book.otf },
4353 ipa~ mono~ font = { NewCMMono10-Book.otf }
4354 }
4355 }
4356 % \end{macrocode}
4357 % \end{macro}
4358 % \begin{macro}{ipa newcm mono}
4359 % This is a |.meta:n| key that sets the default \textsc{ipa}
4360 % fonts to the monospaced family.
4361 % \begin{macrocode}
4362
4363 \keys_define:nn { lngx_keys } {
4364 ipa~ newcm~ mono
4365 .meta:n = {
4366 ipa~ main~ font = { NewCMMono10-Book.otf },
4367 ipa~ sans~ font = { NewCMSans10-Book.otf },
4368 ipa~ mono~ font = { NewCMMono10-Book.otf }
4369 }
4370 }
4371 % \end{macrocode}
4372 % \end{macro}
4373 % \begin{macro}{ipa newcm regular}
4374 % This is a |.meta:n| key that sets the default fonts to the
4375 % regular variant of the New Computer Modern family.
4376 % \begin{macrocode}
4377
4378 \keys_define:nn { lngx_keys } {
4379 ipa~ newcm~ regular
4380 .meta:n = {
4381 ipa~ main~ font = { NewCM10-Regular.otf },
4382 ipa~ sans~ font = { NewCMSans10-Regular.otf },
4383 ipa~ mono~ font = { NewCMMono10-Regular.otf }
4384 }
4385 }
4386 % \end{macrocode}
4387 % \end{macro}
4388 % \begin{macro}{ipa newcm regular sans}
4389 % This is a |.meta:n| key that sets the default \textsc{ipa}
4390 % fonts to the regular sans variant of the New Computer
4391 % Modern family.
4392 % \begin{macrocode}
4393
4394 \keys_define:nn { lngx_keys } {
4395 ipa~ newcm~ regular~ sans
4396 .meta:n = {
4397 ipa~ main~ font = { NewCMSans10-Regular.otf },
4398 ipa~ sans~ font = { NewCMSans10-Regular.otf },
4399 ipa~ mono~ font = { NewCMMono10-Regular.otf }
4400 }
4401 }
4402 % \end{macrocode}
4403 % \end{macro}
4404 % \begin{macro}{ipa newcm regular mono}
4405 % This is a |.meta:n| key that sets the default \textsc{ipa}
4406 % fonts to the regular monospaced variant of the New
4407 % Computer Modern family.
4408 % \begin{macrocode}
4409
4410 \keys_define:nn { lngx_keys } {
4411 ipa~ newcm~ regular~ mono
4412 .meta:n = {
4413 ipa~ main~ font = { NewCMMono10-Regular.otf },
4414 ipa~ sans~ font = { NewCMSans10-Regular.otf },
4415 ipa~ mono~ font = { NewCMMono10-Regular.otf }
4416 }
4417 }
4418 % \end{macrocode}
4419 % \end{macro}
4420 % We set the |ipa newcm| key by default.
4421 % \begin{macrocode}
4422
4423 \lngx_set_keys:n {ipa~ newcm}
4424 % \end{macrocode}
4425 % \begin{macro}{^^A
4426 % \lngx_set_main_ipa_font:nn,\lngx_main_ipa:,^^A
4427 % lngx_ipa_rm_nfss,^^A
4428 % \lngx_set_sans_ipa_font:nn,\lngx_sans_ipa:,^^A
4429 % lngx_ipa_sf_nfss,^^A
4430 % \lngx_set_mono_ipa_font:nn,\lngx_mono_ipa:,^^A
4431 % lngx_ipa_tt_nfss^^A
4432 % }
4433 % Here, I develop font-setting commands for \textsc{ipa}.
4434 % These commands are set with |\setfontfamily|, so they
4435 % keep overriding the definitions of the same command names.
4436 % These commands set \textsc{nfss} families that we use
4437 % later for setting the \textsc{ipa} fonts. These functions
4438 % and \textsc{nfss} families are public, but manipulating
4439 % them has effects (mostly desired) at several other places,
4440 % so use them with caution.
4441 % \begin{macrocode}
4442
4443 \cs_new_protected:Npn \lngx_set_main_ipa_font:nn #1#2 {
4444 \setfontfamily \lngx_main_ipa: [
4445 #1,
4446 NFSSFamily = { lngx_ipa_rm_nfss }
4447 ] { #2 }
4448 }
4449
4450 \cs_new_protected:Npn \lngx_set_sans_ipa_font:nn #1#2 {
4451 \setfontfamily \lngx_sans_ipa: [
4452 #1,
4453 NFSSFamily = { lngx_ipa_sf_nfss }
4454 ] { #2 }
4455 }
4456
4457 \cs_new_protected:Npn \lngx_set_mono_ipa_font:nn #1#2 {
4458 \setfontfamily \lngx_mono_ipa: [
4459 #1,
4460 NFSSFamily = { lngx_ipa_tt_nfss }
4461 ] { #2 }
4462 }
4463
4464 \cs_generate_variant:Nn \lngx_set_main_ipa_font:nn { VV }
4465 \cs_generate_variant:Nn \lngx_set_sans_ipa_font:nn { VV }
4466 \cs_generate_variant:Nn \lngx_set_mono_ipa_font:nn { VV }
4467 % \end{macrocode}
4468 % \end{macro}
4469 % \begin{macro}{lngx_ipa}
4470 % Here, I create a \enquote{super font family} with
4471 % |\lngx_super_font_family:nn|, a macro provided by
4472 % \lngxnfsslogo. Please see the documentation of that
4473 % package for more information. Note that |lngx_ipa| is a
4474 % super family responsible for all the \textsc{ipa}-related
4475 % functions of the package. It is associated with the
4476 % \textsc{nfss} families defined just now for the
4477 % \textsc{ipa}.
4478 % \begin{macrocode}
4479
4480 \lngx_super_font_family:nn { lngx_ipa } {
4481 rm = { lngx_ipa_rm_nfss },
4482 sf = { lngx_ipa_sf_nfss },
4483 tt = { lngx_ipa_tt_nfss }
4484 }
4485 % \end{macrocode}
4486 % \end{macro}
4487 % \begin{macro}{\lngxipa,\lngx_ipa:}
4488 % I use |\lngx_softer_super_font_family:n| provided by
4489 % \lngxnfsslogo for defining this switch to the
4490 % \textsc{ipa}.
4491 % \begin{macrocode}
4492
4493 \cs_new_protected:Npn \lngx_ipa: {
4494 \lngx_softer_super_font_family:n { lngx_ipa }
4495 }
4496
4497 \cs_gset_eq:NN \lngxipa \lngx_ipa:
4498 % \end{macrocode}
4499 % \end{macro}
4500 % Now, I have used the exact same method that I described in
4501 % the implementation of \lngxfontslogo\ for setting the size
4502 % variants. This is done with lazy evaluation, just before
4503 % |\begin{document}|.
4504 % \begin{macrocode}
4505
4506 \clist_map_inline:nn {
4507 main,
4508 sans,
4509 mono
4510 } {
4511 \cs_new_protected:cpn {
4512 lngx_build_ #1 _ipa_font_features:
4513 } {
4514 \prop_map_inline:cn { g__lngx_ipa_ #1 _fonts_prop } {
4515 \tl_gput_right:cn {
4516 g__lngx_ipa_ #1 _font_features_tl
4517 } { ####2 }
4518 }
4519 }
4520 }
4521 % \end{macrocode}
4522 % Stylistic set 5 of NewCM is dedicated to linguistics. So
4523 % we use it here. For correct diacritic placement, we need
4524 % HarfBuzz renderer. That also is loaded here.
4525 % \begin{macrocode}
4526
4527 \hook_gput_code:nnn { begindocument / before } { . } {
4528 \lngx_set_keys:n {
4529 ipa~ main~ extra~
4530 features = {
4531 Renderer = {HarfBuzz},
4532 StylisticSet = {05}
4533 },
4534 ipa~ sans~ extra~
4535 features = {
4536 Renderer = {HarfBuzz},
4537 StylisticSet = {05}
4538 },
4539 ipa~ mono~ extra~
4540 features = {
4541 Renderer = {HarfBuzz},
4542 StylisticSet = {05}
4543 }
4544 }
4545 \lngx_build_main_ipa_font_features:
4546 \lngx_set_main_ipa_font:VV
4547 \g__lngx_ipa_main_font_features_tl
4548 \g__lngx_ipa_main_font_tl
4549 \lngx_build_sans_ipa_font_features:
4550 \lngx_set_sans_ipa_font:VV
4551 \g__lngx_ipa_sans_font_features_tl
4552 \g__lngx_ipa_sans_font_tl
4553 \lngx_build_mono_ipa_font_features:
4554 \lngx_set_mono_ipa_font:VV
4555 \g__lngx_ipa_mono_font_features_tl
4556 \g__lngx_ipa_mono_font_tl
4557 }
4558 %</ipa>
4559 % \end{macrocode}
4560 % \newpage
4561 % \lngximplementation{languages}
4562 % \begin{macrocode}
4563 %<*lang>
4564 \ProvidesExplPackage{linguistix-languages}
4565 {2026-05-15}
4566 {v1.0}
4567 {%
4568 An assistant package for automatically
4569 loading fonts and more settings for
4570 languages.%
4571 }
4572 % \end{macrocode}
4573 % \lngxbaselogo\ is loaded (if not already done) for the
4574 % key-value parser.
4575 % \begin{macrocode}
4576
4577 \IfPackageLoadedF { linguistix-base } {
4578 \RequirePackage { linguistix-base }
4579 }
4580 % \end{macrocode}
4581 % The \textsf{babel} package is loaded with |provide*=*|
4582 % option as it mandates the use of modern mechanism.
4583 % \begin{macrocode}
4584
4585 \IfPackageLoadedF { babel } {
4586 \RequirePackage [ provide * = * ] { babel }
4587 }
4588 % \end{macrocode}
4589 % To renew the space between the two lines, \pkg{setspace}
4590 % provides a handy set of commands.
4591 % \begin{macrocode}
4592
4593 \IfPackageLoadedF { setspace } {
4594 \RequirePackage { setspace }
4595 }
4596 % \end{macrocode}
4597 % \begin{macro}{\g_lngx_main_language_tl}
4598 % I declare a |tl| that I will use for storing the main
4599 % language. It is publicly available.
4600 % \begin{macrocode}
4601
4602 \tl_new:N \g_lngx_main_language_tl
4603 % \end{macrocode}
4604 % \end{macro}
4605 % \begin{macro}{\g_lngx_languages_clist}
4606 % I declare a |clist| that I will use for storing languages.
4607 % It is publicly available.
4608 % \begin{macrocode}
4609
4610 \clist_new:N \g_lngx_languages_clist
4611 % \end{macrocode}
4612 % \end{macro}
4613 % \begin{macro}{\lngx_languages:nn,\providelanguage}
4614 % I develop a wrapper macro with a |:VV| variant.
4615 % \begin{macrocode}
4616
4617 \cs_new_protected:Npn \lngx_languages:nn #1#2 {
4618 \babelprovide [ #1 ] { #2 }
4619 }
4620
4621 \cs_generate_variant:Nn \lngx_languages:nn { VV }
4622 \cs_gset_eq:NN \providelanguage \lngx_languages:nn
4623 % \end{macrocode}
4624 % \end{macro}
4625 % The \pkg{babel} package produces an \enquote{info} message
4626 % if the fonts are not set with |\babelfont|. Mostly they
4627 % aren’t set with this mechanism, so this warning is
4628 % inevitable in default situations. Imagine loading
4629 % \lngxfontslogo\ first and then loading this package. The
4630 % fonts are already set with |\setmainfont| and friends.
4631 % Thus we will be prompted with this warning always. In
4632 % order to avoid that, I renew the wrapper functions around
4633 % |\setmainfont| to |\babelfont|. Note that this only
4634 % affects the usage when \lngxfontslogo\ is loaded. If you
4635 % use \lngxlanguageslogo\ and then use |\setmainfont|-like
4636 % commands, you will get |babel|’s warning and I have no
4637 % intention to suppress that behaviour.
4638 % \begin{macrocode}
4639
4640 \IfPackageLoadedTF { linguistix-fonts } {
4641 \cs_gset_protected:Npn \lngx_set_main_font:nn #1#2 {
4642 \babelfont { rm } [ #1 ] { #2 }
4643 }
4644 \cs_gset_protected:Npn \lngx_set_sans_font:nn #1#2 {
4645 \babelfont { sf } [ #1 ] { #2 }
4646 }
4647 \cs_gset_protected:Npn \lngx_set_mono_font:nn #1#2 {
4648 \babelfont { tt } [ #1 ] { #2 }
4649 }
4650 } {
4651 \cs_new_protected:Npn \lngx_set_main_font:nn #1#2 {
4652 \babelfont { rm } [ #1 ] { #2 }
4653 }
4654 \cs_new_protected:Npn \lngx_set_sans_font:nn #1#2 {
4655 \babelfont { sf } [ #1 ] { #2 }
4656 }
4657 \cs_new_protected:Npn \lngx_set_mono_font:nn #1#2 {
4658 \babelfont { tt } [ #1 ] { #2 }
4659 }
4660 }
4661 % \end{macrocode}
4662 % \begin{macro}{^^A
4663 % \lngx_other_main_font:nnn,^^A
4664 % \lngx_other_sans_font:nnn,^^A
4665 % \lngx_other_mono_font:nnn
4666 % }
4667 % The following macros set fonts for other languages using
4668 % the |\babelfont| command.
4669 % \begin{macrocode}
4670
4671 \cs_gset_protected:Npn \lngx_other_main_font:nnn #1#2#3 {
4672 \babelfont [ #1 ] { rm } [ #2 ] { #3 }
4673 }
4674
4675 \cs_gset_protected:Npn \lngx_other_sans_font:nnn #1#2#3 {
4676 \babelfont [ #1 ] { sf } [ #2 ] { #3 }
4677 }
4678
4679 \cs_gset_protected:Npn \lngx_other_mono_font:nnn #1#2#3 {
4680 \babelfont [ #1 ] { tt } [ #2 ] { #3 }
4681 }
4682
4683 \cs_generate_variant:Nn \lngx_other_main_font:nnn { nee }
4684 \cs_generate_variant:Nn \lngx_other_sans_font:nnn { nee }
4685 \cs_generate_variant:Nn \lngx_other_mono_font:nnn { nee }
4686 % \end{macrocode}
4687 % \end{macro}
4688 % \begin{macro}{\lngx_load_languages:n,\loadlanguages}
4689 % I provide a simple macro that only does the job of loading
4690 % languages, both in \LaTeX3 style, as well as the in the
4691 % plain style.
4692 % \begin{macrocode}
4693
4694 \cs_new_protected:Npn \lngx_load_languages:n #1 {
4695 \lngx_set_keys:n { languages = { #1 } }
4696 }
4697
4698 \cs_gset_eq:NN \loadlanguages \lngx_load_languages:n
4699 % \end{macrocode}
4700 % \end{macro}
4701 % \begin{macro}{\lngx_counter:n}
4702 % I equate the \cs{arabic} command to a new command I want
4703 % to provide. This is done in order to get control over the
4704 % default \LaTeX\ counters. The command is manipulated when
4705 % plugs are activated.
4706 % \begin{macrocode}
4707
4708 \cs_gset_eq:NN \lngx_counter:n \arabic
4709 % \end{macrocode}
4710 % \end{macro}
4711 % Now all the default counters are changed from \cs{arabic}
4712 % to \cs{lngx_counter:n}.
4713 % \begin{macrocode}
4714
4715 \cs_set:Npn \thechapter {
4716 \lngx_counter:n { chapter }
4717 }
4718 \cs_set:Npn \thesection {
4719 \lngx_counter:n { section }
4720 }
4721 \cs_set:Npn \thesubsection {
4722 \lngx_counter:n { subsection }
4723 }
4724 \cs_set:Npn \thesubsubsection {
4725 \lngx_counter:n { subsubsection }
4726 }
4727 \cs_set:Npn \theparagraph {
4728 \lngx_counter:n { section }
4729 }
4730 \cs_set:Npn \thesubparagraph {
4731 \lngx_counter:n { section }
4732 }
4733 \cs_set:Npn \thepage {
4734 \lngx_counter:n { page }
4735 }
4736 \cs_set:Npn \thefigure {
4737 \lngx_counter:n { figure }
4738 }
4739 \cs_set:Npn \thetable {
4740 \lngx_counter:n { table }
4741 }
4742 \cs_set:Npn \thefootnote {
4743 \lngx_counter:n { footnote }
4744 }
4745 \cs_set:Npn \thempfootnote {
4746 \lngx_counter:n { mpfootnote }
4747 }
4748 \cs_set:Npn \theequation {
4749 \lngx_counter:n { equation }
4750 }
4751 % \end{macrocode}
4752 % Here, I define the socket |lngx/native-numbering|.
4753 % \begin{macrocode}
4754
4755 \socket_new:nn { lngx / native-numbering } { 0 }
4756 % \end{macrocode}
4757 % \begin{macro}{strict}
4758 % This plug sets the numbering strictly to the main
4759 % language. If used, the function \cs{lngx_counter:n} is
4760 % changed to the respective |\xxxxcounter| command (where
4761 % |xxxx| stands for the main language of the document).
4762 % \begin{macrocode}
4763
4764 \socket_new_plug:nnn { lngx / native-numbering }
4765 { strict } {
4766 \cs_gset_eq:Nc \lngx_counter:n {
4767 \tl_use:N \g_lngx_main_language_tl counter
4768 }
4769 }
4770 % \end{macrocode}
4771 % \end{macro}
4772 % \begin{macro}{logical}
4773 % Here, I define the |logical| plug for
4774 % |lngx/native-numbering|. The mechanism is pretty similar
4775 % as the one used for |strict|, but here I don’t renew it to
4776 % the main language counter, but instead I use the
4777 % |\localecounter| command provided by the \pkg{babel}
4778 % package. The counters are then printed contextually (and
4779 % \TeX-logically).
4780 % \begin{macrocode}
4781
4782 \socket_new_plug:nnn { lngx / native-numbering }
4783 { logical } {
4784 \cs_gset_protected:Npn \lngx_counter:n ##1 {
4785 \localecounter { digits } { ##1 }
4786 }
4787 }
4788 % \end{macrocode}
4789 % \end{macro}
4790 % \begin{macro}{off}
4791 % If the |off| plug is selected, then native digits are not
4792 % needed. Thus the \cs{lngx_counter:n} is set to the
4793 % unmodified \cs{arabic} again.
4794 % \begin{macrocode}
4795
4796 \socket_new_plug:nnn { lngx / native-numbering} { off } {
4797 \cs_gset_eq:NN \lngx_counter:n \arabic
4798 }
4799 % \end{macrocode}
4800 % \end{macro}
4801 % \begin{macro}{native numbering}
4802 % The three choices for the |native numbering| key, i.e.,
4803 % |strict|, |logical| and |off| are defined here. All of
4804 % them activate the plugs of their name with the
4805 % |lngx/native-numbering| socket.
4806 % \begin{macrocode}
4807
4808 \keys_define:nn { lngx_keys } {
4809 native~ numbering
4810 .choices:nn = { strict,logical,off } {
4811 \exp_args:Nee
4812 \socket_assign_plug:nn { lngx / native-numbering } {
4813 \str_use:N \l_keys_choice_str
4814 }
4815 \socket_use:n { lngx / native-numbering }
4816 },
4817 % \end{macrocode}
4818 % Similarly, we set the default value to on.
4819 % \begin{macrocode}
4820 native~ numbering
4821 .default:n = { strict }
4822 }
4823 % \end{macrocode}
4824 % \end{macro}
4825 % \begin{macro}{\lngx_misc_reset:}
4826 % Despite having sufficient control with the two plugs,
4827 % there are some additional settings required by some
4828 % languages that are often not needed by most others. E.g.,
4829 % Marathi renews the way enumerated lists are printed and
4830 % that is supposed to be renewed when the language is
4831 % changed. I provide a shorthand to be used for resetting
4832 % such settings. It can be used in the packages of languages
4833 % that don’t need special settings.
4834 % \begin{macrocode}
4835
4836 \cs_new_protected:Npn \lngx_misc_reset: {
4837 \cs_set:Npn \theenumii { \alph { enumii } }
4838 \cs_set:Npn \labelenumii { ( \theenumii ) }
4839 \cs_set:Npn \theenumiii { \roman { enumiii } }
4840 \cs_set:Npn \labelenumiii { \theenumiii . }
4841 \cs_set:Npn \theenumiv { \Alph { enumiv } }
4842 \cs_set:Npn \labelenumiv { \theenumiv . }
4843 \IfPackageLoadedT { expex } {
4844 \lingset { labeltype = alpha }
4845 }
4846 \cs_gset_eq:NN \emph \textit
4847 }
4848 % \end{macrocode}
4849 % \end{macro}
4850 % Here, I write a message to be issued when user loads an
4851 % unsupported language.
4852 % \begin{macrocode}
4853
4854 \msg_new:nnn { linguistix-languages } { no_support } {
4855 ‘#1’~ is~ not~ supported.\\
4856 If~ you~ want~ it~ to~ be~ supported,~ please~ report~
4857 to~ the~ maintainers.
4858 }
4859 % \end{macrocode}
4860 % \begin{macro}{languages}
4861 % I use the |.code:n| type for developing the |languages|
4862 % key.
4863 % \begin{macrocode}
4864
4865 \keys_define:nn { lngx_keys } {
4866 languages
4867 .code:n = {
4868 % \end{macrocode}
4869 % I pass the argument of this key to a global |clist|. It is
4870 % stored for public use.
4871 % \begin{macrocode}
4872 \clist_gset:Nn \g_lngx_languages_clist { #1 }
4873 % \end{macrocode}
4874 % Since this is a public |clist| for accessing the names of
4875 % the languages, I copy it to a temporary one so that the
4876 % items of public interest are not lost during the
4877 % operations.
4878 % \begin{macrocode}
4879 \clist_set_eq:NN \l_tmpa_clist \g_lngx_languages_clist
4880 % \end{macrocode}
4881 % I check if the |clist| is empty or not. If it is empty,
4882 % that means the user used the key without a value. In that
4883 % case, \textsf{babel} already loads an
4884 % \enquote{info}-message saying that no language is loaded.
4885 % So we ignore the branch and silently move to the false
4886 % branch.
4887 % \begin{macrocode}
4888 \clist_if_empty:NF \l_tmpa_clist {
4889 % \end{macrocode}
4890 % In the false branch, I pop out the first element from the
4891 % clist to |\l_tmpa_tl|. This is the first language passed
4892 % by the user. In \lngxlanguageslogo, I assume that it is
4893 % intended to be the first language. It is important to pop
4894 % the element out because the settings used for the main
4895 % language are different than the ones used for other
4896 % languages.
4897 % \begin{macrocode}
4898 \clist_pop:NN \l_tmpa_clist \l_tmpa_tl
4899 % \end{macrocode}
4900 % Since this |tl| stores the language that is going to be
4901 % the main one, I equate it to another public |tl| that I
4902 % will be using later in language files.
4903 % \begin{macrocode}
4904 \tl_set_eq:NN \g_lngx_main_language_tl \l_tmpa_tl
4905 % \end{macrocode}
4906 % In |\l_tmpb_tl|, I save the options that need to go with
4907 % the language stored in |\l_tmpa_tl|. The package used to
4908 % have |onchar| option loaded conditionally with Lua\LaTeX,
4909 % but to avoid potential clashes, now it has moved to the
4910 % individual package files of languages. Now I directly load
4911 % the |main| option which makes the concerned language the
4912 % \enquote{main} language of the document.
4913 % \begin{macrocode}
4914 \tl_set:Ne \l_tmpb_tl {
4915 main,
4916 % \end{macrocode}
4917 % To load the data from |ini| files, I use the |import|
4918 % parameter.
4919 % \begin{macrocode}
4920 import
4921 }
4922 % \end{macrocode}
4923 % I use the |\babelprovide| wrapper we saw earlier with the
4924 % values of the first language.
4925 % \begin{macrocode}
4926 \lngx_languages:VV \l_tmpb_tl \l_tmpa_tl
4927 % \end{macrocode}
4928 % I scan if the package for this language is available. If
4929 % it is, it is loaded.
4930 % \begin{macrocode}
4931 \file_if_exist:nTF { linguistix - \l_tmpa_tl . sty } {
4932 \exp_args:Ne \RequirePackage
4933 { linguistix - \l_tmpa_tl }
4934 } {
4935 % \end{macrocode}
4936 % If it is not, I issue the |no_ldf| warning message. It
4937 % takes one argument that is the name of the language. It is
4938 % extracted using the |V| argument type.
4939 % \begin{macrocode}
4940 \msg_warning:nnV { linguistix-languages }
4941 { no_support }
4942 \l_tmpa_tl
4943 }
4944 % \end{macrocode}
4945 % The temporary |tl|s are cleared.
4946 % \begin{macrocode}
4947 \tl_clear:N \l_tmpa_tl
4948 \tl_clear:N \l_tmpb_tl
4949 % \end{macrocode}
4950 % I again check if the |clist| is empty. If it is, it means
4951 % the user is typesetting a monolingual document as they
4952 % don’t need any other language than the \enquote{main} one.
4953 % \begin{macrocode}
4954 \clist_if_empty:NF \l_tmpa_clist {
4955 % \end{macrocode}
4956 % Now I have to repeat the same actions for all the pending
4957 % languages. I do it with |\clist_map_inline:Nn|.
4958 % \begin{macrocode}
4959 \clist_map_inline:Nn \l_tmpa_clist {
4960 \clist_pop:NN \l_tmpa_clist \l_tmpa_tl
4961 \tl_set:Ne \l_tmpb_tl { import }
4962 \lngx_languages:VV \l_tmpb_tl \l_tmpa_tl
4963 \file_if_exist:nTF {
4964 linguistix - \l_tmpa_tl . sty
4965 } {
4966 \exp_args:Ne \RequirePackage
4967 { linguistix - \l_tmpa_tl }
4968 } {
4969 \msg_warning:nnV { linguistix-languages }
4970 { no_ldf }
4971 \l_tmpa_tl
4972 }
4973 \tl_clear:N \l_tmpa_tl
4974 \tl_clear:N \l_tmpb_tl
4975 }
4976 }
4977 }
4978 }
4979 }
4980 %</lang>
4981 % \end{macrocode}
4982 % \end{macro}
4983 % \newpage
4984 % \lngximplementation{logos}
4985 % \begin{macrocode}
4986 %<*logos>
4987 \ProvidesExplPackage{linguistix-logos}
4988 {2026-05-15}
4989 {v1.0}
4990 {%
4991 Logos of the ‘LinguisTiX’ bundle.%
4992 }
4993 % \end{macrocode}
4994 % The \pkg{fontspec} package (if not already loaded).
4995 % \begin{macrocode}
4996
4997 \IfPackageLoadedF { fontspec } {
4998 \RequirePackage { fontspec }
4999 }
5000 % \end{macrocode}
5001 % \begin{macro}{\lngx_logo_font:}
5002 % This is a command that switches to the New Computer Modern
5003 % Uncial font family.
5004 % \begin{macrocode}
5005
5006 \newfontfamily \lngx_logo_font: [
5007 UprightFont = { NewCMUncial10-Book.otf },
5008 UprightFeatures = {
5009 SizeFeatures = {
5010 {
5011 Size = {-8},
5012 Font = {NewCMUncial08-Book.otf}
5013 },
5014 {
5015 Size = {8-},
5016 Font = {NewCMUncial10-Book.otf}
5017 },
5018 }
5019 },
5020 BoldFont = { NewCMUncial10-Bold.otf },
5021 BoldFeatures = {
5022 SizeFeatures = {
5023 {
5024 Size = {-8},
5025 Font = {NewCMUncial08-Bold.otf}
5026 },
5027 {
5028 Size = {8-},
5029 Font = {NewCMUncial10-Bold.otf}
5030 },
5031 }
5032 }
5033 ]{ NewCMUncial10-Book.otf }
5034 % \end{macrocode}
5035 % \end{macro}
5036 % \begin{macro}{lngx_purple_color}
5037 % The following defines the |lngx_purple_color|.
5038 % \begin{macrocode}
5039
5040 \color_set:nn { lngx_purple_color } { blue ! 50 ! red }
5041 % \end{macrocode}
5042 % \end{macro}
5043 % \begin{macro}{\lngxlogo}
5044 % Here, I define the commands for printing various logos.
5045 % \begin{macrocode}
5046
5047 \NewDocumentCommand \lngxlogo { O{} } {%
5048 \group_begin:
5049 \lngx_logo_font:
5050 LinguisTi
5051 \color_group_begin:
5052 \color_select:n { lngx_purple_color }
5053 X
5054 \color_group_end:
5055 \IfBlankF { #1 } { - #1 }
5056 \group_end:
5057 }
5058 % \end{macrocode}
5059 % \end{macro}
5060 % Since we need expandable commands, I use the non-protected
5061 % function, |\cs_new:Npn| for defining them.
5062 % \begin{macrocode}
5063
5064 \cs_new:Npn \lngxpkg {
5065 \IfPackageLoadedTF { hyperref } {
5066 \texorpdfstring {
5067 \lngxlogo
5068 } {
5069 LinguisTiX
5070 }
5071 } {
5072 \lngxlogo
5073 }
5074 }
5075 % \end{macrocode}
5076 % Here, I define all the logos with a |clist|. The package
5077 % names are stored in the |clist| and then used at
5078 % appropriate positions.
5079 % \begin{macrocode}
5080
5081 \clist_map_inline:nn {
5082 base,examples,fixpex,fonts,ipa,languages,logos,nfss,
5083 marathi,british,american,english,greek,malayalam,glossing,
5084 leipzig,russian
5085 } {
5086 % \end{macrocode}
5087 % |#1| is substituted with the package name. First, for the
5088 % command-name itself, then as the optional argument of
5089 % |\lngxlogo| and then in the \textsc{pdf}-string.
5090 % \begin{macrocode}
5091 \cs_new:cpn { lngx #1 logo } {
5092 \texorpdfstring {
5093 \lngxlogo [ #1 ]
5094 } {
5095 LinguisTiX - #1
5096 }
5097 }
5098 }
5099 %</logos>
5100 % \end{macrocode}
5101 % \lngximplementation{nfss}
5102 % \begin{macrocode}
5103 %<*nfss>
5104 \ProvidesExplPackage{linguistix-nfss}
5105 {2026-05-15}
5106 {v1.0}
5107 {%
5108 An extension to the core NFSS commands
5109 from the ‘LinguisTiX’ bundle.%
5110 }
5111 % \end{macrocode}
5112 % I need a few temporary |tl|s. I declare them here. As
5113 % noted by the use of |__|, these are package-internal
5114 % |tl|s. Even though I don’t have any intention to change
5115 % them, these are better not touched by the users.
5116 % \begin{macrocode}
5117
5118 \tl_new:N \l__lngx_normalfont_tmp_tl
5119 \tl_new:N \l__lngx_selectfont_tmp_tl
5120 \tl_new:N \l__lngx_family_tmp_tl
5121 \tl_new:N \l__lngx_nfss_tmp_tl
5122 % \end{macrocode}
5123 % These |tl|s are required for saving some values that are
5124 % accessed later by the package as well as by the users.
5125 % \begin{macrocode}
5126
5127 \tl_new:N \l_lngx_current_encoding_tl
5128 \tl_new:N \l_lngx_current_meta_family_tl
5129 \tl_new:N \l_lngx_current_super_family_tl
5130 \tl_new:N \l_lngx_current_series_tl
5131 \tl_new:N \l_lngx_current_shape_tl
5132 % \end{macrocode}
5133 % \begin{macro}{^^A
5134 % \c_lngx_default_rmdefault_tl,^^A
5135 % \c_lngx_default_sfdefault_tl,^^A
5136 % \c_lngx_default_ttdefault_tl
5137 % }
5138 % Here, I start the |begindocument/end| hook. After the
5139 % document has started, a lot of initialisation can be
5140 % assumed to have happened. I set some publicly available
5141 % |tl|s here.
5142 % \begin{macrocode}
5143
5144 \hook_gput_code:nnn { begindocument / end } { . } {
5145 \tl_const:Ne \c_lngx_default_rmdefault_tl { \rmdefault }
5146 \tl_const:Ne \c_lngx_default_sfdefault_tl { \sfdefault }
5147 \tl_const:Ne \c_lngx_default_ttdefault_tl { \ttdefault }
5148 % \end{macrocode}
5149 % \end{macro}
5150 % \begin{macro}{^^A
5151 % \l_lngx_current_encoding_tl,^^A
5152 % \l_lngx_current_meta_family_tl,^^A
5153 % \l_lngx_current_super_family_tl,^^A
5154 % \l_lngx_current_series_tl,^^A
5155 % \l_lngx_current_shape_tl
5156 % }
5157 % First, I set the value |default| for the initial super
5158 % font family.
5159 % \begin{macrocode}
5160 \tl_set:Nn \l_lngx_current_super_family_tl { default }
5161 % \end{macrocode}
5162 % The current encoding is saved in the relevant |tl|.
5163 % \begin{macrocode}
5164 \tl_set:Ne \l_lngx_current_encoding_tl {
5165 \encodingdefault
5166 }
5167 % \end{macrocode}
5168 % When the package was first released, there was no public
5169 % interface for guessing the current meta family, but from
5170 % |ltnews42|, |\@currentmetafamily| became available. Thanks
5171 % Frank for pointing this out.
5172 % \begin{macrocode}
5173 \tl_set:Ne \l_lngx_current_meta_family_tl {
5174 \@currentmetafamily % new from ltnews42, thanks Frank!
5175 }
5176 % \end{macrocode}
5177 % Here, the series and shape |tl|s are set to their
5178 % defaults.
5179 % \begin{macrocode}
5180 \tl_set:Nn \l_lngx_current_series_tl { md }
5181 \tl_set:Nn \l_lngx_current_shape_tl { up }
5182 }
5183 % \end{macrocode}
5184 % \end{macro}
5185 % The |\selectfont| command overrides the encoding. I trick
5186 % the command by saving the encoding that was active before
5187 % |\selectfont| in a temporary |tl|.
5188 % \begin{macrocode}
5189
5190 \hook_gput_code:nnn { cmd / selectfont / before } { . } {
5191 \tl_set:Ne \l__lngx_selectfont_tmp_tl { \f@encoding }
5192 }
5193 % \end{macrocode}
5194 % After the processing of |\selectfont|, I equate the
5195 % temporary |tl| with the one that the package is tracking.
5196 % This way, the effect of |\selectfont| remains unchanged,
5197 % but we still save the values that were there before using
5198 % it. Only encoding needs this special setting. Other
5199 % attributes aren’t reset by |\selectfont|.
5200 % \begin{macrocode}
5201
5202 \hook_gput_code:nnn { cmd / selectfont / after } { . } {
5203 \tl_set_eq:NN \l_lngx_current_encoding_tl
5204 \l__lngx_selectfont_tmp_tl
5205 \tl_clear:N \l__lngx_selectfont_tmp_tl
5206 }
5207 % \end{macrocode}
5208 % Now, after each |\XXfamily| commands, I save the family
5209 % name in the respective |tl| for accessing later. All of
5210 % these commands too reset the encoding. I repeat my trick
5211 % for them too.
5212 % \begin{macrocode}
5213
5214 \hook_gput_code:nnn { cmd / rmfamily / before } { . } {
5215 \tl_set:Nn \l_lngx_current_meta_family_tl { rm }
5216 \tl_set:Ne \l__lngx_family_tmp_tl { \f@encoding }
5217 }
5218
5219 \hook_gput_code:nnn { cmd / rmfamily / after } { . } {
5220 \tl_set:Nn \l_lngx_current_meta_family_tl { rm }
5221 \tl_set_eq:NN \l_lngx_current_encoding_tl
5222 \l__lngx_family_tmp_tl
5223 \tl_clear:N \l__lngx_family_tmp_tl
5224 }
5225
5226 \hook_gput_code:nnn { cmd / sffamily / before } { . } {
5227 \tl_set:Nn \l_lngx_current_meta_family_tl { sf }
5228 \tl_set:Ne \l__lngx_family_tmp_tl { \f@encoding }
5229 }
5230
5231 \hook_gput_code:nnn { cmd / sffamily / after } { . } {
5232 \tl_set:Nn \l_lngx_current_meta_family_tl { sf }
5233 \tl_set_eq:NN \l_lngx_current_encoding_tl
5234 \l__lngx_family_tmp_tl
5235 \tl_clear:N \l__lngx_family_tmp_tl
5236 }
5237
5238 \hook_gput_code:nnn { cmd / ttfamily / before } { . } {
5239 \tl_set:Nn \l_lngx_current_meta_family_tl { tt }
5240 \tl_set:Ne \l__lngx_family_tmp_tl { \f@encoding }
5241 }
5242
5243 \hook_gput_code:nnn { cmd / ttfamily / after } { . } {
5244 \tl_set:Nn \l_lngx_current_meta_family_tl { tt }
5245 \tl_set_eq:NN \l_lngx_current_encoding_tl
5246 \l__lngx_family_tmp_tl
5247 \tl_clear:N \l__lngx_family_tmp_tl
5248 }
5249 % \end{macrocode}
5250 % After the series commands, I save the series name in the
5251 % |tl|. Note that, I don’t use the traditional \LaTeX\
5252 % labels |m|, |bx| etc. Using, |md| and |bx| is more
5253 % intuitive, plus they also can be used in the argument of
5254 % |\use:c| directly.
5255 % \begin{macrocode}
5256
5257 \hook_gput_code:nnn { cmd / mdseries / after } { . } {
5258 \tl_set:Nn \l_lngx_current_series_tl { md }
5259 }
5260
5261 \hook_gput_code:nnn { cmd / bfseries / after } { . } {
5262 \tl_set:Nn \l_lngx_current_series_tl { bf }
5263 }
5264 % \end{macrocode}
5265 % For shape related commands too, I save the names that are
5266 % more closer to their respective commands.
5267 % \begin{macrocode}
5268
5269 \hook_gput_code:nnn { cmd / upshape / after } { . } {
5270 \tl_set:Nn \l_lngx_current_shape_tl { up }
5271 }
5272
5273 \hook_gput_code:nnn { cmd / itshape / after } { . } {
5274 \tl_set:Nn \l_lngx_current_shape_tl { it }
5275 }
5276
5277 \hook_gput_code:nnn { cmd / scshape / after } { . } {
5278 \tl_set:Nn \l_lngx_current_shape_tl { sc }
5279 }
5280
5281 \hook_gput_code:nnn { cmd / sscshape / after } { . } {
5282 \tl_set:Nn \l_lngx_current_shape_tl { ssc }
5283 }
5284
5285 \hook_gput_code:nnn { cmd / slshape / after } { . } {
5286 \tl_set:Nn \l_lngx_current_shape_tl { sl }
5287 }
5288
5289 \hook_gput_code:nnn { cmd / swshape / after } { . } {
5290 \tl_set:Nn \l_lngx_current_shape_tl { sw }
5291 }
5292
5293 \hook_gput_code:nnn { cmd / ulcshape / after } { . } {
5294 \tl_set:Nn \l_lngx_current_shape_tl { ulc }
5295 }
5296 % \end{macrocode}
5297 %
5298 % \begin{macro}[pTF]{\lngx_if_encoding:n}
5299 % I provide a conditional for checking the current encoding
5300 % with the given argument.
5301 % \begin{macrocode}
5302
5303 \prg_new_conditional:Nnn \lngx_if_encoding:n {
5304 p,
5305 T,
5306 F,
5307 TF
5308 } {
5309 \tl_if_eq:NnTF \l_lngx_current_encoding_tl { #1 } {
5310 \prg_return_true:
5311 } {
5312 \prg_return_false:
5313 }
5314 }
5315
5316 % \end{macrocode}
5317 % \end{macro}
5318 % \begin{macro}{\IfEncodingTF,\IfEncodingT,\IfEncodingF}
5319 % For non-\LaTeX3 contexts, these simpler alternatives are
5320 % provided.
5321 % \begin{macrocode}
5322
5323 \cs_new_eq:NN \IfEncodingTF \lngx_if_encoding:nTF
5324 \cs_new_eq:NN \IfEncodingT \lngx_if_encoding:nT
5325 \cs_new_eq:NN \IfEncodingF \lngx_if_encoding:nF
5326 % \end{macrocode}
5327 % \end{macro}
5328 % \begin{macro}[pTF]{\lngx_if_meta_family:n}
5329 % A conditional for checking the meta family with the given
5330 % argument.
5331 % \begin{macrocode}
5332
5333 \prg_new_conditional:Nnn \lngx_if_meta_family:n {
5334 p,
5335 T,
5336 F,
5337 TF
5338 } {
5339 \tl_if_eq:NnTF \l_lngx_current_meta_family_tl { #1 } {
5340 \prg_return_true:
5341 } {
5342 \prg_return_false:
5343 }
5344 }
5345 % \end{macrocode}
5346 % \end{macro}
5347 % \begin{macro}{^^A
5348 % \IfMetaFamilyTF,^^A
5349 % \IfMetaFamilyT,^^A
5350 % \IfMetaFamilyF
5351 % }
5352 % User-facing conditionals for meta family.
5353 % \begin{macrocode}
5354
5355 \cs_new_eq:NN \IfMetaFamilyTF \lngx_if_meta_family:nTF
5356 \cs_new_eq:NN \IfMetaFamilyT \lngx_if_meta_family:nT
5357 \cs_new_eq:NN \IfMetaFamilyF \lngx_if_meta_family:nF
5358 % \end{macrocode}
5359 % \end{macro}
5360 % \begin{macro}[pTF]{\lngx_if_super_family:n}
5361 % A conditional for checking the super family with the given
5362 % argument.
5363 % \begin{macrocode}
5364
5365 \prg_new_conditional:Nnn \lngx_if_super_family:n {
5366 p,
5367 T,
5368 F,
5369 TF
5370 } {
5371 \tl_if_eq:NnTF \l_lngx_current_super_family_tl { #1 } {
5372 \prg_return_true:
5373 } {
5374 \prg_return_false:
5375 }
5376 }
5377 % \end{macrocode}
5378 % \end{macro}
5379 % \begin{macro}{^^A
5380 % \IfSuperFamilyTF,^^A
5381 % \IfSuperFamilyT,^^A
5382 % \IfSuperFamilyF
5383 % }
5384 % User-facing conditionals for super family.
5385 % \begin{macrocode}
5386
5387 \cs_new_eq:NN \IfSuperFamilyTF \lngx_if_super_family:nTF
5388 \cs_new_eq:NN \IfSuperFamilyT \lngx_if_super_family:nT
5389 \cs_new_eq:NN \IfSuperFamilyF \lngx_if_super_family:nF
5390 % \end{macrocode}
5391 % \end{macro}
5392 % \begin{macro}[pTF]{\lngx_if_series:n}
5393 % A conditional for checking the current series with the
5394 % given argument.
5395 % \begin{macrocode}
5396
5397 \prg_new_conditional:Nnn \lngx_if_series:n {
5398 p,
5399 T,
5400 F,
5401 TF
5402 } {
5403 \tl_if_eq:NnTF \l_lngx_current_series_tl { #1 } {
5404 \prg_return_true:
5405 } {
5406 \prg_return_false:
5407 }
5408 }
5409 % \end{macrocode}
5410 % \end{macro}
5411 % \begin{macro}{\IfSeriesTF,\IfSeriesT,\IfSeriesF}
5412 % Its user-side macros.
5413 % \begin{macrocode}
5414
5415 \cs_new_eq:NN \IfSeriesTF \lngx_if_series:nTF
5416 \cs_new_eq:NN \IfSeriesT \lngx_if_series:nT
5417 \cs_new_eq:NN \IfSeriesF \lngx_if_series:nF
5418 % \end{macrocode}
5419 % \end{macro}
5420 % \begin{macro}[pTF]{\lngx_if_shape:n}
5421 % A conditional for checking the current shape with the
5422 % current argument.
5423 % \begin{macrocode}
5424
5425 \prg_new_conditional:Nnn \lngx_if_shape:n {
5426 p,
5427 T,
5428 F,
5429 TF
5430 } {
5431 \tl_if_eq:NnTF \l_lngx_current_shape_tl { #1 } {
5432 \prg_return_true:
5433 } {
5434 \prg_return_false:
5435 }
5436 }
5437 % \end{macrocode}
5438 % \end{macro}
5439 % \begin{macro}{\IfShapeTF,\IfShapeT,\IfShapeF}
5440 % User-side macros for the same.
5441 % \begin{macrocode}
5442
5443 \cs_new_eq:NN \IfShapeTF \lngx_if_shape:nTF
5444 \cs_new_eq:NN \IfShapeT \lngx_if_shape:nT
5445 \cs_new_eq:NN \IfShapeF \lngx_if_shape:nF
5446 % \end{macrocode}
5447 % \end{macro}
5448 % Now I will use the |\clist_map_inline:nn| technique for
5449 % generating multiple conditionals of the same pattern. For
5450 % that, I need a |cnn| variant of |\prg_new_conditional:Nnn|
5451 % that I create with the following.
5452 % \begin{macrocode}
5453
5454 \cs_generate_variant:Nn \prg_new_conditional:Nnn { cnn }
5455 % \end{macrocode}
5456 %
5457 % \begin{macro}[pTF]{^^A
5458 % \lngx_if_meta_family_rm:,\lngx_if_meta_family_sf:,^^A
5459 % \lngx_if_meta_family_tt:
5460 % }
5461 % These are separate conditionals for |rm|, |sf| and |tt|
5462 % families. They don’t require arguments. No user side
5463 % commands are provided for these.
5464 % \begin{macrocode}
5465
5466 \clist_map_inline:nn {
5467 rm,
5468 sf,
5469 tt
5470 } {
5471 \prg_new_conditional:cnn { lngx_if_meta_family_ #1 : } {
5472 p, T, F, TF
5473 } {
5474 \tl_if_eq:NnTF \l_lngx_current_meta_family_tl { #1 } {
5475 \prg_return_true:
5476 } {
5477 \prg_return_false:
5478 }
5479 }
5480 }
5481 % \end{macrocode}
5482 % \end{macro}
5483 % \begin{macro}[pTF]{^^A
5484 % \lngx_if_series_md:,\lngx_if_series_bf:
5485 % }
5486 % Separate conditionals for both the series.
5487 % \begin{macrocode}
5488
5489 \clist_map_inline:nn {
5490 md,
5491 bf
5492 } {
5493 \prg_new_conditional:cnn { lngx_if_series_ #1 : } {
5494 p, T, F, TF
5495 } {
5496 \tl_if_eq:NnTF \l_lngx_current_series_tl { #1 } {
5497 \prg_return_true:
5498 } {
5499 \prg_return_false:
5500 }
5501 }
5502 }
5503 % \end{macrocode}
5504 % \end{macro}
5505 % \begin{macro}[pTF]{^^A
5506 % \lngx_if_shape_up:,\lngx_if_shape_it:,^^A
5507 % \lngx_if_shape_sc:,\lngx_if_shape_ssc:,^^A
5508 % \lngx_if_shape_sl:,\lngx_if_shape_sw:,^^A
5509 % \lngx_if_shape_ulc:
5510 % }
5511 % Separate conditionals for all the shapes.
5512 % \begin{macrocode}
5513
5514 \clist_map_inline:nn {
5515 up,
5516 it,
5517 sc,
5518 ssc,
5519 sl,
5520 sw,
5521 ulc
5522 } {
5523 \prg_new_conditional:cnn { lngx_if_shape_ #1 : } {
5524 p, T, F, TF
5525 } {
5526 \tl_if_eq:NnTF \l_lngx_current_shape_tl { #1 } {
5527 \prg_return_true:
5528 } {
5529 \prg_return_false:
5530 }
5531 }
5532 }
5533 % \end{macrocode}
5534 % \end{macro}
5535 % These keys are used in the argument of
5536 % |\lngx_super_font_family:nn|. This is why they are
5537 % separated from the set |lngx_keys|. We create new |tl|s
5538 % using these keys that save the |rm|, |sf| and |tt|
5539 % defaults of the new super font family.
5540 % |\l__lngx_nfss_tmp_tl| is defined by the command that
5541 % creates the super font family.
5542 % \begin{macrocode}
5543
5544 \clist_map_inline:nn {
5545 rm,
5546 sf,
5547 tt
5548 } {
5549 \keys_define:nn { lngx_nfss } {
5550 #1
5551 .code:n = {
5552 \tl_gclear_new:c {
5553 g_lngx_ \l__lngx_nfss_tmp_tl _ #1 default _tl
5554 }
5555 \tl_gset:cn {
5556 g_lngx_ \l__lngx_nfss_tmp_tl _ #1 default _tl
5557 } { ##1 }
5558 }
5559 }
5560 }
5561 % \end{macrocode}
5562 % \begin{macro}{^^A
5563 % \lngx_super_font_family:nn,\superfontfamily^^A
5564 % }
5565 % I first set the temporary |tl| with the name of the super
5566 % font family retrieved from the first argument.
5567 % \begin{macrocode}
5568
5569 \cs_new_protected:Npn \lngx_super_font_family:nn #1#2 {
5570 \tl_set:Ne \l__lngx_nfss_tmp_tl { #1 }
5571 % \end{macrocode}
5572 % Now, I pass the second argument to the key-set I just
5573 % defined. The temporary |tl| is cleared. This function
5574 % comes with a user-side macro.
5575 % \begin{macrocode}
5576 \keys_set:nn { lngx_nfss } { #2 }
5577 \tl_clear:N \l__lngx_nfss_tmp_tl
5578 }
5579
5580 \cs_gset_eq:NN \superfontfamily
5581 \lngx_super_font_family:nn
5582 % \end{macrocode}
5583 % \end{macro}
5584 % \begin{macro}{^^A
5585 % \lngx_soft_super_font_family:nn,\softsuperfontfamily
5586 % }
5587 % I set the |tl| that saves the current font family to the
5588 % first argument.
5589 % \begin{macrocode}
5590
5591 \cs_new_protected:Npn \lngx_soft_super_font_family:nn #1#2 {
5592 \tl_set:Ne \l_lngx_current_super_family_tl { #1 }
5593 % \end{macrocode}
5594 % I first check if the |tl|s for rm, sf and tt are empty or
5595 % not. Only if they are not, I use their content in the
5596 % respective |\XXdefault|. This makes the use of all the
5597 % keys optional. Only the keys that the user has used are
5598 % processed here.
5599 % \begin{macrocode}
5600 \clist_map_inline:nn {
5601 rm,
5602 sf,
5603 tt
5604 } {
5605 \tl_if_empty:cF { g_lngx_ #1 _ ##1 default_tl } {
5606 \cs_set:cpe { ##1 default } {
5607 \tl_use:c { g_lngx_ #1 _ ##1 default _tl }
5608 }
5609 }
5610 }
5611 % \end{macrocode}
5612 % After setting the |\XXdefault|, I use the |\normalfont| to
5613 % initialise the super font family.
5614 % \begin{macrocode}
5615 \normalfont
5616 % \end{macrocode}
5617 % Now all the aspects are reset. But, we have them saved in
5618 % our |tl|s. So now depending on the attributes that the
5619 % user wants to retrieve, I call those attributes again. The
5620 % second argument is (expected to be) a comma-separated list
5621 % of all such attributes. Thus, we change the super font
5622 % family, but retain the already active attributes. This
5623 % command has a user-facing macro.
5624 % \begin{macrocode}
5625 \clist_map_inline:nn { #2 } {
5626 \str_case:nn { ##1 } {
5627 { encoding } {
5628 \exp_args:NV \fontencoding
5629 \l_lngx_current_encoding_tl
5630 }
5631 { family } {
5632 \use:c {
5633 \l_lngx_current_meta_family_tl family
5634 }
5635 \exp_args:NV \fontencoding
5636 \l_lngx_current_encoding_tl
5637 \selectfont
5638 }
5639 { series } {
5640 \use:c {
5641 \l_lngx_current_series_tl series
5642 }
5643 }
5644 { shape } {
5645 \use:c {
5646 \l_lngx_current_shape_tl shape
5647 }
5648 }
5649 }
5650 }
5651 }
5652
5653 \cs_gset_eq:NN \softsuperfontfamily
5654 \lngx_soft_super_font_family:nn
5655 % \end{macrocode}
5656 % \end{macro}
5657 % \begin{macro}{^^A
5658 % \lngx_softer_super_font_family:n,\softersuperfontfamily
5659 % }
5660 % This function excludes the encoding and resets all the
5661 % other attributes. It comes with a user-side macro.
5662 % \begin{macrocode}
5663
5664 \cs_new_protected:Npn \lngx_softer_super_font_family:n #1 {
5665 \lngx_soft_super_font_family:nn { #1 } {
5666 family,
5667 series,
5668 shape
5669 }
5670 }
5671
5672 \cs_gset_eq:NN \softersuperfontfamily
5673 \lngx_softer_super_font_family:n
5674 % \end{macrocode}
5675 % \end{macro}
5676 % \begin{macro}{^^A
5677 % \lngx_softest_super_font_family:n,\softestsuperfontfamily
5678 % }
5679 % This function resets all the attributes. It is available
5680 % as a user-side macro.
5681 % \begin{macrocode}
5682
5683 \cs_new_protected:Npn \lngx_softest_super_font_family:n #1 {
5684 \lngx_soft_super_font_family:nn { #1 } {
5685 encoding,
5686 family,
5687 series,
5688 shape
5689 }
5690 }
5691
5692 \cs_gset_eq:NN \softestsuperfontfamily
5693 \lngx_softest_super_font_family:n
5694 % \end{macrocode}
5695 % \end{macro}
5696 % \begin{macro}{^^A
5697 % \lngx_soft_normal_font:n,\softnormalfont
5698 % }
5699 % Following the same logic, I now provide the command for
5700 % resetting to the default super family, but retaining the
5701 % active attributes. I provide a user-side macro for this.
5702 % \begin{macrocode}
5703
5704 \cs_new_protected:Npn \lngx_soft_normal_font:n #1 {
5705 \tl_set:Ne \l_lngx_current_super_family_tl { default }
5706 \clist_map_inline:nn {
5707 rm,
5708 sf,
5709 tt
5710 } {
5711 \cs_set:cpe { ##1 default } {
5712 \tl_use:c { c_lngx_default_ ##1 default _tl }
5713 }
5714 }
5715 \normalfont
5716 \clist_map_inline:nn { #1 } {
5717 \str_case:nn { ##1 } {
5718 { encoding } {
5719 \exp_args:NV \fontencoding
5720 \l_lngx_current_encoding_tl
5721 }
5722 { family } {
5723 \use:c {
5724 \l_lngx_current_meta_family_tl family
5725 }
5726 \exp_args:NV \fontencoding
5727 \l_lngx_current_encoding_tl
5728 \selectfont
5729 }
5730 { series } {
5731 \use:c {
5732 \l_lngx_current_series_tl series
5733 }
5734 }
5735 { shape } {
5736 \use:c {
5737 \l_lngx_current_shape_tl shape
5738 }
5739 }
5740 }
5741 }
5742 }
5743
5744 \cs_gset_eq:NN \softnormalfont \lngx_soft_normal_font:n
5745 % \end{macrocode}
5746 % \end{macro}
5747 % \begin{macro}{^^A
5748 % \lngx_softer_normal_font:,\softernormalfont
5749 % }
5750 % This is a parallel to the \enquote{softer} super family
5751 % command for the default super family.
5752 % \begin{macrocode}
5753
5754 \cs_new_protected:Npn \lngx_softer_normal_font: {
5755 \lngx_soft_normal_font:n {
5756 family,
5757 series,
5758 shape
5759 }
5760 }
5761
5762 \cs_gset_eq:NN \softernormalfont \lngx_softer_normal_font:
5763 % \end{macrocode}
5764 % \end{macro}
5765 % \begin{macro}{^^A
5766 % \lngx_softest_normal_font:,\softestnormalfont
5767 % }
5768 % This is a parallel to the \enquote{softest} super family
5769 % command for the default super family.
5770 % \begin{macrocode}
5771
5772 \cs_new_protected:Npn \lngx_softest_normal_font: {
5773 \lngx_soft_normal_font:n {
5774 encoding,
5775 family,
5776 series,
5777 shape
5778 }
5779 }
5780
5781 \cs_gset_eq:NN \softestnormalfont \lngx_softest_normal_font:
5782 % \end{macrocode}
5783 % \end{macro}
5784 % \begin{macro}[EXP]{^^A
5785 % \CurrentEncoding,\CurrentMetaFamily,\CurrentSeries,^^A
5786 % \CurrentShape
5787 % }
5788 % Lastly, we create the commands that print the current
5789 % values of the font attributes and end the package.
5790 % \begin{macrocode}
5791 \cs_new:Npn \CurrentEncoding {
5792 \tl_use:N \l_lngx_current_encoding_tl
5793 }
5794 \cs_new:Npn \CurrentMetaFamily {
5795 \tl_use:N \l_lngx_current_meta_family_tl
5796 }
5797 \cs_new:Npn \CurrentSuperFamily {
5798 \tl_use:N \l_lngx_current_super_family_tl
5799 }
5800 \cs_new:Npn \CurrentSeries {
5801 \tl_use:N \l_lngx_current_series_tl
5802 }
5803 \cs_new:Npn \CurrentShape {
5804 \tl_use:N \l_lngx_current_shape_tl
5805 }
5806 %</nfss>
5807 % \end{macrocode}
5808 % \end{macro}
5809 % \end{implementation}
5810 % \newpage
5811 % \printbibliography
5812 % \newpage
5813 % \PrintIndex
5814 % \Finale