latexq is an experimental CLI for context management in LaTeX manuscripts
Project description
latexq
latexq is an experimental CLI for context management in LaTeX manuscripts.
latexq can query and reshape paper-like LaTeX manuscripts into smaller parts to improve AI-assisted review and editing workflows.
In practice, a common workflow when writing is to review and revise a smaller part of a manuscript at a time.
latexq is designed to help manage scope when this workflow is adapted with AI:
-
For review,
lq selecthelps extract only the parts that provide sufficient context for the review. This makes it easier to send only a portion of a manuscript to an AI for review, and withlq selectone can automate (and script) context extraction into a repeatable process. -
For editing,
lq splithelps keep the manuscript organized so that each section (or subsection) is its own file. Limiting the content in each file makes it easier to keep AI-generated edits limited to the intended part; a common challenge with AI tools is that they are overeager to make edits.
The purpose of latexq is intentionally narrow.
It does not interact with GenAI endpoints and has no dependency on AI APIs.
AI-assisted editing is usually done interactively within an editor like VS Code or an agentic tool like Claude Code.
To extract structure in LaTeX manuscripts, latexq uses existing LaTeX commands like \section, \subsection, \appendix, \ref and \label commands.
For the full supported subset and parser constraints, see docs/latex-subset.md.
🚀 Getting started
Requirements
- Python 3.12+
📦 Installation
$ python -m pip install git+https://github.com/genai-latex-proofreader/latexq.git
From a local checkout:
$ python -m pip install .
Example command to extract one section
Input manuscript main.tex:
\documentclass{article}
\begin{document}
\section{Introduction}
\label{sec:intro}
This is the intro.
\section{Methods}
\label{sec:methods}
This is the methods section.
\end{document}
lq select \
--input-file main.tex \
--query '@sec:methods'
This emits the selected LaTeX fragment to stdout:
\section{Methods}
\label{sec:methods}
This is the methods section.
📚 Learn More
The core latexq commands are:
| Command | See | |
|---|---|---|
| 🔎 | lq select extracts parts of a manuscript for focused review or editing. |
docs/latexq-select.md |
| ✂️ | lq split splits a manuscript into smaller files so that each section or subsection is in its own file. |
docs/latexq-split.md |
| 📄 | lq flatten combines a manuscript into one .tex file. |
docs/latexq-flatten.md |
| 🔗 | lq graph builds a reference dependency graph showing which sections and subsections reference each other. |
docs/latexq-graph.md |
Specifications:
- docs/latex-subset.md: the supported LaTeX subset, parser assumptions, and structural constraints.
- docs/query-language.md: Defines the query language used by
lq selectandlq flattento extract part of a LaTeX manuscript.
Instructions for developing latexq can be found in docs/development.md.
Feedback and ideas is welcome.
⚖️ License
Copyright 2024-2026 Matias Dahl and contributors.
latexq is released under the MIT License, see LICENSE.md.
Large parts of latexq (both code and documentation) have been created with the assistance of AI-powered tools.
An earlier version of this work is https://github.com/genai-latex-proofreader/genai-latex-proofreader
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 latexq-0.1.0.tar.gz.
File metadata
- Download URL: latexq-0.1.0.tar.gz
- Upload date:
- Size: 125.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34f56345ed46703d9224b8c43089e0b679c275f2166adaa73a76ac8c9bb51526
|
|
| MD5 |
dc21f379a8a2e1346c0ae884bbaa881d
|
|
| BLAKE2b-256 |
f93319ad1420aa5d70b059540ba2fdda7d2ed95513db965779402ea2f41aa249
|
Provenance
The following attestation bundles were made for latexq-0.1.0.tar.gz:
Publisher:
release.yml on genai-latex-proofreader/latexq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
latexq-0.1.0.tar.gz -
Subject digest:
34f56345ed46703d9224b8c43089e0b679c275f2166adaa73a76ac8c9bb51526 - Sigstore transparency entry: 1535732364
- Sigstore integration time:
-
Permalink:
genai-latex-proofreader/latexq@d8a933b36803c8d72f9d8d6b85c761b9d59fb139 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/genai-latex-proofreader
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d8a933b36803c8d72f9d8d6b85c761b9d59fb139 -
Trigger Event:
push
-
Statement type:
File details
Details for the file latexq-0.1.0-py3-none-any.whl.
File metadata
- Download URL: latexq-0.1.0-py3-none-any.whl
- Upload date:
- Size: 50.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da93e520fff446a277e448625f61f4d05e87441f9c5e1b80a42f20fa5fa6f209
|
|
| MD5 |
e357af5ba58b79cca6a906819114a1c0
|
|
| BLAKE2b-256 |
f3c148666b6fd2b3b3b543b8c2bd293196ef68cb7a657be0eb0c7805b17f0e1b
|
Provenance
The following attestation bundles were made for latexq-0.1.0-py3-none-any.whl:
Publisher:
release.yml on genai-latex-proofreader/latexq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
latexq-0.1.0-py3-none-any.whl -
Subject digest:
da93e520fff446a277e448625f61f4d05e87441f9c5e1b80a42f20fa5fa6f209 - Sigstore transparency entry: 1535732517
- Sigstore integration time:
-
Permalink:
genai-latex-proofreader/latexq@d8a933b36803c8d72f9d8d6b85c761b9d59fb139 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/genai-latex-proofreader
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d8a933b36803c8d72f9d8d6b85c761b9d59fb139 -
Trigger Event:
push
-
Statement type: