From 2e7621d77ba56c42a648b847b81b579b9c9b361e Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 25 Mar 2005 15:27:30 +0000 Subject: [PATCH] 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 --- lib/ChangeLog | 5 +++++ lib/configure.m4 | 21 ++++++++++++++++++++- po/POTFILES.in | 1 + src/ChangeLog | 11 +++++++++++ src/buffer.C | 2 ++ src/exporter.C | 3 ++- src/lyxrc.C | 39 +++++++++++++++++++++++++++------------ src/lyxrc.h | 3 +++ 8 files changed, 71 insertions(+), 14 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 0cffce95da..533698c602 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2005-03-23 Jean-Marc Lasgouttes + + * 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 * scripts/convertDefault.sh: remove the test that "convert" really, diff --git a/lib/configure.m4 b/lib/configure.m4 index fce618c094..070bb8fdc7 100644 --- a/lib/configure.m4 +++ b/lib/configure.m4 @@ -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 ; 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 <>$outfile < + + * 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 * rowpainter.C: use default text height for drawing change tracker diff --git a/src/buffer.C b/src/buffer.C index 9287b877ba..63f3417a7b 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -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" diff --git a/src/exporter.C b/src/exporter.C index c79f001ea2..75032dda9c 100644 --- a/src/exporter.C +++ b/src/exporter.C @@ -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; diff --git a/src/lyxrc.C b/src/lyxrc.C index 13497997c4..3db4de3682 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -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(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(cygwin_path_fix) << '\n'; } + case RC_TEX_ALLOWS_SPACES: + if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) { + os << "\\tex_allows_spaces " + << convert(tex_allows_spaces) << '\n'; + } + case RC_KBMAP: + if (ignore_system_lyxrc || + use_kbmap != system_lyxrc.use_kbmap) { + os << "\\kbmap " << convert(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; diff --git a/src/lyxrc.h b/src/lyxrc.h index 00271517f4..016ac5ee98 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -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. */ -- 2.39.5