texwatch 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
texwatch-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 texwatch contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,240 @@
1
+ Metadata-Version: 2.4
2
+ Name: texwatch
3
+ Version: 1.0.0
4
+ Summary: Terminal-based Overleaf-like LaTeX watcher: recompiles pdflatex on file change and refreshes the PDF.
5
+ Author: Arif
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/arif/texwatch
8
+ Keywords: latex,pdflatex,watch,overleaf,pdf
9
+ Classifier: Environment :: Console
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: MacOS
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: watchdog>=3.0
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest>=8; extra == "dev"
18
+ Requires-Dist: ruff>=0.6; extra == "dev"
19
+ Requires-Dist: mypy>=1.11; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # texwatch
23
+
24
+ [![CI](https://github.com/YOUR_USERNAME/texwatch/actions/workflows/ci.yml/badge.svg)](https://github.com/YOUR_USERNAME/texwatch/actions/workflows/ci.yml)
25
+ [![PyPI](https://img.shields.io/pypi/v/texwatch)](https://pypi.org/project/texwatch/)
26
+ [![Python](https://img.shields.io/pypi/pyversions/texwatch)](https://pypi.org/project/texwatch/)
27
+
28
+ **A terminal-based Overleaf for LaTeX.** Watch a `.tex` file, recompile
29
+ automatically when it changes — while you edit in your own editor and view the
30
+ PDF in whatever viewer you like. On top of that, **revision mode** produces a
31
+ journal-style "marked-up copy" (yellow highlights for additions, red
32
+ strikethrough for deletions) that updates live as you revise a manuscript.
33
+
34
+ ```text
35
+ $ texwatch manuscript/main.tex --revise manuscript/submitted-v1.tex
36
+
37
+ texwatch — watching manuscript/main.tex
38
+ engine : pdflatex
39
+ output : manuscript/build
40
+ deps : 3 file(s) also watched
41
+ debounce : 500 ms
42
+ revise : diffing against submitted-v1.tex (UNDERLINE)
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Why texwatch?
48
+
49
+ - **Zero-config watch**: edit anywhere (VS Code, vim, TeXShop, Notepad++),
50
+ texwatch rebuilds ~0.5 s after you save. Open the PDF in any viewer —
51
+ auto-refreshing ones (Skim, SumatraPDF, Evince, Zathura) will pick up each
52
+ rebuild live.
53
+ - **Dependency-aware**: edits to `\input`/`\include`/`\includegraphics`/
54
+ `\bibliography` files also trigger rebuilds.
55
+ - **Revision mode**: an auto-regenerating highlighted "diff PDF" for
56
+ journal resubmissions — no more manually marking changes.
57
+ - **Cross-platform**: macOS, Linux, Windows. Detects your TeX distribution
58
+ automatically.
59
+ - **Respectful of your machine**: debounced, queued compiles; artifacts in
60
+ `build/`; your last good PDF is never destroyed by a broken compile.
61
+
62
+ ---
63
+
64
+ ## Install
65
+
66
+ Requires **Python 3.9+** and a TeX distribution (MacTeX / TeX Live / MiKTeX).
67
+
68
+ ```bash
69
+ # any platform, isolated install (recommended)
70
+ pipx install texwatch
71
+ # or
72
+ uv tool install texwatch
73
+ # or
74
+ pip install --user texwatch
75
+ ```
76
+
77
+ Install TeX if needed:
78
+
79
+ | OS | Command |
80
+ |---|---|
81
+ | macOS | `brew install --cask mactex-no-gui` |
82
+ | Debian/Ubuntu | `sudo apt install texlive-latex-extra texlive-fonts-recommended` |
83
+ | Windows | [MiKTeX](https://miktex.org/download) |
84
+
85
+ For **revision mode**, latexdiff is required (ships with full TeX Live/MacTeX;
86
+ MiKTeX may prompt to install it).
87
+
88
+ ---
89
+
90
+ ## Quick start
91
+
92
+ ```bash
93
+ texwatch main.tex # watch & compile
94
+ texwatch main.tex --revise v1.tex # + live highlighted revision copy
95
+ ```
96
+
97
+ Try the bundled demo:
98
+
99
+ ```bash
100
+ git clone https://github.com/YOUR_USERNAME/texwatch && cd texwatch/examples
101
+ texwatch main.tex --revise v1.tex
102
+ # now edit main.tex or sections/intro.tex in another terminal; watch
103
+ # build/main.pdf and build/main-diff.pdf update — open them in any viewer
104
+ ```
105
+
106
+ ---
107
+
108
+ ## The manual
109
+
110
+ ### Concepts
111
+
112
+ ```
113
+ texwatch REVISED.tex --revise REFERENCE.tex
114
+ ```
115
+
116
+ | Argument | Role |
117
+ |---|---|
118
+ | `REVISED.tex` (positional) | The file you are editing. Watched and compiled. |
119
+ | `REFERENCE.tex` (`--revise`) | The frozen original (e.g. the submitted version). Used only as the "before" for latexdiff; never modified or compiled. |
120
+
121
+ Every time you save (in the revised file **or any of its dependencies**):
122
+
123
+ 1. A **debounce** timer waits for 500 ms of quiet (resets on each save).
124
+ 2. The clean PDF is compiled (up to 3 passes, resolving cross-references).
125
+ 3. In revision mode, `latexdiff --flatten` computes the diff and the marked-up
126
+ PDF is compiled right after. Diff failures never block the clean PDF.
127
+
128
+ ### Revision mode
129
+
130
+ ```bash
131
+ texwatch main.tex --revise submitted-v1.tex
132
+ ```
133
+
134
+ produces:
135
+
136
+ | Output | Content |
137
+ |---|---|
138
+ | `build/main.pdf` | your clean revised paper |
139
+ | `build/main-diff.pdf` | changes marked: **yellow highlight = added**, **red strikethrough = deleted** (blue text inside math) |
140
+
141
+ Options:
142
+
143
+ ```bash
144
+ --diff-type CFONT # latexdiff markup style (UNDERLINE, CFONT, CHANGEBAR, BOLD…)
145
+ --diff-out mydiff # custom output basename
146
+ --highlight classic # latexdiff's native markup instead of yellow
147
+ --no-diff # suspend diffing, keep watching (escape hatch)
148
+ ```
149
+
150
+ Tips from the trenches:
151
+
152
+ - Keep the baseline file **frozen** — it's your reference snapshot.
153
+ - If a diff compile fails on exotic packages (algorithm2e, minted, …), use
154
+ `--no-diff` to keep working, or try `--diff-type PDFCOMMENT`.
155
+ - Network drives (NFS/SMB, HPC home dirs) may not deliver file events:
156
+ add `--poll`.
157
+
158
+ ### All options
159
+
160
+ ```text
161
+ Positional:
162
+ tex the .tex file to watch
163
+
164
+ Build:
165
+ --out DIR build directory (default: ./build next to the tex file)
166
+ --engine ENGINE pdflatex | xelatex | lualatex (default: pdflatex)
167
+ --timeout S kill hung compiles after S seconds (default: 30)
168
+
169
+ Watching:
170
+ --debounce MS quiet period before compiling (default: 500)
171
+ --poll use polling (for NFS/SMB/network mounts)
172
+ --once compile once and exit
173
+ --clean remove the build directory and exit
174
+
175
+ Revision:
176
+ --revise OLD.tex enable revision mode against this baseline
177
+ --diff-type T latexdiff markup type (default: UNDERLINE)
178
+ --diff-out NAME basename for diff outputs (default: <stem>-diff)
179
+ --highlight STYLE yellow (default) or classic
180
+ --no-diff suspend diffing; clean PDF only
181
+
182
+ Output:
183
+ --quiet only show errors
184
+ --verbose debug output on stderr
185
+
186
+ Diagnostics:
187
+ --log-file FILE rotating debug log (attach to bug reports)
188
+ --version, --help
189
+ ```
190
+
191
+ ### Viewing the PDF
192
+
193
+ texwatch deliberately does **not** open or manage a PDF viewer — you open
194
+ `build/main.pdf` in whatever you prefer. Viewers that auto-reload on file
195
+ change give the full Overleaf-like experience:
196
+
197
+ | OS | Auto-reloading viewers |
198
+ |---|---|
199
+ | macOS | Skim |
200
+ | Linux | Evince, Okular, Zathura, qpdfview |
201
+ | Windows | SumatraPDF (doesn't lock the file, unlike Acrobat/Edge) |
202
+
203
+ ### Config discovery
204
+
205
+ texwatch finds TeX automatically: `PATH`, then known locations
206
+ (`/Library/TeX/texbin` on macOS; `C:\texlive\*\bin\windows` and MiKTeX dirs on
207
+ Windows; `/usr/local/texlive/*/bin/*` on Linux). Same for latexdiff.
208
+
209
+ ---
210
+
211
+ ## Troubleshooting
212
+
213
+ | Symptom | Fix |
214
+ |---|---|
215
+ | `pdflatex not found` | Install TeX (table above) or add its bin dir to PATH |
216
+ | `another texwatch instance appears to be running` | Another watcher holds the build dir. Close it, or delete `build/.texwatch.lock` |
217
+ | Nothing happens when I save on a network drive | Use `--poll` |
218
+ | PDF doesn't refresh in my viewer | Use an auto-reloading viewer (table above); Acrobat/Edge on Windows lock the file |
219
+ | Diff PDF doesn't rebuild but clean does | latexdiff hiccup — see the warning line; try `--no-diff` or another `--diff-type` |
220
+ | Weird characters in the diff | Ensure UTF-8 sources; texwatch falls back to cp1252 automatically |
221
+ | Something else broke | `texwatch ... --log-file tw.log --verbose` and attach `tw.log` to an issue |
222
+
223
+ ---
224
+
225
+ ## Development
226
+
227
+ ```bash
228
+ git clone https://github.com/YOUR_USERNAME/texwatch && cd texwatch
229
+ python -m venv .venv && source .venv/bin/activate
230
+ pip install -e ".[dev]"
231
+ pytest # unit + real-pdflatex integration tests
232
+ ruff check src tests
233
+ ```
234
+
235
+ Releases: push a tag `v1.0.0` — CI builds the wheel/sdist and publishes to
236
+ PyPI via trusted publishing.
237
+
238
+ ## License
239
+
240
+ MIT
@@ -0,0 +1,219 @@
1
+ # texwatch
2
+
3
+ [![CI](https://github.com/YOUR_USERNAME/texwatch/actions/workflows/ci.yml/badge.svg)](https://github.com/YOUR_USERNAME/texwatch/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/texwatch)](https://pypi.org/project/texwatch/)
5
+ [![Python](https://img.shields.io/pypi/pyversions/texwatch)](https://pypi.org/project/texwatch/)
6
+
7
+ **A terminal-based Overleaf for LaTeX.** Watch a `.tex` file, recompile
8
+ automatically when it changes — while you edit in your own editor and view the
9
+ PDF in whatever viewer you like. On top of that, **revision mode** produces a
10
+ journal-style "marked-up copy" (yellow highlights for additions, red
11
+ strikethrough for deletions) that updates live as you revise a manuscript.
12
+
13
+ ```text
14
+ $ texwatch manuscript/main.tex --revise manuscript/submitted-v1.tex
15
+
16
+ texwatch — watching manuscript/main.tex
17
+ engine : pdflatex
18
+ output : manuscript/build
19
+ deps : 3 file(s) also watched
20
+ debounce : 500 ms
21
+ revise : diffing against submitted-v1.tex (UNDERLINE)
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Why texwatch?
27
+
28
+ - **Zero-config watch**: edit anywhere (VS Code, vim, TeXShop, Notepad++),
29
+ texwatch rebuilds ~0.5 s after you save. Open the PDF in any viewer —
30
+ auto-refreshing ones (Skim, SumatraPDF, Evince, Zathura) will pick up each
31
+ rebuild live.
32
+ - **Dependency-aware**: edits to `\input`/`\include`/`\includegraphics`/
33
+ `\bibliography` files also trigger rebuilds.
34
+ - **Revision mode**: an auto-regenerating highlighted "diff PDF" for
35
+ journal resubmissions — no more manually marking changes.
36
+ - **Cross-platform**: macOS, Linux, Windows. Detects your TeX distribution
37
+ automatically.
38
+ - **Respectful of your machine**: debounced, queued compiles; artifacts in
39
+ `build/`; your last good PDF is never destroyed by a broken compile.
40
+
41
+ ---
42
+
43
+ ## Install
44
+
45
+ Requires **Python 3.9+** and a TeX distribution (MacTeX / TeX Live / MiKTeX).
46
+
47
+ ```bash
48
+ # any platform, isolated install (recommended)
49
+ pipx install texwatch
50
+ # or
51
+ uv tool install texwatch
52
+ # or
53
+ pip install --user texwatch
54
+ ```
55
+
56
+ Install TeX if needed:
57
+
58
+ | OS | Command |
59
+ |---|---|
60
+ | macOS | `brew install --cask mactex-no-gui` |
61
+ | Debian/Ubuntu | `sudo apt install texlive-latex-extra texlive-fonts-recommended` |
62
+ | Windows | [MiKTeX](https://miktex.org/download) |
63
+
64
+ For **revision mode**, latexdiff is required (ships with full TeX Live/MacTeX;
65
+ MiKTeX may prompt to install it).
66
+
67
+ ---
68
+
69
+ ## Quick start
70
+
71
+ ```bash
72
+ texwatch main.tex # watch & compile
73
+ texwatch main.tex --revise v1.tex # + live highlighted revision copy
74
+ ```
75
+
76
+ Try the bundled demo:
77
+
78
+ ```bash
79
+ git clone https://github.com/YOUR_USERNAME/texwatch && cd texwatch/examples
80
+ texwatch main.tex --revise v1.tex
81
+ # now edit main.tex or sections/intro.tex in another terminal; watch
82
+ # build/main.pdf and build/main-diff.pdf update — open them in any viewer
83
+ ```
84
+
85
+ ---
86
+
87
+ ## The manual
88
+
89
+ ### Concepts
90
+
91
+ ```
92
+ texwatch REVISED.tex --revise REFERENCE.tex
93
+ ```
94
+
95
+ | Argument | Role |
96
+ |---|---|
97
+ | `REVISED.tex` (positional) | The file you are editing. Watched and compiled. |
98
+ | `REFERENCE.tex` (`--revise`) | The frozen original (e.g. the submitted version). Used only as the "before" for latexdiff; never modified or compiled. |
99
+
100
+ Every time you save (in the revised file **or any of its dependencies**):
101
+
102
+ 1. A **debounce** timer waits for 500 ms of quiet (resets on each save).
103
+ 2. The clean PDF is compiled (up to 3 passes, resolving cross-references).
104
+ 3. In revision mode, `latexdiff --flatten` computes the diff and the marked-up
105
+ PDF is compiled right after. Diff failures never block the clean PDF.
106
+
107
+ ### Revision mode
108
+
109
+ ```bash
110
+ texwatch main.tex --revise submitted-v1.tex
111
+ ```
112
+
113
+ produces:
114
+
115
+ | Output | Content |
116
+ |---|---|
117
+ | `build/main.pdf` | your clean revised paper |
118
+ | `build/main-diff.pdf` | changes marked: **yellow highlight = added**, **red strikethrough = deleted** (blue text inside math) |
119
+
120
+ Options:
121
+
122
+ ```bash
123
+ --diff-type CFONT # latexdiff markup style (UNDERLINE, CFONT, CHANGEBAR, BOLD…)
124
+ --diff-out mydiff # custom output basename
125
+ --highlight classic # latexdiff's native markup instead of yellow
126
+ --no-diff # suspend diffing, keep watching (escape hatch)
127
+ ```
128
+
129
+ Tips from the trenches:
130
+
131
+ - Keep the baseline file **frozen** — it's your reference snapshot.
132
+ - If a diff compile fails on exotic packages (algorithm2e, minted, …), use
133
+ `--no-diff` to keep working, or try `--diff-type PDFCOMMENT`.
134
+ - Network drives (NFS/SMB, HPC home dirs) may not deliver file events:
135
+ add `--poll`.
136
+
137
+ ### All options
138
+
139
+ ```text
140
+ Positional:
141
+ tex the .tex file to watch
142
+
143
+ Build:
144
+ --out DIR build directory (default: ./build next to the tex file)
145
+ --engine ENGINE pdflatex | xelatex | lualatex (default: pdflatex)
146
+ --timeout S kill hung compiles after S seconds (default: 30)
147
+
148
+ Watching:
149
+ --debounce MS quiet period before compiling (default: 500)
150
+ --poll use polling (for NFS/SMB/network mounts)
151
+ --once compile once and exit
152
+ --clean remove the build directory and exit
153
+
154
+ Revision:
155
+ --revise OLD.tex enable revision mode against this baseline
156
+ --diff-type T latexdiff markup type (default: UNDERLINE)
157
+ --diff-out NAME basename for diff outputs (default: <stem>-diff)
158
+ --highlight STYLE yellow (default) or classic
159
+ --no-diff suspend diffing; clean PDF only
160
+
161
+ Output:
162
+ --quiet only show errors
163
+ --verbose debug output on stderr
164
+
165
+ Diagnostics:
166
+ --log-file FILE rotating debug log (attach to bug reports)
167
+ --version, --help
168
+ ```
169
+
170
+ ### Viewing the PDF
171
+
172
+ texwatch deliberately does **not** open or manage a PDF viewer — you open
173
+ `build/main.pdf` in whatever you prefer. Viewers that auto-reload on file
174
+ change give the full Overleaf-like experience:
175
+
176
+ | OS | Auto-reloading viewers |
177
+ |---|---|
178
+ | macOS | Skim |
179
+ | Linux | Evince, Okular, Zathura, qpdfview |
180
+ | Windows | SumatraPDF (doesn't lock the file, unlike Acrobat/Edge) |
181
+
182
+ ### Config discovery
183
+
184
+ texwatch finds TeX automatically: `PATH`, then known locations
185
+ (`/Library/TeX/texbin` on macOS; `C:\texlive\*\bin\windows` and MiKTeX dirs on
186
+ Windows; `/usr/local/texlive/*/bin/*` on Linux). Same for latexdiff.
187
+
188
+ ---
189
+
190
+ ## Troubleshooting
191
+
192
+ | Symptom | Fix |
193
+ |---|---|
194
+ | `pdflatex not found` | Install TeX (table above) or add its bin dir to PATH |
195
+ | `another texwatch instance appears to be running` | Another watcher holds the build dir. Close it, or delete `build/.texwatch.lock` |
196
+ | Nothing happens when I save on a network drive | Use `--poll` |
197
+ | PDF doesn't refresh in my viewer | Use an auto-reloading viewer (table above); Acrobat/Edge on Windows lock the file |
198
+ | Diff PDF doesn't rebuild but clean does | latexdiff hiccup — see the warning line; try `--no-diff` or another `--diff-type` |
199
+ | Weird characters in the diff | Ensure UTF-8 sources; texwatch falls back to cp1252 automatically |
200
+ | Something else broke | `texwatch ... --log-file tw.log --verbose` and attach `tw.log` to an issue |
201
+
202
+ ---
203
+
204
+ ## Development
205
+
206
+ ```bash
207
+ git clone https://github.com/YOUR_USERNAME/texwatch && cd texwatch
208
+ python -m venv .venv && source .venv/bin/activate
209
+ pip install -e ".[dev]"
210
+ pytest # unit + real-pdflatex integration tests
211
+ ruff check src tests
212
+ ```
213
+
214
+ Releases: push a tag `v1.0.0` — CI builds the wheel/sdist and publishes to
215
+ PyPI via trusted publishing.
216
+
217
+ ## License
218
+
219
+ MIT
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "texwatch"
7
+ version = "1.0.0"
8
+ description = "Terminal-based Overleaf-like LaTeX watcher: recompiles pdflatex on file change and refreshes the PDF."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ authors = [{ name = "Arif" }]
13
+ keywords = ["latex", "pdflatex", "watch", "overleaf", "pdf"]
14
+ classifiers = [
15
+ "Environment :: Console",
16
+ "Programming Language :: Python :: 3",
17
+ "Operating System :: MacOS",
18
+ ]
19
+ dependencies = ["watchdog>=3.0"]
20
+
21
+ [project.scripts]
22
+ texwatch = "texwatch.cli:main"
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/arif/texwatch"
26
+
27
+ [tool.setuptools.packages.find]
28
+ where = ["src"]
29
+
30
+ [project.optional-dependencies]
31
+ dev = ["pytest>=8", "ruff>=0.6", "mypy>=1.11"]
32
+
33
+ [tool.pytest.ini_options]
34
+ testpaths = ["tests"]
35
+ addopts = "-q"
36
+
37
+ [tool.ruff]
38
+ line-length = 95
39
+ src = ["src", "tests"]
40
+
41
+ [tool.ruff.lint]
42
+ select = ["E", "F", "W", "I", "UP", "B", "SIM"]
43
+
44
+ [tool.mypy]
45
+ python_version = "3.9"
46
+ strict = false
47
+ warn_unused_ignores = true
48
+ ignore_missing_imports = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """texwatch: watch a .tex file, recompile on change, refresh the PDF."""
2
+
3
+ __version__ = "1.0.0"