TexStripper
Motivation
Grammarly is a popular tool for checking grammar and spelling errors in English text. However, LaTeX documents are not well supported by Grammarly, as LaTeX commands will interfere with the grammar checking process. Removing LaTeX syntax from the document is tiresome. TexStripper aims to provide a simple tool to strip LaTeX syntax from the document, so that the document can be checked by Grammarly.
Installation and Usage
- Clone the repository:
git clone https://github.com/AllenYolk/tex-stripper.git
- Run the script with Python:
python texstripper/cli.py -s <path_to_source_file> -o <path_to_output_file>
Functionality
Read TeX scripts recursively according to the \input{...} and \include{...} commands.
- So, you only need to run
texstripperonce onmain.tex, and all the subfiles will be processed.
Remove the following LaTeX components from a .tex file:
- Comments:
% ..., both between lines and inline - Preamble: the part before
\begin{document} - Authors:
\author{...} - Labels:
\label{...} - Bibliography:
\bibliography{...},\bibliographystyle{...} - Miscellaneous inline commands:
\maketitle,\linenumbers,\nolinenumbers,\newpage, ...- See
texstripper/tex_utils/remove.pyfor more details.
- See
Replace the following LaTeX components with a placeholder:
- Citations:
\cite{...}or~\cite{...} - References:
\ref{...}or~\ref{...} - Equation references:
\eqref{...}or~\eqref{...} - Named references:
\nameref{...}or~\nameref{...} - Inline math:
$...$ - Math blocks:
\begin{equation} ... \end{equation},\begin{align} ... \end{align} - Input & include:
\input{...},\include{...}
Unwrap the following LaTex commands while keeping the contents:
- Title:
\title{...} - Document:
\begin{document} ... \end{document} - Abstract:
\begin{abstract} ... \end{abstract} - Part & chapter & section & paragraph:
\part{},\chapter{...},\section{...},\subsection{...},\subsubsection{...},\paragraph{...},\subparagraph{...} - Bold:
\textbf{...} - Italic:
\textit{...} - Underline:
\underline{...},\uline{...} - Emphasis:
\emph{...} - Color:
\textcolor{...}{...}; only the second argument is kept - Footnote:
\footnote{...} - List:
\begin{itemize} ... \item ... \end{itemize},\begin{enumerate} ... \item ... \end{enumerate}; only the list items are kept - Table:
\begin{table} ... \end{table}; only the caption is kept - Figure:
\begin{figure} ... \end{figure}; only the caption is kept - Pseudocode:
\begin{algorithm} ... \end{algorithm}; only the caption is kept
TODO
- Add
setup.pyto maketexstrippera globally available command-line tool.
Acknowledgements
- This project is inspired by my-yy's JavaScript-based repository MyGrammarly. We appreciate their open-source work!
Metadata
Release files for texstripper 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| texstripper-0.1.0.tar.gz | 8.2 kB | Without provenance | Details for texstripper-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| texstripper-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for texstripper-0.1.0-py3-none-any.whl |
Total release size: 16.7 kB
Release files / texstripper-0.1.0.tar.gz
| Download URL | texstripper-0.1.0.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b274f26ccd372cd79bab5ee961aed166933a8278a342bd740979adee4b2b8493
|
|
BLAKE2b-256 checksum How to use checksums |
9b6c1288ecf6dd532ff07352a4bbb234f77bd3455a7c0f895aa40c417b54bc58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / texstripper-0.1.0-py3-none-any.whl
| Download URL | texstripper-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b3fd8def3c65ef5126bb124078350d9fdf52316167b3e26a446d6dbf4bb6ab1
|
|
BLAKE2b-256 checksum How to use checksums |
78928cbe4ec584a029cfc2401607ee4d7694fd107a206a75c08e48c9cb8a97f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Security for texstripper 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.