enable running latex on files which path contains spaces

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9745 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-03-25 15:27:30 +00:00
parent 1506064b51
commit 2e7621d77b
8 changed files with 71 additions and 14 deletions

View File

@ -1,3 +1,8 @@
2005-03-23 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* configure.m4: add a check to see whether TeX allows spaces in
file names. Works with web2c 7.5.3 or later.
2005-03-23 Angus Leeming <leeming@lyx.org>
* scripts/convertDefault.sh: remove the test that "convert" really,

View File

@ -502,8 +502,8 @@ EOF
fi ;;
esac
done > chklayouts.tex
${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
changequote([,])dnl
[eval] ${LATEX} wrap_chkconfig.ltx 2>/dev/null | grep '^\+'
[eval] `cat chkconfig.vars | sed 's/-/_/g'`
changequote(,)dnl
test -n "${rmlink}" && rm -f chkconfig.ltx
@ -528,6 +528,24 @@ echo "s/@chk_linuxdoc@/$chk_linuxdoc/g" >> chkconfig.sed
echo "s/@chk_docbook@/$chk_docbook/g" >> chkconfig.sed
sed -f chkconfig.sed "${srcdir}"/doc/LaTeXConfig.lyx.in >doc/LaTeXConfig.lyx
### Let's check whether spaces are allowed in TeX file names
MSG_CHECKING(whether TeX allows spaces in file names)
if test ${lyx_check_config} = no ; then
tex_allows_spaces=false
else
fname="a b"
rm -f "$fname".tex
echo "\\message{working^^J}" >"$fname".tex
if ${LATEX} "$fname" </dev/null | grep 'working' >/dev/null ; then
MSG_RESULT(yes)
tex_allows_spaces=true
else
MSG_RESULT(no)
tex_allows_spaces=false
fi
rm -r "$fname".*
fi
echo "creating $outfile"
cat >$outfile <<EOF
# This file has been automatically generated by LyX' lib/configure
@ -660,6 +678,7 @@ cat >>$outfile <<EOF
$rc_entries
\\font_encoding "$chk_fontenc"
\\tex_allows_spaces $tex_allows_spaces
EOF
if [ "x$use_cygwin_path_fix" != "x" ]

View File

@ -197,6 +197,7 @@ src/lyxfunc.C
src/lyxrc.C
src/lyxvc.C
src/mathed/formulamacro.C
src/mathed/math_casesinset.C
src/mathed/math_gridinset.C
src/mathed/math_hullinset.C
src/mathed/math_macrotemplate.C

View File

@ -1,3 +1,14 @@
2005-03-14 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyxrc.C (setDefaults, read, output, getDescription): add support
for tex_allows_spaces.
* exporter.C (Export): allows files in directory containing spaces
if tex_allows_spaces is true.
* buffer.C (makeLaTeXFile): if the document path contains spaces,
output it in double quotes.
2005-03-22 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* rowpainter.C: use default text height for drawing change tracker

View File

@ -857,6 +857,8 @@ void Buffer::makeLaTeXFile(ostream & os,
if (!original_path.empty()) {
string inputpath = os::external_path(original_path);
subst(inputpath, "~", "\\string~");
if (inputpath.find(' ') != string::npos)
inputpath = '"' + inputpath + '"';
os << "\\makeatletter\n"
<< "\\def\\input@path{{"
<< inputpath << "/}}\n"

View File

@ -185,7 +185,8 @@ bool Exporter::Export(Buffer * buffer, string const & format,
else if (backend_format == format) {
runparams.nice = true;
buffer->makeLaTeXFile(filename, string(), runparams);
} else if (contains(buffer->filePath(), ' ')) {
} else if (!lyxrc.tex_allows_spaces
&& contains(buffer->filePath(), ' ')) {
Alert::error(_("File name error"),
_("The directory path to the document cannot contain spaces."));
return false;

View File

@ -155,6 +155,7 @@ keyword_item lyxrcTags[] = {
{ "\\spell_command", LyXRC::RC_SPELL_COMMAND },
{ "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
{ "\\template_path", LyXRC::RC_TEMPLATEPATH },
{ "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
{ "\\ui_file", LyXRC::RC_UIFILE },
{ "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
{ "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
@ -268,6 +269,7 @@ void LyXRC::setDefaults() {
default_language = "english";
show_banner = true;
cygwin_path_fix = false;
tex_allows_spaces = false;
date_insert_format = "%A, %e %B %Y";
cursor_follows_scrollbar = false;
dialogs_iconify_with_main = false;
@ -384,18 +386,24 @@ int LyXRC::read(LyXLex & lexrc)
}
break;
case RC_KBMAP:
if (lexrc.next()) {
use_kbmap = lexrc.getBool();
}
break;
case RC_CYGWIN_PATH_FIX:
if (lexrc.next()) {
cygwin_path_fix = lexrc.getBool();
}
break;
case RC_TEX_ALLOWS_SPACES:
if (lexrc.next()) {
tex_allows_spaces = lexrc.getBool();
}
break;
case RC_KBMAP:
if (lexrc.next()) {
use_kbmap = lexrc.getBool();
}
break;
case RC_KBMAP_PRIMARY:
if (lexrc.next()) {
string const kmap(lexrc.getString());
@ -1312,18 +1320,22 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
index_command != system_lyxrc.index_command) {
os << "\\index_command \"" << index_command << "\"\n";
}
case RC_KBMAP:
if (ignore_system_lyxrc ||
use_kbmap != system_lyxrc.use_kbmap) {
os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
}
case RC_CYGWIN_PATH_FIX:
if (ignore_system_lyxrc ||
cygwin_path_fix != system_lyxrc.cygwin_path_fix) {
os << "\\cygwin_path_fix_needed "
<< convert<string>(cygwin_path_fix) << '\n';
}
case RC_TEX_ALLOWS_SPACES:
if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
os << "\\tex_allows_spaces "
<< convert<string>(tex_allows_spaces) << '\n';
}
case RC_KBMAP:
if (ignore_system_lyxrc ||
use_kbmap != system_lyxrc.use_kbmap) {
os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
}
case RC_KBMAP_PRIMARY:
if (ignore_system_lyxrc ||
primary_kbmap != system_lyxrc.primary_kbmap) {
@ -2371,6 +2383,9 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
break;
case RC_TEX_ALLOWS_SPACES:
break;
case RC_UIFILE:
str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
break;

View File

@ -123,6 +123,7 @@ public:
RC_SPELL_COMMAND,
RC_TEMPDIRPATH,
RC_TEMPLATEPATH,
RC_TEX_ALLOWS_SPACES,
RC_UIFILE,
RC_USER_EMAIL,
RC_USER_NAME,
@ -377,6 +378,8 @@ public:
std::string user_email;
///
bool cygwin_path_fix;
/// True if the TeX engine can handle file names containing spaces
bool tex_allows_spaces;
/** Prepend paths to the PATH environment variable.
* The string is input, stored and output in native format.
*/