]> git.lyx.org Git - features.git/blobdiff - src/graphics/PreviewLoader.cpp
* enable instant preview with XeTeX (requires preview-latex v.11.86) [bug #5577]
[features.git] / src / graphics / PreviewLoader.cpp
index f54fb6bc92ed3d1789ec3ebe3933f365c771c6af..cdb11afdebb50cef2e7efec7ebc40c7f42782b17 100644 (file)
@@ -592,6 +592,8 @@ void PreviewLoader::Impl::startLoading()
           << int(font_scaling_factor) << ' '
           << theApp()->hexName(PreviewLoader::foregroundColor()) << ' '
           << theApp()->hexName(PreviewLoader::backgroundColor());
+       if (buffer_.params().useXetex)
+               cs << " xelatex";
 
        string const command = libScriptSearch(cs.str());
 
@@ -704,18 +706,28 @@ void PreviewLoader::Impl::dumpPreamble(odocstream & os) const
        // Use the preview style file to ensure that each snippet appears on a
        // fresh page.
        // Also support PDF output (automatically generated e.g. when
-       // \usepackage[pdftex]{hyperref} is used.
+       // \usepackage[pdftex]{hyperref} is used and XeTeX.
        os << "\n"
+          << "\\newif\\ifxetex\n"
+          << "\\expandafter\\ifx\\csname XeTeXrevision\\endcsname\\relax\n"
+          << "   \\xetexfalse\n"
+          << "\\else\n"
+          << "    \\xetextrue\n"
+          << "\\fi\n"
           << "\\newif\\ifpdf\n"
           << "\\ifx\\pdfoutput\\undefined\n"
           << "\\else\\ifx\\pdfoutput\\relax\n"
           << "\\else\\ifnum0=\\pdfoutput\n"
           << "\\else\\pdftrue\\fi\\fi\\fi\n"
+          << "\\ifxetex\n"
+          << "  \\usepackage[active,delayed,tightpage,showlabels,lyx,xetex]{preview}\n"
+          << "\\else\n"
           << "\\ifpdf\n"
           << "  \\usepackage[active,delayed,tightpage,showlabels,lyx,pdftex]{preview}\n"
           << "\\else\n"
           << "  \\usepackage[active,delayed,showlabels,lyx,dvips]{preview}\n"
           << "\\fi\n"
+          << "\\fi\n"
           << "\n";
 }