summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/omtext/omtext.dtx
blob: 15fef2612a2da8e78f4a5ff14bd929a6624a4f47 (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
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
% \iffalse meta-comment
% A LaTeX Class and Package for OMDoc Text Fragments
% Copyright (c) 2010 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
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{omtext}[2016/04/07 v1.1 OMDoc Text Fragments]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{url,array,float,amsfonts}
\usepackage{omtext,omdoc}
\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\tracissue#1{\cite{sTeX:online}, \hyperlink{http://trac.kwarc.info/sTeX/ticket/#1}{issue #1}}
\begin{document}\DocInput{omtext.dtx}\end{document}
%</driver>
% \fi
% 
%\CheckSum{411}
% 
% \changes{v0.4}{2008/07/22}{added index markup}
% \changes{v0.4}{2008/09/29}{augmenting the index macros with optional values}
% \changes{v0.6}{2009/07/08}{removing {\texttt{ttin}} {\texttt{{emin}}} and friends, 
%   they were almost never used.}
% \changes{v0.6}{2009/07/08}{renmanig {\texttt{myindex}} to {\texttt{omdoc\@ index}},
%   {\texttt{twin}} to {\texttt{\@ twin}}, and {\texttt{atwin}} to {\texttt{\@ atwin}} to
%   make them packge-local} 
% \changes{v0.7}{2010/02/11}{changing blockquote to sblockquote and inlinequote similarly}
% \changes{v0.9}{2010/05/25}{separated out from \texttt{omdoc.dtx}}
% \changes{v1.0}{2010/06/18}{fixing typos}
% \changes{v1.1}{2015/10/13}{changing \texttt{\textbackslash textleadsto} to
% \texttt{\textbackslash ergo} and defining inverse \texttt{\textbackslash ogre}}
% \changes{v1.1}{2015/11/04}{moving MathHub support out to separate package}
% 
% \GetFileInfo{omtext.sty}
% 
% \MakeShortVerb{\|}
%
% \def\omdoc{OMDoc}
% \def\latexml{{\LaTeX}ML}
% \title{\texttt{omtext}: Semantic Markup for Mathematical Text Fragments in {\LaTeX}\thanks{Version {\fileversion} (last revised
%        {\filedate})}}
%    \author{Michael Kohlhase\\
%            Jacobs University, Bremen\\
%            \url{http://kwarc.info/kohlhase}}
% \maketitle
%
% \begin{abstract}
%   The |omtext| 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).
%
%   This package supplies an infrastructure for writing {\omdoc} text fragments in
%   {\LaTeX}.  
% \end{abstract}
%
%\newpage\tableofcontents\newpage
% 
%\begin{omgroup}[id=sec:STR]{Introduction}
%
%  The |omtext| package supplies macros and environment that allow to mark up mathematical
%  texts in {\sTeX}, 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
%  package supports direct translation to the {\omdoc} format~\cite{Kohlhase:OMDoc1.2}
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:user]{The User Interface}
% 
% \begin{omgroup}[id=sec:user:options]{Package Options}
% 
%   The |omtext| package takes a single option: \DescribeMacro{showmeta}|showmeta|. If
%   this is set, then the metadata keys are shown (see~\cite{Kohlhase:metakeys:ctan} for
%   details and customization options).
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:user:omtext]{Mathematical Text}
% 
%   The \DescribeEnv{omtext}|omtext| environment is used for any text fragment that has a
%   contribution to a text that needs to be marked up. It can have a title, which can be
%   specified via the \DescribeMacro{title=}|title| key. Often it is also helpful to
%   annotate the \DescribeMacro{type=}|type| key. The standard relations from rhetorical
%   structure theory |abstract|, |introduction|, |conclusion|, |thesis|, |comment|,
%   |antithesis|, |elaboration|, |motivation|, |evidence|, |transition|, | note|, |annote|
%   are recommended as values. Note that some of them are unary relations like
%   |introduction|, which calls for a target. In this case, a target using the
%   \DescribeMacro{for=}|for| key should be specified. The |transition| relation is
%   special in that it is binary (a ``transition between two statements''), so
%   additionally, a source should be specified using the \DescribeMacro{from=}|from| key.
% 
%   Note that the values of the |title| and |type| keys are often displayed in the
%   text. This can be turned off by setting the \DescribeMacro{display=}|display| key to
%   the value |flow|. Sometimes we want to specify that a text is a continuation of
%   another, this can be done by giving the identifier of this in the
%   \DescribeMacro{continues=}|continues| key.
%
%   Finally, there is a set of keys that pertain to the mathematical formulae in the
%   text. The \DescribeMacro{functions=}|functions| key allows to specify a list of
%   identifiers that are to be interpreted as functions in the generate content
%   markup. The \DescribeMacro{theory=}|theory| specifies a module
%   (see~\cite{KohAmb:smmssl:svn}) that is to be pre-loaded in this one\ednote{this is not
%   implemented yet.} Finally, \DescribeMacro{verbalizes=}|verbalizes| specifies a (more)
%   formal statement (see~\cite{Kohlhase:smms:svn}) that this text verbalizes or
%   paraphrases.\ednote{MK:specify the form of the reference.}
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:user:phrase]{Phrase-Level Markup}
%
%   \DescribeMacro{\phrase} The |phrase| macro allows to mark up phrases with semantic
%   information. It takes an optional |KeyVal| argument with the keys
%   \DescribeMacro{verbalizes=}|verbalizes| and \DescribeMacro{type=}|type| as above and
%   \DescribeMacro{style}|style,| \DescribeMacro{class}|class|,
%   \DescribeMacro{index}|index| that are disregarded in the {\LaTeX}, but copied into the
%   generated content markup.
% 
%   We use the \DescribeMacro{\nlex}|\nlex{|\meta{phrase}|}| for marking up phrases that
%   serve as natural language examples and \DescribeMacro{\nlcex}|\nlcex{|\meta{phrase}|}|
%   for counter-examples (utterances that are not acceptable for some reason). In natural
%   language examples, we sometimes use ``co-reference markers'' to specify the
%   resolution of anaphora and the like. We use the
%   \DescribeMacro{\coreft}|\coreft{|\meta{phrase}|}{|\meta{mark}|}| to mark up the
%   ``target'' of a co-reference and analogously \DescribeMacro{\corefs}|\corefs| for
%   coreference source -- e.g. for an anaphoric reference. The usage is the following:
%   \begin{verbatim}
%   \nlex{If \coreft{a farmer}1 owns \coreft{a donkey}2, 
%            \corefs{he}2 beats \corefs{it}2.}
%   \end{verbatim}
%   is formatted to 
%   \begin{quote}
%     \nlex{If \coreft{a farmer}1 owns \coreft{a donkey}2, \corefs{he}2 beats \corefs{it}2.}
%   \end{quote}
%   
%   \DescribeMacro{\sinlinequote} The |sinlinequote| macro allows to mark up quotes inline
%   and attribute them. The quote itself is given as the argument, possibly preceded by
%   the a specification of the source in a an optional argument. For instance, we would
%   quote Hamlet with
% \begin{verbatim}
% \sinlinequote[Hamlet, \cite{Shak:1603:Hamlet}]{To be or not to be}
% \end{verbatim}
%   which would appear as \sinlinequote[Hamlet, (Shakespeare 1603)]{To be or not to be} in
%   the text. The style in which inline quotations appear in the text can be adapted by
%   specializing the macros \DescribeMacro{\@sinlinequote}|\@sinlinequote| --- for
%   quotations without source and \DescribeMacro{\@@sinlinequote}|\@@sinlinequote| --- for
%   quotations with source.
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:user:decl]{Declarations (under development)}
%
%   Declarations are special phrases that carry a lot of meaning in mathematics: they
%   introduce and further specify the indentifiers available in formulae.  They are marked
%   up via the \DescribeMacro{\vdec}|\vdec| macro. Inside a declaration we can use the
%   \DescribeMacro{\vids}|\vids| macro to mark up the variable names and
%   \DescribeMacro{\vrest}|\vrest| to mark up the restrictions. In the simplest case we
%   have a single variable as in ``\ldots for all $u$'', which we mark up as.
% \begin{verbatim}
% ... for all \vdec{\vids[u]{$u$}}. 
% \end{verbatim}
%   A more complex example has multiple identifiers embedded in a restriction, as in ``Let
%   $x,y,z\in\mathbb{R}$, such that $x+2y=z$, then \ldots'', which we mark up as
% \begin{verbatim}
% Let \vdec{\vids[x,y,z]{$\minset{x,y,z}\Reals$}, 
%    such that \vrest{$x+2y=z$}}, then \ldots''
% \end{verbatim}
%   \ednote{explain and make better examples}\ednote{unify this with the vardef macros
%   from (currently) the modules package.}\ednote{talk with Frederic about this see what
%   other examples there are.}\ednote{how do we identify the variables in complex
%   restriction patterns. maybe with LMXref, which we should reinstate for this.}
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:user:block]{Block-Level Markup}
%
%   \DescribeEnv{sblockquote} The |sblockquote| environment is the big brother of the
%   |\sinlinequote| macro. It also takes an optional argument to specify the source. Here
%   the four internal macros \DescribeMacro{\begin@sblockquote}|\begin@sblockquote| to
%       \DescribeMacro{\end@@sblockquote}|\end@@sblockquote| are used for styling and can be
%   adapted by package integrators. Here a quote of Hamlet would marked up as
% \begin{verbatim}
% \begin{sblockquote}[Hamlet, \cite{Shak:1603:Hamlet}]\obeylines
%   To be, or not to be: that is the question:
%   Whether 'tis nobler in the mind to suffer
% \end{sblockquote}
% \end{verbatim}
% and would render as 
% \begin{sblockquote}[Hamlet, (Shakespeare 1603)]\obeylines
%   To be, or not to be: that is the question:
%   Whether 'tis nobler in the mind to suffer
% \end{sblockquote}
% 
% \DescribeMacro{\lec}The |\lec| macro takes one argument and sets it as a comment at the
% end of the line, making sure that if the content is too long it is pushed into a new
% line. We use it internally for placing the of source of the |sblockquote| environment
% above.  The actual appearance of the line end comment is determined by the
% \DescribeMacro{\@@lec}|\@@lec| macro, which can be customized in the document class.
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:user:index]{Index Markup}
%
%   The |omtext| package provides some extensions for the well-known indexing macros of
%   {\LaTeX}. The main reason for introducing these macros is that index markup in
%   {\omdoc} wraps the indexed terms rather than just marking the spot for
%   cross-referencing. Furthermore the index commands only indexes words unless
%   the\DescribeMacro{noindex} |noindex| option is set in the |\usepackage|. The |omtext|
%   package and class make the usual |\index| macro undefined\ednote{implement this and
%     issue the respective error message}.
% 
%   The \DescribeMacro{\indextoo}|\indextoo| macro renders a word and marks it for the
%   index. Sometimes, we want to index a slightly different form of the word, e.g. for
%   non-standard plurals: while |\indextoo{word}s| works fine, we cannot use this for the
%   word ``datum'', which has the plural ``data''. For this we have the macro
%   \DescribeMacro{\indexalt}|\indexalt|, which takes another argument for the displayed
%   text, allowing us to use |\indexalt{data}{datum}|, which prints ``data'' but puts
%   ``datum'' into the index.
% 
%   The second set of macros adds an infrastructure for two-word compounds. Take for
%   instance the compound ``OMDoc document'', which we usually want to add into the index
%   under ``OMDoc'' and ``document''. \DescribeMacro{\twintoo}|\twintoo{OMDoc}{document}|
%   is a variant of |\indextoo| that will do just this. Again, we have a version that
%   prints a variant: This is useful for situations like this the one in
%   Figure~\ref{fig:index-markup}:
% \begin{exfig}
% \begin{verbatim}
% We call group \twinalt{Abelian}{Abelian}{group}, iff \ldots
% \end{verbatim}
% \vspace*{-1em}will result in the following
% \begin{quote}
%   We call group \twinalt{Abelian}{Abelian}{group}, iff \ldots
% \end{quote}
% and put ``Abelian Group'' into the index.
% \caption{Index markup}\label{fig:index-markup}
% \end{exfig}
% 
% The third set of macros does the same for two-word compounds with adjectives,
% e.g. ``wonderful OMDoc
% document''. \DescribeMacro{\atwintoo}|\atwin{wonderful}{OMdoc}{document}| will make the
% necessary index entries under ``wonderful'' and ``document''. Again, we have a variant
% \DescribeMacro{\atwinalt}|\atwinalt| whose first argument is the alternative text.
%
% All index macros take an optional first argument that is used for ordering the
% respective entries in the index.
% \end{omgroup}
%
% \end{omgroup}
% 
% \begin{omgroup}{Limitations}\label{sec:limitations}
% 
% In this section we document known limitations. If you want to help alleviate them,
% please feel free to contact the package author. Some of them are currently discussed in
% the \sTeX GitHub repository~\cite{sTeX:github:on}. 
% \begin{compactenum}
% \item none reported yet
% \end{compactenum}
% \end{omgroup}
% 
% \StopEventually{\newpage\PrintIndex\newpage\PrintChanges\printbibliography}\newpage
%
% \begin{omgroup}[id=sec:impl]{Implementation}
%
% \begin{omgroup}[id=sec:impl:options]{Package Options}
% 
% We declare some switches which will modify the behavior according to the package
% options. Generally, an option |xxx| will just set the appropriate switches to true
% (otherwise they stay false).\ednote{need an implementation for {\latexml}}
%
%    \begin{macrocode}
%<*package>
\newif\if@omtext@mh@\@omtext@mh@false
\DeclareOption{mh}{\@omtext@mh@true
\PassOptionsToPackage{\CurrentOption}{modules}}
\newif\ifindex\indextrue
\DeclareOption{noindex}{\indexfalse}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{modules}}
\ProcessOptions
\ifindex\makeindex\fi
%    \end{macrocode}
%
%    \begin{macrocode}
\if@omtext@mh@\RequirePackage{omtext-mh}\fi
\RequirePackage{xspace}
\RequirePackage{modules}
\RequirePackage{comment}
\RequirePackage{mdframed}
\RequirePackage{latexsym}
%    \end{macrocode}
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:impl:mtxt]{Mathematical Text}
%
%   We define the actions that are undertaken, when the keys are encountered. The first
%   set just records metadata; this is very simple via the |\addmetakey|
%   infrastructure~\ctancite{Kohlhase:metakeys}. Note that we allow math in the |title|
%   field, so we do not declare it to be |Semiverbatim| (indeed not at all, which allows
%   it by default).
%
%    \begin{macrocode}
\srefaddidkey{omtext}
\addmetakey[]{omtext}{functions}
\addmetakey*{omtext}{display}
\addmetakey{omtext}{for}
\addmetakey{omtext}{from}
\addmetakey{omtext}{type}
\addmetakey*{omtext}{title}
\addmetakey*{omtext}{start}
\addmetakey{omtext}{theory}
\addmetakey{omtext}{continues}
\addmetakey{omtext}{verbalizes}
\addmetakey{omtext}{subject}
%    \end{macrocode}
% The next keys handle module loading (see~\ctancite{KohAmb:smmssl}). 
%    \begin{macrocode}
% \ednote{MK: need to implement these in LaTeXML, I wonder whether there is a general
% mechanism like numberit.}\ednote{MK: this needs to be rethought in the light of
% |\usemodule|. It is probably obsolete. Is this used? Is this documented?}
\define@key{omtext}{require}{\requiremodules{#1}{sms}}
\define@key{omtext}{module}{\message{module: #1}\importmodule{#1}\def\omtext@theory{#1}}
%    \end{macrocode}
%
% \begin{macro}{\st@flow}
% We define this macro, so that we can test whether the |display| key has the value |flow|
%    \begin{macrocode}
\def\st@flow{flow}
%    \end{macrocode}
% \end{macro}
%
% We define a switch that allows us to see whether we are inside an |omtext| environment
% or a statement. It will be used to give better error messages for inline statements.
%
%    \begin{macrocode}
\newif\if@in@omtext\@in@omtextfalse
%    \end{macrocode}
%
% \begin{environment}{omtext}
%   The |omtext| environment is different, it does not have a keyword that marks
%   it. Instead, it can have a title, which is used in a similar way. We redefine the
%   |\lec| macro so the trailing |\par| does not get into the way.
%    \begin{macrocode}
\def\omtext@pre@skip{\smallskip}
\def\omtext@post@skip{}
\providecommand{\stDMemph}[1]{\textbf{#1}}
\newenvironment{omtext}[1][]{\@in@omtexttrue%
\bgroup\metasetkeys{omtext}{#1}\sref@label@id{this paragraph}%
\def\lec##1{\@lec{##1}}%
\ifx\omtext@display\st@flow\else\omtext@pre@skip\par\noindent%
\ifx\omtext@title\@empty%
\ifx\omtext@start\@empty\else\stDMemph{\omtext@start}\xspace\fi%
\else\stDMemph{\omtext@title}:\xspace%
\ifx\omtext@start\@empty\else\omtext@start\xspace\fi%
\fi% omtext@title empty
\fi% omtext@display=flow
\ignorespaces}
{\egroup\omtext@post@skip\@in@omtextfalse}
%    \end{macrocode}
% \end{environment}
% \end{omgroup}
%
% \begin{omgroup}[id=sec:impl:phrase]{Phrase-level Markup}
% 
% \begin{macro}{\phrase}
%    For the moment, we do disregard the most of the keys
%    \begin{macrocode}
\srefaddidkey{phrase}
\addmetakey{phrase}{style}
\addmetakey{phrase}{class}
\addmetakey{phrase}{index}
\addmetakey{phrase}{verbalizes}
\addmetakey{phrase}{type}
\addmetakey{phrase}{only}
\newcommand\phrase[2][]{\metasetkeys{phrase}{#1}%
\ifx\prhase@only\@empty\only<\phrase@only>{#2}\else #2\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\coref*}
%    \begin{macrocode}
\providecommand\textsubscript[1]{\ensuremath{_{#1}}}
\newcommand\corefs[2]{#1\textsubscript{#2}}
\newcommand\coreft[2]{#1\textsuperscript{#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\n*lex}
%    \begin{macrocode}
\newcommand\nlex[1]{\green{\sl{#1}}}
\newcommand\nlcex[1]{*\green{\sl{#1}}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{sinlinequote}
%    \begin{macrocode}
\def\@sinlinequote#1{``{\sl{#1}}''}
\def\@@sinlinequote#1#2{\@sinlinequote{#2}~#1}
\newcommand\sinlinequote[2][]
{\def\@opt{#1}\ifx\@opt\@empty\@sinlinequote{#2}\else\@@sinlinequote\@opt{#2}\fi}
%    \end{macrocode}
% \end{macro}
% \end{omgroup}
%
% \begin{omgroup}[id=sec:user:decl]{Declarations (under development)}
% 
%   The declaration macros are still under development (i.e. the macros) are still under
%   development and may change at any time. Currently they are completely empty.
% 
% \begin{macrocode}
\newcommand\vdec[1]{#1}
\newcommand\vids[2][]{#2}
\newcommand\vrest[2][]{#2}
%    \end{macrocode}
% \end{omgroup}
%
% \begin{omgroup}[id=sec:impl:block]{Block-Level Markup}
%
% \begin{environment}{sblockquote}
%    \begin{macrocode}
\def\begin@sblockquote{\begin{quote}\sl}
\def\end@sblockquote{\end{quote}}
\def\begin@@sblockquote#1{\begin@sblockquote}
\def\end@@sblockquote#1{\def\@@lec##1{{\rm ##1}}\@lec{#1}\end@sblockquote}
\newenvironment{sblockquote}[1][]
  {\def\@opt{#1}\ifx\@opt\@empty\begin@sblockquote\else\begin@@sblockquote\@opt\fi}
  {\ifx\@opt\@empty\end@sblockquote\else\end@@sblockquote\@opt\fi}
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{sboxquote}
%    \begin{macrocode}
\newenvironment{sboxquote}[1][]
{\def\@@src{#1}\begin{mdframed}[leftmargin=.5cm,rightmargin=.5cm]}
{\@lec{\rm\@@src}\end{mdframed}}
%    \end{macrocode}
% \end{environment}
% 
% The line end comment macro makes sure that it will not be forced on the next line unless
% necessary.
% \begin{macro}{\lec}
%   The actual appearance of the line end comment is determined by the |\@@lec| macro,
%   which can be customized in the document class. The basic one here is provided so that
%   it is not missing.
%    \begin{macrocode}
\providecommand{\@@lec}[1]{(#1)}
\def\@lec#1{\strut\hfil\strut\null\nobreak\hfill\@@lec{#1}}
\def\lec#1{\@lec{#1}\par}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\my*graphics}
%   We set up a special treatment for including graphics to respect the intended {\omdoc}
%   document structure. The main work is done in the transformation stylesheet though.
%    \begin{macrocode}
\newcommand\mygraphics[2][]{\includegraphics[#1]{#2}}
\newcommand\mycgraphics[2][]{\begin{center}\mygraphics[#1]{#2}\end{center}}
\newcommand\mybgraphics[2][]{\fbox{\mygraphics[#1]{#2}}}
\newcommand\mycbgraphics[2][]{\begin{center}\fbox{\mygraphics[#1]{#2}}\end{center}}
%    \end{macrocode}
% \end{macro}
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:impl:index]{Index Markup}
% \begin{macro}{\omdoc@index*}
%   these are the main internal indexing commands -- dividing them into three is awful,
%   but I did not get list processing running. It makes sure that the modules necessary
%   for interpreting the math in the index entries are loaded. If the |loadmodules| key is
%   given, we import the module we are in otherwise all the currently imported modules. We
%   do not have to require the module files, since the index is a the end of the
%   document. If the |at| key is given, then we use that for sorting in the index.
%    \begin{macrocode}
\addmetakey{omdoc@index}{at}
\addmetakey[false]{omdoc@index}{loadmodules}[true]
\newcommand\omdoc@indexi[2][]{\ifindex%
\metasetkeys{omdoc@index}{#1}%
\@bsphack\begingroup\@sanitize%
\protected@write\@indexfile{}{\string\indexentry%
{\ifx\omdoc@index@at\@empty\else\omdoc@index@at @\fi%
\ifx\omdoc@index@loadmodules\@true%
\string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#2}%
\else #2\fi% loadmodules 
}{\thepage}}%
\endgroup\@esphack\fi}%ifindex
\newcommand\omdoc@indexii[3][]{\ifindex%
\metasetkeys{omdoc@index}{#1}%
\@bsphack\begingroup\@sanitize%
\protected@write\@indexfile{}{\string\indexentry%
{\ifx\omdoc@index@at\@empty\else\omdoc@index@at @\fi%
\ifx\omdoc@index@loadmodules\@true%
\string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#2}!%
\string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#3}%
\else #2!#3\fi% loadmodules 
}{\thepage}}%
\endgroup\@esphack\fi}%ifindex
\newcommand\omdoc@indexiii[4][]{\ifindex%
\metasetkeys{omdoc@index}{#1}%
\@bsphack\begingroup\@sanitize%
\protected@write\@indexfile{}{\string\indexentry%
{\ifx\omdoc@index@at\@empty\else\omdoc@index@at @\fi%
\ifx\omdoc@index@loadmodules\@true%
\string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#2}!%
\string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#3}!%
\string\withusedmodules{\@ifundefined{mod@id}\used@modules\mod@id}{#4}%
\else #2!#3\fi% loadmodules 
}{\thepage}}%
\endgroup\@esphack\fi}%ifindex
%    \end{macrocode}
% \end{macro}
% 
% Now, we make two interface macros that make use of this: 
%
% \begin{macro}{\indexalt}
%    \begin{macrocode}
\newcommand\indexalt[3][]{{#2}\omdoc@indexi[#1]{#3}}               % word in text and index
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\indextoo}
%    \begin{macrocode}
\newcommand\indextoo[2][]{{#2}\omdoc@indexi[#1]{#2}}               % word in text and index
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@twin}
% this puts two-compound words into the index in various permutations
%    \begin{macrocode}
\newcommand\@twin[3][]{\omdoc@indexii[#1]{#2}{#3}\omdoc@indexii[#1]{#3}{#2}}
%    \end{macrocode}
% \end{macro}
%
% And again we have two interface macros building on this 
%
% \begin{macro}{\twinalt}
%    \begin{macrocode}
\newcommand\twinalt[4][]{#2\@twin[#1]{#3}{#4}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\twinalt}
%    \begin{macrocode}
\newcommand\twintoo[3][]{{#2 #3}\@twin[#1]{#2}{#3}} % and use the word compound too
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\@atwin}
%   this puts adjectivized two-compound words into the index in various
%   permutations\ednote{what to do with the optional argument here and below?}
%    \begin{macrocode}
\newcommand\@atwin[4][]{\omdoc@indexiii[#1]{#2}{#3}{#4}\omdoc@indexii[#1]{#3}{#2 (#4)}}
%    \end{macrocode}
% \end{macro}
% 
% and the two interface macros for this case: 
% \begin{macro}{\@atwinalt}
%    \begin{macrocode}
\newcommand\atwinalt[5][]{#2\@atwin[#1]{#3}{#4}{#4}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\atwintoo}
%    \begin{macrocode}
\newcommand\atwintoo[4][]{{#2 #3 #4}\@atwin[#1]{#2}{#3}{#4}}         % and use it too
%    \end{macrocode}
% \end{macro}
% \end{omgroup}
% 
% \begin{omgroup}[id=sec:impl:misc]{Miscellaneous}
%   Some shortcuts that use math symbols but are not mathematical at all; in particular,
%   they should not be translated by {\latexml}.
%    \begin{macrocode}
\newcommand\hateq{\ensuremath{\hat=}\xspace}
\newcommand\hatequiv{\ensuremath{\hat\equiv}\xspace}
\@ifundefined{ergo}%
{\newcommand\ergo{\ensuremath{\leadsto}\xspace}}%
{\renewcommand\ergo{\ensuremath{\leadsto}\xspace}}%
\newcommand{\reflect@squig}[2]{\reflectbox{$\m@th#1\rightsquigarrow$}}%
\newcommand\ogre{\ensuremath{\mathrel{\mathpalette\reflect@squig\relax}}\xspace}%
%</package>
%    \end{macrocode}
%
% \end{omgroup}
%\end{omgroup}
% \Finale
\endinput
% \iffalse
%%% Local Variables: 
%%% mode: doctex
%%% TeX-master: t
%%% End: 
% \fi
% LocalWords:  GPL structuresharing STR omdoc dtx stex CPERL LoadClass url dc filedate sl 
% LocalWords:  RequirePackage RegisterNamespace namespace xsl DocType ltxml dtd annote mh
% LocalWords:  ltx DefEnvironment beforeDigest AssignValue inPreamble getGullet indexalt
% LocalWords:  afterDigest keyval omgroup DefKeyVal Semiverbatim KeyVal regexp indexalt
% LocalWords:  OptionalKeyVals DefParameterType IfBeginFollows skipSpaces CMP rangle rel
% LocalWords:  ifNext DefMacro needwrapper unlist DefConstructor omtext bgroup rangle baz
% LocalWords:  useCMPItemizations RefStepItemCounter egroup beginItemize li di makeindex
% LocalWords:  beforeDigestEnd dt autoclose ul ol dl env showignores srcref def st@flow
% LocalWords:  afterOpen LastSeenCMP autoClose DefCMPEnvironment proto ToString KeyVals
% LocalWords:  addAttribute nlex nlcex omdocColorMacro args tok MergeFont qw rm XPointer
% LocalWords:  TokenizeInternal toString isMath foreach maybeCloseElement id'd endinput
% LocalWords:  autoOpen minipage footnotesize scriptsize numberIt whatsit href HorIacJuc
% LocalWords:  getAttribute setAttribute OMDoc RelaxNGSchema noindex xml lec sc cscpnrr11
% LocalWords:  Subsubsection useDefaultItemizations refundefinedtrue sblockquote foobar
% LocalWords:  DefCMPConstructor sinlinequote idx idt ide idp emph  extrefs sref mhrepos
% LocalWords:  flushleft flushright DeclareOption PassOptions undef cls iffalse mathhub
% LocalWords:  ProcessOptions subparagraph ignoresfalse ignorestrue raisebox tr finalpath
% LocalWords:  texorpdfstring latexml texttt fileversion maketitle newpage iff mh-variant
% LocalWords:  tableofcontents newpage ednote obeylines usepackage indextoo Cwd coreft
% LocalWords:  indextoo twintoo twintoo exfig vspace twinalt ldots ttin emin importmodule
% LocalWords:  renmanig myindex atwin atwin packge-local blockquote inlinequote coreft
% LocalWords:  atwintoo atwinalt atwinalt printbibliography impl cwd newif ifx mhgraphics
% LocalWords:  ifindex indextrue indexfalse srefaddidkey smallskip showmeta importmodules
% LocalWords:  providecommand stDMemph textbf newenvironment hfil showmeta NeedsTeXFormat
% LocalWords:  noindent ignorespaces newcommand nobreak hfill hbox mygraphics mhcgraphics
% LocalWords:  includegraphics mycgraphics mybgraphics fbox adjectivized hspace corefs
% LocalWords:  printindex jobname.ind jobname.ind omspace footnotemark thead mhcgraphics
% LocalWords:  footnotetext findnodes doctex textsf langle textsf langle funval corefs
% LocalWords:  metakeys funsymbs addmetakey metasetkeys startemph textsl textit mdframed
% LocalWords:  compactenum ifundefined localname localname xspace ctancite mhcurrentrepos
% LocalWords:  KohAmb smmssl requiremodules prhase bsphack begingroup thepage mh-variants
% LocalWords:  indexentry endgroup esphack SOURCEFILE baselocal BASELOCAL importmhmodule
% LocalWords:  mh@currentrepos mhbgraphics co-rerefence usemodule coref textsubscript
% LocalWords:  ensuremath textsuperscript sboxquote leftmargin rightmargin mycbgraphics
% LocalWords:  mhcbgraphics textleadsto customization specializing customized behavior
% LocalWords:  flexiformal latexsym itemize loadmodules recognize hateq hatequiv equiv
% LocalWords:  leadsto renewcommand reflect@squig reflectbox m@th rightsquigarrow
% LocalWords:  mathrel mathpalette
% \endinput
% Local Variables:
% mode: doctex
% TeX-master: t
% End: