Author: lasgouttes
Date: Mon Jan 10 18:27:56 2011
New Revision: 37164
URL: http://www.lyx.org/trac/changeset/37164

Log:
When hyperref is active, define the \LyX macro in a way that does
not break in PDF table of contents (using texorpdfstring).

Uwe, this should allow you to remove some ERT from the documentation.

Modified:
   lyx-devel/trunk/src/LaTeXFeatures.cpp

Modified: lyx-devel/trunk/src/LaTeXFeatures.cpp
==============================================================================
--- lyx-devel/trunk/src/LaTeXFeatures.cpp       Mon Jan 10 11:31:20 2011        
(r37163)
+++ lyx-devel/trunk/src/LaTeXFeatures.cpp       Mon Jan 10 18:27:56 2011        
(r37164)
@@ -60,6 +60,11 @@
 static docstring const lyx_def = from_ascii(
        
"\\providecommand{\\lyx}{l\\kern-.1667em\\lower.25em\\hbox{y}\\kern-.125em...@}");
 
+static docstring const lyx_hyperref_def = from_ascii(
+       "\\providecommand{\\LyX}{\\texorpdfstring%\n"
+       "  {l\\kern-.1667em\\lower.25em\\hbox{y}\\kern-.125em...@}\n"
+        "  {LyX}}");
+
 static docstring const noun_def = from_ascii(
        "\\newcommand{\\noun}[1]{\\textsc{#1}}");
 
@@ -844,8 +849,12 @@
                        macros << papersizepdf_def << '\n';
        }
 
-       if (mustProvide("LyX"))
-               macros << lyx_def << '\n';
+       if (mustProvide("LyX")) {
+               if (isRequired("hyperref"))
+                       macros << lyx_hyperref_def << '\n';
+               else
+                       macros << lyx_def << '\n';
+       }
 
        if (mustProvide("noun"))
                macros << noun_def << '\n';

Reply via email to