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