+2004-04-26 Georg Baum <Georg.Baum@post.rwth-aachen.de>
+
+ * insetgraphics.C (latex): strip the extension and replace dots in
+ the filename if doing a "nice" export. This is a partial fix for
+ bug 1231 without reintroducing bug 655.
+
2004-04-19 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* insetoptarg.h: remove the editable() method (InsetCollapsable
using lyx::support::IsFileReadable;
using lyx::support::LibFileSearch;
using lyx::support::rtrim;
+using lyx::support::subst;
using lyx::support::Systemcall;
using lyx::support::unzipFile;
using lyx::support::unzippedFileName;
if (runparams.nice) {
// a relative filename should be relative to the master
// buffer.
- latex_str += params().filename.outputFilename(m_buffer->filePath());
+ string basename = params().filename.outputFilename(m_buffer->filePath());
+ // Remove the extension so the LaTeX will use whatever
+ // is appropriate (when there are several versions in
+ // different formats)
+ if (!(IsFileReadable(file_ + ".eps") || IsFileReadable(file_ + ".ps")))
+ basename = RemoveExtension(basename);
+ // This works only if the filename contains no dots besides
+ // the just removed one. We can fool here by replacing all
+ // dots with a macro whose definition is just a dot ;-)
+ latex_str += subst(basename, ".", "\\lyxdot ");
} else if (file_exists) {
// Make the filename relative to the lyx file
// and remove the extension so the LaTeX will use whatever
features.require("graphicx");
+ if (features.nice()) {
+ Buffer const * m_buffer = features.buffer().getMasterBuffer();
+ string basename =
+ params().filename.outputFilename(m_buffer->filePath());
+ string const file_ = params().filename.absFilename();
+ if (!(IsFileReadable(file_ + ".eps") || IsFileReadable(file_ + ".ps")))
+ basename = RemoveExtension(basename);
+ if (contains(basename, "."))
+ features.require("lyxdot");
+ }
+
if (params().subcaption)
features.require("subfigure");
}
string const lyxgreyedout_def =
"%% The greyedout annotation environment\n"
"\\newenvironment{lyxgreyedout}{\\color[gray]{0.8}}{}\n";
+
+// We want to omit the file extension for includegraphics, but this does not
+// work when the filename contains other dots.
+// Idea from http://www.tex.ac.uk/cgi-bin/texfaq2html?label=unkgrfextn
+string const lyxdot_def =
+ "%% A simple dot to overcome graphicx limitations\n"
+ "\\newcommand{\\lyxdot}{.}\n";