Skip to main content

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 select helps 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 with lq select one can automate (and script) context extraction into a repeatable process.

  • For editing, lq split helps 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 select and lq flatten to 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

latexq-0.1.0.tar.gz (125.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

latexq-0.1.0-py3-none-any.whl (50.5 kB view details)

Uploaded Python 3

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

Hashes for latexq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 34f56345ed46703d9224b8c43089e0b679c275f2166adaa73a76ac8c9bb51526
MD5 dc21f379a8a2e1346c0ae884bbaa881d
BLAKE2b-256 f93319ad1420aa5d70b059540ba2fdda7d2ed95513db965779402ea2f41aa249

See more details on using hashes here.

Provenance

The following attestation bundles were made for latexq-0.1.0.tar.gz:

Publisher: release.yml on genai-latex-proofreader/latexq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for latexq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da93e520fff446a277e448625f61f4d05e87441f9c5e1b80a42f20fa5fa6f209
MD5 e357af5ba58b79cca6a906819114a1c0
BLAKE2b-256 f3c148666b6fd2b3b3b543b8c2bd293196ef68cb7a657be0eb0c7805b17f0e1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for latexq-0.1.0-py3-none-any.whl:

Publisher: release.yml on genai-latex-proofreader/latexq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page