1

I have a collection of documents, all of which contain a common "sub-document" using the subfiles package. These different master documents all define various booleans using the functionality from etoolbox. One thing I noticed is that using reverse lookup (TeXworks) doesn't work well with text that happens to be included in a conditional statement.

I guess this limitation makes sense because the the TeX is really just parameters to a macro instead of part of the document. So, is there an alternative way to handle conditional compilation that will preserve inverse search functionality?

Consider the following MWE. When compiled, two paragraphs are generated. Attempting to jump to the code for these two paragraphs points to the final closing bracket for the conditional.

\documentclass[11pt]{article}
\usepackage{etoolbox}
\usepackage{lipsum}

\begin{document}
\newbool{foo}
\booltrue{foo}
\ifbool{foo}{
\lipsum[1-2]
}{
\lipsum[3-6]
}

\end{document}
  • LaTeX primitives like \newif seem to work fine. Perhaps that's a better approach? I only went with etoolbox because it was the general recommendation. I do like getting away from having LaTeX inside parameters though, since I was having issues with it making compilation errors almost impossible to find. – Jacob Schaer Sep 1 '15 at 6:07

Your Answer

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

Browse other questions tagged or ask your own question.