This script checks for common mistakes in LaTeX source files of scientific papers.
python3 paperlint.py <file.tex/path> [-i/x <include/exclude switch>] [--error]
Provide either a single .tex file to check or a path to recursively check all .tex files in that directory!
By default, all rules are used for checking the document.
The switches can be configured with the -x
and -i
parameters to exclude and include entire categories of rules or single rules.
The include/exclude switches are evaluated in the order they are specified.
For example, -i typography
only activates the typography rules, whereas -i all -x typography -i cite-space
enables all rules without the typography rules, but enables the cite-space
rule from the typography category.
If --error
is provided, the tool exits with error code 1 if there are warnings.
Warnings are grouped in five different categories:
- General
- Typography
- Visual
- Style
- References
This category includes general mistakes and discouraged things (switch general
).
- Description: Warns if the string "TODO" appears in the paper
- Switch:
todo
- Description: Warns if there are
\note
or\todo
notes in the paper - Switch:
note
- Description: Warns if there are multiple sentences per line
- Switch:
multiple-sentences
- Description: Warns if there are sentences with "will" future
- Switch:
will
- Description: Warns if short forms, such as "can't", "shouldn't", etc., are used
- Switch:
short-form
- Description: Warns if numbers 3 to 12 are written as words instead of numbers
- Switch:
numeral
This category includes typography-related issues, such as wrong punctuation (switch typography
).
- Description: Warns if there is no space before a
\cite
command - Switch:
cite-space
- Description: Warns if the math environment is used purely to format numbers
- Switch:
math-numbers
- Description: Warns if large numbers are not formatted with the
sinuit
package - Switch:
si
- Description: Warns if percentages are not formatted with the
siunit
package - Switch:
percentage
- Description: Warns if the wrong quotation marks (") are used
- Switch:
quotes
- Description: Warns if there is a space before a punctuation character
- Switch:
punctuation-space
- Description: Warns if the number of opening and closing brackets per line does not match
- Switch:
unbalanced-brackets
- Description: Warns if "and/or" is used
- Switch:
and-or
- Description: Warns if an ellipsis with three dots ("...") is used
- Switch:
ellipsis
- Description: Warns if a footnote is before the period
- Switch:
footnote
- Description: Warns if a line does not end with a punctuation mark
- Switch:
punctuation
- Description: Warns if there is no space before a comment
- Switch:
comment-space
- Description: Warns if the spacing for brackets are wrong, i.e., if there is no space before an opening bracket, a space after an opening bracket, or a space before a closing bracket
- Switch:
bracket-spacing
- Description: Warns if a (potential) acronym is not written in upper case
- Switch:
acronym-capitalization
This category includes warning regarding code that is visually not optimal and can be improved to make the paper look better (switch visual
).
- Description: Warns if
\hline
is used in tables instead of\toprule
,\midrule
, and\bottomrule
- Switch:
hline
- Description: Warns if there are two section headers without text in between
- Switch:
two-header
- Description: Warns if a paragraph consists of only a single sentence
- Switch:
single-sentence
- Description: Warns if vertical lines are used in tables
- Switch:
vline
- Description: Warns if a section has only one explicit subsection
- Switch:
single-subsection
- Description: Warns if both
compactitem
anditemize
(orcompactenum
andenumerate
) are used - Switch:
mixed-compact
- Description: Warns if float contents are centered with the
center
environment instead of\centering
- Switch:
float-center
- Description: Warns if the
eqnarray
environment is used instead of thealign
environment - Switch:
eqnarray
- Description: Warns if the capitalization for section titles is wrong
- Switch:
capitalization
This category includes warning of things that are discouraged or wrong for the style of an academic paper (switch style
).
- Description: Warns if the
appendix
environment is used instead of\appendix
- Switch:
appendix
- Description: Warns if dimension macros are used that do not always work, such as \linewidth or \textwidth
- Switch:
dimensions
- Description: Warns if "etc" is used
- Switch:
etc
- Description: Warns if
resizebox
(instead ofadjustbox
) is used for tables - Switch:
resize-table
- Description: Warns if the caption for a table is not above the table
- Switch:
table-top-caption
- Description: Warns if a figure has no explicit alignment
- Switch:
figure-alignment
- Description: Warns if a table has no explicit alignment
- Switch:
table-alignment
- Description: Warns if a listing has no explicit alignment
- Switch:
listing-alignment
- Description: Warns if non-inclusive terms are used (based on the ACM Guidelines)
- Switch:
inclusion
- Description: Warns if a citation is used as a noun
- Switch:
cite-noun
- Description: Warns if a sentence starts with a conjunction ("And", "But", "Or")
- Switch:
conjunction-start
This category includes warnings for everything related to (cross-)references (switch references
).
- Description: Warns if a figure has no label
- Switch:
figure-label
- Description: Warns if a table has no label
- Switch:
table-label
- Description: Warns if a listing has no label
- Switch:
listing-label
- Description: Warns if the label is defined before the caption inside a figure
- Switch:
figure-caption-order
- Description: Warns if the label is defined before the caption inside a table
- Switch:
table-caption-order
- Description: Warns if the label is defined before the caption inside a listing
- Switch:
listing-caption-order
- Description: Warns if there is a label defined that is never referenced
- Switch:
label-referenced
- Description: Warns if a
tabular
environment is not within thetable
float - Switch:
tabular-float
- Description: Warns if a
tikzpicture
environment is not within thefigure
float - Switch:
tikz-float
- Description: Warns if an
lstlisting
environment is not within thelisting
float - Switch:
listing-float
- Description: Warns if a
cite
command has duplicate entries - Switch:
cite-duplicate