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
259 DocBookNoFontInside true
262 #suppress date indication
272 # label font definition
284 # location (i.e. office, department ...)
297 AlignPossible Block, Left
299 # label font definition
306 \newcommand{\MyLocation}[1]{ % will save the info for future use
308 \providecommand{\lylocation}{\relax}
309 \renewcommand{\lylocation}{\location{#1}}
312 DocBookWrapperTag address
313 DocBookWrapperMergeWithPrevious true
322 LatexName MyTelephone
330 AlignPossible Block, Left
332 # label font definition
339 \newcommand{\MyTelephone}[1]{ % will save the info for future use
340 \montelephoneusedtrue
341 \providecommand{\lytelephone}{\relax}
342 \renewcommand{\lytelephone}{\telephone{#1}}
345 DocBookWrapperTag address
346 DocBookWrapperMergeWithPrevious true
350 #suppress telephone indication
356 LatexName MyNoTelephone
360 # label font definition
367 \newcommand{\MyNoTelephone}{
368 \montelephoneusedtrue
369 \providecommand{\lytelephone}{\relax}
370 \renewcommand{\lytelephone}{\notelephone{}}
373 # Don't break the sequential bunch of elements going into the wrapper.
375 DocBookWrapperTag address
376 DocBookWrapperMergeWithPrevious true
392 AlignPossible Block, Left
395 # label font definition
402 \newcommand{\MyFax}[1]{ % will save the info for future use
404 \providecommand{\lyfax}{\relax}
405 \renewcommand{\lyfax}{\fax{#1}}
409 DocBookTagType paragraph
410 DocBookWrapperTag address
411 DocBookWrapperMergeWithPrevious true
415 #suppress fax indication
425 # label font definition
432 \newcommand{\MyNoFax}{
434 \providecommand{\lyfax}{\relax}
435 \renewcommand{\lyfax}{\nofax{}}
438 # Don't break the sequential bunch of elements going into the wrapper.
440 DocBookWrapperTag address
441 DocBookWrapperMergeWithPrevious true
459 AlignPossible Block, Left
461 # label font definition
468 \newcommand{\MyEmail}[1]{ % will save the info for future use
470 \providecommand{\lyemail}{\relax}
471 \renewcommand{\lyemail}{\email{#1}}
475 DocBookTagType paragraph
476 DocBookWrapperTag address
477 DocBookWrapperMergeWithPrevious true
493 AlignPossible Block, Left
495 # label font definition
502 DocBookTagType paragraph
514 # label font definition
520 DocBookTag productnumber
521 DocBookAttr role='your-ref'
522 DocBookTagType paragraph
534 # label font definition
540 DocBookTag productnumber
541 DocBookAttr role='my-ref'
542 DocBookTagType paragraph
546 Style Send_To_Address
547 CopyStyle Send_To_Address
548 Margin Right_Address_Box
552 \newcommand{\lettre}[1] { %% organized as expected by the package
553 \findemessage %% if we already started a letter or a fax
554 \begin{letter}{#1} %% now the new one
577 DocBookWrapperTag address
578 DocBookWrapperAttr role='send-to-address'
579 DocBookWrapperMergeWithPrevious true
583 #As a temporary(?) trick the last(only?) letter of the file must be processed
584 # and to allow changing sender address, location,etc.. in between 2 letters
593 LatexName findemessage
595 LabelString EndOfMessage.
597 # label font definition
607 CopyStyle EndOfMessage
608 LabelString EndOfFile.
612 # Opening style definition (Accroche)
618 # label font definition
626 # Closing style definition (FormuleDePolitesse, Salutations)
635 \newcommand{\lyxclose}[1]{\renewcommand{\Lyclose}{#1}}
639 # Signature style definition
643 LabelString Signature:
646 # label font definition
653 %% automatic assignment of signatures
654 %% there is only 1 Signature style, but multiple latex commands
655 \newcommand{\lyxsig}[1]{
656 \iflyxsigs %% the second sig. exists, so this one is the third
657 \providecommand{\Lysigt}{\relax}
658 \renewcommand{\Lysigt}{#1}
660 \else %% if lyxsigs exist
661 \iflyxsigp %% the second one
662 \providecommand{\Lysigs}{\relax}
663 \renewcommand{\Lysigs}{#1}
665 \else %% the first one
666 \providecommand{\Lysigp}{\relax}
667 \renewcommand{\Lysigp}{#1}
669 \fi %% if lyxsidp exist
670 \fi %% if lyxsigs exist
676 # encl style definition (Ci-joint)
684 # label font definition
691 \newcommand{\lyxenc}[1]{
692 \providecommand{\Lyenc}{\relax}
693 \renewcommand{\Lyenc}{#1}
705 # label font definition
712 \newcommand{\lyxcc}[1]{
713 \providecommand{\Lycc}{\relax}
714 \renewcommand{\Lycc}{#1}
730 # label font definition
737 \newcommand{\lyxps}[1]{
738 \providecommand{\Lyps}{\relax}
739 \renewcommand{\Lyps}{#1}
744 DocBookAttr role='post-scriptum'