## LaTeX forum ⇒ Text Formatting ⇒ conditional "code" Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
BastienBastien
Posts: 40
Joined: Mon Aug 20, 2012 2:27 pm

### conditional "code"  Topic is solved

Hello,
Do you have an idea how I could make a conditional code inclusion?
Something like that:

#define DETAIL ON if (DETAIL=ON)     % in such case we include all the calculation details{     blablabla     blabla}

Regards,
Bastien

Tags:

thomasb
Posts: 76
Joined: Thu Aug 03, 2017 10:54 am
Location: france
With etoolbox package, do you need an example ?

BastienBastien
Posts: 40
Joined: Mon Aug 20, 2012 2:27 pm
Hi,
I was about to answer you: no, thanks I can handle it.
But I had a look on the documentation and it seems low level code.
I am definitely not used to.

May be I could use:

ifdefined
undefinded
ifbool
newtoggle
toggletrue
togllefalse
newbool
ifdef
ifundef

but I am realy not sure!
would be great if you can write a couple of code lines suited to the problematic.

Merci Thomas !

Bastien

thomasb
Posts: 76
Joined: Thu Aug 03, 2017 10:54 am
Location: france
You can use the boolean either to charge packages, either in the document :
\documentclass{article}\usepackage{etoolbox} \newbool{myboolean}\boolfalse{myboolean}%\booltrue{myboolean} \ifbool{myboolean}{    % if}{  % else  }\begin{document} \ifbool{myboolean}{Text : boolean is true}{Text : boolean is false}\end{document}

BastienBastien
Posts: 40
Joined: Mon Aug 20, 2012 2:27 pm
Hi,

I confirme it works fine.
Now I have an other problem: it is diffcult to arange the redaction with two versions:
one without the detaIls,
and all details in a conditional code block,
but this is not a LaTeX issue!

Bye