Spellchecker
check_spelling(filename, pre_release = TRUE, ignore.lines = NULL,
known.correct = NULL, known.wrong = NULL, bib_files, check_etcs = TRUE,
dict_lang = "en_GB", .report_error)
Path to a LaTeX file to check.
Should the document be assumed to be final?
Setting to FALSE
permits the use of ignore_spelling_in
and permits add_to_dictionary
to be
present outside the document preamble.
Integer vector of lines to ignore (due to possibly spurious errors).
Character vector of patterns known to be correct (which will never be raised by this function).
Character vector of patterns known to be wrong.
Bibliography files (containing possible clues to misspellings).
If TRUE
, stop if any variations of etc
, ie
, and eg
are present. (If they are typed literally, they may be formatted inconsistently. Using a macro ensures they appear consistently.)
Passed to hunspell::dictionary
.
A function to provide context to any errors.
Called primarily for its side-effect. If the spell check fails, the line at which the first error was detected, with an error message. If the check suceeds, NULL
invisibly.
Extends and enhances hunspell
. The advantage of this function is that you can add directives
in the document itself. To add a word foobaz
to the dictionary (so its presence does not throw an error), write
% add_to_dictionary: foobaz
on a single line. The advantage of this method is that you can collaborate
on the document without having to keep track of which spelling errors are genuine. You can also add the
directive % ignore_spelling_in: mycmd
which will ignore the spelling of words within the first argument
of \mycmd
.
Other advantages include skipping the contents of certain commands, the spelling of which need not be checked
as they are not printed, viz.
citation and cross-reference commands, and certain optional arguments.
The package comes with a suite of correctly_spelled_words
that were not present in hunspell
's
dictionary.
This function should be quite fast. I aim for less than 500 ms on a real-world report of around 100 pages.
The function is slower when consulting bib_files
, though I recommend adding authors, titles, etc.
explicitly, or using citeauthor
and friends.
This function is forked from https://github.com/hughparsonage/grattanReporter to parse reports of the Grattan Institute, Melbourne for errors. See https://github.com/HughParsonage/grattex/blob/master/doc/grattexDocumentation.pdf for the full spec. Some checks have been omitted in this package.
# NOT RUN {
# }
# NOT RUN {
url_bib <-
paste0("https://raw.githubusercontent.com/HughParsonage/",
"grattex/e6cab97145d38890e44e83d122e995e3b8936fc6/",
"Report.tex")
check_spelling(url_bib)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab