[texhax] writing about 2 parallel developments of a product withthe same base code

Uwe Lück uwe.lueck at web.de
Mon Feb 5 02:12:00 CET 2007


At 15:39 29.01.07, Vaida Bogdan wrote:
>Hi, can someone tell me how can I write 2 documents that have 90% of
>the content the same, the rest 10% modified, some sections added, some
>modified and some deleted?
>Basically I need to write about 2 parallel developments of a product
>with the same base code.

I am not posting another hint for Vaida Bogdan here,
rather some general discussion of the \newif approach
that has been suggested:

At 11:25 30.01.07, Philip G. Ratcliffe wrote:
>Alternatively to maintain just a single main file, or if you wish to
>interleave pieces for one or other document inside the subfiles, put
>
>   \newif\ifdocA
>
>in the main files' preambles, followed by either \docAtrue or \docAfalse
>accordingly.
>
>In your subfiles you can then simply put things like:
>
>This product is \ifdocAtrue really wonderful\else absolutely useless\fi. We
>\ifdocAtrue\else cannot \fi recommend it.

A minor technical remark on this proposal:
instead of \ifdocAtrue, you must type \ifdocA
-- cf.:

At 06:45 31.01.07, Hartmut Henkel wrote:
>you can also create one master document (e. g. doc.tex) for editing and
>make links with different names to it (e. g. doc-a.tex and doc-b.tex (or
>only doc-a.tex)):
>
>$ ln -s doc.tex doc-a.tex
>$ ln -s doc.tex doc-b.tex
>
>Then prepare file doc.tex like the following for automatic switching
>between document variants based on the document name:
>
>\documentclass{article}
>
>\newif\ifdocA
>\expandafter\def\csname doc-a\endcsname{\docAtrue}
>\expandafter\def\csname doc-b\endcsname{\docAfalse}
>\csname\jobname\endcsname
>
>\begin{document}
>This is the  \ifdocA original \else alternate \fi version.
>\end{document}

With large documents or differences
(and/or too primitive source editors),
you may experience difficulties concerning
which \if... corresponds to some given \fi.
Another danger is that some inter-word space
may be missing or wrongly doubled in the output
-- unless the user is careful and skilled enough.

At least some of the packages at which this thread
has hinted help in avoiding these problems.

HTH -- Uwe.



More information about the texhax mailing list