Quick Start =================================== The below illustrates major categories of features that TexSoup supports--how it works, when it works, and how to leverage its utilities. .. note:: Full disclaimer: I'm a big fan of BeautifulSoup documentation and modeled these guides after theirs. How to Use ----------------------------------- Here is a LaTeX document that we'll be using as an example throughout:: >>> tex_doc = """ ... \begin{document} ... \section{Hello \textit{world}.} ... \subsection{Watermelon} ... (n.) A sacred fruit. Also known as: ... \begin{itemize} ... \item red lemon ... \item life ... \end{itemize} ... Here is the prevalence of each synonym, in Table \ref{table:synonyms}. ... \begin{tabular}{c c}\label{table:synonyms} ... red lemon & uncommon \\ \n ... life & common ... \end{tabular} ... \end{document} ... """ There are two ways to input $\LaTeX$ into TexSoup. Either pass in 1. a file buffer (`open('file.tex')`) OR 2. a string Below, we demonstrate using the string defined above:: >>> from TexSoup import TexSoup >>> soup = TexSoup(tex_doc) >>> soup \begin{document} \section{Hello \textit{world}.} \subsection{Watermelon} (n.) A sacred fruit. Also known as: \begin{itemize} \item red lemon \item life \end{itemize} Here is the prevalence of each synonym, in Table \ref{table:synonyms}. \begin{tabular}{c c}\label{table:synonyms} red lemon & uncommon \\ \n life & common \end{tabular} \end{document} With the soupified :math:`\LaTeX`, you can now search and traverse the document tree. The code below demonstrates the basic functions that TexSoup provides.:: >>> soup.section \section{Hello \textit{world}.} >>> soup.section.name 'section' >>> soup.section.string 'Hello \\textit{world}.' >>> soup.section.parent.name 'document' >>> soup.tabular \begin{tabular}{c c}\label{table:synonyms} red lemon & uncommon \\ \n life & common \end{tabular} >>> soup.tabular.args[0] 'c c' >>> soup.item \item red lemon ... >>> list(soup.find_all('item')) [\item red lemon , \item life ] One possible task is searching for references to a figure. For this (slightly) more advanced search, include arguments. For example, to search for all references to a particular label, search for ``ref{