Name | TexSoup JSON |
Version |
0.3.1
JSON |
| download |
home_page | https://github.com/alvinwan/TexSoup |
Summary | parses valid LaTeX and provides variety of Beautiful-Soup-esque methods and Pythonic idioms for iterating over and searching the parse tree |
upload_time | 2020-08-03 10:14:56 |
maintainer | |
docs_url | None |
author | Alvin Wan |
requires_python | |
license | BSD |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
|
coveralls test coverage |
|
<a href="https://texsoup.alvinwan.com"><img src="https://user-images.githubusercontent.com/2068077/55692228-b7f92d00-595a-11e9-93a2-90090a361d12.png" width="80px"></a>
# [TexSoup](https://texsoup.alvinwan.com)
[](https://pypi.python.org/pypi/TexSoup/)
[](https://travis-ci.org/alvinwan/TexSoup)
[](https://coveralls.io/github/alvinwan/TexSoup?branch=master)
TexSoup is a fault-tolerant, Python3 package for searching, navigating, and modifying LaTeX documents.
- [Getting Started](https://github.com/alvinwan/TexSoup#Getting-Started)
- [Installation](https://github.com/alvinwan/TexSoup#Installation)
- [API Reference](http://texsoup.alvinwan.com/docs/data.html)
Created by [Alvin Wan](http://alvinwan.com) + [contributors](https://github.com/alvinwan/TexSoup/graphs/contributors).
# Getting Started
To parse a $LaTeX$ document, pass an open filehandle or a string into the
`TexSoup` constructor.
``` python
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.
```python
>>> 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](https://texsoup.alvinwan.com/docs/quickstart.html). Or, try TexSoup [online, via repl.it →](https://repl.it/@ALVINWAN1/texsoup)
Links:
- [Quickstart Guide: how and when to use TexSoup](http://texsoup.alvinwan.com/docs/quickstart.html)
- [Example Use Cases: counting references, resolving imports, and more](https://github.com/alvinwan/TexSoup/tree/master/examples)
# Installation
## Pip
TexSoup is published via PyPi, so you can install it via `pip`. The package
name is `TexSoup`:
```bash
$ pip install texsoup
```
## From source
Alternatively, you can install the package from source:
```bash
$ git clone https://github.com/alvinwan/TexSoup.git
$ cd TexSoup
$ pip install .
```
Raw data
{
"_id": null,
"home_page": "https://github.com/alvinwan/TexSoup",
"name": "TexSoup",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Alvin Wan",
"author_email": "hi@alvinwan.com",
"download_url": "https://files.pythonhosted.org/packages/84/58/1c503390ed1a81cdcbff811dbf7a54132994acef8dd2194d55cf657a9e97/TexSoup-0.3.1.tar.gz",
"platform": "",
"description": "<a href=\"https://texsoup.alvinwan.com\"><img src=\"https://user-images.githubusercontent.com/2068077/55692228-b7f92d00-595a-11e9-93a2-90090a361d12.png\" width=\"80px\"></a>\n\n# [TexSoup](https://texsoup.alvinwan.com)\n\n[](https://pypi.python.org/pypi/TexSoup/)\n[](https://travis-ci.org/alvinwan/TexSoup)\n[](https://coveralls.io/github/alvinwan/TexSoup?branch=master)\n\nTexSoup is a fault-tolerant, Python3 package for searching, navigating, and modifying LaTeX documents.\n\n- [Getting Started](https://github.com/alvinwan/TexSoup#Getting-Started)\n- [Installation](https://github.com/alvinwan/TexSoup#Installation)\n- [API Reference](http://texsoup.alvinwan.com/docs/data.html)\n\nCreated by [Alvin Wan](http://alvinwan.com) + [contributors](https://github.com/alvinwan/TexSoup/graphs/contributors).\n\n# Getting Started\n\nTo parse a $LaTeX$ document, pass an open filehandle or a string into the\n`TexSoup` constructor.\n\n``` python\nfrom TexSoup import TexSoup\nsoup = TexSoup(\"\"\"\n\\begin{document}\n\n\\section{Hello \\textit{world}.}\n\n\\subsection{Watermelon}\n\n(n.) A sacred fruit. Also known as:\n\n\\begin{itemize}\n\\item red lemon\n\\item life\n\\end{itemize}\n\nHere is the prevalence of each synonym.\n\n\\begin{tabular}{c c}\nred lemon & uncommon \\\\\nlife & common\n\\end{tabular}\n\n\\end{document}\n\"\"\")\n```\n\nWith the soupified $\\LaTeX$, you can now search and traverse the document tree.\nThe code below demonstrates the basic functions that TexSoup provides.\n\n```python\n>>> soup.section # grabs the first `section`\n\\section{Hello \\textit{world}.}\n>>> soup.section.name\n'section'\n>>> soup.section.string\n'Hello \\\\textit{world}.'\n>>> soup.section.parent.name\n'document'\n>>> soup.tabular\n\\begin{tabular}{c c}\nred lemon & uncommon \\\\\nlife & common\n\\end{tabular}\n>>> soup.tabular.args[0]\n'c c'\n>>> soup.item\n\\item red lemon\n>>> list(soup.find_all('item'))\n[\\item red lemon, \\item life]\n```\n\nFor more use cases, see [the Quickstart Guide](https://texsoup.alvinwan.com/docs/quickstart.html). Or, try TexSoup [online, via repl.it →](https://repl.it/@ALVINWAN1/texsoup)\n\nLinks:\n\n- [Quickstart Guide: how and when to use TexSoup](http://texsoup.alvinwan.com/docs/quickstart.html)\n- [Example Use Cases: counting references, resolving imports, and more](https://github.com/alvinwan/TexSoup/tree/master/examples)\n\n# Installation\n\n## Pip\n\nTexSoup is published via PyPi, so you can install it via `pip`. The package\nname is `TexSoup`:\n\n```bash\n$ pip install texsoup\n```\n\n## From source\n\nAlternatively, you can install the package from source:\n\n```bash\n$ git clone https://github.com/alvinwan/TexSoup.git\n$ cd TexSoup\n$ pip install .\n```",
"bugtrack_url": null,
"license": "BSD",
"summary": "parses valid LaTeX and provides variety of Beautiful-Soup-esque methods and Pythonic idioms for iterating over and searching the parse tree",
"version": "0.3.1",
"project_urls": {
"Download": "https://github.com/alvinwan/TexSoup/archive/0.3.1.zip",
"Homepage": "https://github.com/alvinwan/TexSoup"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5ca7e9eb0e14633710b51b8472a3beccc7d6a44d55a0a3ef4493ebb4b7977253",
"md5": "780702c5e214d105db52281655406245",
"sha256": "ae8f08d17f86a905b7c2ce01c9f2da613fbca0bcea78c71d727719e896045bed"
},
"downloads": -1,
"filename": "TexSoup-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "780702c5e214d105db52281655406245",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 27809,
"upload_time": "2024-02-28T09:15:28",
"upload_time_iso_8601": "2024-02-28T09:15:28.697654Z",
"url": "https://files.pythonhosted.org/packages/5c/a7/e9eb0e14633710b51b8472a3beccc7d6a44d55a0a3ef4493ebb4b7977253/TexSoup-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "84581c503390ed1a81cdcbff811dbf7a54132994acef8dd2194d55cf657a9e97",
"md5": "2130d0ed9648cbe0da1d6d15c6a2ce65",
"sha256": "3f6b2ad0abe3688a6656f544c1ba04d0eb25f423f8c377b7369f9ce061ddb70b"
},
"downloads": -1,
"filename": "TexSoup-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "2130d0ed9648cbe0da1d6d15c6a2ce65",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 26174,
"upload_time": "2020-08-03T10:14:56",
"upload_time_iso_8601": "2020-08-03T10:14:56.027082Z",
"url": "https://files.pythonhosted.org/packages/84/58/1c503390ed1a81cdcbff811dbf7a54132994acef8dd2194d55cf657a9e97/TexSoup-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-08-03 10:14:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alvinwan",
"github_project": "TexSoup",
"travis_ci": true,
"coveralls": true,
"github_actions": false,
"lcname": "texsoup"
}