commit bb87e0422a17f062c0b53071a7628419979b7a4b
Author: Georg Baum <[email protected]>
Date: Mon Dec 22 21:32:45 2014 +0100
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.
diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index 8cd5378..dd7ea96 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