23.12.2012 Views

The Communications of the TEX Users Group Volume 30 ... - TUG

The Communications of the TEX Users Group Volume 30 ... - TUG

The Communications of the TEX Users Group Volume 30 ... - TUG

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

174 <strong>TUG</strong>boat, <strong>Volume</strong> <strong>30</strong> (2009), No. 2<br />

Ross Moore<br />

\pdfstructelem attr{/S /Formula} 3 27<br />

\pdfstructelem attr{/S /math} 27 28<br />

\pdfstructelem attr{/S /mrow} 28 29<br />

\pdfstructelem attr{/S /msup} 29 <strong>30</strong><br />

\pdfstructelem attr{/S /mrow} <strong>30</strong> 31<br />

\pdfstructelem attr{/S /mo} 31 32<br />

\pdfstartmarkedcontent attr{/ActualText(\050)<br />

/Alt(, open bracket, )} 32 {mo}\biggl( \pdfendmarkedcontent<br />

\pdfstructelem attr{/S /mi} 31 33<br />

\pdfstartmarkedcontent attr{/Alt( alpha )}noendtext<br />

33 {mi}\alpha \pdfendmarkedcontent<br />

\pdfstructelem attr{/S /mo} 31 34<br />

\pdfstartmarkedcontent attr{/Alt( plus )}noendtext<br />

34 {mo}+ \pdfendmarkedcontent<br />

...<br />

<strong>The</strong> primitive \pdfstructelem requires two numbers specifying a unique<br />

identifier for <strong>the</strong> structure node being created, preceded by <strong>the</strong> identifier <strong>of</strong> its<br />

parent node, and attributes including <strong>the</strong> type <strong>of</strong> tag. Leaf nodes, constructed<br />

with \pdfstartmarkedcontent, require <strong>the</strong> identifier <strong>of</strong> <strong>the</strong> parent structure<br />

node. <strong>The</strong>ir attributes can include /Alt text to be read by a screen-reader,<br />

and an /ActualText alternative for text-extraction. <strong>The</strong> kind <strong>of</strong> node for a<br />

ma<strong>the</strong>matical symbol agrees with its parent structure node, (e.g., /mi, /mo or<br />

/mn). This is followed by <strong>the</strong> <strong>TEX</strong> coding to produce a visual representation,<br />

terminatedby\pdfendmarkedcontent.Part<strong>of</strong><strong>the</strong> PDFcontentstreamresulting<br />

from this coding is given below, showing how <strong>the</strong> tagging is interspersed with<br />

positioning and font-changing commands, and <strong>the</strong> font characters <strong>the</strong>mselves.<br />

1 0 0 1 70.69 -23.949 cm<br />

/mo BDC<br />

1 0 0 1 0 17.036 cm BT<br />

/F1 9.9626 Tf/F18 1 Tf( )Tj/F1 9.9626 Tf [(\040)]TJ ET EMC<br />

1 0 0 1 7.887 -17.036 cm<br />

/mi BDC BT<br />

/F11 9.9626 Tf/F18 1 Tf( )Tj/F11 9.9626 Tf [(\013)]TJ ET EMC<br />

1 0 0 1 6.41 0 cm<br />

/mo BDC<br />

1 0 0 1 2.214 0 cm BT<br />

/F8 9.9626 Tf/F18 1 Tf( )Tj/F8 9.9626 Tf [(+)]TJ ET EMC<br />

This kind <strong>of</strong> coding, directly in pdf<strong>TEX</strong> primitives, is really only useful for<br />

testing and “pro<strong>of</strong> <strong>of</strong> concept” examples, such as Figure 2. Any mistake in <strong>the</strong><br />

numerical identifiers can result in a broken PDF that may appear to render<br />

properly, but never<strong>the</strong>less crashes Acrobat due to a malformed structure tree.<br />

Handling those numerical identifiers and parent relationships is something<br />

better done using an extra layer <strong>of</strong> L A<strong>TEX</strong> macros, as in <strong>the</strong> coding example<br />

below. A \taginlinemath macro sets up an enclosing /Formula structure tag.<br />

Presentation MathML structure is specified using \tagmathbranch. MathML<br />

content tags are associated with <strong>TEX</strong> source using \tagmathbleaf, which has

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!