On 03/19/2013 09:20 AM, Nick Fort wrote:
On 19 March 2013 15:01, Richard Heck <rgh...@lyx.org <mailto:rgh...@lyx.org>> wrote:

    On 03/19/2013 01:00 AM, Nick Fort wrote:
    On 19 March 2013 00:04, Richard Heck <rgh...@lyx.org
    <mailto:rgh...@lyx.org>> wrote:

        On 03/18/2013 05:57 AM, Nick Fort wrote:
        Hi,

        I've stumbled upon an issue with LyX 2.0.5.1
        <http://2.0.5.1>: using enumitem in an included file inside
        another does not appear to work.

        For example, take the enumitem-example.lyx file from here:
        http://wiki.lyx.org/Tips/Enumitem, and include it in another
        file of the same class, with the enumitem module loaded.

        When compiled on its own, enumitem-example.lyx creates the
        PDF without a problem. When this file is included in another
        LyX file (also of class "article", with the enumitem module
        loaded), a bunch of LaTeX errors occur:

        "Missing \endcsname inserted.
        Extra \endcsname."

        I haven't seen anything similar on the web about this -- is
        there a workaround/fix to this issue? Or am I doing
        something wrong?

        You have to load the enumitem module in the master document.
        If it's only in the child, the master does not see it.

        rh


    I created a new master file to test this -- in it, I added the
    enumitem module. I then included in that master file the child
    document. As soon as I removed the enumitem module from the
    child, LyX gave me four "Layout not found" errors, specifically
    relating to the enumitem-resume layout. The PDF then builds, but
    (a) includes a page break before the child document, and (b) does
    not actually use any of the enumitem features, i.e. the lists are
    stock-standard.

    Sorry, I should have been more explicit: You need to load the
    module in the master AND the child. Modules do not get inherited
    by children. There is a reason for this (the fact that what is a
    child can also be used not as a child), although I agree that it
    is counter-intuitive.

    Richard


Sorry, I actually got what you meant some time after I sent that reply. Indeed, I remember LyX throwing an error when I tried to load a module child in a no-module parent. I also now see that the files I attached were wrong. Sigh -- sorry about that!

What I should have stated more clearly is that what you say (module in parent and child) is what I tried initially when I got the

"Missing \endcsname inserted.
Extra \endcsname."

If you have a look at the files I've attached now, does it build for you, or do you also get the "endcsname" error?


OK, so I have finally found the bug. The problem is that we are outputting this code:

Itemize, Enumeration, and Description lists may have an optional arguments.
If the optional argument contains special characters (e.g. the backslash),
put it in an ERT box.
\begin{enumerate}[\selectlanguage{british}%
labelindent=\parindent,leftmargin=*,label=\Roman*.,widest=IV,align=left \selectlanguage{english}%
]
\item  An enumeration
\item with left-aligned roman
\item numbering
\item 1of items.
\end{enumerate}

Note the language change. This would appear to be because the two files use different languages. We obviously should not be outputting that in this case.

Can you file a bug about this?

Richard

Reply via email to