Generaltool to merge multiple part document into a single .tex file

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
yoshi314
Posts: 1
Joined: Fri Nov 28, 2008 9:01 am

tool to merge multiple part document into a single .tex file

Post by yoshi314 »

I have a document composed of multiple files pulled in by \input command. some of them are included conditionally, basing on how certain variables in preamble are set.

Example

Code: Select all

\def\target{admin}   %who is documentation targeted to?

\newcommand{\checkuser}[3]{                    
    \IfSubStringInString{,#1,}{,\target,}{#2}{#3}
}   

(.....)

Feature XYZ is supposed to do this and that. 

%this part is visible for admins only
\checkuser{admin}
{ 
Technical info for admins goes here 
\input{technical_info_xyz.tex}
}
{ Technical information is available to administators. }  %this part is visible for non-admins
now, by flipping one switch in the preamble i can decide if i build documentation with extra info for technical users, or not.

lets assume i would like to create a source of the documentation for users, that means hide everything that would be visible for admins. something like pdflatex/latex would do, but with producing another source file instead of pdf/dvi output.

in other words i would like obtain something like this from above example :


admin version:

Code: Select all

\def\target{admin}   %who is documentation targeted to?

\newcommand{\checkuser}[3]{                    
    \IfSubStringInString{,#1,}{,\target,}{#2}{#3}
}   

(.....)

Feature XYZ is supposed to do this and that. 

Technical info for admins goes here 

< file technical_info_xyz.tex is inserted in this place >

user version: (after altering \target variable}

Code: Select all

\def\target{user}   %who is documentation targeted to?

\newcommand{\checkuser}[3]{                    
    \IfSubStringInString{,#1,}{,\target,}{#2}{#3}
}   

(.....)

Feature XYZ is supposed to do this and that. 

Technical information is available to administators.
so admin-visible lines are totally stripped off the sources for admins, and user-visible lines are removed from admin-sources.

the resulting file should be a latex source file.

so, my question is - is there an automated tool that will help me accomplish this?

i know i can already use filename-recorder feature of pdflatex and help me with that somewhat.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply