Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm in the middle of proofreading TeX source for a book, and have found a couple of places where a stray space has slipped through before a footnote mark. Is there any automated way of scanning TeX source to detect this?

share|improve this question
    
I'd like to add a 'proofreading' tag here, if no one objected. I think there is a class of otherwise disparate activities which naturally fall under that tag. –  Mohan Dec 15 '12 at 12:54

2 Answers 2

up vote 8 down vote accepted

If you're running linux or OSX or cygwin under Windows, you can use

grep -n '\([[:space:]]\|^\)\\footnote' file.tex

in a terminal. This command outputs each line of file file.tex (prefixed with line number) that contains \footnote preceded by a space (any type of space) or at the beginning of a line.

share|improve this answer

The answer depends whether you are proofreading the PDF or the *.tex source. While there may be a possibility to search via »regular expressions« through a PDF looking for footnote numbers, I have no idea how to do that.

But for the *.tex source in the editor there should be a very easy solution: All editors I know provide a funcitionality called »search and replace«. You just have to search for _\footnote{ and replace that by \footnote{ .


Edit: As serveral comments demand to be as precise as possible, I admit that this would be usefull. So I correct: "_" meant a whitespace and certainly it would be a good idea to search and replace two leading whitespaces before a footnote, as well.

share|improve this answer
    
Does '_' match against whitespace in standard r.e.s? –  Mohan Dec 16 '12 at 11:05
3  
Nitpick: that would not work for this \footnote{\dots} that is preceded by two spaces. Tab characters also pose a problem, as do footnote commands at the beginning of a line. –  Christian Lindig Dec 16 '12 at 11:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.