Re: commands with 2 args in a layout ?

2001-02-03 Thread Allan Rae

On Fri, 2 Feb 2001, Nabil Hathout wrote:

> Hello,
>
> I am trying to make a layout for the lettre.cls written by Denis Mégevaud. I
> have had no problem for the "lettre" TextClass but I am having one whith the
> "telefax" one, namely that they must start with \telefax{XXX}{YYY} where XXX is
> the fax number and YYY is the recepiender name and I have not found any "style"
> that could generate this kind of structure.  Is this acheivable or is it
> necessary to use a dialog box (as for the citation insertions) ?
>
> There might be another solution, that is to modify the lettre class, but then
> the layout will be dependant of this modification.

For cases where commands take multiple arguements and none are optional or
at least optional arguements come between required arguements you can
use the normal command generation of LyX and require the user to add "}{"
in the right place (marked as raw LaTeX).

That is, for a telefax paragraph you would write:
12345678}{fred bloggs

with "}{" marked as TeX.  Yes, it is ugly but this works.
The resultant output would then be:
\telefax{12345678}{fred bloggs}

Allan. (ARRae)




Re: commands with 2 args in a layout ?

2001-02-02 Thread ben

Nabil Hathout a écrit :

> Hello,
>
> I am trying to make a layout for the lettre.cls written by Denis Mégevaud. I
> have had no problem for the "lettre" TextClass but I am having one whith the
> "telefax" one, namely that they must start with \telefax{XXX}{YYY} where XXX is
> the fax number and YYY is the recepiender name and I have not found any "style"
> that could generate this kind of structure.  Is this acheivable or is it
> necessary to use a dialog box (as for the citation insertions) ?
>
> There might be another solution, that is to modify the lettre class, but then
> the layout will be dependant of this modification.
>
> Thank you in advance,
>
> --Nabil Hathout

You can use a single latex parameter, and split it into two parameters by using
predefined delimiters (brackets in the example). Of course, it works only if the
writter respect the syntax!

Bye,
BG


#LyX 1.1 created this file. For more info see http://www.lyx.org/
\lyxformat 2.16
\textclass faxstyle
\begin_preamble
%% command defined here, only to make it work

\def\telefax#1#2{Phone number: #1; Name: #2}
\end_preamble
\language default
\inputencoding latin1
\fontscheme default
\graphics default
\paperfontsize default
\spacing single 
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\paperorientation portrait
\secnumdepth -1
\tocdepth -1
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Title

Example
\layout FaxStyle

02.34.56.78.
 (Mr.
 Bloch)
\the_end


#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[article]{Telefax}
# CV textclass definition file. 
# Author : Jean-Marc Lasgouttes ([EMAIL PROTECTED])

# General textclass parameters
Columns 1
Sides   1
SecNumDepth -1
TocDepth-1
MaxCounter  Counter_Section

Input stdclass.inc

# Standard style definition
Style FaxStyle
  MarginFirst_Dynamic
  LatexType Command
  LatexName lyxtelefax
  LabelType Static
  LabelSep  xx
  LabelString   "Telefax:"
  LabelFont
Shape   Italic
  EndFont

  Preamble
  \def\lyxparsefax#1(#2){ \telefax{#1}{#2} }
  \def\lyxtelefax#1{ \lyxparsefax#1 }
  EndPreamble
End




Re: commands with 2 args in a layout ?

2001-02-02 Thread Alain Castera


Salut Nabil.

I already started working with lettre.cls, but never went deeply into the
fax part. In fact, I stopped when I got the very minimum I needed. lazzy
boy!

So I havent exactly your answer, but this file may help you anyway.
There is a lot of thing a layout can do, by putting LaTeX cod einto the 
Preamble.
Here, the idea was to get rid of the imposed order of letter and so on
classes( I like to write a letter as I am used to see it). So each layout,
instead of using the Latex command, declared a variables. The appropriate
latex construction is done once a new "lettre" or "fax" is encountered
(with lettre.cls there may be more than one on a file), and when the "fin
de fichier" layout is encountered.

So, for the fax, you could declare a "numero du destinataire" and a
"destinataire" layouts, which set LaTeX variables destNumber and destId,
and then when buildind the correct LaTeX output use
\telefax{\destNumber}{\destId}

If you adopt this scheme, I will be glad to use your layout (I insist to
make LyX lettre layout "order insensitive"). And maybe I could find some
time to help you a little bit (but remember, I am lazzy).

Anyway, if my draft can help you, here it is.

Have fun
Alain

On Fri, 2 Feb 2001, Nabil Hathout wrote:

> Hello,
> 
> I am trying to make a layout for the lettre.cls written by Denis Mégevaud. I
> have had no problem for the "lettre" TextClass but I am having one whith the
> "telefax" one, namely that they must start with \telefax{XXX}{YYY} where XXX is
> the fax number and YYY is the recepiender name and I have not found any "style"
> that could generate this kind of structure.  Is this acheivable or is it
> necessary to use a dialog box (as for the citation insertions) ?
> 
> There might be another solution, that is to modify the lettre class, but then
> the layout will be dependant of this modification.
> 
> Thank you in advance,
> 
> --Nabil Hathout
> 

 Veuillez noter ma nouvelle adresse "courriel". Merci
 PLEASE NOTE my new email address.Thank's
 ***
 *Alain Castera*
 * LPNHE - Tour 33 RdC   | e-mail : [EMAIL PROTECTED] *
 * 4 Place Jussieu   |  or[EMAIL PROTECTED] *
 * 75252 Paris Cedex 05  | Telephone : (+33) 144274187 *
 * France| Fax :   (+33) 144274638 *
 ***


#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass{lettre (Francais)}
# French Letter textclass definition file. 
# Author : Alain Castera <[EMAIL PROTECTED]>
# Modifies only some things from letter.layout
# to use the lettre.cls class from Denis Megevand




# Input general definitions
Input letter.layout


# (Re)define some stuff

Preamble
%% to allow reorder commands when needed
 \newif\ifneedsendletter
 \newif\ifneedsendfax
%% Sometimes you don't want a closing
 \def\Lyclose{}
%% automatic assignment of signatures (only one Signature Style
 \long\def\lyxsig#1{
 \@ifundefined{Lysigp}{\def\Lysigp{#1}}
{\@ifundefined{Lysigs}{\def\Lysigs{#1}}{\def\Lysigt{#1}}}
 }
 \long\def\lyxsigp#1{\def\Lysigp{#1}}
 \long\def\lyxsigs#1{\def\Lysigs{#1}}
 \long\def\lyxsigt#1{\def\Lysigt{#1}}
%% 
 \long\def\lyxclose#1{\def\Lyclose{#1}}
 \long\def\lyxsubj#1{\def\Lysubj{#1}}
 \long\def\lyxps#1{\def\Lyps{#1}}
 \long\def\lyxenc#1{\def\Lyenc{#1}}
 \long\def\lyxmenc{\def\Lymenc{\menc}}
 \long\def\lyxcc#1{\def\Lycc{#1}}
 \newcommand{\findemessage}
{ 
  \ifneedsendletter
  \@ifundefined{Lysigp}{\name{}}{\signature{\Lysigp}} 
  \@ifundefined{Lysigs}{}{\secondsignature{\Lysigs}}
  \@ifundefined{Lysigt}{}{\thirdsignature{\Lysigt}} 
  \closing{\Lyclose}
  \@ifundefined{Lyps}{}{\ps{P.S. : }{\Lyps}}
  \@ifundefined{Lycc}{}{\cc{\Lycc}}
  \@ifundefined{Lyenc}{}{\encl{\Lyenc}}
  \end{letter}
  \needsendletterfalse 
  \fi
  \ifneedsendfax \end{telefax}
  \needsendfaxfalse 
  \fi
}
EndPreamble

# My Address style
Style MonAdresse
  MarginStatic
  LatexType Command
  LatexName address
  ParSkip   0.4
  BottomSep 1.5
  ParSep1.5
  Align Left
  AlignPossible Left
End

# City name style
Style Lieu
  MarginStatic
  LatexType Command
  LatexName lieu
  LeftMarginVille::xx
  LabelSep  xx
  TopSep0.4
  BottomSep 0.4
  ParSep0.4
  Align Block
  AlignPossible Block, Left
  LabelType Static
  LabelString   Ville:
  # label font definition
  LabelFont 
Series  Bold
Shape   Italic
Latex   Latex
  EndFont
End

#suppress City