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