From 085d3937c6dccac48e2cd4f4ccaffcfb9ba4ebb0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Sat, 15 Nov 2014 21:22:21 +0100 Subject: [PATCH] tex2lyx: support for \item with opt arg in itemize environment --- 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 ++++++++++---- status.21x | 2 ++ 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/tex2lyx/TODO.txt b/src/tex2lyx/TODO.txt index 1de2a31d89..974dcce9bf 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[] \begin_inset Argument item: 450 ugm LaTeX font, \font_roman, \font_osf, 451 beamer overlay arguments InsetArgument \command, \begin{env} diff --git a/src/tex2lyx/test/test-structure.lyx.lyx b/src/tex2lyx/test/test-structure.lyx.lyx index e7de51d1cd..08dbf2b1b3 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 745872b363..824994eb12 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 6f88d8e414..fceeb928e5 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. diff --git a/status.21x b/status.21x index ff2d217e7e..7c2df49ca4 100644 --- a/status.21x +++ b/status.21x @@ -43,6 +43,8 @@ What's new - Support for textual references (LaTeX-command \namref from the package nameref). +- Support for items in itemize environments that have an optional argument. + - Support for the math font of the Iwona and Kurier font families. -- 2.39.5