/// Note that \p format may be unknown (i. e. an empty string)
string findTargetFormat(string const & format, OutputParams const & runparams)
{
- // Are we using latex or XeTeX/LuaTeX/pdflatex?
+ // Are we latexing to DVI or PDF?
if (runparams.flavor == OutputParams::PDFLATEX
|| runparams.flavor == OutputParams::XETEX
|| runparams.flavor == OutputParams::LUATEX) {
// extension removed, because base.eps and base.eps.gz may
// have different content but would get the same mangled
// name in this case.
+ // Also take into account that if the name of the zipped file
+ // has no zip extension then the name of the unzipped one is
+ // prefixed by "unzipped_".
string const base = removeExtension(file.unzippedFileName());
- string::size_type const ext_len = file_in.length() - base.length();
+ string::size_type const prefix_len =
+ prefixIs(onlyFileName(base), "unzipped_") ? 9 : 0;
+ string::size_type const ext_len =
+ file_in.length() + prefix_len - base.length();
mangled[mangled.length() - ext_len] = '.';
}
FileName const file_out(makeAbsPath(mangled, dir));
string before;
string after;
- if (runparams.moving_arg)
- before += "\\protect";
-
- // We never use the starred form, we use the "clip" option instead.
- before += "\\includegraphics";
-
// Write the options if there are any.
bool const ps = runparams.flavor == OutputParams::LATEX
|| runparams.flavor == OutputParams::DVILUATEX;
string const opts = createLatexOptions(ps);
LYXERR(Debug::GRAPHICS, "\tOpts = " << opts);
+ if (contains(opts, '=') && contains(runparams.active_chars, '=')) {
+ // We have a language that makes = active. Deactivate locally
+ // for keyval option parsing (#2005).
+ before = "\\begingroup\\catcode`\\=12";
+ after = "\\endgroup";
+ }
+
+ if (runparams.moving_arg)
+ before += "\\protect";
+
+ // We never use the starred form, we use the "clip" option instead.
+ before += "\\includegraphics";
+
if (!opts.empty() && !message.empty())
before += ('[' + opts + ',' + message + ']');
else if (!opts.empty() || !message.empty())