I need to produce from this file three different versions of document, e.g. first version only with first item, second with second item, and third with both of them.
I know, that i can use ifthen package or sed tool to achieve this, but when you have many documents, which differs only in a few places (e.g. uC specification) and the rest is the same, producing them e.g. with Makefile is complicated.
Is there any simpler way, maybe latex built-in functionality, to do this?
Thank you.
nieproszenieja
Last edited by nieproszenieja on Thu Jul 31, 2008 9:55 pm, edited 1 time in total.
localghost wrote:Perhaps another topic will help you in finding a solution to this issue [1]. There have been given some interesting approaches.
[1] managed compilation
Thank you for response.
Still I can't write Makefile without sed, which can produce from one source file a few versions of document, although comment package (from 4th post [1]) seems to simplify the task.
So is there any way to include/exclude some parts of source file at build time, without using external tools (like sed) and (maybe) with comment/ifthen package?
nieproszenieja wrote:Still I can't write Makefile without sed, which can produce from one source file a few versions of document, although comment package (from 4th post [1]) seems to simplify the task.
So is there any way to include/exclude some parts of source file at build time, without using external tools (like sed) and (maybe) with comment/ifthen package?
I'm not sure what are you trying to achieve exactly. Do you mean activation/deactivation of document fragments without making changes to your source file? If that's the case then you could move the setup of the comment package from the source to the command line like this:
T3. wrote:
I'm not sure what are you trying to achieve exactly. Do you mean activation/deactivation of document fragments without making changes to your source file? If that's the case then you could move the setup of the comment package from the source to the command line like this:
Yes, this is exactly what I mean - I want to create different versions of document without editing source file, activating/deactivating some parts of source from Makefile or command line.
The command works great. It is possible now, to check in source file wherther commentA and/or commentB and/or comment package were already defined from command line (if not, the default values will be used)?
nieproszenieja wrote:The command works great. It is possible now, to check in source file wherther commentA and/or commentB and/or comment package were already defined from command line (if not, the default values will be used)?
Alternatively, you could have '\input{commentsetup}' in your preamble and 'commentsetup.tex' file would contain the configuration for the comment package. This file could be easily created from the make file. Then you can compile as usual. Choose whichever solution you prefer.
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:
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
Last edited by nieproszenieja on Wed Aug 20, 2008 4:43 pm, edited 1 time in total.
The idea to use '\jobname' for variant switching is nice, especially that you also get a differently named document for each variant. Below is a solution that will allow you to keep the setup code for all the variants in your main file.
T3. wrote:The idea to use '\jobname' for variant switching is nice, especially that you also get a differently named document for each variant. Below is a solution that will allow you to keep the setup code for all the variants in your main file.
I don't know why, but it doesn't work for me (in \jobname and \Defaultsetup is the same string, I checked this)
Althrough, in both examples you keep all variants in main file (setup "opta", "optb" etc.).
The difference is, that this method is less flexible (you can't change output file name) and you need to write additional code (ifx statement) for each setup (i.e. for each \def\UseOption{...}), but usage is much simpler,