#!/bin/bash # xdvi_forward-search_from-kile.desktop v. 0.1 20070420 # Configuration instructions: In # Settings -> Configure Kile -> Tools -> Build -> ForwardDVI # set: Command = xdvi_forward-search_from-kile.desktop # Options = '%target' # Explicitly forbidden to use white spaces in the filenames (error code 75) # since, anyway, it does not work properly. # if test "$#" -ne 1 ; then echo -e "ERROR: incorrect number of parameters\nAborting with error code '73'" exit 73 fi # FileName="`echo "$1" | tr -d ' ' | sed 's!file:.*/\(.*\).dvi#src:.*!\1!'`" if ! test -r "${FileName}.dvi" ; then echo -e "ERROR: the file '${FileName}.dvi' does not exist\nAborting with error code '75'" exit 75 fi # LineNumber="`echo "$1" | sed "s!.*#src:\(.*\)$FileName\.tex!\1!" | tr -d ' '`" /usr/bin/xdvi -s 5 -gamma 2.5 -unique -editor "kile --line %l %f" -sourceposition "${LineNumber} ${FileName}.tex" "${FileName}.dvi" #