I need to figure out how many percent of the text in my latex document which consists of quotes (in block quotes, particularly). I have wrapped all quotes in the block quotes command:


Is there any tool which would easily allow me to either:

  1. Calculate the percentage directly, or
  2. Extract all content within the block quotes command, and also (in a separate output) extract all content which is outside of the block quotes command. So that I can input both texts into an online word counter, and calculate the percentage from comparing the resulting amount of words.

I am using Overleaf, so it's limited what packages I can run, but I think it can run most.

  • It would be a nice programming exercise for e.g. Python. Would running a Python Script be okay for you? – Uwe Ziegenhagen Mar 16 '20 at 18:16
  • 1
    @UweZiegenhagen Yeah, it would be, but I'd rather not bother to fiddle with it. I was able to find a neat and quick LaTeX solution though. See my answer. – Magne Mar 16 '20 at 19:25
  • 3
    texcount is able to count words of delimited parts of the text, as well as text of some common LaTeX structures. See tex.stackexchange.com/a/277734/11604 – Fran Mar 16 '20 at 19:56
  • @Fran Yup, that was the one I ended up using. I found the online service, and linked it in my answer below. – Magne Mar 19 '20 at 15:52

I was able to use the extract package to get just the quotes out in a separate tex document:

% To extract all block quotes to a separate quotes.txt file, downloadable in the bottom of the "log and output files" page in Overleaf

Then I was able to use the LaTeX word counter found here:


Running it first on the original file, and then on the quotes.tex file, and compare the word counts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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