On Tue, Jun 12, 2007 at 06:29:03AM +0200, Jürgen Spitzmüller wrote: > Enrico Forestieri wrote: > > Well, either we remove the MarkBoth environment or actually add code > > to the preamble in order to avoid a latex failure when someone uses > > MarkBoth in the document without disabling babel. Also take into account > > the fact that one may have old files using the IEEEtran class with > > MarkBoth, and it is a real nuisance having to disable babel. > > > > I don't think removing MarkBoth is feasible without breaking those old > > documents (without a format change?), so maybe your solution could be > > complemented with mine but modified as you suggest, i.e., adding the > > preamble stuff to the MarkBoth definition in the layout file. > > I agree with all of this. > > > In this way, using \markboth in the preamble is encouraged, but MarkBoth > > in the document is still possible. > > Yes. Xo could you prepare a patch for the layout file? While you are at it, > you could add some OptArgs where needed.
Here is what I came up with. Given that the needed definitions for the MarkBoth environment are in the layout file (so they are not accessible by the user), I had to go through the babel code to find an automatic workaround (luckily I found it almost immediately :). Now no adjustments are needed when changing the language. Note that if you use the MarkBoth environment and change the language after a first View->DVI, you will get an error afterwards, due to the .aux file still in effect. Simply do another View->DVI to get rid of it. As regards the OptArgs, do you have something specific in mind? -- Enrico
Index: lib/templates/IEEEtran.lyx =================================================================== --- lib/templates/IEEEtran.lyx (revision 18750) +++ lib/templates/IEEEtran.lyx (working copy) @@ -44,25 +44,6 @@ \begin_body -\begin_layout Standard -\begin_inset Note Note -status open - -\begin_layout Standard -To specify the left and right header, go to -\family sans -Document\SpecialChar \menuseparator -Settings\SpecialChar \menuseparator -Preamble -\family default - and change the definition there. -\end_layout - -\end_inset - - -\end_layout - \begin_layout Title Your Title: And maybe a bit extra \end_layout @@ -104,6 +85,66 @@ This paper presents a simple template fo simplicity, beauty, elegance \end_layout +\begin_layout Standard +\begin_inset Note Note +status open + +\begin_layout Standard +To specify the left and right header, go to +\family sans +Document\SpecialChar \menuseparator +Settings\SpecialChar \menuseparator +LaTeX Preamble +\family default + and change the definition there. + You could also use the MarkBoth environment as shown in the note below, + but be warned that in this case the preamble will be cluttered by further + definitions, needed to workaround a babel bug. +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Note Note +status collapsed + +\begin_layout Standard +In order to use the MarkBoth environment, you have to separate left and + right pages material through +\begin_inset Quotes eld +\end_inset + +}{ +\begin_inset Quotes erd +\end_inset + + in ERT as follows: +\end_layout + +\begin_layout Standard +\align center +This is for left pages +\begin_inset ERT +status collapsed + +\begin_layout Standard + +}{ +\end_layout + +\end_inset + +and this is for right pages +\end_layout + +\end_inset + + +\end_layout + \begin_layout Section Introduction \begin_inset Note Note Index: lib/layouts/IEEEtran.layout =================================================================== --- lib/layouts/IEEEtran.layout (revision 18750) +++ lib/layouts/IEEEtran.layout (working copy) @@ -466,6 +466,18 @@ Style MarkBoth LaTeXName markboth Align Center AlignPossible Center + Preamble + % Note: the following fixes a bug with older versions of babel + % http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=babel/3238 + \DeclareRobustCommand{\FOREIGNLANGUAGE}[1]{% + \lowercase{\foreignlanguage{#1}}} + % More recent babel versions already have the above definition, but + % introduce yet another related bug, cured by the following workaround + [EMAIL PROTECTED]@language + [EMAIL PROTECTED] + [EMAIL PROTECTED] + + EndPreamble End