I am trying to implement single sourcing such that same document can be conditionally typeset for number of purposes. This is what I would like to do.
\IfFileExists{../DecMaker.txt}{
var x = DecMaker.txt %the file will contain a single digit number
if x = 0{
\newcommand{\product}{Windows}
}
if x = 1{
\newcommand{\product}{Linux}
}
if x = 2{
\newcommand{\product}{Mac}
}
\product\ computer bought from ThisRandomBrand is amazing!
}
{
Go and buy a \product\ computer from ThisRandomBrand!!
}
I read up a bit about etoolbox
and tried to use the \iftoggle
command. Its complicating the matters with multiple ifs.
Please let me know if you need more details.
EDIT: I intend to use the above variable in numerous other places in my document. E.g.
if x = 0{
Press the power button and pray that you don't get a blue screen
}
if x = 1{
Congratulations for forwarding the evolution!!
}