TeXnik - Tips TeX and LaTeX

Welcome to the TeXnik website (under construction)

`ifthen` package
 Main page Index UK FAQ Documentation Software CTAN Search CTAN: Statistics Google c.t.t. Google d.c.t.t.
comment package |  ifthen package |  Print selected Textparts  |

comment

By default the text in a comment-environment is totally ignored by latex. With the package comment, which is often part of your local tex-installation, otherwise available at CTAN, the behaviour can be changed. in latex preamble write

```\usepackage{comment}
\includecomment{comment}```
and the comments will be printed in the same layout as the paragraph before this comment-environment. With \excludecomment{comment} toggling of printing/not printing is possible.

Print selected Parts
You need ifthen-package (see next item). In the preamble you define the parts of the text which schould be printed:
```\usepackage{ifthen}
\newcommand\toPrint{part1}% or part2, part3 ...```
In the text you write always
```\ifthenelse{\equal{\toPrint}{part1}}{% all in red
....
the text for part 1 ...
...
}{}```
And same for other parts.

ifthen package / Optional Text

If your output depends to one ore more variables, you can use the ifthen packagem which should be part of your local tex-installation, otherwise available at CTAN.

in latex preamble write for example:

```\usepackage{ifthen}
\newboolean{PrintEquation}
\setboolean{PrintEquation}{true}```
In your text you can ise it like:
```... blah ...
\ifthenelse{\boolean{PrintEquation}}{<latex text if true>}{<latex text if false>}
... blah ...```
With \setboolean{PrintEquation}{false} you can toggle between the two texts.

local time: Sun Apr 11 23:27:58 CEST 2021 ; file is: 654.125266203704 days old
contact webmaster _at_ TeXnik.de