I have a command
\foo which takes two arguments and which I use about a hundred times throughout my document (but never within an argument of another instance of
\foo). I now want to spellcheck every first argument in language A and every second argument in language B. There is a lot of other text in my document, which I do not wish to spellcheck.
The main problem here is parsing all first or second arguments of
\foo. I could in theory write a script that extracts this, but I suppose somebody has already done this and taken care of all caveats and special cases. So, essentially I am looking for a tool that allows me to extract all arguments of a certain command throughout a document. Feeding the output into a spellchecker shouldn’t be a problem.
I am on Linux, so I should be able to get most things running. I prefer solutions that write the arguments to
stdout or in a file.
The following questions and answers do not solve my problem satisfactorily:
- How to Spell-Check LaTeX in multiple languages / language variants – question was specific to a certain editor and only solution so far was to use external files (which is not feasible for me and would require parsing anyway to set it up automatically).
- Extract all emphasized words from latex document – This answer would probably work, but is aimed at collecting and printing inside a single document and thus probably overly complicated for my needs.
- https://tex.stackexchange.com/q/193097/28608 – This question also aims at addressing the problem in TeX, as far as I understand it.