Martin,
Martin Scholz
is there a way in conTeXt how I can use a filename, so that I can write a text where I can refer to it for using it in the following scenario:
I need 4 documents with nearly the same content. what I like to do is to switch in the document depending on the called filename.
as I got a file called invoice.tex and create some links to this file called delivery.tex order.tex and so on and now call
texexec invoice.tex
or
texexec order.tex
I want the document to recognize in the first case that it is invoice and in the second case that it is order, so that I can use an if then else environment on the different parts where I can define the following
if{filename==invoice} then{print this content} else{} if{filename==order} then{print this part of content} else{}
Have you looked at modes? I use this technique for making manuscript, presentation and speakernotes versions of teaching documents. Here is an example: %%% TheEarthWorks.tex --- %% Author: rmason@mun.ca %% Version: $Id: TheEarthWorks.tex,v 0.0 2009/01/14 19:16:14 rmason Exp$ % Styles specific to the pres and MS modes: \input presentation.tex \input manuscript.tex \starttext \startcolor[TextColor] \setupalign[right, nothyphenated] \setuptolerance[horizontal,verytolerant] % Title \titlepage{Gems, The Earth \& its Works} % ----------------------------------------------------------------------------- \NewSlide{Diamonds are a girls best friend} \oneplot{fig:intro}{Diamonds are a girls best friend\ldots and tell us a lot about how the Earth works.}{\externalfigure[Brillanten]} % reference caption image \startmode[manuscript] \section{Introduction} The Earth is made of rocks and in turn the rocks are made of minerals. Most gems (\in{Fig.}[fig:intro]) are minerals. We will look at rocks and minerals soon, but before we do so it is useful to have an overview of the bigger picture: the structure of the Earth. We will then go on to look at how various kinds of rocks are formed before focusing on minerals and gems. \stopmode%[manuscript] \startmode[manuscript] \section{Structure of the Earth} What is the interior of the Earth like? Is it structureless, like Christmas cake, or does it have a structure, like layer cake? If the Earth is structureless then maybe gems can form and be found anywhere. If it has structure then perhaps specific gems form only in particular places. \stopmode%[manuscript] % ----------------------------------------------------------------------------- \NewSlide{Structure of the Earth} \twoplots % reference caption % image1 caption1 % image2 caption2 {fig:cakes}{What is the structure of the earth?} {\externalfigure[Stirring_christmas_pudding]}{Christmas pudding?} % http://en.wikipedia.org/wiki/Image:Stirring\_christmas\_pudding.JPG % No licensing info given. {\externalfigure[Layer_cake]}{Layer cake?} % http://kitchen-delights.blogspot.com/2007/10/ % iced-lemon-curd-layer-cake.html} % Licensing conditions not known. \startmode[manuscript] Various lines of evidence show that Earth is a layered planet (\in{Fig.}[fig:earthstructure]). The outermost layer is the \emph{crust}, which is made largely of rocks and minerals that have low density. \stopmode%[manuscript] % ----------------------------------------------------------------------------- \NewSlide{Earth Structure} \oneplot{fig:earthstructure}{Internal structure of the Earth}{\externalfigure[Earth_structure]} % reference caption image % http://en.wikipedia.org/wiki/Image:Earth-crust-cutaway-english.svg Surachit % Original png was public domain. No license info for this svg version \startmode[presentation] % ----------------------------------------------------------------------------- \NewSlide{Where are gems found?} \onewideplot{fig:gemsfound}{Where are gems found?}{\externalfigure[Crust]} % reference caption image % ----------------------------------------------------------------------------- \NewSlide{Where are gems formed?} \onewideplot{fig:gemsformed}{Where are gems formed?}{\externalfigure[Crust_upper_mantle.jpg]} % reference caption image \stopmode%[presentation] \startmode[manuscript] The next layer inwards is the \emph{mantle} which occupies a large portion of the volume of the Earth and is made of rocks and minerals with a density around twice that of the crust. Beneath the mantle is the core, which is subdivided into the \emph{outer core}, which is liquid and the \emph{inner core} which is solid. The core has a density about twice that of the mantle. The layering then is by {\em density} and it increases as the centre of the Earth is approached. Tha majority of gems are found, and originated in, the crust (\in{Fig.}[fig:earthstructure]). Diamonds are an exception, having been formed in the upper mantle. The gemstone {\em peridot} (a form of the mineral {\em olivine}) can also be formed in the mantle and incorporated in the crust in the form of \emph{peridotite} inclusions that are brought up in some volcanic eruptions. There is no evidence that material from the core reaches the Earth's surface. However, we do have material similar to the material of the core in the form of {\em iron} and \emph{stony-iron} meteorites (\in{Fig.}[fig:meteorites]). Fewer than 100 stony-irons are known and they are commercially and scientifically valuable. The ``stony'' component is olivine, often peridot quality. The iron component is an iron-nickel alloy. \stopmode%[manuscript] The \input *.tex documents contain definitions used in the text. The document is then compiled using a command: texexec --mode=manuscript --result=EarthWorksMS.pdf TheEarthWorks.tex When i want the presentation version I just change to --mode=presentation on the command line. Cheers, Roger