Skip to content

Instantly share code, notes, and snippets.

@rorybyrne
Created April 17, 2021 07:35
Show Gist options
  • Save rorybyrne/6ebd809f7c21678d587787623945db9e to your computer and use it in GitHub Desktop.
Save rorybyrne/6ebd809f7c21678d587787623945db9e to your computer and use it in GitHub Desktop.
LaTeXML output of a sample LaTeX document (https://guides.nyu.edu/LaTeX/sample-document)
<?xml version="1.0" encoding="UTF-8"?>
<?latexml searchpaths="/home/rory/projects/personal/notpaper/docs,/home/rory/projects/personal/notpaper"?>
<!-- %This is a simple sample document. For more complicated documents take a look in the excersice tab. Note that everything that comes after a % symbol is treated as comment and ignored when the code is compiled. --><?latexml class="article"?>
<?latexml package="amsmath"?>
<!-- %Sets article title --><!-- %Sets authors name --><!-- %Sets date for date compiled --><!-- %The preamble ends with the command “begin–document˝ --><?latexml RelaxNGSchema="LaTeXML"?>
<document xmlns="http://dlmf.nist.gov/LaTeXML" class="ltx_authors_1line">
<resource src="LaTeXML.css" type="text/css"/>
<resource src="ltx-article.css" type="text/css"/>
<title>Simple Sample</title>
<creator role="author">
<personname>My Name</personname>
</creator>
<date role="creation">April 17, 2021</date>
<!-- %All begin commands must be paired with an end command somewhere
%creates title using infromation in preamble (title, author, date)--> <section inlist="toc" xml:id="S1">
<tags>
<tag>1</tag>
<tag role="refnum">1</tag>
<tag role="typerefnum">§1</tag>
</tags>
<title><tag close=" ">1</tag>Hello World!</title>
<!-- %creates a section --> <para xml:id="S1.p1">
<p><text font="bold">Hello World!</text> Today I am learning LaTeX. <!-- %notice how the command will end at the first non-alphabet charecter such as the . after “LaTeX -->LaTeX is a great program for writing math. I can write in line math such as <Math mode="inline" tex="a^{2}+b^{2}=c^{2}" text="a ^ 2 + b ^ 2 = c ^ 2" xml:id="S1.p1.m1">
<XMath>
<XMApp>
<XMTok meaning="equals" role="RELOP">=</XMTok>
<XMApp>
<XMTok meaning="plus" role="ADDOP">+</XMTok>
<XMApp>
<XMTok role="SUPERSCRIPTOP" scriptpos="post1"/>
<XMTok font="italic" role="UNKNOWN">a</XMTok>
<XMTok fontsize="70%" meaning="2" role="NUMBER">2</XMTok>
</XMApp>
<XMApp>
<XMTok role="SUPERSCRIPTOP" scriptpos="post1"/>
<XMTok font="italic" role="UNKNOWN">b</XMTok>
<XMTok fontsize="70%" meaning="2" role="NUMBER">2</XMTok>
</XMApp>
</XMApp>
<XMApp>
<XMTok role="SUPERSCRIPTOP" scriptpos="post1"/>
<XMTok font="italic" role="UNKNOWN">c</XMTok>
<XMTok fontsize="70%" meaning="2" role="NUMBER">2</XMTok>
</XMApp>
</XMApp>
</XMath>
</Math> <!-- %$ tells LaTexX to compile as math -->. I can also give equations their own space:</p>
<equation xml:id="S1.E1">
<tags>
<tag>(1)</tag>
<tag role="refnum">1</tag>
</tags>
<Math mode="display" tex="\gamma^{2}+\theta^{2}=\omega^{2}" text="gamma ^ 2 + theta ^ 2 = omega ^ 2" xml:id="S1.E1.m1">
<XMath>
<XMApp>
<XMTok meaning="equals" role="RELOP">=</XMTok>
<XMApp>
<XMTok meaning="plus" role="ADDOP">+</XMTok>
<XMApp>
<XMTok role="SUPERSCRIPTOP" scriptpos="post1"/>
<!-- %Creates an equation environment and is compiled as math --> <XMTok font="italic" name="gamma" role="UNKNOWN">γ</XMTok>
<XMTok fontsize="70%" meaning="2" role="NUMBER">2</XMTok>
</XMApp>
<XMApp>
<XMTok role="SUPERSCRIPTOP" scriptpos="post1"/>
<XMTok font="italic" name="theta" role="UNKNOWN">θ</XMTok>
<XMTok fontsize="70%" meaning="2" role="NUMBER">2</XMTok>
</XMApp>
</XMApp>
<XMApp>
<XMTok role="SUPERSCRIPTOP" scriptpos="post1"/>
<XMTok font="italic" name="omega" role="UNKNOWN">ω</XMTok>
<XMTok fontsize="70%" meaning="2" role="NUMBER">2</XMTok>
</XMApp>
</XMApp>
</XMath>
</Math>
</equation>
<p>If I do not leave any blank lines LaTeX will continue this text without making it into a new paragraph. Notice how there was no indentation in the text after equation (1).
Also notice how even though I hit enter after that sentence and here <Math mode="inline" tex="\downarrow" text="downarrow" xml:id="S1.p1.m2">
<XMath>
<XMTok name="downarrow" role="ARROW">↓</XMTok>
</XMath>
</Math>
<!-- %**** sample.tex Line 25 **** -->LaTeX formats the sentence without any break. Also look how it doesn’t matter how many spaces I put between my words.</p>
</para>
<para xml:id="S1.p2">
<p>For a new paragraph I can leave a blank space in my code.</p>
</para>
</section>
</document>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment