alvinwan / Texsoup
Licence: bsd-2-clause
fault-tolerant Python3 package for searching, navigating, and modifying LaTeX documents
Stars: ✭ 157
Programming Languages
Projects that are alternatives of or similar to Texsoup
Algebra Latex
Parse and calculate latex formatted math
Stars: ✭ 20 (-87.26%)
Mutual labels: latex, parser
Whatsbook
Create books from WhatsApp group chats with Python and LaTeX
Stars: ✭ 147 (-6.37%)
Mutual labels: latex
Nasa Latex Docs
An easy and convenient package to create technical LaTeX documents.
Stars: ✭ 153 (-2.55%)
Mutual labels: latex
Xml2lua
XML Parser written entirely in Lua that works for Lua 5.1+. Convert XML to and from Lua Tables 🌖💱
Stars: ✭ 150 (-4.46%)
Mutual labels: parser
Omniparser
omniparser: a native Golang ETL streaming parser and transform library for CSV, JSON, XML, EDI, text, etc.
Stars: ✭ 148 (-5.73%)
Mutual labels: parser
Latex Koma Template
Generic template for midsize and larger documents based on KOMA script classes.
Stars: ✭ 151 (-3.82%)
Mutual labels: latex
Libnmea
Lightweight C library for parsing NMEA 0183 sentences
Stars: ✭ 146 (-7.01%)
Mutual labels: parser
Isobmff
C++ Library for ISO/IEC 14496-12 - ISO Base Media File Format (QuickTime, MPEG-4, HEIF, etc)
Stars: ✭ 157 (+0%)
Mutual labels: parser
Resumeparser
A simple resume parser used for extracting information from resumes
Stars: ✭ 150 (-4.46%)
Mutual labels: parser
Postagga
A Library to parse natural language in pure Clojure and ClojureScript
Stars: ✭ 152 (-3.18%)
Mutual labels: parser
Org Fragtog
Automatically toggle Org mode LaTeX fragment previews as the cursor enters and exits them
Stars: ✭ 149 (-5.1%)
Mutual labels: latex
Umbrella
"A collection of functional programming libraries that can be composed together.
Unlike a framework, thi.ng is a suite of instruments and you (the user) must be
the composer of. Geared towards versatility, not any specific type of music."
— @loganpowell via Twitter
Stars: ✭ 2,186 (+1292.36%)
Mutual labels: parser
Forge
A lightweight, elegant scripting language with built-in Rust-FFI.
Stars: ✭ 153 (-2.55%)
Mutual labels: parser
Koalanlp
KoalaNLP = Korean + Scala + NLP. 한국어 형태소 및 구문 분석기의 모음입니다.
Stars: ✭ 146 (-7.01%)
Mutual labels: parser
Gcfg
read INI-style configuration files into Go structs; supports user-defined types and subsections
Stars: ✭ 146 (-7.01%)
Mutual labels: parser
TexSoup
TexSoup is a fault-tolerant, Python3 package for searching, navigating, and modifying LaTeX documents.
Created by Alvin Wan + contributors.
Getting Started
To parse a $LaTeX$ document, pass an open filehandle or a string into the
TexSoup
constructor.
from TexSoup import TexSoup
soup = TexSoup("""
\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.
\begin{tabular}{c c}
red lemon & uncommon \\
life & common
\end{tabular}
\end{document}
""")
With the soupified $\LaTeX$, you can now search and traverse the document tree. The code below demonstrates the basic functions that TexSoup provides.
>>> soup.section # grabs the first `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}
red lemon & uncommon \\
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]
For more use cases, see the Quickstart Guide. Or, try TexSoup online, via repl.it →
Links:
- Quickstart Guide: how and when to use TexSoup
- Example Use Cases: counting references, resolving imports, and more
Installation
Pip
TexSoup is published via PyPi, so you can install it via pip
. The package
name is TexSoup
:
$ pip install texsoup
From source
Alternatively, you can install the package from source:
$ git clone https://github.com/alvinwan/TexSoup.git
$ cd TexSoup
$ pip install .
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].