The branch, 2.0.x, has been updated.

- Log -----------------------------------------------------------------

commit c0ebff8617c48b22bc3ccbb1170420c51efb2727
Author: Uwe Stöhr <uwesto...@lyx.org>
Date:   Tue Jul 3 00:21:39 2012 +0200

    tex2lyx: support for syncTeX
    
    backport enhancement bug #8217

diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index 746e216..c02ca5b 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -450,6 +450,8 @@ Preamble::Preamble() : one_language(true), 
title_layout_found(false)
        //h_notefontcolor;
        //h_options;
        h_output_changes          = "false";
+       h_output_sync             = "0";
+       //h_output_sync_macro
        h_papercolumns            = "1";
        h_paperfontsize           = "default";
        h_paperorientation        = "portrait";
@@ -749,6 +751,15 @@ void Preamble::handle_package(Parser &p, string const & 
name,
                options.clear();
        }
 
+       else if (name == "srcltx") {
+               h_output_sync = "1";
+               if (!opts.empty()) {
+                       h_output_sync_macro = "\\usepackage[" + opts + 
"]{srcltx}";
+                       options.clear();
+               } else
+                       h_output_sync_macro = "\\usepackage{srcltx}";
+       }
+
        else if (is_known(name, known_old_language_packages)) {
                // known language packages from the times before babel
                // if they are found and not also babel, they will be used as
@@ -956,7 +967,10 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc)
           << "\\font_sf_scale " << h_font_sf_scale << "\n"
           << "\\font_tt_scale " << h_font_tt_scale << "\n"
           << "\\graphics " << h_graphics << "\n"
-          << "\\default_output_format " << h_default_output_format << "\n";
+          << "\\default_output_format " << h_default_output_format << "\n"
+          << "\\output_sync " << h_output_sync << "\n";
+       if (h_output_sync == "1")
+               os << "\\output_sync_macro \"" << h_output_sync_macro << "\"\n";
        if (!h_float_placement.empty())
                os << "\\float_placement " << h_float_placement << "\n";
        os << "\\paperfontsize " << h_paperfontsize << "\n"
@@ -1445,6 +1459,19 @@ void Preamble::parse(Parser & p, string const & 
forceclass,
                else if (t.cs() == "setstretch")
                        h_spacing = "other " + p.verbatim_item();
 
+               else if (t.cs() == "synctex") {
+                       // the scheme is \synctex=value
+                       // where value can only be "1" or "-1"
+                       h_output_sync = "1";
+                       // there can be any character behind the value (e.g. a 
linebreak or a '\'
+                       // therefore we extract it char by char
+                       p.get_token();
+                       string value = p.get_token().asInput();
+                       if (value == "-")
+                               value += p.get_token().asInput();
+                       h_output_sync_macro = "\\synctex=" + value;
+               }
+
                else if (t.cs() == "begin") {
                        string const name = p.getArg('{', '}');
                        if (name == "document")
diff --git a/src/tex2lyx/Preamble.h b/src/tex2lyx/Preamble.h
index 1389a86..bde44a0 100644
--- a/src/tex2lyx/Preamble.h
+++ b/src/tex2lyx/Preamble.h
@@ -123,6 +123,8 @@ private:
        std::string h_notefontcolor;
        std::string h_options;
        std::string h_output_changes;
+       std::string h_output_sync;
+       std::string h_output_sync_macro;
        std::string h_papercolumns;
        std::string h_paperfontsize;
        std::string h_paperorientation;
diff --git a/src/tex2lyx/test/test-structure.tex 
b/src/tex2lyx/test/test-structure.tex
index 609860f..b935634 100644
--- a/src/tex2lyx/test/test-structure.tex
+++ b/src/tex2lyx/test/test-structure.tex
@@ -4,7 +4,7 @@
 \usepackage[latin9]{inputenc}
 \usepackage{color}
 \usepackage{rotfloat}
-\usepackage{wrapfig}
+\synctex=-1\usepackage{wrapfig}
 
 \makeatletter
 
diff --git a/status.20x b/status.20x
index e245bfb..6b8df8b 100644
--- a/status.20x
+++ b/status.20x
@@ -36,6 +36,8 @@ What's new
 
 - The polyglossia/XeTeX language commands are now supported (bug 8212).
 
+- It is now recognized if syncTeX is used (bug 8217).
+
 
 * USER INTERFACE
 

-----------------------------------------------------------------------

Summary of changes:
 src/tex2lyx/Preamble.cpp            |   29 ++++++++++++++++++++++++++++-
 src/tex2lyx/Preamble.h              |    2 ++
 src/tex2lyx/test/test-structure.tex |    2 +-
 status.20x                          |    2 ++
 4 files changed, 33 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to