LaTeXML
view release on metacpan or search on metacpan
lib/LaTeXML/Package/latexml.sty.ltxml view on Meta::CPAN
DeclareOption('notracing', sub {
AssignValue(TRACING => (LookupValue('TRACING') || 0) & ~TRACE_ALL); });
DeclareOption('profiling', sub {
AssignValue(TRACING => (LookupValue('TRACING') || 0) | TRACE_PROFILE); });
DeclareOption('noprofiling', sub {
AssignValue(TRACING => (LookupValue('TRACING') || 0) & ~TRACE_PROFILE); });
DeclareOption('mathparserspeculate', sub { AssignValue('MATHPARSER_SPECULATE' => 1, 'global'); });
DeclareOption('nomathparserspeculate', sub { AssignValue('MATHPARSER_SPECULATE' => 0, 'global'); });
DeclareOption('guesstabularheaders', sub { AssignValue(GUESS_TABULAR_HEADERS => 1, 'global'); });
DeclareOption('noguesstabularheaders', sub { AssignValue(GUESS_TABULAR_HEADERS => 0, 'global'); });
# 'nobibtex' intended to be used for arXiv-like build harnesses, where there
# is explicit instruction to only use ".bbl" and that bibtex will not be ran.
DeclareOption('bibtex', sub { AssignValue('NO_BIBTEX' => 0, 'global'); });
DeclareOption('nobibtex', sub { AssignValue('NO_BIBTEX' => 1, 'global'); });
# Lexeme serialization for math formulas
DeclareOption('mathlexemes', sub { AssignValue('LEXEMATIZE_MATH' => 1, 'global'); });
# Finer control over which (if any) raw .sty/.cls files to include
DeclareOption('rawstyles', sub { AssignValue('INCLUDE_STYLES' => 1, 'global'); });
DeclareOption('localrawstyles', sub { AssignValue('INCLUDE_STYLES' => 'searchpaths', 'global'); });
DeclareOption('norawstyles', sub { AssignValue('INCLUDE_STYLES' => 0, 'global'); });
DeclareOption('rawclasses', sub { AssignValue('INCLUDE_CLASSES' => 1, 'global'); });
DeclareOption('localrawclasses', sub { AssignValue('INCLUDE_CLASSES' => 'searchpaths', 'global'); });
DeclareOption('norawclasses', sub { AssignValue('INCLUDE_CLASSES' => 0, 'global'); });
# Avoid extra line-breaks in UnTeX
DeclareOption('breakuntex', sub { AssignValue('SUPPRESS_UNTEX_LINEBREAKS' => 0, 'global'); });
DeclareOption('nobreakuntex', sub { AssignValue('SUPPRESS_UNTEX_LINEBREAKS' => 1, 'global'); });
DefConstructor('\lx@save@parameter{}{}', sub {
$_[0]->insertPI('latexml', ToString($_[1]) => $_[2]); });
DefKeyVal('LTXML', 'dpi', 'Number', '', code => sub {
$STATE->assignValue(DPI => ToString($_[1]));
AtBeginDocument(Tokens(T_CS('\lx@save@parameter'), T_OTHER('DPI'), T_BEGIN, $_[1], T_END)); });
DefKeyVal('LTXML', 'magnify', 'Number', '', code => sub {
AtBeginDocument(Tokens(T_CS('\lx@save@parameter'), T_OTHER('magnifiy'), T_BEGIN, $_[1], T_END)); });
DefKeyVal('LTXML', 'upsample', 'Number', '', code => sub {
AtBeginDocument(Tokens(T_CS('\lx@save@parameter'), T_OTHER('upsample'), T_BEGIN, $_[1], T_END)); });
DefKeyVal('LTXML', 'zoomout', 'Number', '', code => sub {
AtBeginDocument(Tokens(T_CS('\lx@save@parameter'), T_OTHER('zoomout'), T_BEGIN, $_[1], T_END)); });
DefKeyVal('LTXML', 'tokenlimit', 'Number', '', code => sub {
$LaTeXML::TOKEN_LIMIT = int(ToString($_[1]));
return; });
DefKeyVal('LTXML', 'iflimit', 'Number', '', code => sub {
$LaTeXML::IF_LIMIT = int(ToString($_[1]));
return; });
DefKeyVal('LTXML', 'absorblimit', 'Number', '', code => sub {
$LaTeXML::ABSORB_LIMIT = int(ToString($_[1]));
return; });
DefKeyVal('LTXML', 'pushbacklimit', 'Number', '', code => sub {
$LaTeXML::PUSHBACK_LIMIT = int(ToString($_[1]));
return; });
ProcessOptions(inorder => 1, keysets => ['LTXML']);
#======================================================================
# From latexml.sty
# Making these all be links, every time, seems in hindsight rather obnoxious.
# OTOH, would be nice to have an idiom to make (some of) them be links; or only the first one?
# [does this really belong here? or should this be disableable?]
DefConstructor('\URL[] Verbatim', "<ltx:ref href='#href'>?#1(#1)(#href)</ltx:ref>",
properties => sub { (href => CleanURL($_[2])); });
DefMacro('\XML', '\textsc{xml}'); # '\URL[\texttt{XML}]{http://www.w3.org/XML/}');
DefMacro('\SGML', '\textsc{sgml}'); # '\URL[\texttt{HTML}]{http://www.w3.org/MarkUp/SGML/}');
DefMacro('\HTML', '\textsc{html}'); #'\URL[\texttt{HTML}]{http://www.w3.org/html/}');
DefMacro('\XHTML', '\textsc{xhtml}'); #'\URL[\texttt{XHTML}]{http://www.w3.org/TR/xhtml11/}');
DefMacro('\XSLT', '\textsc{xslt}'); # '\URL[\texttt{XSLT}]{http://www.w3.org/Style/XSL/}');
DefMacro('\CSS', '\textsc{css}'); #'\URL[\texttt{CSS}]{http://www.w3.org/Style/CSS/}');
DefMacro('\MathML', '\texttt{MathML}'); # '\URL[\texttt{MathML}]{http://www.w3.org/Math/}');
DefMacro('\OpenMath', '\texttt{OpenMath}'); # '\URL[\texttt{OpenMath}]{http://www.openmath.org/}');
##DefMacro('\LaTeXML', '\URL[\texttt{LaTeXML}]{http://dlmf.nist.gov/LaTeXML/}');
#DefMacro('\BibTeX','BibTeX');
# Link is maybe a bit pushy? (by default)
#DefMacro('\LaTeXML', '\URL[\LaTeXML@logo]{http://dlmf.nist.gov/LaTeXML/}');
DefMacro('\LaTeXML', '\LaTeXML@logo');
DefConstructor('\LaTeXML@logo',
"<ltx:text class='ltx_LaTeXML_logo'>"
. "<ltx:text cssstyle='letter-spacing:-0.2em; margin-right:0.1em'>"
. "L"
. "<ltx:text cssstyle='font-variant:small-caps;' yoffset='0.4ex'>a</ltx:text>"
. "T"
. "<ltx:text cssstyle='font-variant:small-caps;font-size:120%' yoffset='-0.2ex'>e</ltx:text>"
. "</ltx:text>"
. "<ltx:text cssstyle='font-size:90%' yoffset='-0.2ex'>XML</ltx:text>"
. "</ltx:text>",
sizer => sub { (Dimension('3.8em'), Dimension('1.6ex'), Dimension('0.4ex')); });
DefMacro('\LaTeXMLversion', sub { ExplodeText($LaTeXML::VERSION); });
DefMacro('\LaTeXMLrevision', sub { ExplodeText($LaTeXML::Version::REVISION); });
DefMacro('\LaTeXMLfullversion',
'\LaTeXML (\LaTeXMLversion\expandafter\ifx\expandafter.\LaTeXMLrevision.\else; rev.~\LaTeXMLrevision\fi)');
#======================================================================
# id related features
# Set the id to used for the top-level document
DefMacro('\lxDocumentID{}', '\def\thedocument@ID{#1}');
# \LXMID{id}{math} Associate the identifier id with the given math expression.
DefMacro('\LXMID{}{}', '\lx@xmarg{#1}{#2}');
# \LXRef{id} Refer to the math expression associated with id.
# In presentation, this is similar to using a shorthand macro.
# In content situations, an XMRef is generated.
DefMacro('\LXMRef{}', '\lx@xmref{#1}');
#======================================================================
# Augmenting & Annotating features
# \lxRegisterNamespace{prefix}{namespace-uri}
# Registers an XML namespace that can be used for foreign attributes in the document.
DefPrimitive('\lxRegisterNamespace {} Semiverbatim', sub {
my ($stomach, $prefix, $namespaceuri) = @_;
RegisterNamespace(ToString($prefix) => ToString($namespaceuri));
return; });
# class related features
( run in 5.681 seconds using v1.01-cache-2.11-cpan-71847e10f99 )