A tool to strip LaTeX files for Grammarly.
Project description
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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file texstripper-0.1.0.tar.gz.
File metadata
- Download URL: texstripper-0.1.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b274f26ccd372cd79bab5ee961aed166933a8278a342bd740979adee4b2b8493
|
|
| MD5 |
cdc2e21fdc325709abbb6d0dc320330d
|
|
| BLAKE2b-256 |
9b6c1288ecf6dd532ff07352a4bbb234f77bd3455a7c0f895aa40c417b54bc58
|
File details
Details for the file texstripper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: texstripper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b3fd8def3c65ef5126bb124078350d9fdf52316167b3e26a446d6dbf4bb6ab1
|
|
| MD5 |
dff99969865258e85b42b738045eb4ac
|
|
| BLAKE2b-256 |
78928cbe4ec584a029cfc2401607ee4d7694fd107a206a75c08e48c9cb8a97f8
|