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