[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: system command
From: |
John W. Eaton |
Subject: |
Re: system command |
Date: |
Thu, 17 May 2001 07:30:20 -0500 |
On 17-May-2001, Jan-Mark Batke <address@hidden> wrote:
| Yes, works here, too. Now, try the following:
|
| ,----[ testscript.sh ]
| | #! /bin/bash
| | latex testfile.tex
| `----
|
| and
|
| ,----[ testfile.tex ]
| | \documentclass[10pt,draft]{article}
| | \begin{document}
| | I am a \LaTeX ed file.
| | \end{document}
| `----
|
| This gives
|
| ,----
| | octave:4> system('./testscript.sh')
| | This is TeX, Version 3.14159 (Web2C 7.3.1)
| | I can't find the format file `latex.fmt'!
| | ans = 1
| | octave:5>
| `----
|
| Maybe its not the environment but something else and more
| teTeX-related. BTW I'm using Debian R2.1.
OK, here is what is happening. Octave and teTeX both use the
kpathsearch library, and that library has some TeX-specific things in
it. One thing it does is add some variables to the environment when
it is initialized. So when Octave starts, it adds values for the
following variables
SELFAUTOLOC
SELFAUTODIR
SELFAUTOPARENT
TEXMFDBS
that are not appropriate for TeX. The quick fix is to add
unset SELFAUTOLOC
unset SELFAUTODIR
unset SELFAUTOPARENT
unset TEXMFDBS
before running latex in your script. Another possible "fix" is to apply
the following patch (relative to the current CVS sources). I think a
better long term solution would be to make it possible to initialize
the kpathsearch library in a way that avoids the TeX-specific
initialization stuff.
Thanks,
jwe
2001-05-17 John W. Eaton <address@hidden>
* pathsearch.cc (dir_path::set_program_name): Set the environment
variables SELFAUTOLOC, SELFAUTODIR, SELFAUTOPARENT, and TEXMFDBS
to the empty string.
Index: pathsearch.cc
===================================================================
RCS file: /usr/local/cvsroot/octave/liboctave/pathsearch.cc,v
retrieving revision 1.12
diff -c -r1.12 pathsearch.cc
*** pathsearch.cc 2000/02/01 11:04:15 1.12
--- pathsearch.cc 2001/05/17 12:26:52
***************
*** 29,34 ****
--- 29,35 ----
#include <string>
#include "lo-utils.h"
+ #include "oct-env.h"
#include "oct-kpse.h"
#include "pathsearch.h"
#include "str-vec.h"
***************
*** 136,141 ****
--- 137,155 ----
dir_path::set_program_name (const std::string& nm)
{
::octave_kpse_set_progname (nm.c_str ());
+
+ // Calling kpse_set_progname has the unfortunate side-effect of
+ // exporting the following variables. We make them empty here so
+ // that they will not interfere with TeX, if it is run as a
+ // subprocess of Octave.
+ //
+ // XXX FIXME XXX -- is there a reasonable way to actually remove
+ // them from the environment?
+
+ octave_env::putenv ("SELFAUTOLOC", "");
+ octave_env::putenv ("SELFAUTODIR", "");
+ octave_env::putenv ("SELFAUTOPARENT", "");
+ octave_env::putenv ("TEXMFDBS", "");
}
void
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
Re: fishy rank, Paul Kienzle, 2001/05/17