Partly fix for bug 1231

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8696 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2004-04-26 11:05:19 +00:00
parent 9cb1a23cb8
commit 7f68b94d8a
6 changed files with 44 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2004-04-26 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* LaTeXFeatures.C, lyx_sty.[Ch]: add \lyxdot macro
2003-09-24 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* output_latex.C (TeXEnvironment): make sure that there is a line

View File

@ -377,6 +377,9 @@ string const LaTeXFeatures::getMacros() const
if (isRequired("lyxgreyedout"))
macros << lyxgreyedout_def;
if (isRequired("lyxdot"))
macros << lyxdot_def << '\n';
// floats
getFloatDefinitions(macros);

View File

@ -1,3 +1,9 @@
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

View File

@ -93,6 +93,7 @@ using lyx::support::getExtFromContents;
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;
@ -591,7 +592,16 @@ int InsetGraphics::latex(Buffer const & buf, ostream & os,
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
@ -663,6 +673,17 @@ void InsetGraphics::validate(LaTeXFeatures & features) const
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");
}

View File

@ -126,3 +126,10 @@ string const tabularnewline_def =
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";

View File

@ -52,5 +52,7 @@ extern std::string const mathcircumflex_def;
extern std::string const tabularnewline_def;
///
extern std::string const lyxgreyedout_def;
///
extern std::string const lyxdot_def;
#endif // LYX_STY_H