textlint-rule-punctuation-end-of-equation
v1.1.0
Published
Textlint rule to enforce punctuation at the end of LaTeX math environments
Maintainers
Readme
textlint-rule-punctuation-end-of-equation
A textlint rule to enforce punctuation at the end of LaTeX math environments in academic writing.
Installation
From npm (when published)
npm install textlint-rule-punctuation-end-of-equationLocal development/usage
Clone and build the rule:
git clone <this-repo> cd period-endof-equation pnpm install pnpm run buildInstall textlint globally:
npm install -g textlintLink the rule locally:
# In the rule directory npm link # In your document directory npm link textlint-rule-punctuation-end-of-equationCreate a
.textlintrcfile in your document directory:{ "plugins": ["@textlint/markdown"], "rules": { "punctuation-end-of-equation": true } }Run textlint on your documents:
# Check a single file textlint your-document.md # Check and auto-fix textlint --fix your-document.md # Check all markdown files textlint "**/*.md"
Configuration Options
You can customize which math environments and punctuation marks to check:
{
"rules": {
"punctuation-end-of-equation": {
"allowedMathEnvironments": ["equation", "align", "gather", "multline"],
"allowedPunctuation": [".", ",", ";", "!", "?"]
}
}
}Options
allowedMathEnvironments(default:["equation", "align", "gather", "multline", "split", "eqnarray"]): LaTeX math environments to checkallowedPunctuation(default:[".", ",", ";", "!", "?"]): Punctuation marks considered valid at the end of equations
Alternative: Direct usage without global installation
If you prefer not to install textlint globally:
Install textlint locally in your document project:
# In your document directory npm init -y npm install textlint @textlint/textlint-plugin-markdown npm link textlint-rule-punctuation-end-of-equationAdd scripts to your
package.json:{ "scripts": { "lint": "textlint *.md", "lint:fix": "textlint --fix *.md" } }Run with npm:
npm run lint npm run lint:fix
What it checks
This rule enforces punctuation at the end of LaTeX math environments:
- Display math:
$$...$$ - Display math:
\[...\] - Environment-based math:
\begin{equation}...\end{equation},\begin{align}...\end{align}, etc.
Valid examples
This is correct: $$x = y + z.$$
With comma: $$f(x) = x^2,$$
With semicolon: \[a = b + c;\]
\begin{equation}
E = mc^2.
\end{equation}
\begin{align}
x &= y + z, \\
a &= b + c.
\end{align}Invalid examples
This is wrong: $$x = y + z$$
Another wrong example: \[a = b + c\]
\begin{equation}
E = mc^2
\end{equation}Development
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Lint
npm run lintLicense
MIT
