Hi Marvin (and you, LyXer).
I promized, so here it is ... but it will still be of no use for you ;-)

Here is my new lettre.layout file, cleaned (lot of raw TeX discarded), a
little bit extended, and with extra code to allow tth giving a somewhat
sensible output.

I didn't used the last lettre.layout I saw on the list, because the "Style
order independance" feature given by my approach is, IMHO, the main
interest of this layout.

Hopefully, it will be interesting enough for giving somebody the idea to
do the same job for u.s.,english,german,... letters.

Concerning this layout file, notice that :
        - it is not yet complete; no real fax support, no \telex, \mencl,
\makelabels, \institute ... As is, it fullfills 99% of my needs. Should
not be too hard to complete.
        - no \date support in html : \today is used instead, shame on me !
        - no html title is provided, tth does its best ... which is of no
use. To be continued ...
        - I am not sure that everything was tested (e.g. email Style). If
something is going really wrong, please let me know
        - it works with tth only ! It should be easy to adapt to
latex2html, may be not so easy to make it working with both. No idea what
to do for HeVeA, which complains on the class declaration!!

Anyway, I hope it will be usefull (at least it is for me). If somebody
improves it, please don't forget me ! ;-)

Best regards
        Alain

-- 
 *******************************************************************
 *        Alain Castera                                            *
 * IPNL - UCB Lyon 1             | e-mail : [EMAIL PROTECTED] *
 * Bat. Paul Dirac               |      or        [EMAIL PROTECTED] *
 * Campus de la Doua             | Telephone :     (+33) 472448429 *
 * F69622 Villeurbanne CEDEX     | Fax :           (+33) 472448004 *
 *******************************************************************
#% 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
 \newif\ifmonaddressused
 \newif\ifmonlieuused
 \newif\ifmonlocationused
 \newif\ifmontelephoneused
 \newif\ifmonfaxused
 \newif\ifmonemailused
 \newif\iflyxsigp
 \newif\iflyxsigs
 \newif\iflyxsigt
 \newif\ifpsneeded
 \newif\ifccneeded
 \newif\ifencneeded

%% To help tex->html
 \newif\iftth
 \iftth
    \newsavebox{\sigp}
    \newsavebox{\sigs}
    \newsavebox{\sigt}
 \fi

%% Sometimes you don't want a closing, but the package still needs it
 \newcommand{\Lyclose}{}
%% 


 \newcommand{\lyxmenc}{\newcommand{\Lymenc}{\menc}}

 %% here we ouput the commands in the "proper" order
 \newcommand{\findemessage}
  { 
    \ifneedsendletter
      \iftth
        \closing{\Lyclose}
      \fi
      \iflyxsigp \signature{\Lysigp} \else \name{} \fi
      \iflyxsigs \secondsignature{\Lysigs} \fi
      \iflyxsigt \thirdsignature{\Lysigt} \fi   
      \iftth
        \iflyxsigp
          \begin{tabular}{ p{5cm} p{5cm} p{5cm} p{5cm} }
            \parbox{50mm}{{\hfill}} &
            \parbox{50mm}{\sigp} &
            \parbox{50mm}{\sigs} & 
            \parbox{50mm}{\sigt} \\
          \end{tabular}
          \bigskip{}
        \fi
        %% needed after last signature ???
      \else  %% should be in a different if block to be clean
        \closing{\Lyclose}
      \fi
      \ifpsneeded \ps{P.S. : }{\Lyps} \fi
      \ifccneeded \cc{\Lycc} \fi
      \ifencneeded \encl{\Lyenc} \fi
      \end{letter}
      \needsendletterfalse 
    \fi
      \ifneedsendfax \end{telefax}
      \needsendfaxfalse 
    \fi
  }

EndPreamble

# My Address style
Style MonAdresse
  Margin        Static
  LatexType     Command
  LatexName     Monaddress
  ParSkip       0.4
  BottomSep     1.5
  ParSep        1.5
  Align         Left
  AlignPossible     Left
  Preamble
   \newcommand{\Monaddress}[1]{
        \monaddressusedtrue
        \newcommand{\lyaddress}{\address{#1}}
        }
    \iftth %% tex->html converters do not know this package
       \newcommand{\address}[1]{\mbox{#1}\par}
    \fi
  EndPreamble
End

# City name style
Style Lieu
  Margin                Static
  LatexType             Command
  LatexName             Monlieu
  LeftMargin            Ville::xx
  LabelSep              xx
  TopSep                0.4
  BottomSep             0.4
  ParSep                0.4
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Static
  LabelString           Ville:
  # label font definition
  LabelFont 
    Series              Bold
    Shape               Italic
    Latex               Latex
  EndFont
  Preamble
   \newcommand{\Monlieu}[1]{
        \monlieuusedtrue
        \providecommand{\lylieu}{\relax}
        \renewcommand{\lylieu}{\lieu{#1}}
        }
    \iftth %% tex->html converters do not know this package
      \newcommand{\lieu}[1]{{\raggedleft #1,\today}}
    \fi
  EndPreamble

End

#suppress City indication
Style NoLieu
  KeepEmpty             1
  LatexType             Command
  LatexName             Monnolieu
  LabelType             Static
  LeftMargin            NoLieuxx
  LabelString           NoLieu
  # label font definition
  LabelFont
    Series              Bold
    Latex               Latex
  EndFont
  Preamble
   \newcommand{\Monnolieu}{
        \monlieuusedtrue
        \providecommand{\lylieu}{\relax}
        \renewcommand{\lylieu}{\nolieu{}}
        }
   \iftth %% tex->html converters do not know this package
     \newcommand{\nolieu}[1][nowhere]{{\raggedleft \today}}
   \fi
  EndPreamble
End

# date Style
Style Date
  Margin                Static
  LatexType             Command
  LatexName             date
  LeftMargin            Date::xx
  LabelSep              xx
  TopSep                0.4
  BottomSep             0.4
  ParSep                0.4
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Static
  LabelString           Date:
  # label font definition
  LabelFont 
    Series              Bold
    Shape               Italic
    Latex               Latex
  EndFont
End

#suppress date indication
Style NoDate
  KeepEmpty             1
  LatexType             Command
  LatexName             nodate
  LabelType             Static
  LeftMargin            NoDatexx
  LabelString           NoDate
  # label font definition
  LabelFont
    Series              Bold
    Latex               Latex
  EndFont
End

# location (i.e. office, department ...)
Style Localisation
  Margin                Static
  LatexType             Command
  LatexName             Monlocation
  LeftMargin            Bureau::xx
  LabelSep              xx
  TopSep                0.4
  BottomSep             0.4
  ParSep                0.4
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Static
  LabelString           Location:
  # label font definition
  LabelFont 
    Series              Bold
    Shape               Italic
    Latex               Latex
  EndFont
  Preamble
   \newcommand{\Monlocation}[1]{
        \monlocationusedtrue
        \newcommand{\lylocation}{\location{#1}}
        }
    \iftth %% tex->html converters do not know this package
      \newcommand{\location}[1]{ #1}
    \fi
  EndPreamble


End

# telephone Style
Style Telephone
  Margin                Static
  LatexType             Command
  LatexName             Montelephone
  LeftMargin            Tel::xx
  LabelSep              xx
  TopSep                0.4
  BottomSep             0.4
  ParSep                0.4
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Static
  LabelString           Tel:
  # label font definition
  LabelFont 
    Series              Bold
    Shape               Italic
    Latex               Latex
  EndFont
  Preamble
    \newcommand{\Montelephone}[1]{
        \montelephoneusedtrue
        \providecommand{\lytelephone}{\relax}
        \renewcommand{\lytelephone}{\telephone{#1}}
       }
    \iftth %% tex->html converters do not know this package
      \newcommand{\telephone}[1]{Tel : #1\par}
    \fi
  EndPreamble

End

#suppress telephone indication
Style NoTelephon
  KeepEmpty             1
  LatexType             Command
  LatexName             Monnotelephone
  LabelType             Static
  LeftMargin            NoTelxx
  LabelString           NoTel
  # label font definition
  LabelFont
    Series              Bold
    Latex               Latex
  EndFont
  Preamble
   \newcommand{\Monnotelephone}{
        \montelephoneusedtrue
        \providecommand{\lytelephone}{\relax}
        \renewcommand{\lytelephone}{\notelephone{}}
        }
    \iftth %% tex->html converters do not know this package
      \newcommand{\notelephone}[1][tele]{}
    \fi
  EndPreamble

End

# telefax Style
Style Fax
  Margin                Static
  LatexType             Command
  LatexName             Monfax
  LeftMargin            Fax::xx
  LabelSep              xx
  TopSep                0.4
  BottomSep             0.4
  ParSep                0.4
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Static
  LabelString           Fax:
  # label font definition
  LabelFont 
    Series              Bold
    Shape               Italic
    Latex               Latex
  EndFont
  Preamble
   \newcommand{\Monfax}[1]{
        \monfaxusedtrue
        \providecommand{\lyfax}{\relax}
        \renewcommand{\lyfax}{\fax{#1}}
        }
    \iftth %% tex->html converters do not know this package
      \newcommand{\fax}[1]{Fax : #1\par}
    \fi
  EndPreamble
End

#suppress fax indication
Style NoFax
  KeepEmpty             1
  LatexType             Command
  LatexName             Monnofax
  LabelType             Static
  LeftMargin            NoFaxxx
  LabelString           NoFax
  # label font definition
  LabelFont
    Series              Bold
    Latex               Latex
  EndFont
  Preamble
   \newcommand{\Monnofax}{
        \monfaxusedtrue
        \providecommand{\lyfax}{\relax}
        \renewcommand{\lyfax}{\nofax{}}
        }
    \iftth %% tex->html converters do not know this package
      \newcommand{\nofax}[1][fax]{}
    \fi
  EndPreamble

End


# Email Style
Style Email
  Margin                Static
  LatexType             Command
  LatexName             Monemail
  LeftMargin            Email::xx
  LabelSep              xx
  TopSep                0.4
  BottomSep             0.4
  ParSep                0.4
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Static
  LabelString           Email:
  # label font definition
  LabelFont 
    Series              Bold
    Shape               Italic
    Latex               Latex
  EndFont
  Preamble
   \newcommand{\Monemail}[1]{
        \monemailusedtrue
        \providecommand{\lyemail}{\relax}
        \renewcommand{\lyemail}{\email{#1}}
        }
    \iftth %% tex->html converters do not know this package
      \newcommand{\email}[1]{email : #1\par}
    \fi

  EndPreamble
End

# Objet Style
Style Objet
  CopyStyle             Email
  LatexType             Command
  LatexName             conc
  LeftMargin            Objet::xx
  LabelString           Objet:
  Preamble
    \iftth %% tex->html converters do not know this package
    \newcommand{\conc}[1]{
        Objet : #1 \par
        }
    \fi
  EndPreamble
End

# VRef Style
Style VRef
  CopyStyle             Email
  LatexType             Command
  LatexName             vref
  LeftMargin            V/Ref::xx
  LabelString           V/Ref:
  Preamble
    \iftth %% tex->html converters do not know this package
    \newcommand{\vref}[1]{
        V/Ref : #1 \par
        }
    \fi
  EndPreamble
End

# NRef Style
Style NRef
  CopyStyle             Email
  LatexType             Command
  LatexName             nref
  LeftMargin            N/Ref::xx
  LabelString           N/Ref:
  Preamble
    \iftth %% tex->html converters do not know this package
    \newcommand{\nref}[1]{
        N/Ref : #1 \par
        }
    \fi
  EndPreamble
End

Style Destinataire
  Margin                Right_Address_Box
  LatexType             Command
  LatexName             lettre
  Preamble
  \iftth %% tex->html converters do not know this package
    \newcommand{\toaddress}[1]
      { \newsavebox{\dest}
        \sbox{\dest}{\centering #1}
        {\raggedleft{\dest}\par}
      }
    \newenvironment{letter}[1]{}{}
  \fi
  \newcommand{\lettre}[1]
        { \findemessage 
          \begin{letter}{#1}
          \ifmonaddressused
          \lyaddress{}
          \fi
          \ifmonlocationused
          \lylocation{}
          \fi
          \ifmonlieuused
          \lylieu{}
          \fi
          \ifmontelephoneused
          \lytelephone{}
          \fi
          \ifmonfaxused
          \lyfax{}
          \fi
          \ifmonemailused
          \lyemail{}
          \fi
          \needsendlettertrue
          \iftth
            \toaddress{#1}
          \fi
        }
  EndPreamble
End

#As a temporary(?) trick 
Style FinDeFichier
  KeepEmpty             1
  LatexType             Command
  LatexName             findemessage
  LabelType             Static
  LabelString           Fin_du_fichier.
  LeftMargin            Fin_du_fichier.
  # label font definition
  LabelFont 
    Series              Bold
    Shape               Italic
    Latex               Latex
  EndFont
End

# Opening style definition

Style Accroche
  CopyStyle             Opening
  LeftMargin            Accroche::xx
  LabelString           Accroche:
  Preamble
    \iftth %% tex->html converters do not know this package
      \newcommand{\opening}[1]{{\qquad #1}}
    \fi
  EndPreamble
End

# Signature style definition
Style Signature
  LeftMargin            Signature::xx
  LabelString           Signature:
  LatexName                     lyxsig
  Preamble
      %% automatic assignment of signatures (only one Signature Style
       \newcommand{\lyxsig}[1]{
         \iflyxsigs
           \newcommand{\Lysigt}{#1}
           \lyxsigttrue
          \else
            \iflyxsigp
              \newcommand{\Lysigs}{#1}
              \lyxsigstrue
             \else
               \newcommand{\Lysigp}{#1}
               \lyxsigptrue
             \fi
          \fi
        }
        \iftth %% tex->html converters do not know this package
           \newcommand{\signature}[1]
              { 
               \sbox{\sigp}{{#1}}
              }
           \newcommand{\secondsignature}[1]
              {
               \sbox{\sigs}{{#1}} 
              }
           \newcommand{\thirdsignature}[1]
              { 
               \sbox{\sigt}{{#1}} 
              }
        \fi
  EndPreamble
End


# Closing style definition
Style FormuleDePolitesse
  CopyStyle             Closing
  LeftMargin            Salutations::xx
  LabelString           Salutations:
  LatexType             Command
  LatexName             lyxclose
  Preamble
    \newcommand{\lyxclose}[1]{\renewcommand{\Lyclose}{#1}}
    \iftth %% tex->html converters do not know this package
      \newcommand{\closing}[1]{#1\par}
    \fi
  EndPreamble
End

# encl style definition
Style incl
CopyStyle               encl
  LeftMargin            Ci-joint::xx
  LabelString           Ci-joint:
  LatexName                     lyxenc
  Preamble
    \newcommand{\lyxenc}[1]{\newcommand{\Lyenc}{#1} \encneededtrue}
    \iftth %% tex->html converters do not know this package
      \newcommand{\encl}[1]{p.j. : #1 \par}
    \fi
  EndPreamble
End

#Carbon Copy
Style   cc
  LatexName                     lyxcc
  Preamble
    \newcommand{\lyxcc}[1]{\newcommand{\Lycc}{#1} \ccneededtrue}
    \iftth %% tex->html converters do not know this package
      \newcommand{\cc}[1]{cc : #1 \par} 
    \fi
  EndPreamble
End

#Post Scriptum
Style Post_Scriptum
  Margin        Static
  LatexType         Command
  LatexName         lyxps
  LabelSep      xx
  LabelType     Static
  LeftMargin        P.S.::xx
  LabelString       P.S.:
  LatexName         lyxps
  Preamble
    \newcommand{\lyxps}[1]{\newcommand{\Lyps}{#1} \psneededtrue}
    \iftth %% tex->html converters do not know this package
      \newcommand{\ps}[2]{#1 #2 \par} 
    \fi
  EndPreamble
End


# now suppress unwanted styles
NoStyle My_Address
NoStyle Send_To_Address
NoStyle Opening
NoStyle Closing
NoStyle encl


Reply via email to