lettre: new layout and template file to write French letters, patch from Jean-Pierre Chretien

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35620 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2010-10-13 03:23:51 +00:00
parent cde054cc6b
commit eaf7c6c6eb
4 changed files with 902 additions and 0 deletions

View File

@ -1364,6 +1364,7 @@ lib_templates_files = Split('''
koma-letter2.lyx
latex8.lyx
letter.lyx
lettre.lyx
README.new_templates
revtex.lyx
revtex4.lyx
@ -2793,6 +2794,7 @@ lib_layouts_files = Split('''
kluwer.layout
latex8.layout
letter.layout
lettre.layout
literate-article.layout
literate-book.layout
literate-report.layout

View File

@ -1104,6 +1104,7 @@ dist_layouts_DATA =\
layouts/kluwer.layout \
layouts/latex8.layout \
layouts/letter.layout \
layouts/lettre.layout \
layouts/lilypond.module \
layouts/linguistics.module \
layouts/literate-article.layout \
@ -1251,6 +1252,7 @@ dist_templates_DATA = \
templates/koma-letter2.lyx \
templates/latex8.lyx \
templates/letter.lyx \
templates/lettre.lyx \
templates/README.new_templates \
templates/revtex.lyx \
templates/revtex4.lyx \

669
lib/layouts/lettre.layout Normal file
View File

@ -0,0 +1,669 @@
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass{letter (lettre)}
# French Letter textclass definition file.
# Author : Alain Castera <castera@in2p3.fr>
# Modifies only some things from letter.layout
# to use the lettre.cls class from Denis Megevand
# (almost) nothing regarding fax, only letter
#---------------
# rev 1; A. Castera :
# A lot of LateX code added to avoid being bored by
# the imposed command order of the class letter (see comments)
#---------------
#rev 2; A. Castera :
# further more LaTeX code to make tth happy
# with the class.(Following a request on
# such kind of thing from lyx-users@lists.lyx.org)
#---------------
# rev.3; J.-P. Chretien oct 2010
# general update and review for inclusion in lyx-1.6.8
# - remove tth stuff
# - english named styles (translated in fr.po)
# - margins set to dynamic to ensure alignment of line headings
# - categories
# - ordering control left at the beginning (any other way ?)
Format 29
#(pre)declarations (just to impose some order on the menus)
Style Standard
End
Style My_Address
End
Style Location
End
Style Telephone
End
Style NoTelephone
End
Style Fax
End
Style NoFax
End
Style Email
End
Style Place
End
Style NoPlace
End
Style Date
End
Style NoDate
End
Style Send_To_Address
End
Style Subject
End
Style YourRef
End
Style MyRef
End
Style Opening
End
Style Closing
End
Style Signature
End
Style encl
End
Style cc
End
Style Post_Scriptum
End
Style EndOfMessage
End
Style EndOfFile
End
# Input general definitions
Input letter.layout
Preamble
%% A lot of newif
%% to allow reorder commands and output them when needed only
\newif\ifneedsendletter % we started a letter
\newif\ifneedsendfax % we started a fax
\newif\ifmonaddressused % sender address specified
\newif\ifmonlieuused % city
\newif\ifmonlocationused % sender extra info (office, etc..)
\newif\ifmontelephoneused % sender phone # specified
\newif\ifmonfaxused % sender fax # specified
\newif\ifmonemailused % sender email address specified
\newif\iflyxsigp % first of up to 3 signatures
\newif\iflyxsigs % second signature
\newif\iflyxsigt % third one
\newif\ifpsneeded % post-scriptum
\newif\ifccneeded % carbon copy to somebody
\newif\ifencneeded % encluded items
%% Sometimes you don't want a closing ("formule de politesse"),
%% but the package still needs it. Use a void macro instead of a newif
\newcommand{\Lyclose}{}
%%
%% here is the real stuff : ouput the commands in the "proper" order
\newcommand{\findemessage}
{
\ifneedsendletter %% did we start a letter ?
\iflyxsigp \signature{\Lysigp} \else \name{} \fi
\iflyxsigs \secondsignature{\Lysigs} \fi
\iflyxsigt \thirdsignature{\Lysigt} \fi
\lyxsigpfalse
\lyxsigsfalse
\lyxsigtfalse
\closing{\Lyclose}
\ifpsneeded \ps{P.S. : }{\Lyps} \psneededfalse \fi
\ifccneeded \cc{\Lycc} \ccneededfalse \fi
\ifencneeded \encl{\Lyenc} \encneededfalse \fi
\end{letter}
\needsendletterfalse %% done with letter
\fi % if needSendLetter
\ifneedsendfax \end{telefax} %% nothing provided yet for telefax !
\needsendfaxfalse
\fi % if needSendFax
} %findemessage
EndPreamble
# My Address style used to specify sender name and coordinates
Style My_Address
CopyStyle My_Address
Category Headings
Margin Static
LatexType Command
LatexName MyAddress
ParSkip 0.4
BottomSep 1.5
ParSep 1.5
Align Left
AlignPossible Left
Preamble
\newcommand{\MyAddress}[1]{ % will save the info for future use
\monaddressusedtrue
\providecommand{\lyaddress}{\address{#1}}
}
EndPreamble
End
# City name style
Style Place
Category Headings
Margin Dynamic
LatexType Command
LatexName Myplace
LabelSep xx
TopSep 0.4
BottomSep 0.4
ParSep 0.4
Align Block
AlignPossible Block, Left
LabelType Static
LabelString City:
LeftMargin x
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
\newcommand{\Myplace}[1]{ % will save the info for future use
\monlieuusedtrue
\providecommand{\lylieu}{\relax}
\renewcommand{\lylieu}{\lieu{#1}}
}
EndPreamble
End
#suppress City indication
Style NoPlace
Category Headings
KeepEmpty 1
LatexType Command
LatexName MyNoPlace
LabelType Static
Margin Dynamic
LabelString NoPlace
LeftMargin x
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
\newcommand{\MyNoPlace}{
\monlieuusedtrue
\providecommand{\lylieu}{\relax}
\renewcommand{\lylieu}{\nolieu{}}
}
EndPreamble
End
# date Style
Style Date
Category Headings
Margin Dynamic
LatexType Command
LatexName date
LeftMargin x
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
Color red
EndFont
End
#suppress date indication
Style NoDate
Category Headings
KeepEmpty 1
Margin Dynamic
LatexType Command
LatexName nodate
LabelType Static
LeftMargin x
LabelString NoDate
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
EndPreamble
End
# location (i.e. office, department ...)
Style Location
Category Headings
Margin Dynamic
LatexType Command
LatexName MyLocation
LeftMargin x
LabelString Office:
LabelSep xx
TopSep 0.4
BottomSep 0.4
ParSep 0.4
Align Block
AlignPossible Block, Left
LabelType Static
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
\newcommand{\MyLocation}[1]{ % will save the info for future use
\monlocationusedtrue
\providecommand{\lylocation}{\relax}
\renewcommand{\lylocation}{\location{#1}}
}
EndPreamble
End
# telephone Style
Style Telephone
Category Headings
Margin Dynamic
LatexType Command
LatexName MyTelephone
LeftMargin x
LabelString Tel:
LabelSep xx
TopSep 0.4
BottomSep 0.4
ParSep 0.4
Align Block
AlignPossible Block, Left
LabelType Static
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
\newcommand{\MyTelephone}[1]{ % will save the info for future use
\montelephoneusedtrue
\providecommand{\lytelephone}{\relax}
\renewcommand{\lytelephone}{\telephone{#1}}
}
EndPreamble
End
#suppress telephone indication
Style NoTelephone
Category Headings
KeepEmpty 1
Margin Dynamic
LatexType Command
LatexName MyNoTelephone
LabelType Static
LeftMargin x
LabelString NoTel
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
\newcommand{\MyNoTelephone}{
\montelephoneusedtrue
\providecommand{\lytelephone}{\relax}
\renewcommand{\lytelephone}{\notelephone{}}
}
EndPreamble
End
# telefax Style
Style Fax
Category Headings
Margin Dynamic
LatexType Command
LatexName MyFax
LeftMargin x
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
Color red
EndFont
Preamble
\newcommand{\MyFax}[1]{ % will save the info for future use
\monfaxusedtrue
\providecommand{\lyfax}{\relax}
\renewcommand{\lyfax}{\fax{#1}}
}
EndPreamble
End
#suppress fax indication
Style NoFax
Category Headings
KeepEmpty 1
Margin Dynamic
LatexType Command
LatexName MyNoFax
LabelType Static
LeftMargin x
LabelString NoFax
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
\newcommand{\MyNoFax}{
\monfaxusedtrue
\providecommand{\lyfax}{\relax}
\renewcommand{\lyfax}{\nofax{}}
}
EndPreamble
End
# Email Style
Style Email
Category Headings
Margin Dynamic
LatexType Command
LatexName MyEmail
LeftMargin x
LabelString Email:
LabelSep xx
TopSep 0.4
BottomSep 0.4
ParSep 0.4
Align Block
AlignPossible Block, Left
LabelType Static
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
\newcommand{\MyEmail}[1]{ % will save the info for future use
\monemailusedtrue
\providecommand{\lyemail}{\relax}
\renewcommand{\lyemail}{\email{#1}}
}
EndPreamble
End
# Subject Style
Style Subject
Margin Dynamic
LatexType Command
LatexName conc
LeftMargin x
LabelString Subject:
LabelSep xx
TopSep 0.4
BottomSep 0.4
ParSep 0.4
Align Block
AlignPossible Block, Left
LabelType Static
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
End
# YourRef Style
Style YourRef
CopyStyle Subject
Margin Dynamic
LatexType Command
LatexName Vref
LeftMargin x
LabelString YourRef:
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
End
# MyRef Style
Style MyRef
CopyStyle Subject
Margin Dynamic
LatexType Command
LatexName Nref
LeftMargin x
LabelString MyRef:
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
End
Style Send_To_Address
CopyStyle Send_To_Address
Margin Right_Address_Box
LatexType Command
LatexName lettre
Preamble
\newcommand{\lettre}[1] { %% organized as expected by the package
\findemessage %% if we already started a letter or a fax
\begin{letter}{#1} %% now the new one
\ifmonaddressused
\lyaddress{}
\fi
\ifmonlocationused
\lylocation{}
\fi
\ifmonlieuused
\lylieu{}
\fi
\ifmontelephoneused
\lytelephone{}
\fi
\ifmonfaxused
\lyfax{}
\fi
\ifmonemailused
\lyemail{}
\fi
\needsendlettertrue
}
EndPreamble
End
#As a temporary(?) trick the last(only?) letter of the file must be processed
# and to allow changing sender address, location,etc.. in between 2 letters
Style EndOfMessage
Category Closings
KeepEmpty 1
Margin Dynamic
TopSep 0.8
BottomSep 0.8
ParSep 0.8
LatexType Command
LatexName findemessage
LabelType Static
LabelString EndOfMessage.
LeftMargin x
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
End
Style EndOfFile
CopyStyle EndOfMessage
LabelString EndOfFile.
End
# Opening style definition (Accroche)
Style Opening
CopyStyle Opening
Margin Dynamic
LeftMargin x
LabelString Opening:
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
End
# Closing style definition (FormuleDePolitesse, Salutations)
Style Closing
CopyStyle Closing
Margin Dynamic
LeftMargin x
LabelString Closing:
LatexType Command
LatexName lyxclose
Preamble
\newcommand{\lyxclose}[1]{\renewcommand{\Lyclose}{#1}}
EndPreamble
End
# Signature style definition
Style Signature
Margin Dynamic
LeftMargin x
LabelString Signature:
LatexType Command
LatexName lyxsig
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
%% automatic assignment of signatures
%% there is only 1 Signature style, but multiple latex commands
\newcommand{\lyxsig}[1]{
\iflyxsigs %% the second sig. exists, so this one is the third
\providecommand{\Lysigt}{\relax}
\renewcommand{\Lysigt}{#1}
\lyxsigttrue
\else %% if lyxsigs exist
\iflyxsigp %% the second one
\providecommand{\Lysigs}{\relax}
\renewcommand{\Lysigs}{#1}
\lyxsigstrue
\else %% the first one
\providecommand{\Lysigp}{\relax}
\renewcommand{\Lysigp}{#1}
\lyxsigptrue
\fi %% if lyxsidp exist
\fi %% if lyxsigs exist
}
EndPreamble
End
# encl style definition (Ci-joint)
Style encl
CopyStyle encl
Category Closings
Margin Dynamic
LeftMargin x
LabelString encl:
LatexName lyxenc
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
\newcommand{\lyxenc}[1]{
\providecommand{\Lyenc}{\relax}
\renewcommand{\Lyenc}{#1}
\encneededtrue
}
EndPreamble
End
#Carbon Copy
Style cc
CopyStyle encl
LatexName lyxcc
LeftMargin x
LabelString cc:
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
\newcommand{\lyxcc}[1]{
\providecommand{\Lycc}{\relax}
\renewcommand{\Lycc}{#1}
\ccneededtrue
}
EndPreamble
End
#Post Scriptum
Style Post_Scriptum
Category Closings
Margin Dynamic
LatexType Command
LatexName lyxps
LabelSep xx
LabelType Static
LeftMargin x
LabelString P.S.:
# label font definition
LabelFont
Series Bold
Shape Italic
Color red
EndFont
Preamble
\newcommand{\lyxps}[1]{
\providecommand{\Lyps}{\relax}
\renewcommand{\Lyps}{#1}
\psneededtrue
}
EndPreamble
End

229
lib/templates/lettre.lyx Normal file
View File

@ -0,0 +1,229 @@
#LyX 2.0.0svn created this file. For more info see http://www.lyx.org/
\lyxformat 403
\begin_document
\begin_header
\textclass lettre
\begin_preamble
% to get A4 pagesize
\input pdftexconfig.tex
\end_preamble
\use_default_options false
\maintain_unincluded_children false
\language french
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\use_xetex false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 11
\spacing single
\use_hyperref false
\papersize a4paper
\use_geometry false
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language french
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Note Note
status open
\begin_layout Plain Layout
La liste des styles couvre tous les éléments d'une lettre qui apparaissent
dans la classe, à l'exception du bas de page institutionnel.
Elle ne permet pas non plus la création de télécopies.
\end_layout
\begin_layout Plain Layout
L'ordre des éléments est indifférent.
\end_layout
\begin_layout Plain Layout
Pour la compilation
\family typewriter
pdflatex
\family default
, le police implicite est
\family typewriter
lmodern
\family default
: si vous voulez utiliser une autre police via
\family sans
Documents ▹ Paramètres ▹ Polices,
\family default
supprimez le préambule LaTeX
\end_layout
\end_inset
\end_layout
\begin_layout My Address
Mon Nom
\begin_inset Newline newline
\end_inset
Ma Rue
\begin_inset Newline newline
\end_inset
Ma Ville
\end_layout
\begin_layout Location
Pièce A 356
\end_layout
\begin_layout Telephone
Mon tel
\end_layout
\begin_layout NoFax
\begin_inset Note Note
status collapsed
\begin_layout Plain Layout
Ce style LyX est utile pour éviter qu'apparaissent les données implictes
du fichier de données personnelles que l'on peut utiliser pour éviter de
les ressaisir dans chaque lettre (cf.
la documentation de
\family typewriter
lettre.cls
\family default
).
Des styles similaires existent pour le téléphone, le lieu et la date.
\end_layout
\end_inset
\end_layout
\begin_layout Email
\family typewriter
prenom.nom@free.fr
\end_layout
\begin_layout Place
À Maville
\end_layout
\begin_layout Date
le date_manuelle
\end_layout
\begin_layout Send To Address
Son Nom
\begin_inset Newline newline
\end_inset
Sa Rue
\begin_inset Newline newline
\end_inset
Sa Ville
\end_layout
\begin_layout Subject
Nouvelles
\end_layout
\begin_layout YourRef
xxx.yyy
\end_layout
\begin_layout MyRef
zzz
\end_layout
\begin_layout Opening
Cher Monsieur,
\end_layout
\begin_layout Standard
<texte de la lettre>
\end_layout
\begin_layout Signature
Ma signature
\end_layout
\begin_layout Signature
Autre signature
\end_layout
\begin_layout Signature
Troisième signature
\end_layout
\begin_layout Closing
Je vous prie d'agréer, Cher Monsieur, blah blah blah
\end_layout
\begin_layout Post Scriptum
blah blah blah
\end_layout
\begin_layout encl
Documents
\end_layout
\begin_layout cc
DG, DRH
\end_layout
\begin_layout EndOfMessage
\begin_inset Note Note
status collapsed
\begin_layout Plain Layout
Marqueur de fin de lettre obligatoire (il peut y avoir plusieurs lettres
dans le même fichier)
\end_layout
\end_inset
\end_layout
\end_body
\end_document