I have suffered many times by the fact that applications from the dock or from the spotlight do not reach the same environment variables as if they were started from a shell. This is really problematic as some of them start non-interactive non-login sh shells (e.g. Doxygen, Eclipse plugins, etc) which cannot work properly without access to executables such as LaTeX, mercurial, etc.
I have tried many solutions, including the magical ~/.MacOSX/environment.plist, etc. Only one worked: I created a launchd.conf file in /etc and filled it up with content like:
setenv PATH /bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServ\
ices:/usr/texbin:/sw/bin:/usr/local/bin
After this all you need is a reboot.