On September 3, 2003 02:23 pm, Johnathan Burchill wrote:
> On September 3, 2003 03:00 pm, Angus Leeming wrote:
> > Martin Vermeer wrote:
> > > On Wed, Sep 03, 2003 at 07:58:32PM +0000, Angus Leeming spake thusly:
> > >> It seems to me that there are two possible solution strategies.
> > >> 1. Output some clever latex in the 'Product' line. Something along
> > >> the lines of (psuedo code)
> > >>         if (exists($$Basename.pstex_t))
> > >>                 \\input{$$Basename.pstex_t}
> > >>         else
> > >>                 \\fbox{$$Basename.pstex_t not found}
> > >>
> > >> This puts the responsibility on LaTeX to do the right thing. Other
> > >> export formats will continue to work AFAICS.
> > >
> > > ...
> > >
> > >> Personally, I favour approach #1, but my latex knowledge is not up
> > >> to the task. Can some guru help me out?
> > >>
> > >> --
> > >> Angus
> > >
> > > Sure this should work. Replace the linefeeds by \n to make it one
> > > string. What about outputting a marginal note \marginpar{...}
> > > instead?
> >
> > Sounds good. What I'm looking for is the LaTeX-ese of the if then else
> > construct. Also what package would I need to add to the preamble?
>
> \IfFileExists{file_name}{true}{false}
> executes "true" if the file exists, otherwise it executes false.
> More specific to your task is
> \InputIfFileExists{file_name}{true}{false}
> which inputs the file if it exists, then executes true. Otherwise,
> executes false.
>
> \InputIfFileExists{$$Basename.pstex\_t}{}{\\fbox{$$Basename.pstex\_t not
> found}}
one too many \ in front of fbox command
 \InputIfFileExists{$$Basename.pstex\_t}{}{\fbox{$$Basename.pstex\_t not 
found}}
>
> No extra packages are necessary for this kind of logic.
>
> JB

-- 
Johnathan K. Burchill, Ph.D.
Department of Physics and Astronomy
University of Calgary
2500 University Drive N.W.
Calgary, AB T2N 1N4
Canada

(403) 217-4286
[EMAIL PROTECTED]

Reply via email to