0

I'm new to latex and really do not master its dialect and concepts...sorry inadvance.

I came to it because I need to create documents that will look different based on the targeted audience.

To be more concrete I want to generate procedure to send to customers. Depending on wether the customer have a windows or a linux environment, the procedure will obviously be different. I've seen that latex has some conditionals but I can't understand how to implement what I need. I was thinking I could somehow set a document metadata (e.g targetSystem: linux or windows) and later you a condition to choose which section should be included in the doc and which should not.

If I had to write it in code, it would be something like:

if (target == linux) { "some text" } else { "some other text" }

Expect I don't know what "target" could be in a latex document.

Any guidance?

  • 3
    Welcome to TeX.SX! Please keep in mind, that thi isen't an forum. What is your specific problem/question? Latex will generate a pdf. – Bobyandbob Aug 9 '18 at 15:54
  • My question is "how do I use conditionals in order to make a section or a paragraph appear in the rendered document based on a property I can set prior to rendering" – alxgomz Aug 10 '18 at 7:49
  • I edited the question to try to make it more clear... – alxgomz Aug 10 '18 at 7:55
  • This doesn't answer your question at all, but I wouldn't generate different versions. Include the different instructions in the same document. Your client might be a company running different operating systems. – Johannes_B Aug 10 '18 at 8:02
  • Maybe this helps tex.stackexchange.com/questions/84652/… – faltfe Aug 10 '18 at 8:35
1

You can use conditionals in LaTeX. The following shows a really basic example on how to use conditionals

\documentclass{article}

\newif\ifislinux % define new flag
\islinuxfalse    % No Linux system
%\islinuxtrue    % Linux system

\begin{document}
    \ifislinux Hello Linux\else Hello Window\fi
\end{document}

Try to toggle the comment out on \islinuxtrue and \islinuxfalse and see what happens. Note that you have to toggle the flag manually. It doesn't detect the running OS.

You might have a look at etoolbox or similar packages which give a lot more control about conditionals.

| improve this answer | |

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.