TeXML
Previous step: “More TeXML

Better layout

This example demonstrates how to tune the layout of a generated LaTeX code. The result can be made indistinguishable from code written by a human.

On the previous step, we got the following LaTeX document:

\documentclass[a4paper]{article} ....
\begin{document}
Hello, {\it{}World}!
\end{document}

A better code layout is:

\documentclass[a4paper]{article}
....
\begin{document}
Hello, {\it World}!
\end{document}

The source TeXML code uses the attributes nl2 and gr to tune the layout:

<TeXML>
  <cmd name="documentclass" nl2="1">
    <opt>a4paper</opt>
    <parm>article</parm>
  </cmd>
  ....
  <env name="document">
    Hello, <group><cmd name="it" gr="0"/>World</group>!
  </env>
</TeXML>

Next step: “PDF literal strings


TeXML
This page: http://getfo.org/texml/tour_better.html