LaTeXML
view release on metacpan or search on metacpan
lib/LaTeXML/Package/amsppt.sty.ltxml view on Meta::CPAN
DefRegister('\rosteritemwd' => Dimension(0));
# \Runinitem ?
NewCounter('roster', 'document', idprefix => 'I');
NewCounter('rosteritem', 'roster', idprefix => 'i');
DefMacro('\therosteritem{}', '\rom{(#1)}');
DefConstructor('\roster DigestUntil:\endroster',
"<ltx:enumerate>#body</ltx:enumerate>",
bounded => 1,
properties => sub { RefStepID('roster') },
beforeDigest => sub { Let('\item', '\roster@item'); });
DefConstructor('\roster@item',
"<ltx:item xml:id='#id'>?#1(<ltx:tags><ltx:tag>#1</ltx:tag></ltx:tags>)",
properties => sub { RefStepID('rosteritem') });
Let('\endroster', '\relax');
DefConstructor('\block DigestUntil:\endblock',
"<ltx:quote>#1</ltx:quote>");
Let('\endblock', '\relax');
DefRegister('\pagenumwd' => Dimension(0));
DefRegister('\indenti' => Dimension(0));
DefRegister('\indentii' => Dimension(0));
DefMacro('\linespacing Number', '');
DefMacro('\endquotes', ''); # ?
NewCounter('footnote');
DefMacro('\thefootnote', sub { ExplodeText(ToString(LookupRegister('\c@footnote')->valueOf)); });
# same as LaTeX (but LaTeX.pool NOT included for amsppt!!!)
DefConstructor('\footnote[]{}',
"<ltx:note role='footnote' mark='#mark' xml:id='#id'>"
. "#tags"
. "#2"
. "</ltx:note>",
mode => 'text', bounded => 1,
beforeDigest => sub { reenterTextMode(1); neutralizeFont(); },
properties => sub {
($_[1]
? (mark => $_[1])
: (RefStepCounter('footnote'),
mark => DigestText(T_CS('\thefootnote')))) });
DefConstructor('\footnotemark[]',
"<ltx:note role='footnotemark' mark='#mark' xml:id='#id'>"
. "#tags"
. "</ltx:note>",
mode => 'text',
properties => sub {
($_[1]
? (mark => $_[1])
: (RefStepCounter('footnote'),
mark => DigestText(T_CS('\thefootnote')))) });
DefConstructor('\footnotetext[]{}',
"<ltx:note role='footnotetext' mark='#mark' xml:id='#id'>#2</ltx:note>",
mode => 'text',
properties => sub {
($_[1]
? (mark => $_[1])
: (mark => Digest(T_CS("\\thefootnote")))); });
Tag('ltx:note', afterClose => \&relocateFootnote);
sub relocateFootnote {
my ($document, $node) = @_;
if (($node->getAttribute('role') || '') =~ /^(\w+?)text$/) {
my $notetype = $1; # Eg "footnote", "endnote",...
if (my $mark = $node->getAttribute('mark')) {
if (my $note = $document->findnode(".//ltx:note[\@role='${notetype}mark'][\@mark='$mark']")) {
$node->parentNode->removeChild($node);
append_nodes($note, $node->childNodes);
$document->setAttribute($note, role => $notetype); } } }
return; }
#======================================================================
DefMacro('\rom{}', '{rm #1}');
DefMacro('\PSAMSFonts', '');
RawTeX('\newif\ifPSAMSFonts\PSAMSFontstrue');
DefMacro('\qed', '\ltx@qed');
DefConstructor('\ltx@qed', "?#isMath(<ltx:XMTok role='PUNCT'>\x{220E}</ltx:XMTok>)(\x{220E})", reversion => '\qed');
DefPrimitiveI('\tildechar', undef, "~", font => { family => 'typewriter' });
DefMacro('\breakcheck', '');
DefRegister('\normalparindent' => Dimension(0));
DefMacro('\usualspace', ' ');
#======================================================================
# Bibliography
DefMacro('\Refsname', 'References');
DefConstructor('\cite Semiverbatim', "<ltx:cite>[<ltx:bibref show='refnum' bibrefs='#1'/>]</ltx:cite>");
# arg or no arg?
DefMacro('\thebibliography@ID', '\ifx.\thedocument@id.\thedocument@id.bib\else bib\fi');
DefMacro('\@auto@Refs', '\Refs');
DefMacro('\Refs', '\@Refs\def\@auto@Refs{}');
DefConstructor('\@Refs',
"<ltx:bibliography xml:id='#id'>"
. "<ltx:title>References</ltx:title>"
. "<ltx:biblist>",
afterDigest => sub {
$_[1]->setProperty(id => ToString(Expand(T_CS('\thebibliography@ID')))); });
DefMacro('\endRefs', '\def\@auto@Refs{\Refs}\end@Refs');
DefConstructor('\end@Refs', "</ltx:bibliography>");
NewCounter('@bibitem', 'bibliography', idprefix => 'bib');
DefMacro('\the@bibitem', '\number\c@@bibitem');
# Since \Refs is apparently optional, we need to automatically open/close
## No that gives too many elements that can be auto-opened!
## try the \@auto@Refs bit ... ?
##Tag('ltx:bibliography',autoOpen=>1,autoClose=>1);
Tag('ltx:bibliography', autoClose => 1);
Tag('ltx:biblist', autoOpen => 1, autoClose => 1);
DefRegister('\refindentwd' => Dimension(0));
DefMacro('\refstyle{}', '');
DefMacro('\keyformat{}', '#1');
DefMacro('\refbreaks', '');
DefMacro('\defaultreftexts', '');
DefMacro('\ref', '\@auto@Refs\begingroup\@bibitem\@bibfield{random}');
DefMacro('\endref', '\@end@bibfield\@fill@bibitem\@end@bibitem\endgroup');
( run in 0.996 second using v1.01-cache-2.11-cpan-71847e10f99 )