]> git.lyx.org Git - lyx.git/blob - lib/layouts/lettre.layout
new module and example file for chemical risk and safety statements; requires the...
[lyx.git] / lib / layouts / lettre.layout
1 #% Do not delete the line below; configure depends on this
2 #    \DeclareLaTeXClass{letter (lettre)}
3 # French Letter textclass definition file. 
4 # Author : Alain Castera <castera@in2p3.fr>
5 # Modifies only some things from letter.layout
6 # to use the lettre.cls class from Denis Megevand
7 # (almost) nothing regarding fax, only letter
8 #---------------
9 # rev 1; A. Castera :
10 # A lot of LateX code added to avoid being bored by
11 # the imposed command order of the class letter (see comments)
12 #---------------
13 #rev 2; A. Castera :
14 # further more LaTeX code to make tth happy
15 # with the class.(Following a request on 
16 # such kind of thing from lyx-users@lists.lyx.org)
17 #---------------
18 # rev.3; J.-P. Chretien oct 2010
19 # general update and review for inclusion in lyx-1.6.8
20 #  - remove tth stuff
21 #  - english named styles (translated in fr.po)
22 #  - margins set to dynamic to ensure alignment of line headings
23 #  - categories
24 #  - ordering control left at the beginning (any other way ?)
25
26
27 Format 35
28
29 #(pre)declarations (just to impose some order on the menus)
30 Style Standard
31 End
32
33 Style My_Address
34 End
35 Style Location
36 End
37 Style Telephone
38 End
39 Style NoTelephone
40 End
41 Style Fax
42 End
43 Style NoFax
44 End
45 Style Email
46 End
47 Style Place
48 End
49 Style NoPlace
50 End
51 Style Date
52 End
53 Style NoDate
54 End
55 Style Send_To_Address
56 End
57 Style Subject
58 End
59 Style YourRef
60 End
61 Style MyRef
62 End 
63 Style Opening
64 End
65 Style Closing
66 End
67 Style Signature
68 End
69 Style encl
70 End
71 Style   cc
72 End
73 Style Post_Scriptum
74 End
75 Style EndOfMessage
76 End
77 Style EndOfFile
78 End
79
80
81 # Input general definitions
82 Input letter.layout
83
84 Preamble
85 %% A lot of newif 
86 %% to allow reorder commands and output them when needed only
87  \newif\ifneedsendletter        % we started a letter
88  \newif\ifneedsendfax           % we started a fax
89  \newif\ifmonaddressused        % sender address specified
90  \newif\ifmonlieuused           % city
91  \newif\ifmonlocationused       % sender extra info (office, etc..)
92  \newif\ifmontelephoneused      % sender phone # specified
93  \newif\ifmonfaxused            % sender fax # specified
94  \newif\ifmonemailused          % sender email address specified
95  \newif\iflyxsigp               % first of up to 3 signatures
96  \newif\iflyxsigs               % second signature
97  \newif\iflyxsigt               % third one
98  \newif\ifpsneeded              % post-scriptum
99  \newif\ifccneeded              % carbon copy to somebody
100  \newif\ifencneeded             % encluded items
101    
102 %% Sometimes you don't want a closing ("formule de politesse"),
103 %% but the package still needs it. Use a void macro instead of a newif
104  \newcommand{\Lyclose}{}
105 %% 
106
107 %% here is the real stuff : ouput the commands in the "proper" order
108  \newcommand{\findemessage}
109   { 
110     \ifneedsendletter %% did we start a letter ?
111       \iflyxsigp \signature{\Lysigp} \else \name{} \fi
112       \iflyxsigs \secondsignature{\Lysigs} \fi
113       \iflyxsigt \thirdsignature{\Lysigt} \fi   
114       \lyxsigpfalse
115       \lyxsigsfalse
116       \lyxsigtfalse
117       \closing{\Lyclose}
118       \ifpsneeded \ps{P.S. : }{\Lyps} \psneededfalse \fi
119       \ifccneeded \cc{\Lycc} \ccneededfalse \fi
120       \ifencneeded \encl{\Lyenc} \encneededfalse \fi
121       \end{letter}
122       \needsendletterfalse %% done with letter
123     \fi         % if needSendLetter
124       \ifneedsendfax \end{telefax} %% nothing provided yet for telefax !
125       \needsendfaxfalse 
126     \fi         % if needSendFax
127   }     %findemessage
128
129 % to get the specified pagesize 
130 % (workaround for an a4paper/lettre problem in pdf mode)
131 \@ifpackageloaded{ifpdf}{}{\usepackage{ifpdf}}
132 \ifpdf\input pdftexconfig.tex\fi
133
134 EndPreamble
135
136 # My Address style used to specify sender name and coordinates
137 Style My_Address
138   CopyStyle     My_Address
139   Category      Headings
140   Margin        Static
141   LatexType     Command
142   LatexName     MyAddress
143   ParSkip       0.4
144   BottomSep     1.5
145   ParSep        1.5
146   Align         Left
147   AlignPossible     Left
148   Preamble
149    \newcommand{\MyAddress}[1]{ % will save the info for future use
150         \monaddressusedtrue
151         \providecommand{\lyaddress}{\address{#1}}
152         }
153   EndPreamble
154 End
155
156 # City name style
157 Style Place
158   Category              Headings
159   Margin                Dynamic
160   LatexType             Command
161   LatexName             Myplace
162   LabelSep              xx
163   TopSep                0.4
164   BottomSep             0.4
165   ParSep                0.4
166   Align                 Block
167   AlignPossible         Block, Left
168   LabelType             Static
169   LabelString           City:
170   LeftMargin            x
171   # label font definition
172   LabelFont 
173     Series              Bold
174     Shape               Italic
175     Color               red
176   EndFont
177   Preamble
178    \newcommand{\Myplace}[1]{   % will save the info for future use
179         \monlieuusedtrue
180         \providecommand{\lylieu}{\relax}
181         \renewcommand{\lylieu}{\lieu{#1}}
182         }
183   EndPreamble
184 End
185
186 #suppress City indication
187 Style NoPlace
188   Category              Headings
189   KeepEmpty             1
190   LatexType             Command
191   LatexName             MyNoPlace
192   LabelType             Static
193   Margin                Dynamic
194   LabelString           NoPlace
195   LeftMargin            x
196   # label font definition
197   LabelFont 
198     Series              Bold
199     Shape               Italic
200     Color               red
201   EndFont
202
203   Preamble
204    \newcommand{\MyNoPlace}{
205         \monlieuusedtrue
206         \providecommand{\lylieu}{\relax}
207         \renewcommand{\lylieu}{\nolieu{}}
208         }
209   EndPreamble
210 End
211
212 # date Style
213 Style Date
214   Category              Headings
215   Margin                Dynamic
216   LatexType             Command
217   LatexName             date
218   LeftMargin            x
219   LabelSep              xx
220   TopSep                0.4
221   BottomSep             0.4
222   ParSep                0.4
223   Align                 Block
224   AlignPossible         Block, Left
225   LabelType             Static
226   LabelString           Date:
227   # label font definition
228   LabelFont 
229     Series              Bold
230     Shape               Italic
231     Color               red
232   EndFont
233 End
234
235 #suppress date indication
236 Style NoDate
237   Category              Headings
238   KeepEmpty             1
239   Margin                Dynamic
240   LatexType             Command
241   LatexName             nodate
242   LabelType             Static
243   LeftMargin            x
244   LabelString           NoDate
245   # label font definition
246   LabelFont 
247     Series              Bold
248     Shape               Italic
249     Color               red
250   EndFont
251   Preamble
252   EndPreamble
253 End
254
255 # location (i.e. office, department ...)
256 Style Location
257   Category              Headings
258   Margin                Dynamic
259   LatexType             Command
260   LatexName             MyLocation
261   LeftMargin            x
262   LabelString           Office:
263   LabelSep              xx
264   TopSep                0.4
265   BottomSep             0.4
266   ParSep                0.4
267   Align                 Block
268   AlignPossible         Block, Left
269   LabelType             Static
270   # label font definition
271   LabelFont 
272     Series              Bold
273     Shape               Italic
274     Color               red
275   EndFont
276   Preamble
277    \newcommand{\MyLocation}[1]{ % will save the info for future use
278         \monlocationusedtrue
279         \providecommand{\lylocation}{\relax}
280         \renewcommand{\lylocation}{\location{#1}}
281         }
282   EndPreamble
283 End
284
285 # telephone Style
286 Style Telephone
287   Category              Headings
288   Margin                Dynamic
289   LatexType             Command
290   LatexName             MyTelephone
291   LeftMargin            x
292   LabelString           Tel:
293   LabelSep              xx
294   TopSep                0.4
295   BottomSep             0.4
296   ParSep                0.4
297   Align                 Block
298   AlignPossible         Block, Left
299   LabelType             Static
300   # label font definition
301   LabelFont 
302     Series              Bold
303     Shape               Italic
304     Color               red
305   EndFont
306   Preamble
307     \newcommand{\MyTelephone}[1]{ % will save the info for future use
308         \montelephoneusedtrue
309         \providecommand{\lytelephone}{\relax}
310         \renewcommand{\lytelephone}{\telephone{#1}}
311        }
312   EndPreamble
313 End
314
315 #suppress telephone indication
316 Style NoTelephone
317   Category              Headings
318   KeepEmpty             1
319   Margin                Dynamic
320   LatexType             Command
321   LatexName             MyNoTelephone
322   LabelType             Static
323   LeftMargin            x
324   LabelString           NoTel
325   # label font definition
326   LabelFont 
327     Series              Bold
328     Shape               Italic
329     Color               red
330   EndFont
331   Preamble
332    \newcommand{\MyNoTelephone}{
333         \montelephoneusedtrue
334         \providecommand{\lytelephone}{\relax}
335         \renewcommand{\lytelephone}{\notelephone{}}
336         }
337   EndPreamble
338
339 End
340
341 # telefax Style
342 Style Fax
343   Category              Headings
344   Margin                Dynamic
345   LatexType             Command
346   LatexName             MyFax
347   LeftMargin            x
348   LabelSep              xx
349   TopSep                0.4
350   BottomSep             0.4
351   ParSep                0.4
352   Align                 Block
353   AlignPossible         Block, Left
354   LabelType             Static
355   LabelString           Fax:
356   # label font definition
357   LabelFont 
358     Series              Bold
359     Shape               Italic
360     Color               red
361   EndFont
362   Preamble
363    \newcommand{\MyFax}[1]{ % will save the info for future use
364         \monfaxusedtrue
365         \providecommand{\lyfax}{\relax}
366         \renewcommand{\lyfax}{\fax{#1}}
367         }
368   EndPreamble
369 End
370
371 #suppress fax indication
372 Style NoFax
373   Category              Headings
374   KeepEmpty             1
375   Margin                Dynamic
376   LatexType             Command
377   LatexName             MyNoFax
378   LabelType             Static
379   LeftMargin            x
380   LabelString           NoFax
381    # label font definition
382   LabelFont 
383     Series              Bold
384     Shape               Italic
385     Color               red
386   EndFont
387   Preamble
388    \newcommand{\MyNoFax}{
389         \monfaxusedtrue
390         \providecommand{\lyfax}{\relax}
391         \renewcommand{\lyfax}{\nofax{}}
392         }
393   EndPreamble
394 End
395
396
397 # Email Style
398 Style Email
399   Category              Headings
400   Margin                Dynamic
401   LatexType             Command
402   LatexName             MyEmail
403   LeftMargin            x
404   LabelString           Email:
405   LabelSep              xx
406   TopSep                0.4
407   BottomSep             0.4
408   ParSep                0.4
409   Align                 Block
410   AlignPossible         Block, Left
411   LabelType             Static
412   # label font definition
413   LabelFont 
414     Series              Bold
415     Shape               Italic
416     Color               red
417   EndFont
418   Preamble
419    \newcommand{\MyEmail}[1]{ % will save the info for future use
420         \monemailusedtrue
421         \providecommand{\lyemail}{\relax}
422         \renewcommand{\lyemail}{\email{#1}}
423         }
424   EndPreamble
425 End
426
427 # Subject Style
428 Style Subject
429   Margin                Dynamic
430   LatexType             Command
431   LatexName             conc
432   LeftMargin            x
433   LabelString           Subject:
434   LabelSep              xx
435   TopSep                0.4
436   BottomSep             0.4
437   ParSep                0.4
438   Align                 Block
439   AlignPossible         Block, Left
440   LabelType             Static
441   # label font definition
442   LabelFont 
443     Series              Bold
444     Shape               Italic
445     Color               red
446   EndFont
447 End
448
449 # YourRef Style
450 Style YourRef
451   CopyStyle             Subject
452   Margin                Dynamic
453   LatexType             Command
454   LatexName             Vref
455   LeftMargin            x
456   LabelString           YourRef:
457   # label font definition
458   LabelFont 
459     Series              Bold
460     Shape               Italic
461     Color               red
462   EndFont
463 End
464
465 # MyRef Style
466 Style MyRef
467   CopyStyle             Subject
468   Margin                Dynamic
469   LatexType             Command
470   LatexName             Nref
471   LeftMargin            x
472   LabelString           MyRef:
473   # label font definition
474   LabelFont 
475     Series              Bold
476     Shape               Italic
477     Color               red
478   EndFont
479 End
480
481 Style Send_To_Address
482   CopyStyle             Send_To_Address
483   Margin                Right_Address_Box
484   LatexType             Command
485   LatexName             lettre
486   Preamble
487   \newcommand{\lettre}[1] { %% organized as expected by the package
488           \findemessage   %% if we already started a letter or a fax
489           \begin{letter}{#1} %% now the new one
490           \ifmonaddressused
491           \lyaddress{}
492           \fi
493           \ifmonlocationused
494           \lylocation{}
495           \fi
496           \ifmonlieuused
497           \lylieu{}
498           \fi
499           \ifmontelephoneused
500           \lytelephone{}
501           \fi
502           \ifmonfaxused
503           \lyfax{}
504           \fi
505           \ifmonemailused
506           \lyemail{}
507           \fi
508           \needsendlettertrue
509         }
510   EndPreamble
511 End
512
513 #As a temporary(?) trick the last(only?) letter of the file must be processed
514 # and to allow changing sender address, location,etc.. in between 2 letters
515 Style EndOfMessage
516   Category              Closings
517   KeepEmpty             1
518   Margin                Dynamic
519   TopSep                0.8
520   BottomSep             0.8
521   ParSep                0.8
522   LatexType             Command
523   LatexName             findemessage
524   LabelType             Static
525   LabelString           EndOfMessage.
526   LeftMargin            x
527   # label font definition
528   LabelFont 
529     Series              Bold
530     Shape               Italic
531     Color               red
532   EndFont
533 End
534
535 Style EndOfFile
536   CopyStyle             EndOfMessage
537   LabelString           EndOfFile.
538 End
539
540 # Opening style definition (Accroche)
541 Style Opening
542   CopyStyle             Opening
543   Margin                Dynamic
544   LeftMargin            x
545   LabelString           Opening:
546   # label font definition
547   LabelFont 
548     Series              Bold
549     Shape               Italic
550     Color               red
551   EndFont
552 End
553
554 # Closing style definition (FormuleDePolitesse, Salutations)
555 Style Closing
556   CopyStyle             Closing
557   Margin                Dynamic
558   LeftMargin            x
559   LabelString           Closing:
560   LatexType             Command
561   LatexName             lyxclose
562   Preamble
563     \newcommand{\lyxclose}[1]{\renewcommand{\Lyclose}{#1}}
564   EndPreamble
565 End
566
567 # Signature style definition
568 Style Signature
569   Margin                Dynamic
570   LeftMargin            x
571   LabelString           Signature:
572   LatexType             Command
573   LatexName             lyxsig
574   # label font definition
575   LabelFont 
576     Series              Bold
577     Shape               Italic
578     Color               red
579   EndFont
580   Preamble
581       %% automatic assignment of signatures
582       %% there is only 1 Signature style, but multiple latex commands
583        \newcommand{\lyxsig}[1]{
584          \iflyxsigs %% the second sig. exists, so this one is the third
585            \providecommand{\Lysigt}{\relax}
586            \renewcommand{\Lysigt}{#1}
587            \lyxsigttrue
588           \else                 %% if lyxsigs exist
589             \iflyxsigp          %% the second one
590               \providecommand{\Lysigs}{\relax}
591               \renewcommand{\Lysigs}{#1}
592               \lyxsigstrue
593              \else              %% the first one
594                \providecommand{\Lysigp}{\relax}
595                \renewcommand{\Lysigp}{#1}
596                \lyxsigptrue
597              \fi                %% if lyxsidp exist
598           \fi                   %% if lyxsigs exist
599         }
600   EndPreamble
601 End
602
603
604 # encl style definition (Ci-joint)
605 Style encl
606   CopyStyle             encl
607   Category              Closings
608   Margin                Dynamic
609   LeftMargin            x
610   LabelString           encl:
611   LatexName             lyxenc
612   # label font definition
613   LabelFont 
614     Series              Bold
615     Shape               Italic
616     Color               red
617   EndFont
618   Preamble
619     \newcommand{\lyxenc}[1]{
620          \providecommand{\Lyenc}{\relax}
621          \renewcommand{\Lyenc}{#1} 
622          \encneededtrue
623         }
624   EndPreamble
625 End
626
627 #Carbon Copy
628 Style   cc
629   CopyStyle             encl
630   LatexName             lyxcc
631   LeftMargin            x
632   LabelString           cc:
633   # label font definition
634   LabelFont 
635     Series              Bold
636     Shape               Italic
637     Color               red
638   EndFont
639   Preamble
640     \newcommand{\lyxcc}[1]{
641          \providecommand{\Lycc}{\relax}
642          \renewcommand{\Lycc}{#1} 
643          \ccneededtrue
644         }
645   EndPreamble
646 End
647
648 #Post Scriptum
649 Style Post_Scriptum
650   Category              Closings
651   Margin                Dynamic
652   LatexType             Command
653   LatexName             lyxps
654   LabelSep              xx
655   LabelType             Static
656   LeftMargin            x
657   LabelString           P.S.:
658   # label font definition
659   LabelFont 
660     Series              Bold
661     Shape               Italic
662     Color               red
663   EndFont
664   Preamble
665     \newcommand{\lyxps}[1]{
666          \providecommand{\Lyps}{\relax}
667          \renewcommand{\Lyps}{#1} 
668          \psneededtrue
669         }
670   EndPreamble
671 End
672
673
674