From bb87e0422a17f062c0b53071a7628419979b7a4b Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Mon, 22 Dec 2014 21:32:45 +0100 Subject: [PATCH] Revert parts of 7e69ac220dd This fixes the tex2lyx test test-refstyle-theorems.tex. It seems that the intent of the fix was to remove a \protect in front of a \caption, \captionabove or \captionbelow, but the implementation did not really do that. Furthermore, it is not clear in which cases a \protect in front of a caption needs to removed, and in which cases it needs to be kept: After looking at the LyX sources I could not see that caprions are always output with \protect. --- src/tex2lyx/text.cpp | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 8cd5378689..dd7ea963fd 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -3432,26 +3432,15 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, else if (is_known(t.cs(), known_phrases) || (t.cs() == "protect" && p.next_token().cat() == catEscape && - is_known(p.next_token().cs(), known_phrases)) || - (t.cs() == "protect" && - (p.next_token().cs() == "caption" || - p.next_token().cs() == "captionabove" || - p.next_token().cs() == "captionbelow"))) { - if (p.next_token().cs() == "caption" || - p.next_token().cs() == "captionabove" || - p.next_token().cs() == "captionbelow") - // we must ignore if \protect is in front of \caption* - ; - else { - // LyX sometimes puts a \protect in front, so we have to ignore it - // FIXME: This needs to be changed when bug 4752 is fixed. - where = is_known( - t.cs() == "protect" ? p.get_token().cs() : t.cs(), - known_phrases); - context.check_layout(os); - os << known_coded_phrases[where - known_phrases]; - skip_spaces_braces(p); - } + is_known(p.next_token().cs(), known_phrases))) { + // LyX sometimes puts a \protect in front, so we have to ignore it + // FIXME: This needs to be changed when bug 4752 is fixed. + where = is_known( + t.cs() == "protect" ? p.get_token().cs() : t.cs(), + known_phrases); + context.check_layout(os); + os << known_coded_phrases[where - known_phrases]; + skip_spaces_braces(p); } // handle refstyle first to catch \eqref which can also occur -- 2.39.2