Pavel Sanda wrote:

> this is interesting idea even for other backends like docbook

Actually, I was just working on a patch that would take the default output 
format instead of just LaTeX or XeTeX for the source view. It would roughly 
look as follows (without XHTML and DocBook so far, but the direction should 
be clear).

The downside at the moment is that getDefaultOutputFormat return the format 
name (e.g., pdf2). This is of course error-prone (e.g., if the users change 
the formats), An alternative would be to additionally loop over the list of 
formats and check the format name for strings such as contains("pdflatex"). 
Still error-prone, but maybe a bit better.

What do you think?

Index: src/Buffer.cpp
===================================================================
--- src/Buffer.cpp      (Revision 36453)
+++ src/Buffer.cpp      (Arbeitskopie)
@@ -3029,8 +3029,17 @@
 {
        OutputParams runparams(&params().encoding());
        runparams.nice = true;
-       runparams.flavor = params().useXetex ? 
-               OutputParams::XETEX : OutputParams::LATEX;
+       // use the default output format, if possible
+       // FIXME the format name might be changed by the user
+       string const default_format = getDefaultOutputFormat();
+       if (default_format == "pdf2")
+               runparams.flavor = OutputParams::PDFLATEX;
+       else if (default_format == "pdf4")
+               runparams.flavor = OutputParams::XETEX;
+       else if (default_format == "pdf5")
+               runparams.flavor = OutputParams::LUATEX;
+       else
+               runparams.flavor = OutputParams::LATEX;
        runparams.linelen = lyxrc.plaintext_linelen;
        // No side effect of file copying and image conversion
        runparams.dryrun = true;

Jürgen

Reply via email to