From a06b3900d2518eef984f651099cbb068aead4ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Mon, 25 May 2015 17:49:54 +0200 Subject: [PATCH] tex2lyx/Preamble.cpp: revert a part of [041a3add/lyxgit] There is a general problem of tex2lyx handling theorems. it is not sufficient to cure only one instance as I did. For more info see bug #9561. Update the references accordingly. --- src/tex2lyx/Preamble.cpp | 11 +---------- src/tex2lyx/test/test-modules.lyx.lyx | 1 + src/tex2lyx/test/test-refstyle-theorems.lyx.lyx | 1 + 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index d1733dd725..f5316bca13 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -1692,17 +1692,8 @@ void Preamble::parse(Parser & p, string const & forceclass, add_known_theorem(name, opt1, !opt2.empty(), from_utf8(complete)); - // we know that our theorem module already add automatically some - // theorem definition. They must not be output in the preamble to - // avoid LaTeX errors about redefinitions - if (complete == "\\newtheorem{thm}{\\protect\\theoremname}") - in_lyx_preamble = true; - else - in_lyx_preamble = false; - if (!in_lyx_preamble) - h_preamble << "\\newtheorem{" << name << '}' - << opt1 << opt2 << '{' << body << '}' << opt3; + h_preamble << complete; } else if (t.cs() == "def") { diff --git a/src/tex2lyx/test/test-modules.lyx.lyx b/src/tex2lyx/test/test-modules.lyx.lyx index 35f583759b..872c0fce1f 100644 --- a/src/tex2lyx/test/test-modules.lyx.lyx +++ b/src/tex2lyx/test/test-modules.lyx.lyx @@ -9,6 +9,7 @@ \numberwithin{figure}{section} %% Comment out for sequentially-numbered \providecommand{\theoremname}{Theorem} \theoremstyle{plain} +\newtheorem{thm}{\protect\theoremname}\theoremstyle{plain} \newtheorem{lem}[thm]{Lemma} \usepackage{babel} diff --git a/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx b/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx index 2c55b76924..3578e44457 100644 --- a/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx +++ b/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx @@ -38,6 +38,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands. \theoremstyle{plain} +\newtheorem{thm}{\protect\theoremname}\theoremstyle{plain} \newtheorem{lem}[thm]{\protect\lemmaname}\theoremstyle{plain} \newtheorem{cor}[thm]{\protect\corollaryname}\theoremstyle{plain} \newtheorem{prop}[thm]{\protect\propositionname}\theoremstyle{plain}