prl-wordcount 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.
- prl_wordcount-1.0.0/LICENSE +17 -0
- prl_wordcount-1.0.0/PKG-INFO +200 -0
- prl_wordcount-1.0.0/README.md +171 -0
- prl_wordcount-1.0.0/prl_wordcount.egg-info/PKG-INFO +200 -0
- prl_wordcount-1.0.0/prl_wordcount.egg-info/SOURCES.txt +9 -0
- prl_wordcount-1.0.0/prl_wordcount.egg-info/dependency_links.txt +1 -0
- prl_wordcount-1.0.0/prl_wordcount.egg-info/entry_points.txt +2 -0
- prl_wordcount-1.0.0/prl_wordcount.egg-info/top_level.txt +1 -0
- prl_wordcount-1.0.0/prl_wordcount.py +829 -0
- prl_wordcount-1.0.0/pyproject.toml +35 -0
- prl_wordcount-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2026 Xingju Wang, Lilun Zhang
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prl-wordcount
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: APS-compliant word count analyzer for Physical Review Letters LaTeX manuscripts
|
|
5
|
+
Author: Xingju Wang
|
|
6
|
+
Author-email: Lilun Zhang <zhanglilun@nudt.edu.cn>
|
|
7
|
+
License: GPL-3.0-or-later
|
|
8
|
+
Project-URL: Homepage, https://github.com/USER/prl-wordcount
|
|
9
|
+
Project-URL: Repository, https://github.com/USER/prl-wordcount
|
|
10
|
+
Project-URL: Issues, https://github.com/USER/prl-wordcount/issues
|
|
11
|
+
Keywords: latex,tex,word-count,prl,physical-review,aps,manuscript
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
24
|
+
Classifier: Topic :: Text Processing :: Markup :: LaTeX
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# PRL Word Count
|
|
31
|
+
|
|
32
|
+
[](https://python.org)
|
|
33
|
+
[](LICENSE)
|
|
34
|
+
[](CHANGELOG.md)
|
|
35
|
+
|
|
36
|
+
**Automated word-count analysis for Physical Review Letters (PRL) LaTeX manuscripts.**
|
|
37
|
+
|
|
38
|
+
Runs `texcount`, parses displayed equations and figure references, applies APS conversion formulas, and generates a self-contained HTML report — all in one command.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Install
|
|
46
|
+
pip install prl-wordcount
|
|
47
|
+
|
|
48
|
+
# Analyze your paper
|
|
49
|
+
prl-wordcount manuscript.tex --open
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Output:
|
|
53
|
+
```
|
|
54
|
+
============================================================
|
|
55
|
+
PRL Word Count Summary — manuscript.tex
|
|
56
|
+
============================================================
|
|
57
|
+
Body text: 3,232 words
|
|
58
|
+
Captions: 179 words
|
|
59
|
+
Displayed eqs: 240 words (15 rows × 16)
|
|
60
|
+
Figures: 641 words (3 figures)
|
|
61
|
+
──────────────────────────────────────────────────
|
|
62
|
+
PRL TOTAL: 4,292 words
|
|
63
|
+
PRL LIMIT: 3,750 words
|
|
64
|
+
Status: OVER by 542 words (14%)
|
|
65
|
+
============================================================
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Plus an HTML report like [this](examples/example_report.html).
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## What It Does
|
|
73
|
+
|
|
74
|
+
| Stage | Description |
|
|
75
|
+
|-------|-------------|
|
|
76
|
+
| **[1/5] texcount** | Runs the TeXcount Perl script, parses per-section word counts |
|
|
77
|
+
| **[2/5] Equations** | Splits main body from appendix, counts rows in `equation`, `align`, `aligned`, `gathered`, `split` |
|
|
78
|
+
| **[3/5] Figures** | Resolves `\includegraphics` paths, reads PNG/JPEG dimensions from binary headers (no Pillow needed) |
|
|
79
|
+
| **[4/5] APS formula** | Converts to PRL word-equivalents: 16 words/eq-row, (150/aspect)+20 per 1-col figure |
|
|
80
|
+
| **[5/5] HTML report** | Self-contained HTML with stat cards, per-section table, equation inventory, bar charts |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Installation
|
|
85
|
+
|
|
86
|
+
### Via pip (recommended)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install prl-wordcount
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### From source
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
git clone https://github.com/USER/prl-wordcount.git
|
|
96
|
+
cd prl-wordcount
|
|
97
|
+
pip install -e .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Dependencies
|
|
101
|
+
|
|
102
|
+
| Dependency | Required? | Install |
|
|
103
|
+
|-----------|-----------|---------|
|
|
104
|
+
| Python 3.8+ | Yes | https://python.org |
|
|
105
|
+
| `texcount` (Perl) | Yes | `tlmgr install texcount` (TeX Live) |
|
|
106
|
+
| `pdfinfo` | No | `apt install poppler-utils` / `brew install poppler` |
|
|
107
|
+
|
|
108
|
+
No Python packages beyond the standard library are required.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Usage
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Basic analysis
|
|
116
|
+
prl-wordcount paper.tex
|
|
117
|
+
|
|
118
|
+
# Specify output path
|
|
119
|
+
prl-wordcount paper.tex -o my_report.html
|
|
120
|
+
|
|
121
|
+
# Auto-open report in browser after generation
|
|
122
|
+
prl-wordcount paper.tex --open
|
|
123
|
+
|
|
124
|
+
# Custom word limit (for non-PRL journals)
|
|
125
|
+
prl-wordcount paper.tex --limit 4000
|
|
126
|
+
|
|
127
|
+
# Machine-readable JSON output
|
|
128
|
+
prl-wordcount paper.tex --json
|
|
129
|
+
|
|
130
|
+
# Show version
|
|
131
|
+
prl-wordcount --version
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## PRL Counting Rules
|
|
137
|
+
|
|
138
|
+
### Counted toward the 3,750-word limit
|
|
139
|
+
|
|
140
|
+
| Component | Conversion |
|
|
141
|
+
|-----------|-----------|
|
|
142
|
+
| Body text | Words between Introduction and Acknowledgments |
|
|
143
|
+
| Section/subsection headers | Word count of titles |
|
|
144
|
+
| Figure/table captions | Word count of caption text |
|
|
145
|
+
| Displayed equations | **16 words/row** (single-column), **32 words/row** (two-column wide) |
|
|
146
|
+
| Single-column figures | **(150 / aspect_ratio) + 20** words |
|
|
147
|
+
| Two-column (wide) figures | **(300 / aspect_ratio) + 40** words |
|
|
148
|
+
| Tables (single-column) | **13 + 6.5 × lines** words |
|
|
149
|
+
| Footnotes | Word count of footnote text |
|
|
150
|
+
|
|
151
|
+
### Not counted
|
|
152
|
+
|
|
153
|
+
- Title, author byline, affiliations
|
|
154
|
+
- Abstract
|
|
155
|
+
- Acknowledgments
|
|
156
|
+
- References / bibliography
|
|
157
|
+
- Appendix / End Matter (up to ~2 extra pages allowed)
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## FAQ
|
|
162
|
+
|
|
163
|
+
**Q: How are displayed equations counted?**
|
|
164
|
+
Each row of an `equation`, `align`, `eqnarray`, `aligned`, `gathered`, or `split` environment counts as **16 words** (single-column width). Two-column wide equations count as 32 words/row.
|
|
165
|
+
|
|
166
|
+
**Q: How are figures counted?**
|
|
167
|
+
The APS formula uses the figure's rendered aspect ratio (width/height), which is read directly from the PNG or JPEG binary header. The formula estimates how much text the figure displaces.
|
|
168
|
+
|
|
169
|
+
**Q: What if my figure is a PDF?**
|
|
170
|
+
The script tries `pdfinfo` (from poppler-utils). If unavailable, it falls back to an assumed 4:3 aspect ratio. Install poppler for accurate results.
|
|
171
|
+
|
|
172
|
+
**Q: How does appendix handling work?**
|
|
173
|
+
Everything after `\appendix` is automatically detected and excluded from the PRL total. Appendix content appears in the "Not counted" section of the report.
|
|
174
|
+
|
|
175
|
+
**Q: Can I use this for other APS journals?**
|
|
176
|
+
Yes. Use `--limit N` to set a custom word limit (e.g., `--limit 7000` for PRX). The same APS conversion rules apply to all Physical Review journals.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Claude Code Integration
|
|
181
|
+
|
|
182
|
+
A Claude Code skill definition is included in [SKILL.md](SKILL.md). When placed in `~/.claude/skills/prl-wordcount/`, the AI assistant can analyze documents by saying:
|
|
183
|
+
|
|
184
|
+
> "Check if paper.tex meets the PRL word limit"
|
|
185
|
+
|
|
186
|
+
See [SKILL.md](SKILL.md) for the complete skill definition.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
This project is licensed under the GNU General Public License v3.0 — see [LICENSE](LICENSE) for details.
|
|
193
|
+
|
|
194
|
+
GPLv3 requires that any derivative works also be distributed under the same license terms.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Contributing
|
|
199
|
+
|
|
200
|
+
Contributions are welcome. Please open an issue or submit a pull request on GitHub.
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# PRL Word Count
|
|
2
|
+
|
|
3
|
+
[](https://python.org)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](CHANGELOG.md)
|
|
6
|
+
|
|
7
|
+
**Automated word-count analysis for Physical Review Letters (PRL) LaTeX manuscripts.**
|
|
8
|
+
|
|
9
|
+
Runs `texcount`, parses displayed equations and figure references, applies APS conversion formulas, and generates a self-contained HTML report — all in one command.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Install
|
|
17
|
+
pip install prl-wordcount
|
|
18
|
+
|
|
19
|
+
# Analyze your paper
|
|
20
|
+
prl-wordcount manuscript.tex --open
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Output:
|
|
24
|
+
```
|
|
25
|
+
============================================================
|
|
26
|
+
PRL Word Count Summary — manuscript.tex
|
|
27
|
+
============================================================
|
|
28
|
+
Body text: 3,232 words
|
|
29
|
+
Captions: 179 words
|
|
30
|
+
Displayed eqs: 240 words (15 rows × 16)
|
|
31
|
+
Figures: 641 words (3 figures)
|
|
32
|
+
──────────────────────────────────────────────────
|
|
33
|
+
PRL TOTAL: 4,292 words
|
|
34
|
+
PRL LIMIT: 3,750 words
|
|
35
|
+
Status: OVER by 542 words (14%)
|
|
36
|
+
============================================================
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Plus an HTML report like [this](examples/example_report.html).
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## What It Does
|
|
44
|
+
|
|
45
|
+
| Stage | Description |
|
|
46
|
+
|-------|-------------|
|
|
47
|
+
| **[1/5] texcount** | Runs the TeXcount Perl script, parses per-section word counts |
|
|
48
|
+
| **[2/5] Equations** | Splits main body from appendix, counts rows in `equation`, `align`, `aligned`, `gathered`, `split` |
|
|
49
|
+
| **[3/5] Figures** | Resolves `\includegraphics` paths, reads PNG/JPEG dimensions from binary headers (no Pillow needed) |
|
|
50
|
+
| **[4/5] APS formula** | Converts to PRL word-equivalents: 16 words/eq-row, (150/aspect)+20 per 1-col figure |
|
|
51
|
+
| **[5/5] HTML report** | Self-contained HTML with stat cards, per-section table, equation inventory, bar charts |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
### Via pip (recommended)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install prl-wordcount
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### From source
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
git clone https://github.com/USER/prl-wordcount.git
|
|
67
|
+
cd prl-wordcount
|
|
68
|
+
pip install -e .
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Dependencies
|
|
72
|
+
|
|
73
|
+
| Dependency | Required? | Install |
|
|
74
|
+
|-----------|-----------|---------|
|
|
75
|
+
| Python 3.8+ | Yes | https://python.org |
|
|
76
|
+
| `texcount` (Perl) | Yes | `tlmgr install texcount` (TeX Live) |
|
|
77
|
+
| `pdfinfo` | No | `apt install poppler-utils` / `brew install poppler` |
|
|
78
|
+
|
|
79
|
+
No Python packages beyond the standard library are required.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Basic analysis
|
|
87
|
+
prl-wordcount paper.tex
|
|
88
|
+
|
|
89
|
+
# Specify output path
|
|
90
|
+
prl-wordcount paper.tex -o my_report.html
|
|
91
|
+
|
|
92
|
+
# Auto-open report in browser after generation
|
|
93
|
+
prl-wordcount paper.tex --open
|
|
94
|
+
|
|
95
|
+
# Custom word limit (for non-PRL journals)
|
|
96
|
+
prl-wordcount paper.tex --limit 4000
|
|
97
|
+
|
|
98
|
+
# Machine-readable JSON output
|
|
99
|
+
prl-wordcount paper.tex --json
|
|
100
|
+
|
|
101
|
+
# Show version
|
|
102
|
+
prl-wordcount --version
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## PRL Counting Rules
|
|
108
|
+
|
|
109
|
+
### Counted toward the 3,750-word limit
|
|
110
|
+
|
|
111
|
+
| Component | Conversion |
|
|
112
|
+
|-----------|-----------|
|
|
113
|
+
| Body text | Words between Introduction and Acknowledgments |
|
|
114
|
+
| Section/subsection headers | Word count of titles |
|
|
115
|
+
| Figure/table captions | Word count of caption text |
|
|
116
|
+
| Displayed equations | **16 words/row** (single-column), **32 words/row** (two-column wide) |
|
|
117
|
+
| Single-column figures | **(150 / aspect_ratio) + 20** words |
|
|
118
|
+
| Two-column (wide) figures | **(300 / aspect_ratio) + 40** words |
|
|
119
|
+
| Tables (single-column) | **13 + 6.5 × lines** words |
|
|
120
|
+
| Footnotes | Word count of footnote text |
|
|
121
|
+
|
|
122
|
+
### Not counted
|
|
123
|
+
|
|
124
|
+
- Title, author byline, affiliations
|
|
125
|
+
- Abstract
|
|
126
|
+
- Acknowledgments
|
|
127
|
+
- References / bibliography
|
|
128
|
+
- Appendix / End Matter (up to ~2 extra pages allowed)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## FAQ
|
|
133
|
+
|
|
134
|
+
**Q: How are displayed equations counted?**
|
|
135
|
+
Each row of an `equation`, `align`, `eqnarray`, `aligned`, `gathered`, or `split` environment counts as **16 words** (single-column width). Two-column wide equations count as 32 words/row.
|
|
136
|
+
|
|
137
|
+
**Q: How are figures counted?**
|
|
138
|
+
The APS formula uses the figure's rendered aspect ratio (width/height), which is read directly from the PNG or JPEG binary header. The formula estimates how much text the figure displaces.
|
|
139
|
+
|
|
140
|
+
**Q: What if my figure is a PDF?**
|
|
141
|
+
The script tries `pdfinfo` (from poppler-utils). If unavailable, it falls back to an assumed 4:3 aspect ratio. Install poppler for accurate results.
|
|
142
|
+
|
|
143
|
+
**Q: How does appendix handling work?**
|
|
144
|
+
Everything after `\appendix` is automatically detected and excluded from the PRL total. Appendix content appears in the "Not counted" section of the report.
|
|
145
|
+
|
|
146
|
+
**Q: Can I use this for other APS journals?**
|
|
147
|
+
Yes. Use `--limit N` to set a custom word limit (e.g., `--limit 7000` for PRX). The same APS conversion rules apply to all Physical Review journals.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Claude Code Integration
|
|
152
|
+
|
|
153
|
+
A Claude Code skill definition is included in [SKILL.md](SKILL.md). When placed in `~/.claude/skills/prl-wordcount/`, the AI assistant can analyze documents by saying:
|
|
154
|
+
|
|
155
|
+
> "Check if paper.tex meets the PRL word limit"
|
|
156
|
+
|
|
157
|
+
See [SKILL.md](SKILL.md) for the complete skill definition.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
This project is licensed under the GNU General Public License v3.0 — see [LICENSE](LICENSE) for details.
|
|
164
|
+
|
|
165
|
+
GPLv3 requires that any derivative works also be distributed under the same license terms.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Contributing
|
|
170
|
+
|
|
171
|
+
Contributions are welcome. Please open an issue or submit a pull request on GitHub.
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prl-wordcount
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: APS-compliant word count analyzer for Physical Review Letters LaTeX manuscripts
|
|
5
|
+
Author: Xingju Wang
|
|
6
|
+
Author-email: Lilun Zhang <zhanglilun@nudt.edu.cn>
|
|
7
|
+
License: GPL-3.0-or-later
|
|
8
|
+
Project-URL: Homepage, https://github.com/USER/prl-wordcount
|
|
9
|
+
Project-URL: Repository, https://github.com/USER/prl-wordcount
|
|
10
|
+
Project-URL: Issues, https://github.com/USER/prl-wordcount/issues
|
|
11
|
+
Keywords: latex,tex,word-count,prl,physical-review,aps,manuscript
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
24
|
+
Classifier: Topic :: Text Processing :: Markup :: LaTeX
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# PRL Word Count
|
|
31
|
+
|
|
32
|
+
[](https://python.org)
|
|
33
|
+
[](LICENSE)
|
|
34
|
+
[](CHANGELOG.md)
|
|
35
|
+
|
|
36
|
+
**Automated word-count analysis for Physical Review Letters (PRL) LaTeX manuscripts.**
|
|
37
|
+
|
|
38
|
+
Runs `texcount`, parses displayed equations and figure references, applies APS conversion formulas, and generates a self-contained HTML report — all in one command.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Install
|
|
46
|
+
pip install prl-wordcount
|
|
47
|
+
|
|
48
|
+
# Analyze your paper
|
|
49
|
+
prl-wordcount manuscript.tex --open
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Output:
|
|
53
|
+
```
|
|
54
|
+
============================================================
|
|
55
|
+
PRL Word Count Summary — manuscript.tex
|
|
56
|
+
============================================================
|
|
57
|
+
Body text: 3,232 words
|
|
58
|
+
Captions: 179 words
|
|
59
|
+
Displayed eqs: 240 words (15 rows × 16)
|
|
60
|
+
Figures: 641 words (3 figures)
|
|
61
|
+
──────────────────────────────────────────────────
|
|
62
|
+
PRL TOTAL: 4,292 words
|
|
63
|
+
PRL LIMIT: 3,750 words
|
|
64
|
+
Status: OVER by 542 words (14%)
|
|
65
|
+
============================================================
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Plus an HTML report like [this](examples/example_report.html).
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## What It Does
|
|
73
|
+
|
|
74
|
+
| Stage | Description |
|
|
75
|
+
|-------|-------------|
|
|
76
|
+
| **[1/5] texcount** | Runs the TeXcount Perl script, parses per-section word counts |
|
|
77
|
+
| **[2/5] Equations** | Splits main body from appendix, counts rows in `equation`, `align`, `aligned`, `gathered`, `split` |
|
|
78
|
+
| **[3/5] Figures** | Resolves `\includegraphics` paths, reads PNG/JPEG dimensions from binary headers (no Pillow needed) |
|
|
79
|
+
| **[4/5] APS formula** | Converts to PRL word-equivalents: 16 words/eq-row, (150/aspect)+20 per 1-col figure |
|
|
80
|
+
| **[5/5] HTML report** | Self-contained HTML with stat cards, per-section table, equation inventory, bar charts |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Installation
|
|
85
|
+
|
|
86
|
+
### Via pip (recommended)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install prl-wordcount
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### From source
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
git clone https://github.com/USER/prl-wordcount.git
|
|
96
|
+
cd prl-wordcount
|
|
97
|
+
pip install -e .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Dependencies
|
|
101
|
+
|
|
102
|
+
| Dependency | Required? | Install |
|
|
103
|
+
|-----------|-----------|---------|
|
|
104
|
+
| Python 3.8+ | Yes | https://python.org |
|
|
105
|
+
| `texcount` (Perl) | Yes | `tlmgr install texcount` (TeX Live) |
|
|
106
|
+
| `pdfinfo` | No | `apt install poppler-utils` / `brew install poppler` |
|
|
107
|
+
|
|
108
|
+
No Python packages beyond the standard library are required.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Usage
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Basic analysis
|
|
116
|
+
prl-wordcount paper.tex
|
|
117
|
+
|
|
118
|
+
# Specify output path
|
|
119
|
+
prl-wordcount paper.tex -o my_report.html
|
|
120
|
+
|
|
121
|
+
# Auto-open report in browser after generation
|
|
122
|
+
prl-wordcount paper.tex --open
|
|
123
|
+
|
|
124
|
+
# Custom word limit (for non-PRL journals)
|
|
125
|
+
prl-wordcount paper.tex --limit 4000
|
|
126
|
+
|
|
127
|
+
# Machine-readable JSON output
|
|
128
|
+
prl-wordcount paper.tex --json
|
|
129
|
+
|
|
130
|
+
# Show version
|
|
131
|
+
prl-wordcount --version
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## PRL Counting Rules
|
|
137
|
+
|
|
138
|
+
### Counted toward the 3,750-word limit
|
|
139
|
+
|
|
140
|
+
| Component | Conversion |
|
|
141
|
+
|-----------|-----------|
|
|
142
|
+
| Body text | Words between Introduction and Acknowledgments |
|
|
143
|
+
| Section/subsection headers | Word count of titles |
|
|
144
|
+
| Figure/table captions | Word count of caption text |
|
|
145
|
+
| Displayed equations | **16 words/row** (single-column), **32 words/row** (two-column wide) |
|
|
146
|
+
| Single-column figures | **(150 / aspect_ratio) + 20** words |
|
|
147
|
+
| Two-column (wide) figures | **(300 / aspect_ratio) + 40** words |
|
|
148
|
+
| Tables (single-column) | **13 + 6.5 × lines** words |
|
|
149
|
+
| Footnotes | Word count of footnote text |
|
|
150
|
+
|
|
151
|
+
### Not counted
|
|
152
|
+
|
|
153
|
+
- Title, author byline, affiliations
|
|
154
|
+
- Abstract
|
|
155
|
+
- Acknowledgments
|
|
156
|
+
- References / bibliography
|
|
157
|
+
- Appendix / End Matter (up to ~2 extra pages allowed)
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## FAQ
|
|
162
|
+
|
|
163
|
+
**Q: How are displayed equations counted?**
|
|
164
|
+
Each row of an `equation`, `align`, `eqnarray`, `aligned`, `gathered`, or `split` environment counts as **16 words** (single-column width). Two-column wide equations count as 32 words/row.
|
|
165
|
+
|
|
166
|
+
**Q: How are figures counted?**
|
|
167
|
+
The APS formula uses the figure's rendered aspect ratio (width/height), which is read directly from the PNG or JPEG binary header. The formula estimates how much text the figure displaces.
|
|
168
|
+
|
|
169
|
+
**Q: What if my figure is a PDF?**
|
|
170
|
+
The script tries `pdfinfo` (from poppler-utils). If unavailable, it falls back to an assumed 4:3 aspect ratio. Install poppler for accurate results.
|
|
171
|
+
|
|
172
|
+
**Q: How does appendix handling work?**
|
|
173
|
+
Everything after `\appendix` is automatically detected and excluded from the PRL total. Appendix content appears in the "Not counted" section of the report.
|
|
174
|
+
|
|
175
|
+
**Q: Can I use this for other APS journals?**
|
|
176
|
+
Yes. Use `--limit N` to set a custom word limit (e.g., `--limit 7000` for PRX). The same APS conversion rules apply to all Physical Review journals.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Claude Code Integration
|
|
181
|
+
|
|
182
|
+
A Claude Code skill definition is included in [SKILL.md](SKILL.md). When placed in `~/.claude/skills/prl-wordcount/`, the AI assistant can analyze documents by saying:
|
|
183
|
+
|
|
184
|
+
> "Check if paper.tex meets the PRL word limit"
|
|
185
|
+
|
|
186
|
+
See [SKILL.md](SKILL.md) for the complete skill definition.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
This project is licensed under the GNU General Public License v3.0 — see [LICENSE](LICENSE) for details.
|
|
193
|
+
|
|
194
|
+
GPLv3 requires that any derivative works also be distributed under the same license terms.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Contributing
|
|
199
|
+
|
|
200
|
+
Contributions are welcome. Please open an issue or submit a pull request on GitHub.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
prl_wordcount
|