]> git.lyx.org Git - lyx.git/commitdiff
enable running latex on files which path contains spaces
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 25 Mar 2005 15:27:30 +0000 (15:27 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 25 Mar 2005 15:27:30 +0000 (15:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9745 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/configure.m4
po/POTFILES.in
src/ChangeLog
src/buffer.C
src/exporter.C
src/lyxrc.C
src/lyxrc.h

index 0cffce95da59f3564aeaa776502cacf336c71973..533698c6029c4d934981a501082f77870eb6630f 100644 (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,
index fce618c0947015f9e7a338f02e72fe12b1e6b12d..070bb8fdc7c509bdde6c8dbfa3571c7d3c829f0d 100644 (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" ]
index 370e93568678bfea8764c07f84cd84afc4abb5e8..a6291fefb06e8cc1d72edcb161c1d0bfc480bda8 100644 (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
index 321d4ce78cf99b3297d76963913e2e19a2e333f4..c524df54d380a0d0797ac9192c6c11d86d2fb4c6 100644 (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
index 9287b877badee5cd4171f149eb58dac8a5534a45..63f3417a7bd12fb9a534caec6e7902aaec73ddc6 100644 (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"
index c79f001ea2a69bc1216bf7a1599ba39aca8a5181..75032dda9c13bdb5fb2116e327cedad77f015f5a 100644 (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;
index 13497997c439ecbbdbdcc0736503b54dff1faaf4..3db4de36829c969e954809897d78904e27bed90c 100644 (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;
index 00271517f48ac1bb025e62bd0fa6408aa50a1067..016ac5ee98ff35e9d3e91a066d905693e87b401e 100644 (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.
         */