[OS X TeX] X11

Peter Breitfeld phbrf at t-online.de
Sun May 29 12:31:12 CEST 2005


Am 29. Mai 2005 um 10:30 schrieb Bruno Voisin:

> Apple has an X11 FAQ 
> <http://developer.apple.com/qa/qa2001/qa1232.html>, which, 
> unfortunately, doesn't mention much more than ~/.xinitrc, 
> /etc/X11/xinit/xinitrc and ~/.MacOSX/environment.plist.
>
> It also mentions, though, the command open-x11 to launch X11 
> applications from Terminal. Thus you can use in Terminal, for example,
>
> open-x11 xdvi

open-x11 didn't work properly for me. E.g I couldn't launch xdvi from 
the AucTeX menu of carbon emacs. So I had to change it a little to a 
new script
start-x11 which looks like this:

----------------------------------><---------------------
#!/bin/bash

BASENAME=${0##*/}

function usage()
{
cat <<HELP
USAGE:
        start-x11 programm [parameter ...]

   Das Programm ruft das X11-Tool "programm" auf und übergibt ggf. die
   "parameter" an dieses. Dabei wird ggf. zuerst X11 gestartet und die
   notwendigen Pfade werden eingerichtet.

SYMLINKS:
   Symlinks wurden eingeführt, um die Programme aus dem AucTeX Menü von
   Emacs starten zu können. Es gibt die folgenden:

   launch-xdvi    ist   "start-x11 xdvi parameter"
   launch-gv      ist   "start-x11 gv   parameter"
HELP
exit 0
}

if [ $# = 0 ]; then usage; fi

# Ist X11 schon da?
lsof | grep X11 > /dev/null
if [ "$?" = "1" ]; then
    echo "Wait until X11 has started..."
    open -a X11.app
    sleep 3
fi

# DISPLAY Variable ggf. setzen
if [ "x$DISPAY" = "x" ]; then
    export DISPLAY=":0.0"
fi

# notwendige Pfade setzen:
for d in /usr/X11R6/bin /usr/bin/X11 /usr/local/bin/X11 ; do
    if [ -d $d ]; then
       case $PATH in
       '') PATH=$d
           ;;
       $d|$d:*|*:$d|*:$d:*)
           : do nothing
           ;;
       *)  PATH=$PATH:$d
           ;;
       esac
    fi
done
export PATH

# Programm starten
case $BASENAME in
launch-xdvi)
    xdvi $@
    ;;
launch-gv)
    gv $@
    ;;
*) prog=$1; shift
    "$prog" "$@" &
    ;;
esac
----------------------------------><---------------------

It first looks if X11 is running and starts it if not. Then it looks for
the PATH as open-x11 does. The symlinks launch-x11 and launch-gv were 
used to start these apps in AucTeX.

Gruß Peter
-- 
===-==-==-==-==-==-==-==-==-==-===-==-==-==-==-==-==-==-==-==
Peter Breitfeld                 | http://www.pBreitfeld.de
Kreuzgasse 4, 88348 Bad Saulgau | PGP/GnuPG Key ist vorhanden
===-==-==-==-==-==-==-==-==-==-===-==-==-==-==-==-==-==-==-==

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list