Opened 18 years ago

Closed 13 years ago

#2438 closed defect (fixed)

tex2lyx inserts a reference to \extrasfrench before \usepackage{babel}

Reported by: jeanpierre.chretien@… Owned by: Uwe Stöhr
Priority: normal Milestone: 2.0.2
Component: tex2lyx Version: 1.4.0
Severity: normal Keywords:
Cc: Uwe Stöhr

Description (last modified by Richard Heck)

If I create a french article, say test_guill_orig.lyx, lyx-1.4.0 exports:

\usepackage{babel}
\addto\extrasfrench{\providecommand{\og}{\leavevmode\flqq~}\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}}

If I rename test_guill_orig.tex as test_guill_roundtrip.tex and run
tex2lyx on this file, a preamble is created in test_guill_roundtrip.lyx without
the \uspackage{babel} command [newlines removed]:

\begin_preamble
%% LyX 1.4.0 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\makeatletter
\addto\extrasfrench{\providecommand{\og}{\leavevmode\flqq~}\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}}
\makeatother
\end_preamble

View->DVI produces an "Undefined control error" on \extrasfrench, as
the \addto command appears now once before the \usepackage{babel} command in the
exported file:

\makeatletter

\addto\extrasfrench{\providecommand{\og}{\leavevmode\flqq~}\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}}
\makeatother

\usepackage{babel}
\addto\extrasfrench{\providecommand{\og}{\leavevmode\flqq~}\providecommand{\fg}{\ifdim\lastskip>\z@\unskip\fi~\frqq}}
\makeatother

Change History (10)

comment:1 by lasgouttes, 18 years ago

dependson: 19

would be fixed by omitting parts of preamble generated by LyX (#19)

comment:2 by jeanpierre.chretien@…, 18 years ago

It's true as well for geometry: if the original lyx file used geomtry package,
it comes back with the inserted preamble so that any change in geometry
from the Document->Settings->Page layout is not taken into account, as it is
exported before the preamble.

The problem is not only with round trip I guess, should not
tex2lyx remove from the preamble the settings it can convert as
lyx commands ?

comment:3 by lasgouttes, 18 years ago

This is true. I wrote something like that in #19, fell free to add comments.

comment:4 by Uwe Stöhr, 16 years ago

Keywords: fixedintrunk added
Milestone: 1.6.0
Severity: minornormal

This is fixedintrunk as we load since LyX 1.6 babel in the correct order. The
given testcase, attachment 1342, works.

That \extrasfrench will appear in the preamble, since it could be another
command than the one that is automatically inserted by LyX.

comment:5 by Uwe Stöhr, 16 years ago

Keywords: fixedintrunk removed
Owner: changed from poenitz to Uwe Stöhr

This is fixedintrunk as we load since LyX 1.6 babel in the correct order. The
given testcase, attachment 1342, works.

We changed in the meantime the babel loading order again, so that this case is
no longer fixed. I'll have a look at it when LyX 1.6 is released to have a
stable code base.

comment:6 by Uwe Stöhr, 16 years ago

Milestone: 1.6.01.6.x

comment:7 by lasgouttes, 15 years ago

blocked: 17

comment:8 by ps, 15 years ago

Priority: highnormal

comment:9 by Richard Heck, 13 years ago

Cc: Uwe Stöhr added
Description: modified (diff)
Milestone: 1.6.x

Uwe, does this still exist in 2.0.0?

comment:10 by Uwe Stöhr, 13 years ago

Milestone: 2.0.2
Resolution: fixed
Status: newclosed

Seems to be fixed in the meantime, tested with LyX 2.0.2svn.

Note: See TracTickets for help on using tickets.