The attached patch adds support for \item with options inside of itemize environments.

OK to go also to branch?

regards Uwe
 src/tex2lyx/TODO.txt                    |  1 -
 src/tex2lyx/test/test-structure.lyx.lyx | 12 +++++++++++-
 src/tex2lyx/test/test-structure.tex     |  2 +-
 src/tex2lyx/text.cpp                    | 14 ++++++++++----
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/src/tex2lyx/TODO.txt b/src/tex2lyx/TODO.txt
index 1de2a31..974dcce 100644
--- a/src/tex2lyx/TODO.txt
+++ b/src/tex2lyx/TODO.txt
@@ -62,7 +62,6 @@ Format LaTeX feature                        LyX feature
 446    Optional and required arguments      InsetArgument
        now numbered by order
 448
-449    \item[<arg>]                         \begin_inset Argument item:<nr>
 450    ugm LaTeX font,                      \font_roman, \font_osf,
 451    beamer overlay arguments             InsetArgument
        \command<arg>, \begin{env}<arg>
diff --git a/src/tex2lyx/test/test-structure.lyx.lyx 
b/src/tex2lyx/test/test-structure.lyx.lyx
index e7de51d..08dbf2b 100644
--- a/src/tex2lyx/test/test-structure.lyx.lyx
+++ b/src/tex2lyx/test/test-structure.lyx.lyx
@@ -867,7 +867,17 @@ the second item
 \end_layout
 
 \begin_layout Itemize
-the third item
+
+\begin_inset Argument item:1
+status open
+
+\begin_layout Plain Layout
+custom label
+\end_layout
+
+\end_inset
+
+the third item has a custom label
 \end_layout
 
 \begin_deeper
diff --git a/src/tex2lyx/test/test-structure.tex 
b/src/tex2lyx/test/test-structure.tex
index 745872b..824994e 100644
--- a/src/tex2lyx/test/test-structure.tex
+++ b/src/tex2lyx/test/test-structure.tex
@@ -285,7 +285,7 @@ and a second paragraph for good measure
 
 \item the second item
 
-\item the third item
+\item[custom label] the third item has a custom label
 
 \subsubsection*{and a sssection heading inside it (why not?)}
 \end{itemize}
diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index 6f88d8e..fceeb92 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -2639,11 +2639,18 @@ void parse_text(Parser & p, ostream & os, unsigned 
flags, bool outer,
                        }
                        if (optarg) {
                                if (context.layout->labeltype != LABEL_MANUAL) {
-                                       // LyX does not support \item[\mybullet]
-                                       // in itemize environments
+                                       // handle option of itemize item
+                                       begin_inset(os, "Argument item:1\n");
+                                       os << "status open\n";
+                                       os << "\n\\begin_layout Plain Layout\n";
                                        Parser p2(s + ']');
                                        os << parse_text_snippet(p2,
                                                FLAG_BRACK_LAST, outer, 
context);
+                                       // we must not use 
context.check_end_layout(os)
+                                       // because that would close the outer 
itemize layout
+                                       os << "\n\\end_layout\n";
+                                       end_inset(os);
+                                       eat_whitespace(p, os, context, false);
                                } else if (!s.empty()) {
                                        // LyX adds braces around the argument,
                                        // so we need to remove them here.
@@ -2659,8 +2666,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, 
bool outer,
                                        } else {
                                                Parser p2(s + ']');
                                                os << parse_text_snippet(p2,
-                                                       FLAG_BRACK_LAST,
-                                                       outer, context);
+                                                       FLAG_BRACK_LAST, outer, 
context);
                                        }
                                        // The space is needed to separate the
                                        // item from the rest of the sentence.

Reply via email to