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
11 # A lot of LateX code added to avoid being bored by
12 # the imposed command order of the class letter (see comments)
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)
19 # rev.3; J.-P. Chretien oct 2010
20 # general update and review for inclusion in lyx-1.6.8
22 # - english named styles (translated in fr.po)
23 # - margins set to dynamic to ensure alignment of line headings
25 # - ordering control left at the beginning (any other way ?)
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)
31 # TODO: DocBook doesn't support several letters in the same file.
36 #(pre)declarations (just to impose some order on the menus)
88 # Input general definitions
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
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}{}
114 %% here is the real stuff : ouput the commands in the "proper" order
115 \newcommand{\findemessage}
117 \ifneedsendletter %% did we start a letter ?
118 \iflyxsigp \signature{\Lysigp} \else \name{} \fi
119 \iflyxsigs \secondsignature{\Lysigs} \fi
120 \iflyxsigt \thirdsignature{\Lysigt} \fi
125 \ifpsneeded \ps{P.S. : }{\Lyps} \psneededfalse \fi
126 \ifccneeded \cc{\Lycc} \ccneededfalse \fi
127 \ifencneeded \encl{\Lyenc} \encneededfalse \fi
129 \needsendletterfalse %% done with letter
130 \fi % if needSendLetter
131 \ifneedsendfax \end{telefax} %% nothing provided yet for telefax !
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
144 # My Address style used to specify sender name and coordinates
147 Category "Postal Data"
157 \newcommand{\MyAddress}[1]{ % will save the info for future use
159 \providecommand{\lyaddress}{\address{#1}}
162 # Don't break the sequential bunch of elements going into the wrapper.
164 DocBookWrapperTag address
165 DocBookWrapperMergeWithPrevious true
180 AlignPossible Block, Left
184 # label font definition
191 \newcommand{\Myplace}[1]{ % will save the info for future use
193 \providecommand{\lylieu}{\relax}
194 \renewcommand{\lylieu}{\lieu{#1}}
198 DocBookTagType paragraph
199 DocBookWrapperTag address
200 DocBookWrapperMergeWithPrevious true
204 #suppress City indication
214 # label font definition
222 \newcommand{\MyNoPlace}{
224 \providecommand{\lylieu}{\relax}
225 \renewcommand{\lylieu}{\nolieu{}}
228 # Don't break the sequential bunch of elements going into the wrapper.
230 DocBookWrapperTag address
231 DocBookWrapperMergeWithPrevious true
247 AlignPossible Block, Left
250 # label font definition
257 DocBookTagType paragraph
261 #suppress date indication
271 # label font definition
283 # location (i.e. office, department ...)
296 AlignPossible Block, Left
298 # label font definition
305 \newcommand{\MyLocation}[1]{ % will save the info for future use
307 \providecommand{\lylocation}{\relax}
308 \renewcommand{\lylocation}{\location{#1}}
311 DocBookWrapperTag address
312 DocBookWrapperMergeWithPrevious true
321 LatexName MyTelephone
329 AlignPossible Block, Left
331 # label font definition
338 \newcommand{\MyTelephone}[1]{ % will save the info for future use
339 \montelephoneusedtrue
340 \providecommand{\lytelephone}{\relax}
341 \renewcommand{\lytelephone}{\telephone{#1}}
344 DocBookWrapperTag address
345 DocBookWrapperMergeWithPrevious true
349 #suppress telephone indication
355 LatexName MyNoTelephone
359 # label font definition
366 \newcommand{\MyNoTelephone}{
367 \montelephoneusedtrue
368 \providecommand{\lytelephone}{\relax}
369 \renewcommand{\lytelephone}{\notelephone{}}
372 # Don't break the sequential bunch of elements going into the wrapper.
374 DocBookWrapperTag address
375 DocBookWrapperMergeWithPrevious true
391 AlignPossible Block, Left
394 # label font definition
401 \newcommand{\MyFax}[1]{ % will save the info for future use
403 \providecommand{\lyfax}{\relax}
404 \renewcommand{\lyfax}{\fax{#1}}
408 DocBookTagType paragraph
409 DocBookWrapperTag address
410 DocBookWrapperMergeWithPrevious true
414 #suppress fax indication
424 # label font definition
431 \newcommand{\MyNoFax}{
433 \providecommand{\lyfax}{\relax}
434 \renewcommand{\lyfax}{\nofax{}}
437 # Don't break the sequential bunch of elements going into the wrapper.
439 DocBookWrapperTag address
440 DocBookWrapperMergeWithPrevious true
458 AlignPossible Block, Left
460 # label font definition
467 \newcommand{\MyEmail}[1]{ % will save the info for future use
469 \providecommand{\lyemail}{\relax}
470 \renewcommand{\lyemail}{\email{#1}}
474 DocBookTagType paragraph
475 DocBookWrapperTag address
476 DocBookWrapperMergeWithPrevious true
492 AlignPossible Block, Left
494 # label font definition
501 DocBookTagType paragraph
513 # label font definition
519 DocBookTag productnumber
520 DocBookAttr role='your-ref'
521 DocBookTagType paragraph
533 # label font definition
539 DocBookTag productnumber
540 DocBookAttr role='my-ref'
541 DocBookTagType paragraph
545 Style Send_To_Address
546 CopyStyle Send_To_Address
547 Margin Right_Address_Box
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
576 DocBookWrapperTag address
577 DocBookWrapperAttr role='send-to-address'
578 DocBookWrapperMergeWithPrevious true
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
592 LatexName findemessage
594 LabelString EndOfMessage.
596 # label font definition
606 CopyStyle EndOfMessage
607 LabelString EndOfFile.
611 # Opening style definition (Accroche)
617 # label font definition
625 # Closing style definition (FormuleDePolitesse, Salutations)
634 \newcommand{\lyxclose}[1]{\renewcommand{\Lyclose}{#1}}
638 # Signature style definition
642 LabelString Signature:
645 # label font definition
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}
659 \else %% if lyxsigs exist
660 \iflyxsigp %% the second one
661 \providecommand{\Lysigs}{\relax}
662 \renewcommand{\Lysigs}{#1}
664 \else %% the first one
665 \providecommand{\Lysigp}{\relax}
666 \renewcommand{\Lysigp}{#1}
668 \fi %% if lyxsidp exist
669 \fi %% if lyxsigs exist
675 # encl style definition (Ci-joint)
683 # label font definition
690 \newcommand{\lyxenc}[1]{
691 \providecommand{\Lyenc}{\relax}
692 \renewcommand{\Lyenc}{#1}
704 # label font definition
711 \newcommand{\lyxcc}[1]{
712 \providecommand{\Lycc}{\relax}
713 \renewcommand{\Lycc}{#1}
729 # label font definition
736 \newcommand{\lyxps}[1]{
737 \providecommand{\Lyps}{\relax}
738 \renewcommand{\Lyps}{#1}
743 DocBookAttr role='post-scriptum'