Duncan,
although I subscribed on the lyx-devel mailing list I got the
answers only via CC's. But anyway, thanks for replying.

On Sun, Mar 03, 2002 at 12:05:39PM +0000, Duncan Simpson wrote:
> Hmmm... you could always use ERT for conditionals. Plain TeX has conditionals
> which shoud do what you need and there is a LaTeX package for those that want a
> slightly prettier version. The LaTeX package might not support the plain TeX
> magic documented in the rest of the message.

I already used \usepackage{ifthen} in my layout file. But I thought it
to be a workaround. Maybe it's a problem of what I expected and I should
better call it a feature. :^)
What I learned from your answer is: If you want to create customized
layouts you should have (more or less) detailed knowledge of the
LyX-Description syntax, of LaTeX and even of TeX.
This might be obvious for you but it's important if you think of the
process of migrating from M$-Word to Lyx.

> \begin{Plain TeX zone}
> Define a macro \faxnum, which is the fax number or empty (\def\faxnum{}, or a
> LaTeX equivilent) and then say
> 
> \def\nofax{}
> \ifx\faxnum\nofax{}\else\includefile{mysignature.jpg}\fi
> 
> all in ERT (this plain TeX magic, which expands to {} if \faxnum has an empty
> defintition and \includefile{mysignature.jpg} otherwise. You could replace {}
> with something appropiate for the end of a letter for extra credit. Oh, and if
> you want a fax cover page or letter heading, depending on whether it is a fax
> or letter, you can do that with a conditional too---once you have done this
> just define \faxnum at the top of your file and the rest should be magic :-)
> 
> Something big fix a like a cover page works nicely if you just put the
> conditional bits, including the \fi, in ERT and do the rest in LyX (which works
> happily, unaware the text might be bypassed).
> \end{plan TeX zone}
> 
> You can hide the *TeX magic inside some macros and not tell people about
> it...all they have to do is type \begin{message}{<fax number>} where <fax
> number> is left blank it is not a fax. Immediately inside \message it says
> \global\def\faxnum{#1}, or \newcommand\faxnum{#1} if you are a LaTeX purist,
> and whatever condition or unconditional text you want feel appropiate. At the
> end of the fax all they need to do it write \end{message} (both in ERT, of
> course).

2 problems with this:
* We don't want the users to write any LaTeX-code because they don't
  know LaTeX.
  Maybe this is another wrong point of view. I recognized several times
  that I needed LaTeX-knowledge to solve LyX-problems (when errors
  occured)
* The fax number is not needed at this time (the letter will be printed
  to a printer called fax which will popup a window and ask for the
  fax number). I simply need a switch: fax? yes or no. Of course I could
  create a label like 'Is this a fax?:' and when the user assigns 'yes'
  or 'of course is this a fax' or even 'no' :^) and your TeX code can catch
  this and include the signature graphics.
  The more general question for me is: Is this description syntax the
  state of the art and all more elaborated layouts have to be programmed
  in (La)TeX or is there a chance for non-developers to initiate changes
  by feature requests?

Helmut

-- 
--------------------------------------------------------------------
 Helmut Lichtenberg   (PGP Public Key available)    [EMAIL PROTECTED]
 Institut f. Tierzucht und Tierverhalten - 31535 Neustadt - Germany
 Tel. +49 (0)5034/871-128                     Fax +49 (0)5034/92579
--------------------------------------------------------------------

Reply via email to