1LaTeXML::Package(3)   User Contributed Perl Documentation  LaTeXML::Package(3)
2
3
4

NAME

6       "LaTeXML::Package" - Support for package implementations and document
7       customization.
8

SYNOPSIS

10       This package defines and exports most of the procedures users will need
11       to customize or extend LaTeXML. The LaTeXML implementation of some
12       package might look something like the following, but see the installed
13       "LaTeXML/Package" directory for realistic examples.
14
15         package LaTeXML::Package::pool;  # to put new subs & variables in common pool
16         use LaTeXML::Package;            # to load these definitions
17         use strict;                      # good style
18         use warnings;
19         #
20         # Load "anotherpackage"
21         RequirePackage('anotherpackage');
22         #
23         # A simple macro, just like in TeX
24         DefMacro('\thesection', '\thechapter.\roman{section}');
25         #
26         # A constructor defines how a control sequence generates XML:
27         DefConstructor('\thanks{}', "<ltx:thanks>#1</ltx:thanks>");
28         #
29         # And a simple environment ...
30         DefEnvironment('{abstract}','<abstract>#body</abstract>');
31         #
32         # A math  symbol \Real to stand for the Reals:
33         DefMath('\Real', "\x{211D}", role=>'ID');
34         #
35         # Or a semantic floor:
36         DefMath('\floor{}','\left\lfloor#1\right\rfloor');
37         #
38         # More esoteric ...
39         # Use a RelaxNG schema
40         RelaxNGSchema("MySchema");
41         # Or use a special DocType if you have to:
42         # DocType("rootelement",
43         #         "-//Your Site//Your DocType",'your.dtd',
44         #          prefix=>"http://whatever/");
45         #
46         # Allow sometag elements to be automatically closed if needed
47         Tag('prefix:sometag', autoClose=>1);
48         #
49         # Don't forget this, so perl knows the package loaded.
50         1;
51

DESCRIPTION

53       This module provides a large set of utilities and declarations that are
54       useful for writing `bindings': LaTeXML-specific implementations of a
55       set of control sequences such as would be defined in a LaTeX style or
56       class file. They are also useful for controlling and customization of
57       LaTeXML's processing.  See the "See also" section, below, for
58       additional lower-level modules imported & re-exported.
59
60       To a limited extent (and currently only when explicitly enabled),
61       LaTeXML can process the raw TeX code found in style files.  However, to
62       preserve document structure and semantics, as well as for efficiency,
63       it is usually necessary to supply a LaTeXML-specific `binding' for
64       style and class files. For example, a binding "mypackage.sty.ltxml"
65       would encode LaTeXML-specific implementations of all the control
66       sequences in "mypackage.sty" so that "\usepackage{mypackage}" would
67       work.  Similarly for "myclass.cls.ltxml".  Additionally, document-
68       specific bindings can be supplied: before processing a TeX source file,
69       eg "mydoc.tex", LaTeXML will automatically include the definitions and
70       settings in "mydoc.latexml".  These ".ltxml" and ".latexml" files
71       should be placed LaTeXML's searchpaths, where will find them: either in
72       the current directory or in a directory given to the --path option, or
73       possibly added to the variable SEARCHPATHS).
74
75       Since LaTeXML mimics TeX, a familiarity with TeX's processing model is
76       critical.  LaTeXML models: catcodes and tokens (See
77       LaTeXML::Core::Token,  LaTeXML::Core::Tokens) which are extracted from
78       the plain source text characters by the LaTeXML::Core::Mouth; "Macros",
79       which are expanded within the LaTeXML::Core::Gullet; and "Primitives",
80       which are digested within the LaTeXML::Core::Stomach to produce
81       LaTeXML::Core::Box, LaTeXML::Core::List.  A key additional feature is
82       the "Constructors": when digested they generate a
83       LaTeXML::Core::Whatsit which, upon absorbtion by
84       LaTeXML::Core::Document, inserts text or XML fragments in the final
85       document tree.
86
87       Notation: Many of the following forms take code references as arguments
88       or options.  That is, either a reference to a defined sub, eg.
89       "\&somesub", or an anonymous function "sub { ... }".  To document these
90       cases, and the arguments that are passed in each case, we'll use a
91       notation like "code($stomach,...)".
92
93   Control Sequences
94       Many of the following forms define the behaviour of control sequences.
95       While in TeX you'll typically only define macros, LaTeXML is
96       effectively redefining TeX itself, so we define "Macros" as well as
97       "Primitives", "Registers", "Constructors" and "Environments".  These
98       define the behaviour of these control sequences when processed during
99       the various phases of LaTeX's imitation of TeX's digestive tract.
100
101       Prototypes
102
103       LaTeXML uses a more convienient method of specifying parameter patterns
104       for control sequences. The first argument to each of these defining
105       forms ("DefMacro", "DefPrimive", etc) is a prototype consisting of the
106       control sequence being defined along with the specification of
107       parameters required by the control sequence.  Each parameter describes
108       how to parse tokens following the control sequence into arguments or
109       how to delimit them.  To simplify coding and capture common idioms in
110       TeX/LaTeX programming, latexml's parameter specifications are more
111       expressive than TeX's  "\def" or LaTeX's "\newcommand".  Examples of
112       the prototypes for familiar TeX or LaTeX control sequences are:
113
114          DefConstructor('\usepackage[]{}',...
115          DefPrimitive('\multiply Variable SkipKeyword:by Number',..
116          DefPrimitive('\newcommand OptionalMatch:* DefToken[]{}', ...
117
118       The general syntax for parameter specification is
119
120       "{spec}"
121           reads a regular TeX argument.  spec can be omitted (ie. "{}").
122           Otherwise spec is itself a parameter specification and the argument
123           is reparsed to accordingly.  ("{}" is a shorthand for "Plain".)
124
125       "[spec]"
126           reads an LaTeX-style optional argument.  spec can be omitted (ie.
127           "{}").  Otherwise, if spec is of the form Default:stuff, then stuff
128           would be the default value.  Otherwise spec is itself a parameter
129           specification and the argument, if supplied, is reparsed according
130           to that specification.  ("[]" is a shorthand for "Optional".)
131
132       Type
133           Reads an argument of the given type, where either Type has been
134           declared, or there exists a ReadType function accessible from
135           LaTeXML::Package::Pool.  See the available types, below.
136
137       "Type:value | Type:value1:value2..."
138           These forms invoke the parser for Type but pass additional Tokens
139           to the reader function.  Typically this would supply defaults or
140           parameters to a match.
141
142       "OptionalType"
143           Similar to Type, but it is not considered an error if the reader
144           returns undef.
145
146       "SkipType"
147           Similar to "Optional"Type, but the value returned from the reader
148           is ignored, and does not occupy a position in the arguments list.
149
150       The predefined argument Types are as follows.
151
152       "Plain, Semiverbatim"
153
154           Reads a standard TeX argument being either the next token, or if
155           the next token is an {, the balanced token list.  In the case of
156           "Semiverbatim", many catcodes are disabled, which is handy for
157           URL's, labels and similar.
158
159       "Token, XToken"
160
161           Read a single TeX Token.  For "XToken", if the next token is
162           expandable, it is repeatedly expanded until an unexpandable token
163           remains, which is returned.
164
165       "Number, Dimension, Glue | MuGlue"
166
167           Read an Object corresponding to Number, Dimension, Glue or MuGlue,
168           using TeX's rules for parsing these objects.
169
170       "Until:match | XUntil:"match>
171
172           Reads tokens until a match to the tokens match is found, returning
173           the tokens preceding the match. This corresponds to TeX delimited
174           arguments.  For "XUntil", tokens are expanded as they are matched
175           and accumulated.
176
177       "UntilBrace"
178
179           Reads tokens until the next open brace "{".  This corresponds to
180           the peculiar TeX construct "\def\foo#{...".
181
182       "Match:match(|match)* | Keyword:"match(|match)*>
183
184           Reads tokens expecting a match to one of the token lists match,
185           returning the one that matches, or undef.  For "Keyword", case and
186           catcode of the matches are ignored.  Additionally, any leading
187           spaces are skipped.
188
189       "Balanced"
190
191           Read tokens until a closing }, but respecting nested {} pairs.
192
193       "BalancedParen"
194
195           Read a parenthesis delimited tokens, but does not balance any
196           nested parentheses.
197
198       "Undigested, Digested, DigestUntil:match"
199
200           These types alter the usual sequence of tokenization and digestion
201           in separate stages (like TeX).  A "Undigested" parameter inhibits
202           digestion completely and remains in token form.  A "Digested"
203           parameter gets digested until the (required) opening { is balanced;
204           this is useful when the content would usually need to have been
205           protected in order to correctly deal with catcodes.  "DigestUntil"
206           digests tokens until a token matching match is found.
207
208       "Variable"
209
210           Reads a token, expanding if necessary, and expects a control
211           sequence naming a writable register.  If such is found, it returns
212           an array of the corresponding definition object, and any arguments
213           required by that definition.
214
215       "SkipSpaces, Skip1Space"
216
217           Skips one, or any number of, space tokens, if present, but
218           contributes nothing to the argument list.
219
220       Common Options
221
222       "scope=>'local' | 'global' | scope"
223           Most defining commands accept an option to control how the
224           definition is stored, for global or local definitions, or using a
225           named scope A named scope saves a set of definitions and values
226           that can be activated at a later time.
227
228           Particularly interesting forms of scope are those that get
229           automatically activated upon changes of counter and label.  For
230           example, definitions that have "scope=>'section:1.1'"  will be
231           activated when the section number is "1.1", and will be deactivated
232           when that section ends.
233
234       "locked=>boolean"
235           This option controls whether this definition is locked from further
236           changes in the TeX sources; this keeps local 'customizations' by an
237           author from overriding important LaTeXML definitions and breaking
238           the conversion.
239
240       Macros
241
242       "DefMacro(prototype, expansion, %options);"
243
244           Defines the macro expansion for prototype; a macro control sequence
245           that is expanded during macro expansion time in the
246           LaTeXML::Core::Gullet.  The expansion should be one of tokens |
247           string | code($gullet,@args)>: a string will be tokenized upon
248           first usage.  Any macro arguments will be substituted for parameter
249           indicators (eg #1) in the tokens or tokenized string and the result
250           is used as the expansion of the control sequence. If code is used,
251           it is called at expansion time and should return a list of tokens
252           as its result.
253
254           DefMacro options are
255
256           "scope=>scope",
257           "locked=>boolean"
258               See "Common Options".
259
260           "mathactive=>boolean"
261               specifies a definition that will only be expanded in math mode;
262               the control sequence must be a single character.
263
264           Examples:
265
266             DefMacro('\thefootnote','\arabic{footnote}');
267             DefMacro('\today',sub { ExplodeText(today()); });
268
269       "DefMacroI(cs, paramlist, expansion, %options);"
270
271           Internal form of "DefMacro" where the control sequence and
272           parameter list have already been separated; useful for definitions
273           from within code.  Also, slightly more efficient for macros with no
274           arguments (use "undef" for paramlist), and useful for obscure cases
275           like defining "\begin{something*}" as a Macro.
276
277       Conditionals
278
279       "DefConditional(prototype, test, %options);"
280
281           Defines a conditional for prototype; a control sequence that is
282           processed during macro expansion time (in the
283           LaTeXML::Core::Gullet).  A conditional corresponds to a TeX "\if".
284           If the test is "undef", a "\newif" type of conditional is defined,
285           which is controlled with control sequences like "\footrue" and
286           "\foofalse".  Otherwise the test should be "code($gullet,@args)"
287           (with the control sequence's arguments) that is called at expand
288           time to determine the condition.  Depending on whether the result
289           of that evaluation returns a true or false value (in the usual Perl
290           sense), the result of the expansion is either the first or else
291           code following, in the usual TeX sense.
292
293           DefConditional options are
294
295           "scope=>scope",
296           "locked=>boolean"
297               See "Common Options".
298
299           "skipper=>code($gullet)"
300               This option is only used to define "\ifcase".
301
302           Example:
303
304             DefConditional('\ifmmode',sub {
305                LookupValue('IN_MATH'); });
306
307       "DefConditionalI(cs, paramlist, test, %options);"
308
309           Internal form of "DefConditional" where the control sequence and
310           parameter list have already been parsed; useful for definitions
311           from within code.  Also, slightly more efficient for conditinal
312           with no arguments (use "undef" for "paramlist").
313
314       "IfCondition($ifcs,@args)"
315
316           "IfCondition" allows you to test a conditional from within perl.
317           Thus something like "if(IfCondition('\ifmmode')){ domath } else {
318           dotext }" might be equivalent to TeX's "\ifmmode domath \else
319           dotext \fi".
320
321       Primitives
322
323       "DefPrimitive(prototype, replacement, %options);"
324
325           Defines a primitive control sequence; a primitive is processed
326           during digestion (in the  LaTeXML::Core::Stomach), after macro
327           expansion but before Construction time.  Primitive control
328           sequences generate Boxes or Lists, generally containing basic
329           Unicode content, rather than structured XML.  Primitive control
330           sequences are also executed for side effect during digestion,
331           effecting changes to the LaTeXML::Core::State.
332
333           The replacement can be a string used as the text content of a Box
334           to be created (using the current font).  Alternatively replacement
335           can be "code($stomach,@args)" (with the control sequence's
336           arguments) which is invoked at digestion time, probably for side-
337           effect, but returning Boxes or Lists or nothing.  replacement may
338           also be undef, which contributes nothing to the document, but does
339           record the TeX code that created it.
340
341           DefPrimitive options are
342
343           "scope=>scope",
344           "locked=>boolean"
345               See "Common Options".
346
347           "mode=> ('text' | 'display_math' | 'inline_math')"
348               Changes to this mode during digestion.
349
350           "font=>{%fontspec}"
351               Specifies the font to use (see "Fonts").  If the font change is
352               to only apply to material generated within this command, you
353               would also use "<bounded="1>>; otherwise, the font will remain
354               in effect afterwards as for a font switching command.
355
356           "bounded=>boolean"
357               If true, TeX grouping (ie. "{}") is enforced around this
358               invocation.
359
360           "requireMath=>boolean",
361           "forbidMath=>boolean"
362               specifies whether the given constructor can only appear, or
363               cannot appear, in math mode.
364
365           "beforeDigest=>code($stomach)"
366               supplies a hook to execute during digestion just before the
367               main part of the primitive is executed (and before any
368               arguments have been read).  The code should either return
369               nothing (return;) or a list of digested items
370               (Box's,List,Whatsit).  It can thus change the State and/or add
371               to the digested output.
372
373           "afterDigest=>code($stomach)"
374               supplies a hook to execute during digestion just after the main
375               part of the primitive ie executed.  it should either return
376               nothing (return;) or digested items.  It can thus change the
377               State and/or add to the digested output.
378
379           "isPrefix=>boolean"
380               indicates whether this is a prefix type of command; This is
381               only used for the special TeX assignment prefixes, like
382               "\global".
383
384           Example:
385
386              DefPrimitive('\begingroup',sub { $_[0]->begingroup; });
387
388       "DefPrimitiveI(cs, paramlist, code($stomach,@args), %options);"
389
390           Internal form of "DefPrimitive" where the control sequence and
391           parameter list have already been separated; useful for definitions
392           from within code.
393
394       Registers
395
396       "DefRegister(prototype, value, %options);"
397
398           Defines a register with value as the initial value (a Number,
399           Dimension, Glue, MuGlue or Tokens --- I haven't handled Box's yet).
400           Usually, the prototype is just the control sequence, but registers
401           are also handled by prototypes like "\count{Number}". "DefRegister"
402           arranges that the register value can be accessed when a numeric,
403           dimension, ... value is being read, and also defines the control
404           sequence for assignment.
405
406           Options are
407
408           "readonly=>boolean"
409               specifies if it is not allowed to change this value.
410
411           "getter=>code(@args)",
412           "setter=>code($value,@args)"
413               By default value is stored in the State's Value table under a
414               name concatenating the control sequence and argument values.
415               These options allow other means of fetching and storing the
416               value.
417
418           Example:
419
420             DefRegister('\pretolerance',Number(100));
421
422       "DefRegisterI(cs, paramlist, value, %options);"
423
424           Internal form of "DefRegister" where the control sequence and
425           parameter list have already been parsed; useful for definitions
426           from within code.
427
428       Constructors
429
430       "DefConstructor(prototype, $replacement, %options);"
431
432           The Constructor is where LaTeXML really starts getting interesting;
433           invoking the control sequence will generate an arbitrary XML
434           fragment in the document tree.  More specifically: during
435           digestion, the arguments will be read and digested, creating a
436           LaTeXML::Core::Whatsit to represent the object. During absorbtion
437           by the LaTeXML::Core::Document, the "Whatsit" will generate the XML
438           fragment according to replacement. The replacement can be
439           "code($document,@args,%properties)" which is called during document
440           absorbtion to create the appropriate XML (See the methods of
441           LaTeXML::Core::Document).
442
443           More conveniently, replacement can be an pattern: simply a bit of
444           XML as a string with certain substitutions to be made. The
445           substitutions are of the following forms:
446
447           "#1, #2 ... #name"
448               These are replaced by the corresponding argument (for #1) or
449               property (for #name) stored with the Whatsit. Each are turned
450               into a string when it appears as in an attribute position, or
451               recursively processed when it appears as content.
452
453           "&function(@args)"
454               Another form of substituted value is prefixed with "&" which
455               invokes a function.  For example, " &func(#1) " would invoke
456               the function "func" on the first argument to the control
457               sequence; what it returns will be inserted into the document.
458
459           "?test(pattern)"  or "?test(ifpattern)(elsepattern)"
460               Patterns can be conditionallized using this form.  The test is
461               any of the above expressions (eg. "#1"), considered true if the
462               result is non-empty.  Thus "?#1(<foo/>)" would add the empty
463               element "foo" if the first argument were given.
464
465           "^" If the constuctor begins with "^", the XML fragment is allowed
466               to float up to a parent node that is allowed to contain it,
467               according to the Document Type.
468
469           The Whatsit property "font" is defined by default.  Additional
470           properties "body" and "trailer" are defined when "captureBody" is
471           true, or for environments.  By using
472           "$whatsit->setProperty(key=>$value);" within "afterDigest", or by
473           using the "properties" option, other properties can be added.
474
475           DefConstructor options are
476
477           "scope=>scope",
478           "locked=>boolean"
479               See "Common Options".
480
481           "mode=>mode",
482           "font=>{%fontspec}",
483           "bounded=>boolean",
484           "requireMath=>boolean",
485           "forbidMath=>boolean"
486               These options are the same as for "Primitives"
487
488           "reversion=>texstring | code($whatsit,#1,#2,...)"
489               specifies the reversion of the invocation back into TeX tokens
490               (if the default reversion is not appropriate).  The textstring
491               string can include "#1", "#2"...  The code is called with the
492               $whatsit and digested arguments and must return a list of
493               Token's.
494
495           "alias=>control_sequence"
496               provides a control sequence to be used in the "reversion"
497               instead of the one defined in the "prototype".  This is a
498               convenient alternative for reversion when a 'public' command
499               conditionally expands into an internal one, but the reversion
500               should be for the public command.
501
502           "sizer=>string | code($whatsit)"
503               specifies how to compute (approximate) the displayed size of
504               the object, if that size is ever needed (typically needed for
505               graphics generation).  If a string is given, it should contain
506               only a sequence of "#1" or "#name" to access arguments and
507               properties of the Whatsit: the size is computed from these
508               items layed out side-by-side.  If code is given, it should
509               return the three Dimensions (width, height and depth).  If
510               neither is given, and the "reversion" specification is of
511               suitible format, it will be used for the sizer.
512
513           "properties=>{%properties} | code($stomach,#1,#2...)"
514               supplies additional properties to be set on the generated
515               Whatsit.  In the first form, the values can be of any type, but
516               if a value is a code references, it takes the same args
517               ($stomach,#1,#2,...) and should return the value; it is
518               executed before creating the Whatsit.  In the second form, the
519               code should return a hash of properties.
520
521           "beforeDigest=>code($stomach)"
522               supplies a hook to execute during digestion just before the
523               Whatsit is created.  The code should either return nothing
524               (return;) or a list of digested items (Box's,List,Whatsit).  It
525               can thus change the State and/or add to the digested output.
526
527           "afterDigest=>code($stomach,$whatsit)"
528               supplies a hook to execute during digestion just after the
529               Whatsit is created (and so the Whatsit already has its
530               arguments and properties). It should either return nothing
531               (return;) or digested items.  It can thus change the State,
532               modify the Whatsit, and/or add to the digested output.
533
534           "beforeConstruct=>code($document,$whatsit)"
535               supplies a hook to execute before constructing the XML
536               (generated by replacement).
537
538           "afterConstruct=>code($document,$whatsit)"
539               Supplies code to execute after constructing the XML.
540
541           "captureBody=>boolean | Token"
542               if true, arbitrary following material will be accumulated into
543               a `body' until the current grouping level is reverted, or till
544               the "Token" is encountered if the option is a "Token".  This
545               body is available as the "body" property of the Whatsit.  This
546               is used by environments and math.
547
548           "nargs=>nargs"
549               This gives a number of args for cases where it can't be infered
550               directly from the prototype (eg. when more args are explicitly
551               read by hooks).
552
553       "DefConstructorI(cs, paramlist, replacement, %options);"
554
555           Internal form of "DefConstructor" where the control sequence and
556           parameter list have already been separated; useful for definitions
557           from within code.
558
559       "DefMath(prototype, tex, %options);"
560
561           A common shorthand constructor; it defines a control sequence that
562           creates a mathematical object, such as a symbol, function or
563           operator application.  The options given can effectively create
564           semantic macros that contribute to the eventual parsing of
565           mathematical content.  In particular, it generates an XMDual using
566           the replacement tex for the presentation.  The content information
567           is drawn from the name and options
568
569           "DefMath" accepts the options:
570
571           "scope=>scope",
572           "locked=>boolean"
573               See "Common Options".
574
575           "font=>{%fontspec}",
576           "reversion=>reversion",
577           "alias=>cs",
578           "sizer=>sizer",
579           "properties=>properties",
580           "beforeDigest=>code($stomach)",
581           "afterDigest=>code($stomach,$whatsit)",
582               These options are the same as for "Constructors"
583
584           "name=>name"
585               gives a name attribute for the object
586
587           "omcd=>cdname"
588               gives the OpenMath content dictionary that name is from.
589
590           "role=>grammatical_role"
591               adds a grammatical role attribute to the object; this specifies
592               the grammatical role that the object plays in surrounding
593               expressions.  This direly needs documentation!
594
595           "mathstyle=>('display' | 'text' | 'script' | 'scriptscript')"
596               Controls whether the this object will be presented in a
597               specific mathstyle, or according to the current setting of
598               "mathstyle".
599
600           "scriptpos=>('mid' | 'post')"
601               Controls the positioning of any sub and super-scripts relative
602               to this object; whether they be stacked over or under it, or
603               whether they will appear in the usual position.  TeX.pool
604               defines a function "doScriptpos()" which is useful for
605               operators like "\sum" in that it sets to "mid" position when in
606               displaystyle, otherwise "post".
607
608           "stretchy=>boolean"
609               Whether or not the object is stretchy when displayed.
610
611           "operator_role=>grammatical_role",
612           "operator_scriptpos=>boolean",
613           "operator_stretchy=>boolean"
614               These three are similar to "role", "scriptpos" and "stretchy",
615               but are used in unusual cases.  These apply to the given
616               attributes to the operator token in the content branch.
617
618           "nogroup=>boolean"
619               Normally, these commands are digested with an implicit grouping
620               around them, localizing changes to fonts, etc; "noggroup=>1"
621               inhibits this.
622
623           Example:
624
625             DefMath('\infty',"\x{221E}",
626                role=>'ID', meaning=>'infinity');
627
628       "DefMathI(cs, paramlist, tex, %options);"
629
630           Internal form of "DefMath" where the control sequence and parameter
631           list have already been separated; useful for definitions from
632           within code.
633
634       Environments
635
636       "DefEnvironment(prototype, replacement, %options);"
637
638           Defines an Environment that generates a specific XML fragment.
639           "replacement" is of the same form as for DefConstructor, but will
640           generally include reference to the "#body" property. Upon
641           encountering a "\begin{env}":  the mode is switched, if needed,
642           else a new group is opened; then the environment name is noted; the
643           beforeDigest hook is run.  Then the Whatsit representing the begin
644           command (but ultimately the whole environment) is created and the
645           afterDigestBegin hook is run.  Next, the body will be digested and
646           collected until the balancing "\end{env}".   Then, any afterDigest
647           hook is run, the environment is ended, finally the mode is ended or
648           the group is closed.  The body and "\end{env}" whatsit are added to
649           the "\begin{env}"'s whatsit as body and trailer, respectively.
650
651           "DefEnvironment" takes the following options:
652
653           "scope=>scope",
654           "locked=>boolean"
655               See "Common Options".
656
657           "mode=>mode",
658           "font=>{%fontspec}"
659           "requireMath=>boolean",
660           "forbidMath=>boolean",
661               These options are the same as for "Primitives"
662
663           "reversion=>reversion",
664           "alias=>cs",
665           "sizer=>sizer",
666           "properties=>properties",
667           "nargs=>nargs"
668               These options are the same as for "DefConstructor"
669
670           "beforeDigest=>code($stomach)"
671               This hook is similar to that for "DefConstructor", but it
672               applies to the "\begin{environment}" control sequence.
673
674           "afterDigestBegin=>code($stomach,$whatsit)"
675               This hook is similar to "DefConstructor"'s "afterDigest" but it
676               applies to the "\begin{environment}" control sequence.  The
677               Whatsit is the one for the beginning control sequence, but
678               represents the environment as a whole.  Note that although the
679               arguments and properties are present in the Whatsit, the body
680               of the environment is not yet available!
681
682           "beforeDigestEnd=>code($stomach)"
683               This hook is similar to "DefConstructor"'s "beforeDigest" but
684               it applies to the "\end{environment}" control sequence.
685
686           "afterDigest=>code($stomach,$whatsit)"
687               This hook is simlar to "DefConstructor"'s "afterDigest" but it
688               applies to the "\end{environment}" control sequence.  Note,
689               however that the Whatsit is only for the ending control
690               sequence, not the Whatsit for the environment as a whole.
691
692           "afterDigestBody=>code($stomach,$whatsit)"
693               This option supplies a hook to be executed during digestion
694               after the ending control sequence has been digested (and all
695               the 4 other digestion hook have executed) and after the body of
696               the environment has been obtained.  The Whatsit is the (useful)
697               one representing the whole environment, and it now does have
698               the body and trailer available, stored as a properties.
699
700           Example:
701
702             DefConstructor('\emph{}',
703                "<ltx:emph>#1</ltx:emph", mode=>'text');
704
705       "DefEnvironmentI(name, paramlist, replacement, %options);"
706
707           Internal form of "DefEnvironment" where the control sequence and
708           parameter list have already been separated; useful for definitions
709           from within code.
710
711   Inputing Content and Definitions
712       "FindFile(name, %options);"
713
714           Find an appropriate file with the given name in the current
715           directories in "SEARCHPATHS".  If a file ending with ".ltxml" is
716           found, it will be preferred.
717
718           Note that if the "name" starts with a recognized protocol
719           (currently one of "(literal|http|https|ftp)") followed by a colon,
720           the name is returned, as is, and no search for files is carried
721           out.
722
723           The options are:
724
725           "type=>type"
726               specifies the file type.  If not set, it will search for both
727               "name.tex" and name.
728
729           "noltxml=>1"
730               inhibits searching for a LaTeXML binding ("name.type.ltxml") to
731               use instead of the file itself.
732
733           "notex=>1"
734               inhibits searching for raw tex version of the file.  That is,
735               it will only search for the LaTeXML binding.
736
737       "InputContent(request, %options);"
738
739           "InputContent" is used for cases when the file (or data) is plain
740           TeX material that is expected to contribute content to the document
741           (as opposed to pure definitions).  A Mouth is opened onto the file,
742           and subsequent reading and/or digestion will pull Tokens from that
743           Mouth until it is exhausted, or closed.
744
745           In some circumstances it may be useful to provide a string
746           containing the TeX material explicitly, rather than referencing a
747           file.  In this case, the "literal" pseudo-protocal may be used:
748
749             InputContent('literal:\textit{Hey}');
750
751           If a file named "$request.latexml" exists, it will be read in as if
752           it were a latexml binding file, before processing.  This can be
753           used for adhoc customization of the conversion of specific files,
754           without modifying the source, or creating more elaborate bindings.
755
756           The only option to "InputContent" is:
757
758           "noerror=>boolean"
759               Inhibits signalling an error if no appropriate file is found.
760
761       "Input(request);"
762
763           "Input" is analogous to LaTeX's "\input", and is used in cases
764           where it isn't completely clear whether content or definitions is
765           expected.  Once a file is found, the approach specified by
766           "InputContent" or "InputDefinitions" is used, depending on which
767           type of file is found.
768
769       "InputDefinitions(request, %options);"
770
771           "InputDefinitions" is used for loading definitions, ie. various
772           macros, settings, etc, rather than document content; it can be used
773           to load LaTeXML's binding files, or for reading in raw TeX
774           definitions or style files.  It reads and processes the material
775           completely before returning, even in the case of TeX definitions.
776           This procedure optionally supports the conventions used for
777           standard LaTeX packages and classes (see "RequirePackage" and
778           "LoadClass").
779
780           Options for "InputDefinitions" are:
781
782           "type=>type"
783               the file type to search for.
784
785           "noltxml=>boolean"
786               inhibits searching for a LaTeXML binding; only raw TeX files
787               will be sought and loaded.
788
789           "notex=>boolean"
790               inhibits searching for raw TeX files, only a LaTeXML binding
791               will be sought and loaded.
792
793           "noerror=>boolean"
794               inhibits reporting an error if no appropriate file is found.
795
796           The following options are primarily useful when "InputDefinitions"
797           is supporting standard LaTeX package and class loading.
798
799           "withoptions=>boolean"
800               indicates whether to pass in any options from the calling class
801               or package.
802
803           "handleoptions=>boolean"
804               indicates whether options processing should be handled.
805
806           "options=>[...]"
807               specifies a list of options (in the 'package options' sense) to
808               be passed (possibly in addition to any provided by the calling
809               class or package).
810
811           "after=>tokens | code($gullet)"
812               provides tokens or code to be processed by a "name.type-h@@k"
813               macro.
814
815           "as_class=>boolean"
816               fishy option that indicates that this definitions file should
817               be treated as if it were defining a class; typically shows up
818               in latex compatibility mode, or AMSTeX.
819
820           A handy method to use most of the TeX distribution's raw TeX
821           definitions for a package, but override only a few with LaTeXML
822           bindings is by defining a binding file, say "tikz.sty.ltxml", to
823           contain
824
825             InputDefinitions('tikz', type => 'sty', noltxml => 1);
826
827           which would find and read in "tizk.sty", and then follow it by a
828           couple of strategic LaTeXML definitions, "DefMacro", etc.
829
830   Class and Packages
831       "RequirePackage(package, %options);"
832
833           Finds and loads a package implementation (usually
834           "package.sty.ltxml", unless "noltxml" is specified)for the
835           requested package.  It returns the pathname of the loaded package.
836           The options are:
837
838           "type=>type"
839               specifies the file type (default "sty".
840
841           "options=>[...]"
842               specifies a list of package options.
843
844           "noltxml=>boolean"
845               inhibits searching for the LaTeXML binding for the file (ie.
846               "name.type.ltxml"
847
848           "notex=>1"
849               inhibits searching for raw tex version of the file.  That is,
850               it will only search for the LaTeXML binding.
851
852       "LoadClass(class, %options);"
853
854           Finds and loads a class definition (usually "class.cls.ltxml").  It
855           returns the pathname of the loaded class.  The only option is
856
857           "options=>[...]"
858               specifies a list of class options.
859
860       "LoadPool(pool, %options);"
861
862           Loads a pool file (usually "pool.pool.ltxml"), one of the top-level
863           definition files, such as TeX, LaTeX or AMSTeX.  It returns the
864           pathname of the loaded file.
865
866       "DeclareOption(option, tokens | string | code($stomach));"
867
868           Declares an option for the current package or class.  The 2nd
869           argument can be a string (which will be tokenized and expanded) or
870           tokens (which will be macro expanded), to provide the value for the
871           option, or it can be a code reference which is treated as a
872           primitive for side-effect.
873
874           If a package or class wants to accomodate options, it should start
875           with one or more "DeclareOptions", followed by "ProcessOptions()".
876
877       "PassOptions(name, ext, @options); "
878
879           Causes the given @options (strings) to be passed to the package (if
880           ext is "sty") or class (if ext is "cls") named by name.
881
882       "ProcessOptions(%options);"
883
884           Processes the options that have been passed to the current package
885           or class in a fashion similar to LaTeX.  The only option (to
886           "ProcessOptions" is "inorder=>boolean" indicating whehter the
887           (package) options are processed in the order they were used, like
888           "ProcessOptions*".
889
890       "ExecuteOptions(@options);"
891
892           Process the options given explicitly in @options.
893
894       "AtBeginDocument(@stuff); "
895
896           Arranges for @stuff to be carried out after the preamble, at the
897           beginning of the document.  @stuff should typically be macro-level
898           stuff, but carried out for side effect; it should be tokens, tokens
899           lists, strings (which will be tokenized), or "code($gullet)" which
900           would yeild tokens to be expanded.
901
902           This operation is useful for style files loaded with "--preload" or
903           document specific customization files (ie. ending with ".latexml");
904           normally the contents would be executed before LaTeX and other
905           style files are loaded and thus can be overridden by them.  By
906           deferring the evaluation to begin-document time, these contents can
907           override those style files.  This is likely to only be meaningful
908           for LaTeX documents.
909
910       "AtEndDocument(@stuff)"
911           Arranges for @stuff to be carried out just before
912           "\\end{document}".  These tokens can be used for side effect, or
913           any content they generate will appear as the last children of the
914           document.
915
916   Counters and IDs
917       "NewCounter(ctr, within, %options);"
918
919           Defines a new counter, like LaTeX's \newcounter, but extended.  It
920           defines a counter that can be used to generate reference numbers,
921           and defines "\thectr", etc. It also defines an "uncounter" which
922           can be used to generate ID's (xml:id) for unnumbered objects.  ctr
923           is the name of the counter.  If defined, within is the name of
924           another counter which, when incremented, will cause this counter to
925           be reset.  The options are
926
927           "idprefix=>string"
928               Specifies a prefix to be used to generate ID's when using this
929               counter
930
931           "nested"
932               Not sure that this is even sane.
933
934       "$num = CounterValue($ctr);"
935
936           Fetches the value associated with the counter $ctr.
937
938       "$tokens = StepCounter($ctr);"
939
940           Analog of "\stepcounter", steps the counter and returns the
941           expansion of "\the$ctr".  Usually you should use
942           "RefStepCounter($ctr)" instead.
943
944       "$keys = RefStepCounter($ctr);"
945
946           Analog of "\refstepcounter", steps the counter and returns a hash
947           containing the keys "refnum="$refnum, id=>$id>.  This makes it
948           suitable for use in a "properties" option to constructors.  The
949           "id" is generated in parallel with the reference number to assist
950           debugging.
951
952       "$keys = RefStepID($ctr);"
953
954           Like to "RefStepCounter", but only steps the "uncounter", and
955           returns only the id;  This is useful for unnumbered cases of
956           objects that normally get both a refnum and id.
957
958       "ResetCounter($ctr);"
959
960           Resets the counter $ctr to zero.
961
962       "GenerateID($document,$node,$whatsit,$prefix);"
963
964           Generates an ID for nodes during the construction phase, useful for
965           cases where the counter based scheme is inappropriate.  The calling
966           pattern makes it appropriate for use in Tag, as in
967
968              Tag('ltx:para',afterClose=>sub { GenerateID(@_,'p'); })
969
970           If $node doesn't already have an xml:id set, it computes an
971           appropriate id by concatenating the xml:id of the closest ancestor
972           with an id (if any), the prefix (if any) and a unique counter.
973
974   Document Model
975       Constructors define how TeX markup will generate XML fragments, but the
976       Document Model is used to control exactly how those fragments are
977       assembled.
978
979       "Tag(tag, %properties);"
980
981           Declares properties of elements with the name tag.  Note that "Tag"
982           can set or add properties to any element from any binding file,
983           unlike the properties set on control by  "DefPrimtive",
984           "DefConstructor", etc..  And, since the properties are recorded in
985           the current Model, they are not subject to TeX grouping; once set,
986           they remain in effect until changed or the end of the document.
987
988           The tag can be specified in one of three forms:
989
990              prefix:name matches specific name in specific namespace
991              prefix:*    matches any tag in the specific namespace;
992              *           matches any tag in any namespace.
993
994           There are two kinds of properties:
995
996           Scalar properties
997               For scalar properties, only a single value is returned for a
998               given element.  When the property is looked up, each of the
999               above forms is considered (the specific element name, the
1000               namespace, and all elements); the first defined value is
1001               returned.
1002
1003               The recognized scalar properties are:
1004
1005               "autoOpen=>boolean"
1006                   Specifies whether tag can be automatically opened if needed
1007                   to insert an element that can only be contained by tag.
1008                   This property can help match the more  SGML-like LaTeX to
1009                   XML.
1010
1011               "autoClose=>boolean"
1012                   Specifies whether this tag can be automatically closed if
1013                   needed to close an ancestor node, or insert an element into
1014                   an ancestor.  This property can help match the more  SGML-
1015                   like LaTeX to XML.
1016
1017           Code properties
1018               These properties provide a bit of code to be run at the times
1019               of certain events associated with an element.  All the code
1020               bits that match a given element will be run, and since they can
1021               be added by any binding file, and be specified in a random
1022               orders, a little bit of extra control is desirable.
1023
1024               Firstly, any early codes are run (eg "afterOpen:early"), then
1025               any normal codes (without modifier) are run, and finally any
1026               late codes are run (eg. "afterOpen:late").
1027
1028               Within each of those groups, the codes assigned for an
1029               element's specific name are run first, then those assigned for
1030               its package and finally the generic one ("*"); that is, the
1031               most specific codes are run first.
1032
1033               When code properties are accumulated by "Tag" for normal or
1034               late events, the code is appended to the end of the current
1035               list (if there were any previous codes added); for early event,
1036               the code is prepended.
1037
1038               The recognized code properties are:
1039
1040               "afterOpen=>code($document,$box)"
1041                   Provides code to be run whenever a node with this tag is
1042                   opened.  It is called with the document being constructed,
1043                   and the initiating digested object as arguments.  It is
1044                   called after the node has been created, and after any
1045                   initial attributes due to the constructor (passed to
1046                   openElement) are added.
1047
1048                   "afterOpen:early" or "afterOpen:late" can be used in place
1049                   of "afterOpen"; these will be run as a group bfore, or
1050                   after (respectively) the unmodified blocks.
1051
1052               "afterClose=>code($document,$box)"
1053                   Provides code to be run whenever a node with this tag is
1054                   closed.  It is called with the document being constructed,
1055                   and the initiating digested object as arguments.
1056
1057                   "afterClose:early" or "afterClose:late" can be used in
1058                   place of "afterClose"; these will be run as a group bfore,
1059                   or after (respectively) the unmodified blocks.
1060
1061       "RelaxNGSchema(schemaname);"
1062
1063           Specifies the schema to use for determining document model.  You
1064           can leave off the extension; it will look for "schemaname.rng" (and
1065           maybe eventually, ".rnc" if that is ever implemented).
1066
1067       "RegisterNamespace(prefix, URL);"
1068
1069           Declares the prefix to be associated with the given URL.  These
1070           prefixes may be used in ltxml files, particularly for constructors,
1071           xpath expressions, etc.  They are not necessarily the same as the
1072           prefixes that will be used in the generated document Use the prefix
1073           "#default" for the default, non-prefixed, namespace.  (See
1074           RegisterDocumentNamespace, as well as DocType or RelaxNGSchema).
1075
1076       "RegisterDocumentNamespace(prefix, URL);"
1077
1078           Declares the prefix to be associated with the given URL used within
1079           the generated XML. They are not necessarily the same as the
1080           prefixes used in code (RegisterNamespace).  This function is less
1081           rarely needed, as the namespace declarations are generally obtained
1082           from the DTD or Schema themselves Use the prefix "#default" for the
1083           default, non-prefixed, namespace.  (See DocType or RelaxNGSchema).
1084
1085       "DocType(rootelement, publicid, systemid, %namespaces);"
1086
1087           Declares the expected rootelement, the public and system ID's of
1088           the document type to be used in the final document.  The hash
1089           %namespaces specifies the namespaces prefixes that are expected to
1090           be found in the DTD, along with each associated namespace URI.  Use
1091           the prefix "#default" for the default namespace (ie. the namespace
1092           of non-prefixed elements in the DTD).
1093
1094           The prefixes defined for the DTD may be different from the prefixes
1095           used in implementation CODE (eg. in ltxml files; see
1096           RegisterNamespace).  The generated document will use the namespaces
1097           and prefixes defined for the DTD.
1098
1099   Document Rewriting
1100       During document construction, as each node gets closed, the text
1101       content gets simplfied.  We'll call it applying ligatures, for lack of
1102       a better name.
1103
1104       "DefLigature(regexp, %options);"
1105
1106           Apply the regular expression (given as a string: "/fa/fa/" since it
1107           will be converted internally to a true regexp), to the text
1108           content.  The only option is "fontTest=>code($font)"; if given,
1109           then the substitution is applied only when "fontTest" returns true.
1110
1111           Predefined Ligatures combine sequences of "." or single-quotes into
1112           appropriate Unicode characters.
1113
1114       "DefMathLigature($string"=""$replacment,%options);>
1115
1116           A Math Ligature typically combines a sequence of math tokens
1117           (XMTok) into a single one.  A simple example is
1118
1119              DefMathLigature(":=" => ":=", role => 'RELOP', meaning => 'assign');
1120
1121           replaces the two tokens for colon and equals by a token
1122           representing assignment.  The options are those characterising an
1123           XMTok, namely: "role", "meaning" and "name".
1124
1125           For more complex cases (recognizing numbers, for example), you may
1126           supply a function "matcher="CODE($document,$node)>, which is passed
1127           the current document and the last math node in the sequence.  It
1128           should examine $node and any preceding nodes (using
1129           "previousSibling") and return a list of "($n,$string,%attributes)"
1130           to replace the $n nodes by a new one with text content being
1131           $string content and the given attributes.  If no replacement is
1132           called for, CODE should return undef.
1133
1134       After document construction, various rewriting and augmenting of the
1135       document can take place.
1136
1137       "DefRewrite(%specification);"
1138       "DefMathRewrite(%specification);"
1139
1140           These two declarations define document rewrite rules that are
1141           applied to the document tree after it has been constructed, but
1142           before math parsing, or any other postprocessing, is done.  The
1143           %specification consists of a sequence of key/value pairs with the
1144           initial specs successively narrowing the selection of document
1145           nodes, and the remaining specs indicating how to modify or replace
1146           the selected nodes.
1147
1148           The following select portions of the document:
1149
1150           "label=>label"
1151               Selects the part of the document with label=$label
1152
1153           "scope=>scope"
1154               The scope could be "label:foo" or "section:1.2.3" or something
1155               similar. These select a subtree labelled 'foo', or a section
1156               with reference number "1.2.3"
1157
1158           "xpath=>xpath"
1159               Select those nodes matching an explicit xpath expression.
1160
1161           "match=>tex"
1162               Selects nodes that look like what the processing of tex would
1163               produce.
1164
1165           "regexp=>regexp"
1166               Selects text nodes that match the regular expression.
1167
1168           The following act upon the selected node:
1169
1170           "attributes=>hashref"
1171               Adds the attributes given in the hash reference to the node.
1172
1173           "replace=>replacement"
1174               Interprets replacement as TeX code to generate nodes that will
1175               replace the selected nodes.
1176
1177   Mid-Level support
1178       "$tokens = Expand($tokens);"
1179
1180           Expands the given $tokens according to current definitions.
1181
1182       "$boxes = Digest($tokens);"
1183
1184           Processes and digestes the $tokens.  Any arguments needed by
1185           control sequences in $tokens must be contained within the $tokens
1186           itself.
1187
1188       "@tokens = Invocation($cs,@args);"
1189
1190           Constructs a sequence of tokens that would invoke the token $cs on
1191           the arguments.
1192
1193       "RawTeX('... tex code ...');"
1194
1195           RawTeX is a convenience function for including chunks of raw TeX
1196           (or LaTeX) code in a Package implementation.  It is useful for
1197           copying portions of the normal implementation that can be handled
1198           simply using macros and primitives.
1199
1200       "Let($token1,$token2);"
1201
1202           Gives $token1 the same `meaning' (definition) as $token2; like
1203           TeX's \let.
1204
1205       "StartSemiVerbatim(); ... ; EndSemiVerbatim();"
1206           Disable disable most TeX catcodes.
1207
1208       "$tokens = Tokenize($string);"
1209           Tokenizes the $string using the standard catcodes, returning a
1210           LaTeXML::Core::Tokens.
1211
1212       "$tokens = TokenizeInternal($string);"
1213           Tokenizes the $string according to the internal cattable (where @
1214           is a letter), returning a LaTeXML::Core::Tokens.
1215
1216   Argument Readers
1217       "ReadParameters($gullet,$spec);"
1218
1219           Reads from $gullet the tokens corresponding to $spec (a Parameters
1220           object).
1221
1222       "DefParameterType(type, code($gullet,@values), %options);"
1223
1224           Defines a new Parameter type, type, with code for its reader.
1225
1226           Options are:
1227
1228           "reversion=>code($arg,@values);"
1229               This code is responsible for converting a previously parsed
1230               argument back into a sequence of Token's.
1231
1232           "optional=>boolean"
1233               whether it is an error if no matching input is found.
1234
1235           "novalue=>boolean"
1236               whether the value returned should contribute to argument lists,
1237               or simply be passed over.
1238
1239           "semiverbatim=>boolean"
1240               whether the catcode table should be modified before reading
1241               tokens.
1242
1243       "<DefColumnType(proto, expansion);"
1244
1245           Defines a new column type for tabular and arrays.  proto is the
1246           prototype for the pattern, analogous to the pattern used for other
1247           definitions, except that macro being defined is a single character.
1248           The expansion is a string specifying what it should expand into,
1249           typically more verbose column specification.
1250
1251   Access to State
1252       "$value = LookupValue($name);"
1253
1254           Lookup the current value associated with the the string $name.
1255
1256       "AssignValue($name,$value,$scope);"
1257
1258           Assign $value to be associated with the the string $name, according
1259           to the given scoping rule.
1260
1261           Values are also used to specify most configuration parameters
1262           (which can therefor also be scoped).  The recognized configuration
1263           parameters are:
1264
1265            VERBOSITY         : the level of verbosity for debugging
1266                                output, with 0 being default.
1267            STRICT            : whether errors (eg. undefined macros)
1268                                are fatal.
1269            INCLUDE_COMMENTS  : whether to preserve comments in the
1270                                source, and to add occasional line
1271                                number comments. (Default true).
1272            PRESERVE_NEWLINES : whether newlines in the source should
1273                                be preserved (not 100% TeX-like).
1274                                By default this is true.
1275            SEARCHPATHS       : a list of directories to search for
1276                                sources, implementations, etc.
1277
1278       "PushValue($name,@values);"
1279
1280           This function, along with the next three are like "AssignValue",
1281           but maintain a global list of values.  "PushValue" pushes the
1282           provided values onto the end of a list.  The data stored for $name
1283           is global and must be a LIST reference; it is created if needed.
1284
1285       "UnshiftValue($name,@values);"
1286
1287           Similar to  "PushValue", but pushes a value onto the front of the
1288           list.  The data stored for $name is global and must be a LIST
1289           reference; it is created if needed.
1290
1291       "PopValue($name);"
1292
1293           Removes and returns the value on the end of the list named by
1294           $name.  The data stored for $name is global and must be a LIST
1295           reference.  Returns "undef" if there is no data in the list.
1296
1297       "ShiftValue($name);"
1298
1299           Removes and returns the first value in the list named by $name.
1300           The data stored for $name is global and must be a LIST reference.
1301           Returns "undef" if there is no data in the list.
1302
1303       "LookupMapping($name,$key);"
1304
1305           This function maintains a hash association named by $name.  It
1306           returns the value associated with $key within that mapping.  The
1307           data stored for $name is global and must be a HASH reference.
1308           Returns "undef" if there is no data associated with $key in the
1309           mapping, or the mapping is not (yet) defined.
1310
1311       "AssignMapping($name,$key,$value);"
1312
1313           This function associates $value with $key within the mapping named
1314           by $name.  The data stored for $name is global and must be a HASH
1315           reference; it is created if needed.
1316
1317       "$value = LookupCatcode($char);"
1318
1319           Lookup the current catcode associated with the the character $char.
1320
1321       "AssignCatcode($char,$catcode,$scope);"
1322
1323           Set $char to have the given $catcode, with the assignment made
1324           according to the given scoping rule.
1325
1326           This method is also used to specify whether a given character is
1327           active in math mode, by using "math:$char" for the character, and
1328           using a value of 1 to specify that it is active.
1329
1330       "$meaning = LookupMeaning($token);"
1331
1332           Looks up the current meaning of the given $token which may be a
1333           Definition, another token, or the token itself if it has not
1334           otherwise been defined.
1335
1336       "$defn = LookupDefinition($token);"
1337
1338           Looks up the current definition, if any, of the $token.
1339
1340       "InstallDefinition($defn);"
1341
1342           Install the Definition $defn into $STATE under its control
1343           sequence.
1344
1345       "XEquals($token1,$token2)"
1346           Tests whether the two tokens are equal in the sense that they are
1347           either equal tokens, or if defined, have the same definition.
1348
1349   Fonts
1350       "MergeFont(%fontspec); "
1351
1352           Set the current font by merging the font style attributes with the
1353           current font.  The %fontspec specifies the properties of the
1354           desired font.  Likely values include (the values aren't required to
1355           be in this set):
1356
1357            family : serif, sansserif, typewriter, caligraphic,
1358                     fraktur, script
1359            series : medium, bold
1360            shape  : upright, italic, slanted, smallcaps
1361            size   : tiny, footnote, small, normal, large,
1362                     Large, LARGE, huge, Huge
1363            color  : any named color, default is black
1364
1365           Some families will only be used in math.  This function returns
1366           nothing so it can be easily used in beforeDigest, afterDigest.
1367
1368       "DeclareFontMap($name,$map,%options);"
1369           Declares a font map for the encoding $name. The map $map is an
1370           array of 128 or 256 entries, each element is either a unicode
1371           string for the representation of that codepoint, or undef if that
1372           codepoint is not supported  by this encoding.  The only option
1373           currently is "family" used because some fonts (notably cmr!)  have
1374           different glyphs in some font families, such as
1375           "family="'typewriter'>.
1376
1377       "FontDecode($code,$encoding,$implicit);"
1378           Returns the unicode string representing the given codepoint $code
1379           (an integer) in the given font encoding $encoding.  If $encoding is
1380           undefined, the usual case, the current font encoding and font
1381           family is used for the lookup.  Explicit decoding is used when
1382           "\\char" or similar are invoked ($implicit is false), and the
1383           codepoint must be represented in the fontmap, otherwise undef is
1384           returned.  Implicit decoding (ie. $implicit is true) occurs within
1385           the Stomach when a Token's content is being digested and converted
1386           to a Box; in that case only the lower 128 codepoints are converted;
1387           all codepoints above 128 are assumed to already be Unicode.
1388
1389           The font map for $encoding is automatically loaded if it has not
1390           already been loaded.
1391
1392       "FontDecodeString($string,$encoding,$implicit);"
1393           Returns the unicode string resulting from decoding the individual
1394           characters in $string according to FontDecode, above.
1395
1396       "LoadFontMap($encoding);"
1397           Finds and loads the font map for the encoding named $encoding, if
1398           it hasn't been loaded before.  It looks for
1399           "encoding.fontmap.ltxml", which would typically define the font map
1400           using "DeclareFontMap", possibly including extra maps for families
1401           like "typewriter".
1402
1403   Color
1404       "$color=LookupColor($name);"
1405           Lookup the color object associated with $name.
1406
1407       "DefColor($name,$color,$scope);"
1408           Associates the $name with the given $color (a color object), with
1409           the given scoping.
1410
1411       "DefColorModel($model,$coremodel,$tocore,$fromcore);"
1412           Defines a color model $model that is derived from the core color
1413           model $coremodel.  The two functions $tocore and $fromcore convert
1414           a color object in that model to the core model, or from the core
1415           model to the derived model.  Core models are rgb, cmy, cmyk, hsb
1416           and gray.
1417
1418   Low-level Functions
1419       "CleanID($id);"
1420
1421           Cleans an $id of disallowed characters, trimming space.
1422
1423       "CleanLabel($label,$prefix);"
1424
1425           Cleans a $label of disallowed characters, trimming space.  The
1426           prefix $prefix is prepended (or "LABEL", if none given).
1427
1428       "CleanIndexKey($key);"
1429
1430           Cleans an index key, so it can be used as an ID.
1431
1432       "CleanBibKey($key);"
1433           Cleans a bibliographic citation key, so it can be used as an ID.
1434
1435       "CleanURL($url);"
1436
1437           Cleans a url.
1438
1439       "UTF($code);"
1440
1441           Generates a UTF character, handy for the the 8 bit characters.  For
1442           example, "UTF(0xA0)" generates the non-breaking space.
1443
1444       "@tokens = roman($number);"
1445
1446           Formats the $number in (lowercase) roman numerals, returning a list
1447           of the tokens.
1448
1449       "@tokens = Roman($number);"
1450
1451           Formats the $number in (uppercase) roman numerals, returning a list
1452           of the tokens.
1453

SEE ALSO

1455       See also LaTeXML::Global, LaTeXML::Common::Object,
1456       LaTeXML::Common::Error, LaTeXML::Core::Token, LaTeXML::Core::Tokens,
1457       LaTeXML::Core::Box, LaTeXML::Core::List, LaTeXML::Common::Number,
1458       LaTeXML::Common::Float, LaTeXML::Common::Dimension,
1459       LaTeXML::Common::Glue, LaTeXML::Core::MuDimension,
1460       LaTeXML::Core::MuGlue, LaTeXML::Core::Pair, LaTeXML::Core::PairList,
1461       LaTeXML::Common::Color, LaTeXML::Core::Alignment, LaTeXML::Common::XML,
1462       LaTeXML::Util::Radix.
1463

AUTHOR

1465       Bruce Miller <bruce.miller@nist.gov>
1466
1468       Public domain software, produced as part of work done by the United
1469       States Government & not subject to copyright in the US.
1470
1471
1472
1473perl v5.28.1                      2018-07-27               LaTeXML::Package(3)
Impressum