On Mon, Aug 14, 2006 at 01:33:21PM +0200, Georg Baum wrote: > Juergen Spitzmueller wrote: > > > Georg Baum wrote: > >> The reason for renaming the files was to be able to put everything in one > >> temp dir. In 1.3 we had one temp dir per buffer, that lead to problems > >> with included graphics. I would be possible to work around this in some > >> different way, but that would not be trivial and need lots of testing. > > > > Isn't it possible to get access to the real filenames nevertheless, by > > using symlinks or something? > > No. If that would work we could have used the original filenames directly. > Consider the included documents > > dir1/x.lyx > dir2/x.lyx > > We can not copy them to the same dir. We could create subdirs, but then that > does not work for absolute paths, or for ../../dir1/dir2/x.lyx. We would > also get problems with files with spaces or other strange characters in the > name. > > >> I'd prefer to add the \includeonly feature natively to LyX. > > > > While that would be nice, it would only cover the problem IMHO. Even if I > > don't know any at the moment, we basically break every package (or LaTeX > > command) that uses the filenames of subdocuments (or of their auxiliary > > files). > > That is a drawback of that approach, yes. The same holds true for images. > OTOH I can't imagine any other case where access to the real file name from > the preamble or a ERT command is needed. We discussed this at length with > Angus, and the result was that creating mangled file names is the best > thing to do.
What about making use of TEXINPUTS and friends? I attach here two wrapper scripts for latex and xdvi that I was using some year ago with lyx versions 1.1.x when no files were copied to the lyx_tmpdir. They were working very well. -- Enrico
#!/bin/sh args=$* PWD=`pwd` case $PWD in /tmp/lyx_tmpdir*) # we were called by LyX, so let's get the input path texpath=`head $1 | grep [EMAIL PROTECTED] IPAT=`expr "$texpath" : '[EMAIL PROTECTED](.*\)//}}.*'` IPAT=.:$IPAT:$IPAT/figs # tell xdvi and/or dvips about the input path echo $IPAT > LYXINPUTPATH # strip off the "/tmp/lyx_tmpdir*/" added by LyX sed -e "s?${PWD}/??g" $1 > $1.new mv $1.new $1 ;; *) while [ $# -ne 0 ]; do file=$1 shift done IPAT=`dirname $file` IPAT=$IPAT:$IPAT/figs ;; esac if test -z "$TEXINPUTS"; then TEXINPUTS=$IPAT: else case $TEXINPUTS in :*) TEXINPUTS=:$IPAT$TEXINPUTS ;; *:) TEXINPUTS=$TEXINPUTS$IPAT: ;; esac fi export TEXINPUTS exec /usr/bin/latex $args
#!/bin/sh # # Visualizza un file dvi in portrait o landscape file="" args="" for arg in "$@"; do case $arg in -*) args="$args $arg" ;; *) if [ -f "$arg" -o -f "$arg.dvi" ]; then dir=`dirname "$arg"` file=`basename "$arg"` cd "$dir" if [ ! -f "$file" ]; then file=$file.dvi fi args="$args \"$file\"" else args="$args $arg" fi ;; esac done if test -f LYXINPUTPATH; then # we were called from LyX, so the input path is in LYXINPUTPATH PWD=`cat LYXINPUTPATH` else PWD="." PWD=$PWD:$PWD/figs fi if test -z "$TEXINPUTS"; then TEXINPUTS=$PWD: else case $TEXINPUTS in :*) TEXINPUTS=:$PWD$TEXINPUTS ;; *:) TEXINPUTS=$TEXINPUTS$PWD: ;; esac fi export TEXINPUTS paper= if [ -f "$file" ]; then # use landscape if horiz >= vert dimension in dvi file line=`dvitype "$file" | grep maxv=` maxv=`expr "$line" : 'maxv=\(.*\), maxh.*'` maxh=`expr "$line" : '.*maxh=\(.*\), maxstack.*'` if [ $maxh -ge $maxv ]; then paper="-paper a4r" else paper="-geometry 638 -margins 1.5" fi fi eval exec /usr/bin/xdvi $paper -gamma 2 -expert $args