From: Enrico Forestieri Date: Tue, 3 Nov 2015 23:36:41 +0000 (+0100) Subject: Fix bug ##9627: Make the document name available to preview insets X-Git-Tag: 2.2.0alpha1~80 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1c94995aeffb11a430d13e06c3076c4b4e850dd3;p=features.git Fix bug ##9627: Make the document name available to preview insets The \jobname macro is redefined for the preview snippets such that it contains the name of the document without extension. This is harmless because the moment it is redefined, TeX has already chosen the name of the output and log files. On the other hand, any use of \jobname in preview snippets is now consistent with what one obtains after exporting and compiling by hand. --- diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 914d7d00d1..88320e4517 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -639,6 +639,11 @@ void PreviewLoader::Impl::startLoading(bool wait) } of << "\\batchmode\n"; + // Set \jobname of previews to the document name (see bug 9627) + of << "\\def\\jobname{" + << from_utf8(changeExtension(buffer_.latexName(true), "")) + << "}\n"; + LYXERR(Debug::LATEX, "Format = " << buffer_.params().getDefaultOutputFormat()); string latexparam = ""; bool docformat = !buffer_.params().default_output_format.empty()