TeXnik - Tips TeX and LaTeX

Welcome to the TeXnik website (under construction)

ifthen package
TUG logo

Main page

Search CTAN:


Google c.t.t.

Google d.c.t.t.



comment package |  ifthen package |  Print selected Textparts  | 


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

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:
\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:

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: Thu Feb 22 18:25:27 CET 2024 ; file is: 1700.95685185185 days old
contact webmaster _at_ TeXnik.de