On Fri, Sep 19, 2003 at 03:39:17PM +0000, Angus Leeming wrote:
> Guys, the attached file works well enough, but it's rather inelegant.
> I have defined a macro, so:
> 
> \newcommand*{\verbatiminputOrWarn}[1]{%
> \IfFileExists{#1}{\verbatiminput{#1}}{\warnNotFound{#1}} }
> 
> using it within the document body, so:
> \verbatiminputOrWarn{test_file.txt}
> 
> Is there a clean way of passing a '*' through to verbatiminput? Ie,
> I'd like to type in the document: \verbatiminputOrWarn*{test_file.txt}
> 
> But things go bananas if I do ;-)
> 
> Further questions: 1. is the '*' needed in '\newcommand*'. Omitting
> it appears to have no effect.  What does it do?

Allow arguments that span multiple paragraphs? Not sure.

> 2. Is '\def\stripprefix#1>{}' positioned correctly?

I think so. There are worse places. Naming it \lyxstripprefix is safer,
though.

> Shouldn't it be within the body of '\warnNotFound'?

This would re-define it everytime \warnNotFound is seen.  It might be
possible to place it in the \fbox, though.  But keep in mind that TeX is
slow. Redefining macros often is not good.

> Does LaTeX have scoping rules?

Yes. {} are some sort of a scope. But if you have

\def\a{b} c\a d

the 'b' end up in the same scope as c a d.

And

\def\a{\def\b{c}} e \a f \a g

expands to  e \def\b{c} f \def\b{c} g


TeX is the ugliest and unfriendliest 'language' I've ever seen...

Andre'

Reply via email to