[OS X Emacs] LaTeX cannot find its class/style files (obvious fixes attended to)

pdfinn at uwm.edu pdfinn at uwm.edu
Fri Jan 4 22:37:45 EST 2008

Thanks Peter!  Your advice worked (see below).

At Sat, 5 Jan 2008 00:31:25 +0100,
Peter Dyballa <Peter_Dyballa at Web.DE> wrote:

> Am 04.01.2008 um 23:11 schrieb pdfinn:
> > If I run LaTeX in the shell it works just fine.  If I evoke it  
> > through Emacs I run
> > into the above problem---this includes evoking LaTeX through Emac's  
> > term and shell
> > modes.
> Are you using AUCTeX or Emacs' latex-mode?

I started with AUCTeX and encountered the problem I described above.  In an
attempt to isolate the source I disabled AUCTeX, and the problem persisted.  So it
seems to occur in both AUCTeX and Emac's latex-mode.

> Are you able to use dired-mode? Can you position in dired-mode the  
> cursor on some file and then press ! followed by
> 	which latex RET
> Two lines will be reported in *Shell Command Output*:
> 	/usr/texbin/latex
> 	file.whatsoever: Command not found.
> I'm not using MacTeX, so the first line can be wrong. The main  
> question is: is the first line same as from a shell when you invoke  
> 'which latex'?

"!which latex RET" in dired-mode yields the same path as when the command "which" is
run in the shell.  On my system that is /opt/local/bin/latex which is the standard
location used by the Macports collection.

> >
> > I have explicitly set (setenv "TEXINPUTS" ".:/paths/") in my .emacs  
> > (and my
> > .profile).

> If your using this statement in both files, then at least in  
> ~/.profile it's nonsense, because of wrong syntax. 

Sorry if this was unclear.  The declaration in my .profile uses the corresponding 
correct syntax.

> It's not that  
> useful anyway, because the important variable is TEXMF. *When* the  
> right binary is found, then no such TeX related variable needs to be  
> set, it's all built-in! And such setting can disable TeX.
> The final problem is that Carbon Emacs is no UNIX binary, it's a Mac  
> OS X application which is not launched with the help of an auxiliary  
> shell. So Carbon Emacs, as all other Carbon and Cocoa applications,  
> does not initiate its process environment from the shell related dot  
> RC files. http://developer.apple.com/qa/qa2001/qa1067.html explains  
> this a bit. You can find more details on the internet – and in the  
> Carbon Emacs Wiki: http://www.emacswiki.org/cgi-bin/emacs-en/ 
> CarbonEmacsPackage. My advice is to remove the TEXINPUTS settings and  
> make sure Carbon Emacs knows the PATH to latex!

I'm not actually using Carbon Emacs; I'm using the standard GNU Emacs 
through a terminal application (iTerm).  The Emacs I'm running seems to know about
environmental variables set in my bash .profile.

I removed the TEXINPUTS setting from both my .profile, and my .emacs.  LaTeX now
seems to be working as it should in both Emacs latex-mode and AUCTeX.

Thanks again,


> Shells can learn from ~/.MacOSX/environment.plist:
> 	export PATH=$(defaults read "${HOME}/.MacOSX/environment" PATH)
> 	MANPATH=$(defaults read "${HOME}/.MacOSX/environment" MANPATH)
> 	export MANPATH
> 	set path=(`defaults read ~/.MacOSX/environment PATH | tr ':' ' '`)
> 	setenv MANPATH   `defaults read ~/.MacOSX/environment MANPATH`
> --
> Greetings
>    Pete
> Encryption, n.: A powerful algorithmic encoding technique
> 		employed in the creation of computer manuals.

More information about the MacOSX-Emacs mailing list