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 would like a way to get a word count while ignoring certain environments. The reason for this is that I have quite a bit of pseudocode enclosed within multiple verbatim blocks.

Ideally, a solution would be like this, but with the ability to select which environments to not select.

edit: I am using TexStudio

share|improve this question
add comment

1 Answer

As far as I know there is no solution you want.

You can try to use package ifthen. Define a boolean variable (\newboolean{WordCount}), set it to true (\setboolean{WordCount}{true}) or false (\setboolean{WordCount}{false}) and suround all environments you do not wanted to be counted with \ìfthenelse{WordCount}{}{<your environment>}. So if WordCount is false your environment is executed, if it is true your environment is not executed:

%in your praeambel:
\usepackage{ifthen}  % http://www.ctan.org/pkg/ifthen
\newboolean{WordCount}
\setboolean{WordCount}{true}
%\setboolean{WordCount}{false}
...
%in your document:
\ifthenelse{\boolean{WordCount}}{% 
   % True, no environment to be executed
}{% False, execute environment:
 <your environment here>
}

Please take a look to the related question is there any way to do a correct word count of a LaTeX document and combine one of the methods there with the code above.

Hope that helps.

share|improve this answer
add comment

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.