On Thu, Mar 13, 2014 at 10:29:29PM +0100, Vincent van Ravesteijn wrote: > > I did some debugging. The problem lies in the use of > QProcess::startDetached. If you call this function with a the "cmd" > prefix, you will inevitably get a command window.
That's the only way to use batch files on Windows with QProcess. > Omitting the "cmd" could be a solution. Does it have any use to add > the latexEnvCmdPrefix to a viewer command ? Yes, it has. Any spawned subprocess should receive a copy of the relevant environment variables. This was initially done using Qt, but due to https://bugreports.qt-project.org/browse/QTBUG-19885 we have to use this workaround. As an example, I attach a wrapper I use to launch xdvi. It relies on TEXINPUTS being correctly set. -- Enrico
#!/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