From optional.sty:
"Enable multiple versions of a document to be printed from one source file, especially if most of the text is shared between versions."
Package optional is very similar to comment, but it is more flexible and there is an easier way to declare which parts of source should be activated or deactivated.
It works perfectly. So it's time for a small summary from your posts:
File: optional_example.tex
Code: Select all
\documentclass{article}
\ifx\UseOption\undefined
\def\UseOption{optb}
\fi
\usepackage{optional}
\begin{document}
\begin{itemize}
\opt{opta}{\item First item}
\opt{optb}{\item Second item}
\end{itemize}
\end{document}
Try to compile this with this commands and compare the results:
Code: Select all
pdflatex -jobname optional_example "\def\UseOption{opta}\input{optional_example}"
pdflatex optional_example.tex
pdflatex -jobname optional_example "\def\UseOption{opta,optb}\input{optional_example}"
For me it's great. Maybe there is a better way, to find out from source file, whether there is a command-line argument for latex/pdflatex or not, but i don't know about it. For me it looks OK.
Thank you all for your help.
Best regards,
nieproszenieja