summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/smultiling/smultiling.dtx
blob: 8bf96302fc056d9e3cb4308f37747b982b3d01e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
% \iffalse meta-comment
% A LaTeX Class and Package for the Smultiling Glossary
% Copyright (c) 2009 Michael Kohlhase, all rights reserved
%               this file is released under the
%               LaTeX Project Public License (LPPL)
%
% The original of this file is in the public repository at 
% http://github.com/KWARC/sTeX/
% \fi
%   
% \iffalse
%<sty>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<sty>\ProvidesPackage{smultiling}[2019/03/20 v0.2 Multilingual Support for sTeX]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage{url,array,omdoc,omtext,float}
\usepackage[show]{ed}
\usepackage[hyperref=auto,style=alphabetic]{biblatex}
\addbibresource{kwarcpubs.bib}
\addbibresource{extpubs.bib}
\addbibresource{kwarccrossrefs.bib}
\addbibresource{extcrossrefs.bib}
\usepackage{stex-logo}
\usepackage{ctangit}
\usepackage{hyperref}
\makeindex
\floatstyle{boxed}
\newfloat{exfig}{thp}{lop}
\floatname{exfig}{Example}
\def\githubissue#1{\cite{sTeX:github:on}, \hyperlink{hstp://trac.kwarc.info/sTeX/ticket/#1}{issue #1}}
\def\smglom{\textsf{SMGloM}\xspace}
\def\omdoc{\textsf{OMDoc}\xspace}
\def\latexml{{\LaTeX}ML\xspace}
\def\lmh{\textsf{lmh}\xspace}
\begin{document}
\RecordChanges
\DocInput{smultiling.dtx}
\end{document}
%</driver>
% \fi
% 
%\CheckSum{189}
% 
% \changes{v0.1}{2014/04/19}{First Version}
% \changes{v0.2}{2017/10/15}{Adding a key-value argument to \texttt{\textbackslash symi}
% and friends for GF metadata}
%
% 
% \MakeShortVerb{\|}
%
% \def\omdoc{OMDoc}
% \def\latexml{{\LaTeX}ML}
% \title{{\texttt{smultiling.sty}}: Multilinguality Support for \protect\sTeX}
%    \author{Michael Kohlhase\\
%    FAU Erlangen-N\"urnberg\\
%    \url{http://kwarc.info/kohlhase}\and
%    Deyan Ginev\\Authorea}
% \maketitle
%
% \begin{abstract}
%   The |smultiling| package is part of the \sTeX collection, a version of {\TeX/\LaTeX}
%   that allows to markup {\TeX/\LaTeX} documents semantically without leaving the
%   document format, essentially turning {\TeX/\LaTeX} into a document format for
%   mathematical knowledge management (MKM).
%
%   The |smultiling| package adds multilinguality support for \sTeX, the idea is that
%   multilingual modules in \sTeX consist of a module signature together with multiple
%   language bindings that inherit symbols from it, which also account for cross-language
%   coordination.
% \end{abstract}
%
%\tableofcontents\newpage
% 
%\begin{omgroup}[id=sec:STR]{Introduction}
%  We have been using \sTeX as the encoding for the Semantic Multilingual Glossary of
%  Mathematics (\smglom; see~\cite{GinIanJuc:spsttom16,SMGloM:gloss:on}). The \smglom data
%  model has been taxing the representational capabilities of \sTeX with respect to
%  multilingual support and verbalization definitions; see~\cite{Kohlhase:dmesmgm14},
%  which we assume as background reading for this note.
% 
% \begin{omgroup}{\protect\sTeX Module Signatures}
%   (Monolingual) \sTeX had the intuition that the symbol definitions (|\symdef| and
%   |\symvariant|) are interspersed with the text and we generate \sTeX module signatures
%   (SMS |*.sms| files) from the \sTeX files. The SMS duplicate ``formal'' information
%   from the ``narrative'' \sTeX files. In the \smglom, we extend this idea by making the
%   the SMS primary objects that contain the language-independent part of the formal
%   structure conveyed by the \sTeX documents and there may be multiple narrative
%   ``language bindings'' that are translations of each other -- and as we do not want to
%   duplicate the formal parts, those are inherited from the SMS rather than written down
%   in the language binding itself. So instead of the traditional monolingual markup in
%   Figure~\ref{fig:stex-monolingual}, we we now advocate the divided style in
%   Figure~\ref{fig:stex-multiling}. 
%
% \begin{exfig}
% \begin{verbatim}
% \begin{module}[id=foo]
% \symdef{bar}{BAR}
% \begin{definition}[for=bar]
%   A \defiii{big}{array}{raster} ($\bar$) is a\ldots, it is much
%   bigger than a \defiii[sar]{small}{array}{raster}.
% \end{definition}
% \end{module}
% \end{verbatim}\vspace{-2em}
% \caption{A module with definition in monolingual \protect\sTeX}\label{fig:stex-monolingual}
% \end{exfig}
% 
% \begin{exfig}
% \begin{verbatim}
% \usepackage{multiling}
% \begin{modsig}{foo}
%   \symdef{bar}{BAR}
%   \symi[gfc=N]{sar}
% \end{modsig}
%
% \begin{modnl}[creators=miko,primary]{foo}{en}
%   \begin{definition}
%     A \defiii[bar]{big}{array}{raster} ($\bar$) is a\ldots, it is much bigger
%     than a \defiii[sar]{small}{array}{raster}. 
%   \end{definition}
% \end{modnl}
%
% \begin{modnl}[creators=miko]{foo}{de}
%   \begin{definition}
%     Ein \defiii[bar]{gro"ses}{Feld}{Raster} ($\bar$) ist ein\ldots, es
%     ist viel gr"o"ser als ein \defiii[sar]{kleines}{Feld}{Raster}. 
%   \end{definition}
% \end{modnl}
% \end{verbatim}\vspace{-2em}
% \caption{Multilingual \protect\sTeX for Figure \protect\ref{fig:stex-monolingual}.}
% \label{fig:stex-multiling}
% \end{exfig}
% 
%   We retain the old |module| environment as an intermediate stage. It is still useful
%   for monolingual texts. Note that for files with a module, we still have to extract
%   |*.sms| files. It is not completely clear yet, how to adapt the workflows. We clearly
%   need a \lmh or editor command that transfers an old-style module into a new-style
%   signature/binding combo to prepare it for multilingual treatment.
% \end{omgroup}
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:user]{The User Interface}
%   The |smultiling| package accepts the \DescribeMacro{langfiles}|langfiles| option that
%   specifies -- for a module \meta{mod} that the module signature file has the name
%   \meta{mod}|.tex| and the language bindings of language with the ISO 639 language
%   specifier \meta{lang} have the file name
%   \meta{mod}|.|\meta{lang}|.tex|.\ednote{implement other schemes, e.g. the onefile
%   scheme.}
% 
% \begin{omgroup}{Multilingual Modules}
%   There the \DescribeEnv{modsig}|modsig| environment works exactly like the old |module|
%   environment, only that the |id| attribute has moved into the required argument --
%   anonymous module signatures do not make sense.
%
%   The \DescribeEnv{modnl}|modnl| environment takes two arguments the first is the name
%   of the module signature it provides language bindings for and the second the ISO 639
%   language specifier of the content language. We add the |primary| key |modnl|, which
%   can specify the primary language binding (the one the others translate from; and which
%   serves as the reference in case of translation conflicts).\ednote{@Hang: This needs to
%   be implemented in LaTeXML}
% 
%   There is another difference in the multilingual encoding: All symbols are introduced
%   in the module signature, either by a |\symdef| or the new \DescribeMacro{\symi}|\symi|
%   macro. |\symi[|\meta{keys}|]{|\meta{name}|}| takes a symbol name \meta{name} as an
%   argument and reserves that name. The variant
%   \DescribeMacro{\symi*}|\symi*[|\meta{keys}|]{|\meta{name}|}| declares \meta{name} to
%   be a primary symbol; see~\cite{Kohlhase:dmesmgm14} for a discussion. \sTeX provides
%   variants \DescribeMacro{\symii}|\symii|, \DescribeMacro{\symiii}|\symiii|, and
%   \DescribeMacro{\symiv}|\symiv| -- and their starred versions -- for multi-part
%   names. The key-value interface \meta{keys} does not have any effect on the {\LaTeX}
%   rendering, it can be used to embed metadata. See  for instance \sref{user:GFmeta}. 
% \end{omgroup}
% 
% \begin{omgroup}{Multilingual Definitions and Cross-referencing Terms}
%   We do not need a new infrastructure for defining mathematical concepts, only the
%   realization that symbols are language-independent. So we can use symbols for the
%   coordination of corresponding verbalizations. As the example in
%   Figure~\ref{fig:stex-multiling} already shows, we can just specify the symbol name in
%   the optional argument of the |\defi| macro to establish that the language bindings
%   provide different verbalizations of the same symbol.
% 
%   For multilingual term references the situtation is more complex: For single-word
%   verbalizations we could use |\atrefi| for language bindings. Say we have introduced a
%   symbol |foo| in English by |\defi{foo}| and in German by |\defi[foo]{Foo}|. Then we
%   can indeed reference it via |\trefi{foo}| and |\atrefi{Foo}{foo}|. But one the one
%   hand this blurs the distinction between translation and ``linguistic variants'' and on
%   the other hand does not scale to multi-word compounds as |bar| in
%   Figure~\ref{fig:stex-multiling}, which we would have to reference as
%   |\atrefiii{gro"ses Feld Raster}{bar}|. To avoid this, the |smultiling| package
%   provides the new macros \DescribeMacro{\mtref}|\mtrefi|, |\mtrefii|, and |\mtrefiii|
%   for multilingual references. Using this, we can reference |bar| as
%   |\mtrefiii[?bar]{gro"ses}{Feld}{Raster}|, where we use the (up to three) mandatory
%   arguments to segment the lexical constituents.
% 
%   The first argument it syntactically optional to keep the parallelism to |\*def*|
%   |\*tref*| it specifies the symbol via its name \meta{name} and module name \meta{mod}
%   in a MMT URI \meta{mod}|?|\meta{name}. Note that MMT URIs can be relative:
%   \begin{enumerate}
%     \item |foo?bar| denotes the symbol |bar| from module |foo|
%     \item |foo| the module |foo| (the symbol name is induced from the remaining
%       arguments of |\mtref*|)
%     \item |?bar| specifies symbol |bar| from the current module
%     \end{enumerate}
%     Note that the number suffix |i|/|ii|/|iii|/|iv| indicates the number of words in the
%     actual language binding, not in the symbol name as in |\atref*|.
% 
%     Finally note that hyperlinks on term references only have information on the
%     underlying symbol and module names -- i.e. signature information -- and we need to
%     cross-reference into the language bindings. To do this, we need to know the base
%     language of the document. To ensure basic functionality we set this to |en| and
%     provide the \DescribeMacro{\sTeXlanguage}|\sTeXlanguage| macro to set it. 
% \end{omgroup}
% 
% \begin{omgroup}{Multilingual Views}
%   Views receive a similar treatment as modules in the |smultiling| package. A
%   multilingual view consists of
%   \begin{enumerate}
%   \item a \textbf{view signature} marked up with the \DescribeEnv{viewsig}|viewsig|
%     environment. This takes three required arguments: a view name, the source module,
%     and the target module. The optional first argument is for metadata (|display|,
%     |title|, |creators|, and |contributors|) and load information (|loadfrom| and
%     |loadto|) and
%   \item multiple \textbf{language bindings} marked up by the
%     \DescribeEnv{viewnl}|viewnl| environment, which takes two required arguments: the
%     view name and the language specifier. The optional first key/value argument takes
%     the same keys as |viewsig| except the last two.
%   \end{enumerate}
% 
% \begin{verbatim}
% \begin{viewsig}[creators=miko]{norm-metric}{metric-space}{norm}
%   \vassign{base-set}{base-set}
%   \fassign{x,y}{\metric{x,y}}{\norm{x-y}}
% \end{viewsig}
% \end{verbatim}
%   Views have language bindings just as modules do, in our case, we have 
% \begin{verbatim}
% \begin{viewnl}[creators=miko]{norm-metric}{en}
%   \obligation{metric-space}{obl.norm-metric.en}
%   \begin{assertion}[type=obligation,id=obl.norm-metric.en]
%     $\defeq{d(x,y)}{\norm{x-y}}$ is a \trefii[metric-space]{distance}{function}
%   \end{assertion}
%   \begin{sproof}[for=obl.norm-metric.en]
%     {we prove the three conditions for a distance function:}
%     ...
%   \end{sproof}
% \end{viewnl}
% \end{verbatim}
% 
% \end{omgroup}
% 
% \begin{omgroup}{Mathematical Keywords}
%   For translations of the mathematical keywords, the |statements| and |sproofs| packages
%   in \sTeX define special language definition files,
%   e.g. |statements-ngerman.ldf|.\ednote{say more about this}\ednote{There is the
%   translator package which belongs to beamer, maybe we should switch to that.} There is
%   currently only very limited support for this.
% \end{omgroup}
% 
% \begin{omgroup}[id=user:GFmeta]{GF Metadata}
%   Several \sTeX macros and environments allow keys for syntactical information about the
%   objects declared. 
% 
%   The symbol-declaring macros |\symi| and friends as well as |\symdef| allow
%   \DescribeMacro{gfc}{gfc} key allows to specify the grammatical category in terms of
%   the Resource Grammar of the Grammatical Framework~\cite{GFResourceGrammar:on}.
%
%   The verbalization-defining macros |\defi| and friends allow the |gfa| (GF apply) and
%   |gfl| (GF linearization) keys. 
%  
%   A definiendum of the form
%   |\defii[gfa=mkN]{empty}{set}| generates the GF linearization |empty_set = mkN "empty set"|. 
%   Some what less conveniently,
%   |\defii[name=datum,gfl={mkN "Datum", "Daten"}{Datum}| can be used if the GF
%   linearization is more complex than simply applying a ``make command'' to the
%   verbalization.  
% \end{omgroup}
% \end{omgroup}
%
% \begin{omgroup}{Limitations}
%
% We list the limitations of the |smultiling| package. 
%
% \begin{omgroup}{General \texttt{babel} Integration}
%   There is currently no integration with the |babel| package that handles
%   language-specific aspects in {\LaTeX}. In particular, selecting the right language
%   must be done manually. In particular, the example from Figure~\ref{fic:stex-multiling}
%   would really have the form given in Figure~\ref{fig:stex-multiling-babel} -- see the
%   |\usepackage[usenglish,ngerman]{babel}| in line 2, and the |\selectlanguage|
%   statements in lines 6 and 13.
% \begin{exfig}
% \begin{verbatim}
% \usepackage{multiling}
% \usepackage[usenglish,ngerman]{babel}% babel support
% \begin{modsig}{foo}
%   \symdef{bar}{BAR}
%   \symi{sar}
% \end{modsig}
% \selectlanguage{english}% english version follows
% \begin{modnl}[creators=miko,primary]{foo}{en}
%   \begin{definition}
%     A \defiii[bar]{big}{array}{raster} ($\bar$) is a\ldots, it is much bigger
%     than a \defiii[sar]{small}{array}{raster}. 
%   \end{definition}
% \end{modnl}
% \selectlanguage{german}% german umlauts please
% \begin{modnl}[creators=miko]{foo}{de}
%   \begin{definition}
%     Ein \defiii[bar]{gro"ses}{Feld}{Raster} ($\bar$) ist ein\ldots, es
%     ist viel gr"o"ser als ein \defiii[sar]{kleines}{Feld}{Raster}. 
%   \end{definition}
% \end{modnl}
% \end{verbatim}\vspace{-2em}
% \caption{Multilingual \protect\sTeX with \texttt{babel}}
% \label{fig:stex-multiling-babel}
% \end{exfig}
% 
% For the |langfiles| setup, which assumes that module signatures and language bindings
% are in separate files, |babel| integration can be simplified by providing a
% language-specific preamble file with |\usepackage{|\meta{language}|}{babel}| which is
% pre-pended to all language binding files when formatted. This preamble can also contain
% the other language-specific packages (e.g. for font encodings, etc.).
% \end{omgroup}
% 
% \begin{omgroup}{PDF links on term references are language-dependent}
%   Given the |langfiles| mode, we need the intended language to generate PDF links on
%   term references. But we cannot infer this for top-level ``papers'' (we do in the
%   language bindings). So it has to be specified via |\sTexlanguage|, and we do not
%   really had a way to check that it is. Unfortunately, the only place it would be natural
%   to do so is in |\mod@component|, but the |\PackageError| there had to be commented
%   out, since it leads to serious errors. Thus we set the language to |en| by default,
%   which is sub-optimal. Maybe there is a way to infer the document language from the
%   babel settings. 
% \end{omgroup}
% 
% \begin{omgroup}{Language-Specific Limitations}
% Some languages have more problems than others
% \begin{description}
% \item[Turkish] makes \texttt{=} an active character (to give better spacing); this
%   interacts unfavourably with the |keyval| package which needs \texttt{=} as key/value
%   separator (and gives it a different category code). Therefore we need to prohibit this by
%   restricting the |shorthands| option: use |\usepackage[turkish,shorthands=:!]{babel}|.
% \item[Chinese] needs special fonts and |xelatex|\ednote{get Jinbo to document this}.
% \end{description}
% \end{omgroup}
% \end{omgroup}
% 
% \StopEventually{\newpage\PrintIndex\newpage\PrintChanges\printbibliography}\newpage
%
% \begin{omgroup}[id=sec:impl:cls]{Implementation}
%
% \begin{omgroup}[id=sec:impl:cls:options]{Class Options}
%    \begin{macrocode}
%<*sty>
\newif\if@smultiling@mh@\@smultiling@mh@false
\DeclareOption{mh}{\@smultiling@mh@true}
\newif\if@langfiles\@langfilesfalse
\DeclareOption{langfiles}{\@langfilestrue}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{modules}}
\ProcessOptions
%    \end{macrocode}
%
% We load the packages referenced here. 
%
%    \begin{macrocode}
\if@smultiling@mh@\RequirePackage{smultiling-mh}\fi
\RequirePackage{etoolbox}
\RequirePackage{structview}
%    \end{macrocode}
% \end{omgroup}
%
% \begin{omgroup}{Signatures}
% 
% \begin{environment}{modsig}
%   The |modsig| environment is just a layer over the |module| environment. We also
%   redefine macros that may occur in module signatures so that they do not create
%   markup. Finally, we set the flag |\mod@|\meta{mod}|@multiling| to |true|.
%    \begin{macrocode}
\newenvironment{modsig}[2][]{\def\@test{#1}%
\ifx\@test\@empty\begin{module}[id=#2]\else\begin{module}[id=#2,#1]\fi%
\expandafter\gdef\csname mod@#2@multiling\endcsname{true}%
\ignorespacesandpars}
{\end{module}\ignorespacesandparsafterend}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\mod@component}
%   We redefine the macro from the |modules| package that computes the module component
%   identifier for external links on term references. If |\mod@|\meta{mod}|@multiling| is
%   |true|, then we make the component identifier |.|\meta{lang}, which can be customized
%   by the next macro below.
%    \begin{macrocode}
\renewcommand\mod@component[1]{%
\expandafter\ifx\csname mod@#1@multiling\endcsname\@true%
\@ifundefined{smultiling@language}{}
% for some reason this error message bombs big time; so we leave it out. 
% {\PackageError{smultiling}%
%   {No document language specified for term reference links}
%   {use \protect\sTeXlanguage to specify it!}}
{.\smultiling@language}%
\fi}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\sTeXlanguage}
%   This macro sets the internal flag |\smultiling@language|, we set the default to |en|,
%   since otherwise hyper-references on term references do not work.
%    \begin{macrocode}
\newcommand\sTeXlanguage[1]{\def\smultiling@language{#1}}
\sTeXlanguage{en}
%    \end{macrocode}
% \end{macro}
% 
% \begin{environment}{viewsig}
%   The |viewsig| environment is just a layer over the |view| environment with the keys
%   suitably adapted.
%    \begin{macrocode}
\newenvironment{viewsig}[4][]{\def\@test{#1}\ifx\@test\@empty%
  \begin{view}[id=#2,ext=tex]{#3}{#4}\else\begin{view}[id=#2,#1,ext=tex]{#3}{#4}\fi%
  \ignorespacesandpars}
  {\end{view}\ignorespacesandparsafterend}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\@sym*}
%   has a starred form for primary symbols. The key/value interface has no effect on the
%   {\LaTeX} side. We read the to check whether only allowed ones are used.
%    \begin{macrocode}
\define@key{symi}{noverb}[all]{}%
\define@key{symi}{align}[WithTheSymbolOfTheSameName]{}%
\define@key{symi}{specializes}{}%
\define@key{symi}{noalign}[true]{}%
\newcommand\symi{\@ifstar\@symi@star\@symi}
\newcommand\@symi[2][]{\metasetkeys{symi}{#1}%
  \if@importing\else\par\noindent Symbol: \textsf{#2}\fi\ignorespacesandpars}
\newcommand\@symi@star[2][]{\metasetkeys{symi}{#1}%
  \if@importing\else\par\noindent Primary Symbol: \textsf{#2}\fi\ignorespacesandpars}
\newcommand\symii{\@ifstar\@symii@star\@symii}
\newcommand\@symii[3][]{\metasetkeys{symi}{#1}%
  \if@importing\else\par\noindent Symbol: \textsf{#2-#3}\fi\ignorespacesandpars}
\newcommand\@symii@star[3][]{\metasetkeys{symi}{#1}%
  \if@importing\else\par\noindent Primary Symbol: \textsf{#2-#3}\fi\ignorespacesandpars}
\newcommand\symiii{\@ifstar\@symiii@star\@symiii}
\newcommand\@symiii[4][]{\metasetkeys{symi}{#1}%
  \if@importing\else\par\noindent Symbol: \textsf{#2-#3-#4}\fi\ignorespacesandpars}
\newcommand\@symiii@star[4][]{\metasetkeys{symi}{#1}%
  \if@importing\else\par\noindent Primary Symbol: \textsf{#2-#3-#4}\fi\ignorespacesandpars}
\newcommand\symiv{\@ifstar\@symiv@star\@symiv}
\newcommand\@symiv[5][]{\metasetkeys{symi}{#1}%
  \if@importing\else\par\noindent Symbol: \textsf{#2-#3-#4-#5}\fi\ignorespacesandpars}
\newcommand\@symiv@star[5][]{\metasetkeys{symi}{#1}%
  \if@importing\else\par\noindent Primary Symbol: \textsf{#2-#3-#4-#5}\fi\ignorespacesandpars}
%    \end{macrocode}
% \end{macro}
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:langbindings]{Language Bindings}
% 
% \begin{macro}{modnl:*}
%    \begin{macrocode}
\addmetakey{modnl}{load}
\addmetakey*{modnl}{title}
\addmetakey*{modnl}{creators}
\addmetakey*{modnl}{contributors}
\addmetakey{modnl}{srccite}
\addmetakey{modnl}{primary}[yes]
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{modnl}
%   The |modnl| environment is just a layer over the |module| environment and the
%   |\importmodule| macro with the keys and language suitably adapted.
%    \begin{macrocode}
\newenvironment{modnl}[3][]{\metasetkeys{modnl}{#1}%
  \def\@test{#1}\ifx\@test\@empty\begin{module}[id=#2.#3]\else\begin{module}[id=#2.#3,#1]\fi%
  \def\smultiling@language{#3}%
  \if@langfiles\importmodule[load=#2,ext=tex]{#2}\else
  \ifx\modnl@load\@empty\importmodule{#2}\else\importmodule[ext=tex,load=\modnl@load]{#2}\fi%
  \fi%
  \ignorespacesandpars}
{\end{module}\ignorespacesandparsafterend}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{viewnl}
%   The |viewnl| environment is just a layer over the |view| environment with the keys and
%   language suitably adapted.\ednote{MK: we have to do something about the if@langfiles
%   situation here. But this is non-trivial, since we do not know the current path, to
%   which we could append .\meta{lang}!}
%    \begin{macrocode}
\newenvironment{viewnl}[5][]{\def\@test{#1}\ifx\@test\@empty%
  \begin{view}[id=#2.#3,ext=tex]{#4}{#5}\else%
  \begin{view}[id=#2.#3,#1,ext=tex]{#4}{#5}\fi%
  \ignorespacesandpars}
  {\end{view}\ignorespacesandparsafterend}
%    \end{macrocode}
% \end{environment}
% \end{omgroup}
% 
% \begin{omgroup}{Multilingual Statements and Terms}
%
% \begin{macro}{\mtref}
%   we first first define an auxiliary conditional |\@instring| that checks of |?| is in
%   the first argument.  |\mtrefi| uses it, if there is one, it just calls |\termref|,
%   otherwise it calls |\@mtrefi|, which assembles the |\termref| after splitting at the
%   |?|.
%    \begin{macrocode}
\def\@instring#1#2{TT\fi\begingroup\edef\x{\endgroup\noexpand\in@{#1}{#2}}\x\ifin@}
\def\@mtref#1?#2\relax{\@@mtref{#1}{#2}}
\newcommand\@@mtref[3]{\def\@@cd{#1}\def\@@name{#2}%
\ifx\@@cd\@empty%
\ifx\@@name\@empty\termref[]{#3}\else\termref[name=\@@name]{#3}\fi%
\else%
\ifx\@@name\@empty\termref[cd=\@@cd]{#3}\else\termref[cd=\@@cd,name=\@@name]{#3}\fi%
\fi}
\newcommand\mtref[2][]{\if\@instring{?}{#1}\@mtref #1\relax{#2}\else\termref[cd=#1]{#2}\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mtrefi*}
%    \begin{macrocode}
\newcommand\mtrefi[2][]{\if\@instring{?}{#1}\@mtref #1\relax{#2}%
\else\termref[cd=#1]{#2}\fi}
\newcommand\mtrefis[2][]{\mtrefi[#1]{#2s}}
\newcommand\Mtrefi[2][]{\if\@instring{?}{#1}\@mtref #1\relax{\capitalize{#2}}%
\else\termref[cd=#1]{\capitalize{#2}}\fi}
\newcommand\Mtrefis[2][]{\Mtrefi[#1]{#2s}}
\newcommand\mtrefii[3][]{\mtrefi[#1]{#2 #3}}
\newcommand\mtrefiis[3][]{\mtrefi[#1]{#2 #3s}}
\newcommand\Mtrefii[3][]{\Mtrefi[#1]{#2 #3a}}
\newcommand\Mtrefiis[3][]{\Mtrefi[#1]{#2 #3s}}
\newcommand\mtrefiii[4][]{\mtrefi[#1]{#2 #3 #4}}
\newcommand\Mtrefiiis[4][]{\Mtrefi[#1]{#2 #3 #4s}}
\newcommand\Mtrefiii[4][]{\Mtrefi[#1]{#2 #3 #4}}
\newcommand\mtrefiiis[4][]{\mtrefi[#1]{#2 #3 #4s}}
\newcommand\mtrefiv[5][]{\mtrefi[#1]{#2 #3 #4 #5}}
\newcommand\mtrefivs[5][]{\mtrefi[#1]{#2 #3 #4 #5s}}
\newcommand\Mtrefiv[5][]{\Mtrefi[#1]{#2 #3 #4 #5}}
\newcommand\Mtrefivs[5][]{\Mtrefi[#1]{#2 #3 #4 #5s}}
%    \end{macrocode}
% \end{macro}
% \end{omgroup}
% 
% \begin{omgroup}[id=impl:GFmeta]{GF Metadata}
%
% \begin{macro}{gfc}
%   We add the |gfc| key to various symbol declaration macros. 
%    \begin{macrocode}
\addmetakey{symi}{gfc}
\addmetakey{symdef}{gfc}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{gfa/l}
%    \begin{macrocode}
\addmetakey{definiendum}{gfa}
\addmetakey{definiendum}{gfl}
%    \end{macrocode}
% \end{macro}
% \end{omgroup}
% 
% \begin{omgroup}{Miscellaneneous}
%   the |\ttl| macro (to-translate) is used to mark untranslated stuff. We need a better
%   \latexml treatment of this eventually that is integrated with MathHub.info. 
% \begin{macro}{\ttl}
%    \begin{macrocode}
\newcommand\ttl[1]{\red{TTL: #1}}
%</sty>
%    \end{macrocode}
% \end{macro}
% \end{omgroup}
% \end{omgroup} 
% \Finale
% 
\endinput
% \iffalse
%%% Local Variables: 
%%% mode: doctex
%%% TeX-master: t
%%% End: 
% \fi

% LocalWords:  iffalse cls omdoc latexml texttt smlog.cls sref NeedsTeXFormat symi Deyan
% LocalWords:  maketitle newpage tableofcontents newpage omgroup ednote ltxml Ginev exfig
% LocalWords:  printbibliography showmeta metakeys amstext ginput newcommand smglom lmh
% LocalWords:  module-defs gimport renewcommand langbindings gle newenvironment symdef
% LocalWords:  doctex smultiling.dtx smultiling.sty GinIanJuc:spsttom16 verbalization gfc
%  LocalWords:  Kohlhase:dmesmgm14 symvariant fig:stex-monolingual fig:stex-multiling gfc
%  LocalWords:  vspace onefile modnl modnl symii symii symiii symiii symiv symiv atrefi
%  LocalWords:  user:GFmeta realization verbalizations trefi atrefiii mtref mtrefi atref
%  LocalWords:  mtrefii mtrefiii textbf viewsig viewsig loadfrom loadto viewnl viewnl gfa
%  LocalWords:  sproofs statements-ngerman.ldf gfl linearization defii datum,gfl keyval
%  LocalWords:  fic:stex-multiling fig:stex-multiling-babel usepackage usenglish,ngerman
%  LocalWords:  selectlanguage turkish,shorthands xelatex Jinbo newif smultiling-mh ifx
%  LocalWords:  etoolbox ignorespacesandpars ignorespacesandparsafterend 2,ext 1,ext ttl
%  LocalWords:  metasetkeys noindent addmetakey srccite tex,load 3,ext termref begingroup
%  LocalWords:  endgroup noexpand mtrefis mtrefiis Mtrefiiis mtrefiv mtrefivs impl:GFmeta
%  LocalWords:  Miscellaneneous sTeXlanguage sTeXlanguage expandafter gdef csname
%  LocalWords:  endcsname smultiling@language