texact 0.1.2__tar.gz → 0.2.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.
- {texact-0.1.2 → texact-0.2.0}/.github/workflows/documentation.yml +1 -0
- {texact-0.1.2 → texact-0.2.0}/.pre-commit-config.yaml +2 -0
- {texact-0.1.2 → texact-0.2.0}/CHANGELOG.md +18 -1
- {texact-0.1.2/source/texact.egg-info → texact-0.2.0}/PKG-INFO +2 -1
- {texact-0.1.2 → texact-0.2.0}/README.md +1 -0
- {texact-0.1.2 → texact-0.2.0}/docs/integration.rst +6 -0
- {texact-0.1.2 → texact-0.2.0}/docs/options.rst +14 -2
- texact-0.2.0/docs/rules/ieee-math-environment.md +23 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/index.md +23 -0
- texact-0.2.0/docs/rules/label-prefix.md +21 -0
- texact-0.2.0/docs/rules/math-operator-command.md +18 -0
- texact-0.2.0/docs/rules/plus-minus-notation.md +16 -0
- texact-0.2.0/docs/rules/scaled-parentheses.md +17 -0
- texact-0.2.0/docs/rules/space-before-punctuation.md +9 -0
- texact-0.2.0/docs/rules/space-before-reference.md +17 -0
- texact-0.2.0/docs/rules/textmu-command.md +17 -0
- texact-0.2.0/docs/rules/title-casing.md +19 -0
- {texact-0.1.2 → texact-0.2.0}/source/configuration.py +21 -2
- {texact-0.1.2 → texact-0.2.0}/source/printer.py +12 -2
- texact-0.2.0/source/reviewers/reviewer_casing.py +472 -0
- texact-0.2.0/source/reviewers/reviewer_math.py +211 -0
- texact-0.2.0/source/reviewers/reviewer_reflabel.py +200 -0
- {texact-0.1.2 → texact-0.2.0}/source/reviewers/reviewer_unsure.py +22 -1
- {texact-0.1.2 → texact-0.2.0}/source/reviewers/rules.py +63 -0
- {texact-0.1.2 → texact-0.2.0/source/texact.egg-info}/PKG-INFO +2 -1
- {texact-0.1.2 → texact-0.2.0}/source/texact.egg-info/SOURCES.txt +11 -0
- {texact-0.1.2 → texact-0.2.0}/source/texact.egg-info/scm_file_list.json +11 -0
- texact-0.2.0/source/texact.egg-info/scm_version.json +8 -0
- {texact-0.1.2 → texact-0.2.0}/source/texact.py +28 -3
- {texact-0.1.2 → texact-0.2.0}/test/configuration_test.py +12 -0
- texact-0.2.0/test/diagnostics_test.py +512 -0
- {texact-0.1.2 → texact-0.2.0}/test/figure_test.tex +7 -0
- texact-0.2.0/test/title_casing_test.tex +11 -0
- texact-0.1.2/source/reviewers/reviewer_casing.py +0 -176
- texact-0.1.2/source/reviewers/reviewer_reflabel.py +0 -107
- texact-0.1.2/source/texact.egg-info/scm_version.json +0 -8
- texact-0.1.2/test/diagnostics_test.py +0 -210
- {texact-0.1.2 → texact-0.2.0}/.github/dependabot.yml +0 -0
- {texact-0.1.2 → texact-0.2.0}/.github/workflows/cli_test.yml +0 -0
- {texact-0.1.2 → texact-0.2.0}/.github/workflows/release-publish-to-pypi.yml +0 -0
- {texact-0.1.2 → texact-0.2.0}/.gitignore +0 -0
- {texact-0.1.2 → texact-0.2.0}/.pre-commit-hooks.yaml +0 -0
- {texact-0.1.2 → texact-0.2.0}/LICENSE.txt +0 -0
- {texact-0.1.2 → texact-0.2.0}/config/chktexrc +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/Makefile +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/_static/custom.css +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/_static/texact.ico +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/_static/texact.svg +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/_static/texactlogo.svg +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/_static/try-it.css +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/_static/try-it.js +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/_templates/versions.html +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/changelog.rst +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/conf.py +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/development.rst +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/index.rst +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/licenses.rst +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/make.bat +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/abstract-first-line-this-work.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/biography-image-not-found.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/caption-before-graphics.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/chktex-command-not-found.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/chktex-config-not-found.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/chktex-diagnostic.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/chktex-execution-failed.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/chktex-not-installed.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/excessive-we-usage.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/inconsistent-caption-period.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/incorrect-casing.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/invalid-biography-image-ratio.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/invalid-figure-position.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/missing-figure-caption.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/missing-figure-label.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/modal-or-uncertain-word.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/scaled-figure-image.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/singular-author-possessive.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/undefined-label-reference.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/underscore-in-label.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/rules/unreferenced-label.md +0 -0
- {texact-0.1.2 → texact-0.2.0}/docs/try-it.rst +0 -0
- {texact-0.1.2 → texact-0.2.0}/pyproject.toml +0 -0
- {texact-0.1.2 → texact-0.2.0}/setup.cfg +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/reviewers/__init__.py +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/reviewers/reviewer.py +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/reviewers/reviewer_chktex.py +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/reviewers/reviewer_figure.py +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/reviewers/reviewer_inthis.py +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/template_check.py +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/texact.egg-info/dependency_links.txt +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/texact.egg-info/entry_points.txt +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/texact.egg-info/requires.txt +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/texact.egg-info/top_level.txt +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/texact_config/__init__.py +0 -0
- {texact-0.1.2 → texact-0.2.0}/source/texact_config/chktexrc +0 -0
- {texact-0.1.2 → texact-0.2.0}/test/assets/bio_bad_size.png +0 -0
- {texact-0.1.2 → texact-0.2.0}/test/assets/bio_ok.png +0 -0
- {texact-0.1.2 → texact-0.2.0}/test/casing_test.tex +0 -0
- {texact-0.1.2 → texact-0.2.0}/test/comment_test.tex +0 -0
- {texact-0.1.2 → texact-0.2.0}/test/ieee_biography_test.tex +0 -0
- {texact-0.1.2 → texact-0.2.0}/test/ignore_test.tex +0 -0
- {texact-0.1.2 → texact-0.2.0}/test/inthis.tex +0 -0
- {texact-0.1.2 → texact-0.2.0}/test/reflabel_test.tex +0 -0
- {texact-0.1.2 → texact-0.2.0}/test/test.py +0 -0
- {texact-0.1.2 → texact-0.2.0}/test/unsure.tex +0 -0
|
@@ -15,6 +15,8 @@ repos:
|
|
|
15
15
|
- id: codespell
|
|
16
16
|
additional_dependencies:
|
|
17
17
|
- tomli
|
|
18
|
+
args:
|
|
19
|
+
- --ignore-words-list=multline
|
|
18
20
|
exclude: ^(source/reviewers/reviewer_casing\.py|config/chktexrc|source/texact_config/chktexrc)$
|
|
19
21
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
|
20
22
|
rev: v22.1.8
|
|
@@ -16,6 +16,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
16
|
|
|
17
17
|
### Removed
|
|
18
18
|
|
|
19
|
+
## [0.2.0] - 2026-09-14
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- Warn about space before punctuation.
|
|
24
|
+
- Check title casing for document titles and section headings.
|
|
25
|
+
- Option for quiet level.
|
|
26
|
+
- Enforce prefixes in label names.
|
|
27
|
+
- Warn about +-.
|
|
28
|
+
- Enforce hard space before `\ref`.
|
|
29
|
+
- Check operator names inside math mode.
|
|
30
|
+
- Enforce `\textmu` instead of `\mu`.
|
|
31
|
+
- Enforce `\left` and `\right` for parentheses in math mode.
|
|
32
|
+
- Enforce `IEEEeqnarray` instead of `align`, `split`, etc. in IEEE papers.
|
|
33
|
+
- Option for VS Code compatible printing.
|
|
34
|
+
|
|
19
35
|
## [0.1.2] - 2026-08-20
|
|
20
36
|
|
|
21
37
|
### Added
|
|
@@ -43,7 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
43
59
|
|
|
44
60
|
Initial release.
|
|
45
61
|
|
|
46
|
-
[unreleased]: https://github.com/Theodor-Lindberg/texact/compare/v0.
|
|
62
|
+
[unreleased]: https://github.com/Theodor-Lindberg/texact/compare/v0.2.0...HEAD
|
|
63
|
+
[0.2.0]: https://github.com/Theodor-Lindberg/texact/releases/tag/v0.2.0
|
|
47
64
|
[0.1.2]: https://github.com/Theodor-Lindberg/texact/releases/tag/v0.1.2
|
|
48
65
|
[0.1.1]: https://github.com/Theodor-Lindberg/texact/releases/tag/v0.1.1
|
|
49
66
|
[0.1.0]: https://github.com/Theodor-Lindberg/texact/releases/tag/v0.1.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: texact
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Automated article and LaTeX checks
|
|
5
5
|
Author: Theodor Lindberg
|
|
6
6
|
Requires-Python: >=3.11
|
|
@@ -39,6 +39,7 @@ complement and incorporate them.
|
|
|
39
39
|
|
|
40
40
|
* Check consistency between "\ref" and "\label".
|
|
41
41
|
* Make sure certain words have correct casing.
|
|
42
|
+
* Check title casing for document titles and section headings.
|
|
42
43
|
* Warn if the abstract begins with "In this work" or similar.
|
|
43
44
|
* Avoid certain modal verbs, such as should, would, could, and might.
|
|
44
45
|
* Run [ChkTeX](https://www.nongnu.org/chktex/), if installed, with "appropriate"
|
|
@@ -20,6 +20,7 @@ complement and incorporate them.
|
|
|
20
20
|
|
|
21
21
|
* Check consistency between "\ref" and "\label".
|
|
22
22
|
* Make sure certain words have correct casing.
|
|
23
|
+
* Check title casing for document titles and section headings.
|
|
23
24
|
* Warn if the abstract begins with "In this work" or similar.
|
|
24
25
|
* Avoid certain modal verbs, such as should, would, could, and might.
|
|
25
26
|
* Run [ChkTeX](https://www.nongnu.org/chktex/), if installed, with "appropriate"
|
|
@@ -69,3 +69,9 @@ Set the name to ``texact:texact`` and let it execute ``texact --no-chktex --html
|
|
|
69
69
|
Press OK to save the settings.
|
|
70
70
|
|
|
71
71
|
TeXact can now be invoked on the current file under Tools->User->texact.
|
|
72
|
+
|
|
73
|
+
Visual Studio Code
|
|
74
|
+
------------------
|
|
75
|
+
|
|
76
|
+
Use ``--vscode-style`` to print diagnostics as ``path:line: [CODE] message``
|
|
77
|
+
so VS Code can navigate to the reported line when the output is clicked.
|
|
@@ -27,6 +27,13 @@ The ignore the rest of the file, use:
|
|
|
27
27
|
% texact-file ##
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
Quiet output
|
|
31
|
+
------------
|
|
32
|
+
|
|
33
|
+
Use ``-q`` or ``--quiet`` to remove per-file summaries. Repeat the short
|
|
34
|
+
option as ``-qq`` to remove both summaries and title lines.
|
|
35
|
+
|
|
36
|
+
|
|
30
37
|
Configuration file
|
|
31
38
|
------------------
|
|
32
39
|
|
|
@@ -50,6 +57,8 @@ The supported structure is::
|
|
|
50
57
|
|
|
51
58
|
[format]
|
|
52
59
|
html-style = true
|
|
60
|
+
vscode-style = true
|
|
61
|
+
quiet = 2
|
|
53
62
|
|
|
54
63
|
[tools]
|
|
55
64
|
chktex_path = "/usr/bin"
|
|
@@ -57,7 +66,10 @@ The supported structure is::
|
|
|
57
66
|
``lint.ignore`` accepts rule codes to suppress. ``lint.casing`` adds
|
|
58
67
|
spellings to the built-in casing list. ``lint.we_count`` changes the maximum
|
|
59
68
|
allowed number of ``we`` occurrences. ``format.html-style`` enables HTML
|
|
60
|
-
output by default
|
|
61
|
-
|
|
69
|
+
output by default. ``format.quiet`` controls non-diagnostic output: ``0``
|
|
70
|
+
prints titles and summaries, ``1`` removes summaries, and ``2`` removes both
|
|
71
|
+
titles and summaries. ``format.vscode-style`` enables VS Code-compatible
|
|
72
|
+
diagnostic output. ``tools.chktex_path`` points to a ChkTeX executable or
|
|
73
|
+
directory.
|
|
62
74
|
|
|
63
75
|
When no configuration file exists, TeXact uses its normal built-in defaults.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# ieee-math-environment (MAT005)
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
Checks that IEEE papers use `IEEEeqnarray` instead of `align`, `split`, or
|
|
6
|
+
similar alignment environments.
|
|
7
|
+
|
|
8
|
+
## Why is this bad?
|
|
9
|
+
|
|
10
|
+
The IEEE template provides a dedicated command for multi-line equations,
|
|
11
|
+
`IEEEeqnarray`.
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```latex
|
|
16
|
+
\begin{align}
|
|
17
|
+
a &= b
|
|
18
|
+
\end{align}
|
|
19
|
+
|
|
20
|
+
\begin{IEEEeqnarray}{rCl}
|
|
21
|
+
a & = & b
|
|
22
|
+
\end{IEEEeqnarray}
|
|
23
|
+
```
|
|
@@ -18,6 +18,17 @@ them per their liking and, if supported, configure them.
|
|
|
18
18
|
| Code | Name | Message | Severity |
|
|
19
19
|
| --- | --- | --- | --- |
|
|
20
20
|
| CAS001 | [incorrect-casing](incorrect-casing.md) | Incorrect casing. | error |
|
|
21
|
+
| CAS002 | [title-casing](title-casing.md) | Use IEEE-style title casing. | error |
|
|
22
|
+
|
|
23
|
+
## Math (`MAT`)
|
|
24
|
+
|
|
25
|
+
| Code | Name | Message | Severity |
|
|
26
|
+
| --- | --- | --- | --- |
|
|
27
|
+
| MAT001 | [plus-minus-notation](plus-minus-notation.md) | Use `\pm` instead of `+-` or `-+`. | error |
|
|
28
|
+
| MAT002 | [math-operator-command](math-operator-command.md) | Use LaTeX commands for common math operators. | error |
|
|
29
|
+
| MAT003 | [textmu-command](textmu-command.md) | Use `\textmu` instead of `\mu`. | error |
|
|
30
|
+
| MAT004 | [scaled-parentheses](scaled-parentheses.md) | Use `\left` and `\right` for math parentheses. | error |
|
|
31
|
+
| MAT005 | [ieee-math-environment](ieee-math-environment.md) | Use `IEEEeqnarray` in IEEE papers. | error |
|
|
21
32
|
|
|
22
33
|
## Unsure (`UNS`)
|
|
23
34
|
|
|
@@ -26,6 +37,7 @@ them per their liking and, if supported, configure them.
|
|
|
26
37
|
| UNS001 | [modal-or-uncertain-word](modal-or-uncertain-word.md) | Avoid modal or uncertain wording. | error |
|
|
27
38
|
| UNS002 | [excessive-we-usage](excessive-we-usage.md) | Reduce use of 'we' when it exceeds the configured maximum. | error |
|
|
28
39
|
| UNS003 | [singular-author-possessive](singular-author-possessive.md) | Use authors' to author's in papers. | error |
|
|
40
|
+
| UNS004 | [space-before-punctuation](space-before-punctuation.md) | Avoid spaces before punctuation. | error |
|
|
29
41
|
|
|
30
42
|
## RefLabel (`REF`)
|
|
31
43
|
|
|
@@ -34,6 +46,8 @@ them per their liking and, if supported, configure them.
|
|
|
34
46
|
| REF001 | [underscore-in-label](underscore-in-label.md) | Use hyphens in label names. | error |
|
|
35
47
|
| REF002 | [undefined-label-reference](undefined-label-reference.md) | Undefined label. | error |
|
|
36
48
|
| REF003 | [unreferenced-label](unreferenced-label.md) | Unreferenced label. | error |
|
|
49
|
+
| REF004 | [label-prefix](label-prefix.md) | Use the matching prefix for the label context. | error |
|
|
50
|
+
| REF005 | [space-before-reference](space-before-reference.md) | Use a hard space (`~`) before `\ref`. | error |
|
|
37
51
|
|
|
38
52
|
## Figure (`FIG`)
|
|
39
53
|
|
|
@@ -69,12 +83,21 @@ come from ChkTeX, and they link to the shared
|
|
|
69
83
|
|
|
70
84
|
abstract-first-line-this-work
|
|
71
85
|
incorrect-casing
|
|
86
|
+
title-casing
|
|
87
|
+
plus-minus-notation
|
|
88
|
+
math-operator-command
|
|
89
|
+
textmu-command
|
|
90
|
+
scaled-parentheses
|
|
91
|
+
ieee-math-environment
|
|
72
92
|
modal-or-uncertain-word
|
|
73
93
|
excessive-we-usage
|
|
74
94
|
singular-author-possessive
|
|
95
|
+
space-before-punctuation
|
|
75
96
|
underscore-in-label
|
|
76
97
|
undefined-label-reference
|
|
77
98
|
unreferenced-label
|
|
99
|
+
label-prefix
|
|
100
|
+
space-before-reference
|
|
78
101
|
invalid-figure-position
|
|
79
102
|
scaled-figure-image
|
|
80
103
|
missing-figure-label
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# label-prefix (REF004)
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
Reports labels whose prefixes do not match the LaTeX structure they belong to.
|
|
6
|
+
Figure labels should start with `fig:`, equation labels with `eq:`, section
|
|
7
|
+
labels with `sec:`, and table labels with `tab:`.
|
|
8
|
+
|
|
9
|
+
## Why is this bad?
|
|
10
|
+
|
|
11
|
+
Inconsistent label prefixes make references more difficult to
|
|
12
|
+
understand and labels harder to find.
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```latex
|
|
17
|
+
\begin{figure}
|
|
18
|
+
\caption{System overview}
|
|
19
|
+
\label{system-overview}
|
|
20
|
+
\end{figure}
|
|
21
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# math-operator-command (MAT002)
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
Checks that common mathematical operators use their LaTeX commands, such as
|
|
6
|
+
`\max`, `\min`, `\log`, and `\sin`.
|
|
7
|
+
|
|
8
|
+
## Why is this bad?
|
|
9
|
+
|
|
10
|
+
Unescaped operator names are typeset as products of variables instead of as
|
|
11
|
+
mathematical operators.
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```latex
|
|
16
|
+
$max(x) = log(x)$
|
|
17
|
+
$\max(x) = \log(x)$
|
|
18
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# plus-minus-notation (MAT001)
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
Checks for `+-` and `-+` in mathematical expressions.
|
|
6
|
+
|
|
7
|
+
## Why is this bad?
|
|
8
|
+
|
|
9
|
+
The proper command should be used: `\pm`.
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```latex
|
|
14
|
+
$x = 3 +- 1$
|
|
15
|
+
$x = 3 \pm 1$
|
|
16
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# scaled-parentheses (MAT004)
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
Checks that parentheses in math mode use `\left` and `\right`.
|
|
6
|
+
|
|
7
|
+
## Why is this bad?
|
|
8
|
+
|
|
9
|
+
Fixed-size parentheses can be too small for the expression they enclose and
|
|
10
|
+
make mathematical expressions harder to read.
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```latex
|
|
15
|
+
$(x + 1)$
|
|
16
|
+
$\left(x + 1\right)$
|
|
17
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# space-before-reference (REF005)
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
Checks that references have a hard space (`~`) before `\ref`.
|
|
6
|
+
|
|
7
|
+
## Why is this bad?
|
|
8
|
+
|
|
9
|
+
A normal space can leave a reference number at the beginning of a line. A hard
|
|
10
|
+
space keeps the preceding text and reference together.
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```latex
|
|
15
|
+
See \ref{fig:example}.
|
|
16
|
+
See~\ref{fig:example}.
|
|
17
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# textmu-command (MAT003)
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
Checks that the Greek letter mu uses the `\textmu` command instead of `\mu`.
|
|
6
|
+
|
|
7
|
+
## Why is this bad?
|
|
8
|
+
|
|
9
|
+
The text mu symbol is preferred for units and
|
|
10
|
+
other quantities that represent the micro prefix.
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```latex
|
|
15
|
+
10~$\mu$m
|
|
16
|
+
10~\textmu m
|
|
17
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# title-casing (CAS002)
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
Checks the casing of document titles and section headings against title-case convention.
|
|
6
|
+
|
|
7
|
+
## Why is this bad?
|
|
8
|
+
|
|
9
|
+
Title casing should be used.
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```latex
|
|
14
|
+
% Correct
|
|
15
|
+
\section{A Study of Digital Systems}
|
|
16
|
+
|
|
17
|
+
% Incorrect
|
|
18
|
+
\section{A study Of digital Systems}
|
|
19
|
+
```
|
|
@@ -26,6 +26,8 @@ class FormatConfig:
|
|
|
26
26
|
"""Output formatting settings loaded from a TeXact configuration."""
|
|
27
27
|
|
|
28
28
|
html_style: bool = False
|
|
29
|
+
vscode_style: bool = False
|
|
30
|
+
quiet: int = 0
|
|
29
31
|
|
|
30
32
|
|
|
31
33
|
@dataclass(frozen=True)
|
|
@@ -104,7 +106,12 @@ def _parse_config(data: Mapping[str, object], path: Path) -> TexactConfig:
|
|
|
104
106
|
tools_data = _table(data.get("tools"), path, "tools")
|
|
105
107
|
|
|
106
108
|
_check_keys(lint_data, {"ignore", "casing", "we_count"}, path, "lint")
|
|
107
|
-
_check_keys(
|
|
109
|
+
_check_keys(
|
|
110
|
+
format_data,
|
|
111
|
+
{"html-style", "vscode-style", "quiet"},
|
|
112
|
+
path,
|
|
113
|
+
"format",
|
|
114
|
+
)
|
|
108
115
|
_check_keys(tools_data, {"chktex_path"}, path, "tools")
|
|
109
116
|
|
|
110
117
|
ignore = _string_list(lint_data.get("ignore", []), path, "lint.ignore")
|
|
@@ -126,6 +133,14 @@ def _parse_config(data: Mapping[str, object], path: Path) -> TexactConfig:
|
|
|
126
133
|
if not isinstance(html_style, bool):
|
|
127
134
|
raise ConfigurationError(f"{path}: format.html-style must be a boolean")
|
|
128
135
|
|
|
136
|
+
vscode_style = format_data.get("vscode-style", False)
|
|
137
|
+
if not isinstance(vscode_style, bool):
|
|
138
|
+
raise ConfigurationError(f"{path}: format.vscode-style must be a boolean")
|
|
139
|
+
|
|
140
|
+
quiet = format_data.get("quiet", 0)
|
|
141
|
+
if isinstance(quiet, bool) or not isinstance(quiet, int) or quiet not in {0, 1, 2}:
|
|
142
|
+
raise ConfigurationError(f"{path}: format.quiet must be 0, 1, or 2")
|
|
143
|
+
|
|
129
144
|
chktex_path = tools_data.get("chktex_path")
|
|
130
145
|
if chktex_path is not None and not isinstance(chktex_path, str):
|
|
131
146
|
raise ConfigurationError(f"{path}: tools.chktex_path must be a string")
|
|
@@ -138,7 +153,11 @@ def _parse_config(data: Mapping[str, object], path: Path) -> TexactConfig:
|
|
|
138
153
|
casing=casing,
|
|
139
154
|
we_count=we_count,
|
|
140
155
|
),
|
|
141
|
-
format=FormatConfig(
|
|
156
|
+
format=FormatConfig(
|
|
157
|
+
html_style=html_style,
|
|
158
|
+
vscode_style=vscode_style,
|
|
159
|
+
quiet=quiet,
|
|
160
|
+
),
|
|
142
161
|
tools=ToolsConfig(chktex_path=chktex_path),
|
|
143
162
|
source_path=path,
|
|
144
163
|
)
|
|
@@ -20,8 +20,9 @@ class Printer:
|
|
|
20
20
|
HTML_DARK_RED = "#800000"
|
|
21
21
|
HTML_YELLOW = "#808000"
|
|
22
22
|
|
|
23
|
-
def __init__(self, html_style: bool = False) -> None:
|
|
24
|
-
self.
|
|
23
|
+
def __init__(self, html_style: bool = False, vscode_style: bool = False) -> None:
|
|
24
|
+
self.vscode_style = vscode_style
|
|
25
|
+
self.html_style = html_style and not vscode_style
|
|
25
26
|
if not self.html_style:
|
|
26
27
|
colorama_init()
|
|
27
28
|
|
|
@@ -42,6 +43,15 @@ class Printer:
|
|
|
42
43
|
print(f"{self.green(line_label)} {self.yellow(warning_label)} {message}")
|
|
43
44
|
|
|
44
45
|
def print_diagnostic(self, diagnostic: "Diagnostic") -> None:
|
|
46
|
+
if self.vscode_style:
|
|
47
|
+
filename = diagnostic.filename or "<unknown>"
|
|
48
|
+
color = (
|
|
49
|
+
self.yellow if diagnostic.severity.value == "warning" else self.dark_red
|
|
50
|
+
)
|
|
51
|
+
warning_label = color(f"[{diagnostic.code}]")
|
|
52
|
+
print(f"{filename}:{diagnostic.line}: {warning_label} {diagnostic.message}")
|
|
53
|
+
return
|
|
54
|
+
|
|
45
55
|
line_label = self.green(f"L{diagnostic.line}")
|
|
46
56
|
color = self.yellow if diagnostic.severity.value == "warning" else self.dark_red
|
|
47
57
|
warning_label = color(f"[{diagnostic.code}]")
|