Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions lib/LaTeXML/Post/MathML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ sub outerWrapper {
qw(about resource property rel rev typeof datatype content);
my $wrapped = ['m:math', { display => ($mode eq 'display' ? 'block' : 'inline'),
class => $math->getAttribute('class'),
intent => $math->getAttribute('intent'),
alttext => $math->getAttribute('tex'),
#### Handy for debugging math
### title => $math->getAttribute('text'),
Expand Down Expand Up @@ -353,6 +354,10 @@ sub pmml {
# Associate the generated node with the source XMath node.
if (my $role = _getattr($refr, $node, 'role')) {
$$result[1]{_role} = $role; }
if (my $intent = _getattr($refr, $node, 'intent')) {
$$result[1]{intent} = $intent; }
if (my $arg = _getattr($refr, $node, 'arg')) {
$$result[1]{arg} = $arg; }
$LaTeXML::Post::MATHPROCESSOR->associateNode($result, $node);
return $result; }

Expand Down Expand Up @@ -536,12 +541,12 @@ sub pmml_maybe_resize {
my $xoff = $node->getAttribute('xoffset') || ($parent && $parent->getAttribute('xoffset'));
my $yoff = $node->getAttribute('yoffset') || ($parent && $parent->getAttribute('yoffset'));
my $role = $node->getAttribute('role') || ($parent && $parent->getAttribute('role'));
my $class = $node->getAttribute('class') || ($parent && $parent->getAttribute('class'));
my $class = $node->getAttribute('class') || ($parent && $parent->getAttribute('class'));

# First, special case hack for stretchy arrows, with specified width
# Stretchiness (currently) only has effect within munder/mover!!!!!
if ($width && (($role || '') eq 'ARROW')
&& (($class||'') =~ /\bltx_horizontally_stretchy\b/)) { # SPECIAL CASE HACK
&& (($class || '') =~ /\bltx_horizontally_stretchy\b/)) { # SPECIAL CASE HACK
$result = ['m:mover', {}, $result, ['m:mspace', { width => $width }]]; }
elsif ($width || $height || $depth || $xoff || $yoff) {
if ($$result[0] eq 'm:mpadded') { }
Expand Down Expand Up @@ -1196,11 +1201,11 @@ our $atomtype_form = {
# (use negative for spacing only in display & text style; use 0 for * which means "shouldn't happen")
# THUS, we'll need to know which style!!!
our $atompair_spacing = {
Ord => { Ord => 0, Op => 1, Bin => -2, Rel => -3, Open => 0, Close => 0, Punct => 0, Inner => -1 },
Op => { Ord => 1, Op => 1, Bin => 0, Rel => -3, Open => 0, Close => 0, Punct => 0, Inner => -1 },
Ord => { Ord => 0, Op => 1, Bin => -2, Rel => -3, Open => 0, Close => 0, Punct => 0, Inner => -1 },
Op => { Ord => 1, Op => 1, Bin => 0, Rel => -3, Open => 0, Close => 0, Punct => 0, Inner => -1 },
Bin => { Ord => -2, Op => -2, Bin => 0, Rel => 0, Open => -2, Close => 0, Punct => 0, Inner => -2 },
Rel => { Ord => -3, Op => -3, Bin => 0, Rel => 0, Open => -3, Close => 0, Punct => 0, Inner => -3 },
Open => { Ord => 0, Op => 0, Bin => 0, Rel => 0, Open => 0, Close => 0, Punct => 0, Inner => 0 },
Open => { Ord => 0, Op => 0, Bin => 0, Rel => 0, Open => 0, Close => 0, Punct => 0, Inner => 0 },
Close => { Ord => 0, Op => 1, Bin => -2, Rel => -3, Open => 0, Close => 0, Punct => 0, Inner => -1 },
Punct => { Ord => -1, Op => -1, Bin => 0, Rel => -1, Open => -1, Close => -1, Punct => -1, Inner => -1 },
Inner => { Ord => -1, Op => 1, Bin => -2, Rel => -3, Open => -1, Close => 0, Punct => -1, Inner => -1 },
Expand Down
9 changes: 9 additions & 0 deletions lib/LaTeXML/resources/RelaxNG/LaTeXML-math.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ Math_attributes =
## a textified representation of the math.
attribute text { text }?,

## intent attribute from MathML 4
attribute intent { text }?,

## preserved grammar-near lexemes for export to external apps
attribute lexemes { text }?

Expand Down Expand Up @@ -88,6 +91,12 @@ XMath.attributes =
## The OpenMath CD for which \attr{meaning} is a symbol.
attribute omcd { text }?,

## intent attribute from MathML 4
attribute intent { text }?,

## arg attribute from MathML 4
attribute arg { text }?,

## An encoding of the position of sub/superscripts
## Before parsing, it takes two forms. On a base token or element,
## it is one of (pre|mid|post), indicating where any script can be placed.
Expand Down
15 changes: 15 additions & 0 deletions lib/LaTeXML/resources/RelaxNG/LaTeXML-math.rng
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ the content of the \elementref{XMath} element.</a:documentation>
<a:documentation>a textified representation of the math.</a:documentation>
</attribute>
</optional>
<optional>
<attribute name="intent">
<a:documentation>intent attribute from MathML 4</a:documentation>
</attribute>
</optional>
<optional>
<attribute name="lexemes">
<a:documentation>preserved grammar-near lexemes for export to external apps</a:documentation>
Expand Down Expand Up @@ -133,6 +138,16 @@ such as the OpenMath name.</a:documentation>
<a:documentation>The OpenMath CD for which \attr{meaning} is a symbol.</a:documentation>
</attribute>
</optional>
<optional>
<attribute name="intent">
<a:documentation>intent attribute from MathML 4</a:documentation>
</attribute>
</optional>
<optional>
<attribute name="arg">
<a:documentation>arg attribute from MathML 4</a:documentation>
</attribute>
</optional>
<optional>
<attribute name="scriptpos">
<a:documentation>An encoding of the position of sub/superscripts
Expand Down
20 changes: 10 additions & 10 deletions lib/LaTeXML/resources/RelaxNG/LaTeXML.model
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,21 @@ subsubsection.body:=(ltx:TOC,ltx:declare,ltx:figure,ltx:float,ltx:glossarydefini
*{!svg:*,*,*:*}(!svg:*,#PCDATA,*,*:*)
*:*{}(*:*)
ltx:ERROR{!xml:*,*:*,about,aboutidref,aboutlabelref,class,content,cssstyle,datatype,fragid,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,typeof,vocab,xml:id,xml:lang}(#PCDATA)
ltx:Math{!xml:*,*:*,about,aboutidref,aboutlabelref,backgroundcolor,class,content,content-tex,cssstyle,datatype,description,fragid,framecolor,framed,imagedepth,imageheight,imagesrc,imagewidth,lexemes,mode,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,tex,text,typeof,vocab,xml:id,xml:lang}(ltx:XMath)
ltx:Math{!xml:*,*:*,about,aboutidref,aboutlabelref,backgroundcolor,class,content,content-tex,cssstyle,datatype,description,fragid,framecolor,framed,imagedepth,imageheight,imagesrc,imagewidth,intent,lexemes,mode,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,tex,text,typeof,vocab,xml:id,xml:lang}(ltx:XMath)
ltx:MathBranch{!xml:*,*:*,about,aboutidref,aboutlabelref,class,content,cssstyle,datatype,format,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,typeof,vocab,xml:lang}(ltx:Math,ltx:td,ltx:tr)
ltx:MathFork{!xml:*,*:*,about,aboutidref,aboutlabelref,class,content,cssstyle,datatype,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,typeof,vocab,xml:lang}(ltx:Math,ltx:MathBranch,ltx:text)
ltx:TOC{!xml:*,*:*,about,aboutidref,aboutlabelref,class,content,cssstyle,datatype,format,lists,name,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,scope,select,show,typeof,vocab,xml:lang}(ltx:title,ltx:toclist)
ltx:XMApp{!xml:*,*:*,about,aboutidref,aboutlabelref,align,backgroundcolor,class,color,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,framecolor,framed,height,href,lpadding,meaning,name,omcd,opacity,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:ERROR,ltx:XMApp,ltx:XMArg,ltx:XMArray,ltx:XMDual,ltx:XMHint,ltx:XMRef,ltx:XMText,ltx:XMTok,ltx:XMWrap)
ltx:XMArg{!xml:*,*:*,about,aboutidref,aboutlabelref,align,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,height,href,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,rule,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:ERROR,ltx:XMApp,ltx:XMArg,ltx:XMArray,ltx:XMDual,ltx:XMHint,ltx:XMRef,ltx:XMText,ltx:XMTok,ltx:XMWrap)
ltx:XMArray{!xml:*,*:*,about,aboutidref,aboutlabelref,align,class,colsep,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,height,href,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rowsep,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:XMRow)
ltx:XMApp{!xml:*,*:*,about,aboutidref,aboutlabelref,align,arg,backgroundcolor,class,color,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,framecolor,framed,height,href,intent,lpadding,meaning,name,omcd,opacity,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:ERROR,ltx:XMApp,ltx:XMArg,ltx:XMArray,ltx:XMDual,ltx:XMHint,ltx:XMRef,ltx:XMText,ltx:XMTok,ltx:XMWrap)
ltx:XMArg{!xml:*,*:*,about,aboutidref,aboutlabelref,align,arg,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,height,href,intent,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,rule,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:ERROR,ltx:XMApp,ltx:XMArg,ltx:XMArray,ltx:XMDual,ltx:XMHint,ltx:XMRef,ltx:XMText,ltx:XMTok,ltx:XMWrap)
ltx:XMArray{!xml:*,*:*,about,aboutidref,aboutlabelref,align,arg,class,colsep,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,height,href,intent,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rowsep,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:XMRow)
ltx:XMCell{!xml:*,*:*,about,aboutidref,aboutlabelref,align,backgroundcolor,border,class,colspan,content,cssstyle,datatype,fragid,framecolor,framed,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,rowspan,thead,typeof,vocab,width,xml:id,xml:lang}(ltx:ERROR,ltx:XMApp,ltx:XMArg,ltx:XMArray,ltx:XMDual,ltx:XMHint,ltx:XMRef,ltx:XMText,ltx:XMTok,ltx:XMWrap)
ltx:XMDual{!xml:*,*:*,about,aboutidref,aboutlabelref,align,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,height,href,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:ERROR,ltx:XMApp,ltx:XMArg,ltx:XMArray,ltx:XMDual,ltx:XMHint,ltx:XMRef,ltx:XMText,ltx:XMTok,ltx:XMWrap)
ltx:XMHint{!xml:*,*:*,about,aboutidref,aboutlabelref,align,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,height,href,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}()
ltx:XMRef{!xml:*,*:*,about,aboutidref,aboutlabelref,align,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,height,href,idref,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}()
ltx:XMDual{!xml:*,*:*,about,aboutidref,aboutlabelref,align,arg,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,height,href,intent,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:ERROR,ltx:XMApp,ltx:XMArg,ltx:XMArray,ltx:XMDual,ltx:XMHint,ltx:XMRef,ltx:XMText,ltx:XMTok,ltx:XMWrap)
ltx:XMHint{!xml:*,*:*,about,aboutidref,aboutlabelref,align,arg,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,height,href,intent,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}()
ltx:XMRef{!xml:*,*:*,about,aboutidref,aboutlabelref,align,arg,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,height,href,idref,intent,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}()
ltx:XMRow{!xml:*,*:*,about,aboutidref,aboutlabelref,backgroundcolor,class,content,cssstyle,datatype,fragid,framecolor,framed,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,typeof,vocab,xml:id,xml:lang}(ltx:XMCell)
ltx:XMText{!xml:*,*:*,about,aboutidref,aboutlabelref,align,backgroundcolor,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,framecolor,framed,height,href,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(#PCDATA,ltx:ERROR,ltx:Math,ltx:anchor,ltx:bibref,ltx:break,ltx:cite,ltx:del,ltx:emph,ltx:glossaryref,ltx:graphics,ltx:inline-block,ltx:inline-description,ltx:inline-enumerate,ltx:inline-itemize,ltx:inline-logical-block,ltx:inline-sectional-block,ltx:picture,ltx:rawhtml,ltx:rawliteral,ltx:ref,ltx:rule,ltx:sub,ltx:sup,ltx:tabular,ltx:text,ltx:verbatim,svg:svg)
ltx:XMTok{!xml:*,*:*,about,aboutidref,aboutlabelref,align,backgroundcolor,class,color,content,cssstyle,datatype,decl_id,depth,enclose,float,font,fontsize,fragid,framecolor,framed,height,href,lpadding,mathstyle,meaning,name,omcd,opacity,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,stretchy,thickness,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(#PCDATA)
ltx:XMWrap{!xml:*,*:*,about,aboutidref,aboutlabelref,align,backgroundcolor,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,framecolor,framed,height,href,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,rule,scriptpos,style,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:ERROR,ltx:XMApp,ltx:XMArg,ltx:XMArray,ltx:XMDual,ltx:XMHint,ltx:XMRef,ltx:XMText,ltx:XMTok,ltx:XMWrap)
ltx:XMText{!xml:*,*:*,about,aboutidref,aboutlabelref,align,arg,backgroundcolor,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,framecolor,framed,height,href,intent,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(#PCDATA,ltx:ERROR,ltx:Math,ltx:anchor,ltx:bibref,ltx:break,ltx:cite,ltx:del,ltx:emph,ltx:glossaryref,ltx:graphics,ltx:inline-block,ltx:inline-description,ltx:inline-enumerate,ltx:inline-itemize,ltx:inline-logical-block,ltx:inline-sectional-block,ltx:picture,ltx:rawhtml,ltx:rawliteral,ltx:ref,ltx:rule,ltx:sub,ltx:sup,ltx:tabular,ltx:text,ltx:verbatim,svg:svg)
ltx:XMTok{!xml:*,*:*,about,aboutidref,aboutlabelref,align,arg,backgroundcolor,class,color,content,cssstyle,datatype,decl_id,depth,enclose,float,font,fontsize,fragid,framecolor,framed,height,href,intent,lpadding,mathstyle,meaning,name,omcd,opacity,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,scriptpos,stretchy,thickness,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(#PCDATA)
ltx:XMWrap{!xml:*,*:*,about,aboutidref,aboutlabelref,align,arg,backgroundcolor,class,content,cssstyle,datatype,decl_id,depth,enclose,float,fragid,framecolor,framed,height,href,intent,lpadding,meaning,name,omcd,possibleFunction,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,role,rpadding,rule,scriptpos,style,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:ERROR,ltx:XMApp,ltx:XMArg,ltx:XMArray,ltx:XMDual,ltx:XMHint,ltx:XMRef,ltx:XMText,ltx:XMTok,ltx:XMWrap)
ltx:XMath{!xml:*,*:*,about,aboutidref,aboutlabelref,class,content,cssstyle,datatype,fragid,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,typeof,vocab,xml:id,xml:lang}(ltx:ERROR,ltx:XMApp,ltx:XMArg,ltx:XMArray,ltx:XMDual,ltx:XMHint,ltx:XMRef,ltx:XMText,ltx:XMTok,ltx:XMWrap)
ltx:_CaptureBlock_{!xml:*,*:*,about,aboutidref,aboutlabelref,align,backgroundcolor,class,content,cssstyle,datatype,depth,float,fragid,framecolor,framed,height,inlist,labels,prefix,property,rdf-prefixes,rel,resource,resourceidref,resourcelabelref,rev,typeof,vattach,vocab,width,xml:id,xml:lang,xoffset,yoffset}(ltx:ERROR,ltx:TOC,ltx:block,ltx:break,ltx:caption,ltx:chapter,ltx:declare,ltx:description,ltx:enumerate,ltx:equation,ltx:equationgroup,ltx:figure,ltx:float,ltx:glossarydefinition,ltx:graphics,ltx:indexmark,ltx:inline-block,ltx:inline-description,ltx:inline-enumerate,ltx:inline-itemize,ltx:inline-logical-block,ltx:inline-sectional-block,ltx:itemize,ltx:listing,ltx:logical-block,ltx:navigation,ltx:note,ltx:p,ltx:pagination,ltx:para,ltx:paragraph,ltx:part,ltx:picture,ltx:proof,ltx:quote,ltx:rawhtml,ltx:rawliteral,ltx:rdf,ltx:resource,ltx:rule,ltx:section,ltx:sectional-block,ltx:sidebar,ltx:slide,ltx:slidesequence,ltx:subsection,ltx:subsubsection,ltx:table,ltx:tabular,ltx:theorem,ltx:toccaption,ltx:verbatim,svg:foreignObject,svg:g,svg:svg)
ltx:abstract{!xml:*,*:*,about,aboutidref,aboutlabelref,class,content,cssstyle,datatype,name,prefix,property,rel,resource,resourceidref,resourcelabelref,rev,typeof,vocab,xml:lang}(ltx:ERROR,ltx:block,ltx:break,ltx:declare,ltx:description,ltx:enumerate,ltx:equation,ltx:equationgroup,ltx:glossarydefinition,ltx:graphics,ltx:indexmark,ltx:inline-block,ltx:inline-description,ltx:inline-enumerate,ltx:inline-itemize,ltx:inline-logical-block,ltx:inline-sectional-block,ltx:itemize,ltx:listing,ltx:navigation,ltx:note,ltx:p,ltx:pagination,ltx:picture,ltx:quote,ltx:rawhtml,ltx:rawliteral,ltx:rdf,ltx:resource,ltx:rule,ltx:tabular,ltx:verbatim,svg:svg)
Expand Down
Loading