What did I wrong, that the following does not work here:

(Edit: I mixed up the true and false parts, but I don't want to change the code, because the answers refer to this in a way confusing one.)






\ifbool{tightspace}{% true part empty - should do nothing
}{% false part:




Because of \textcolor{black}{\itshape{\textbackslash}setbool\{tightspace\}\{true\}}
the line spacing should be very narrow ...
Don't wonder at \textcolor{red}{the missing line breaks:}

And now, with \textcolor{black}{\itshape{\textbackslash}setbool\{tightspace\}\{false\}},
it should have \textcolor{red}{the document's line stretch ...}



It seem's, that the boolean switch has no effect – or is there another thing I didn't realize?


You check the boolean switch once in the preamble and make the definition, which is not changed later.

It would work as expected if you would make the test later, such as:


However, I would make the spacing value a variable instead. And I guess you meant your tightspace check the other way round as in the original code.

  • Though I accepted your answer: Could you please explain the part with the variable a bit more (tm) detailed? And yes, you're right, I mixed up the true and false parts. – Speravir Nov 25 '11 at 23:14

I think you you should make a small dry run.

I will try it:

  1. You define a new bool tightspace -- no problem
  2. You set the new bool tightspace to false -- no problem This step isn't required because newbool set the bool to false.
  3. You make a condition -- here is the problem. The condition is false, so at the beginning of the environment ExampleVerbatim you set the spacing environment for the whole document.
  • Point 2: I didn't know, thanks. (As Stephan correctly remarked - in my original code I had it the other way round; I checked the MWE, too, but as it didn't work I could not notice my error.) To Point 3: That is what I didn't realize (and I think you should write something more comprehensive). I change the condition, before the environment begins, but important is the moment when the hook is defined! (BTW: 3 German tongues talk together in English, and mine is almost broken, because my English is quite poor …) – Speravir Nov 25 '11 at 23:30

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.