pdflatex environment

88 views
Skip to first unread message

wishi

unread,
Jul 31, 2008, 5:10:31 AM7/31/08
to vim...@googlegroups.com
Hi!

I'm trying to write some longer pdfs with LaTeX. Jumping to the terminal
every time is quite painful... so I thought to install Vim-LaTeX
(http://www.vim.org/scripts/script.php?script_id=475) for convenience
reasons. Just clicking in the Menubar... choosing "Compile", "View".
That's what I thought to have. If I have to do without auctex.

A click - nothing happens. Therefore I called pdflatex (for pdf)
manually: !pdflatex %.

I get: zsh - command not found pdflatex. Shell returned 127.

Nevertheless pdflatex is exported to the Path. While searching through
this list I didn't find an answer... Does anybody know what's going
wrong here?

Thanks,
Marius

p.s.: there really isn't anything like auctex, isn't it *g*?

Nico Weber

unread,
Jul 31, 2008, 5:29:19 AM7/31/08
to vim...@googlegroups.com
Hi,

On 31.07.2008, at 11:10, wishi wrote:

> A click - nothing happens. Therefore I called pdflatex (for pdf)
> manually: !pdflatex %.
>
> I get: zsh - command not found pdflatex. Shell returned 127.

try checking "Start vim processes in a shell" in the Preferences. Does
that help?

Nico

Ben Schmidt

unread,
Jul 31, 2008, 5:32:37 AM7/31/08
to vim...@googlegroups.com
wishi wrote:
> Hi!
>
> I'm trying to write some longer pdfs with LaTeX. Jumping to the terminal
> every time is quite painful... so I thought to install Vim-LaTeX
> (http://www.vim.org/scripts/script.php?script_id=475) for convenience
> reasons. Just clicking in the Menubar... choosing "Compile", "View".
> That's what I thought to have. If I have to do without auctex.
>
> A click - nothing happens. Therefore I called pdflatex (for pdf)
> manually: !pdflatex %.
>
> I get: zsh - command not found pdflatex. Shell returned 127.
>
> Nevertheless pdflatex is exported to the Path. While searching through
> this list I didn't find an answer... Does anybody know what's going
> wrong here?

Are you using Vim in a terminal or MacVim? If MacVim, do you have the
"Launch Vim processes in a login shell" preference enabled? How do you
start Vim/MacVim?

What does :echo $PATH give you within Vim? What about :!echo $PATH?

Ben.


valrus

unread,
Aug 3, 2008, 11:13:49 AM8/3/08
to vim_mac
What worked for me on two different machines was adding the line

let $PATH = $PATH.":/usr/texbin"

to my .vimrc.

Of course, this depends where your latex stuff is. Vim seems to ignore
the path you have set in whatever shell you're using.

wishi

unread,
Aug 3, 2008, 12:58:02 PM8/3/08
to vim...@googlegroups.com
Ben Schmidt schrieb:

I enabled this option. Nevertheless it's not reflected by $PATH. I use
zsh - a custom shell ;).
Is there any option to add /Library/TeX/Root/bin/i386-darwin/pdflatex
(the common path for MacTex) in the .vimrc to get the TeX stuff working?
Or do I have to alias this in the vimrc completely?

Thanks for the help!

Marius

wishi

unread,
Aug 11, 2008, 11:49:18 AM8/11/08
to vim...@googlegroups.com
valrus schrieb:

Hmmh, that doesn't help :(

I think the problem it, that MacVim as a Cocoa app forks vim in its
backend through /bin/sh - which is a shell without the customised
environment variables (here). Maybe wrong... just my idea of inheritance.

vim itself, called via Terminal, does everything. Only MacVim completely
fails. Could have been a handy GUI, but without functions it's not very
useful - I assume.

Something like

#export LaTeX
export PATH=/Library/TeX/Root/bin/i386-darwin:$PATH

could be helpful in the general ~/.vimrc.

Because if you don't click als call pdflatex with ! - it works fine.
Just an environment problem.

Any idea how to solve it that way? A script maybe to call MacVim
directly out of the bash/zsh/whatever - without "open", because open
generates a new father-process...

Thanks,
Marius

David Morel

unread,
Aug 11, 2008, 1:28:19 PM8/11/08
to vim...@googlegroups.com
Le 11 août 08 à 17:49, wishi <bro...@gmx.net> a écrit :

>
> valrus schrieb:
>> What worked for me on two different machines was adding the line
>>
>> let $PATH = $PATH.":/usr/texbin"
>>
>> to my .vimrc.
>>
>> Of course, this depends where your latex stuff is. Vim seems to
>> ignore
>> the path you have set in whatever shell you're using.
>>>
>
> Hmmh, that doesn't help :(
>
> I think the problem it, that MacVim as a Cocoa app forks vim in its
> backend through /bin/sh - which is a shell without the customised
> environment variables (here). Maybe wrong... just my idea of
> inheritance

maybe you should check where you define those. bash sources its
various RC files differently wether it is an interactive shell or not.
putting stuff in .bashrc or .bash_profile is not the same...

David

Ted Pavlic

unread,
Aug 11, 2008, 2:18:16 PM8/11/08
to vim_mac
> I enabled this option. Nevertheless it's not reflected by $PATH. I use
> zsh - a custom shell ;).

See

:help macvim-preferences

As documented, you can use:

defaults write org.vim.MacVim MMLoginShellCommand /bin/zsh

That should let you use zsh. I just tested it, and that causes MacVim to
use the path in my ~/.zlogin.

> Is there any option to add /Library/TeX/Root/bin/i386-darwin/pdflatex
> (the common path for MacTex) in the .vimrc to get the TeX stuff working?
> Or do I have to alias this in the vimrc completely?

What's wrong with /usr/texbin, the proper path?

(/usr/texbin should get linked to the proper distribution)

--Ted


--
Ted Pavlic <t...@tedpavlic.com>

Ted Pavlic

unread,
Aug 11, 2008, 2:20:27 PM8/11/08
to vim_mac
NOTE: For more information about making Vim-LaTeX play nicely with Vim
on a Mac, see:

http://phaseportrait.blogspot.com/search/label/VIM-LaTeX

--Ted

Ben Schmidt

unread,
Aug 12, 2008, 8:08:11 AM8/12/08
to vim...@googlegroups.com
> I think the problem it, that MacVim as a Cocoa app forks vim in its
> backend through /bin/sh - which is a shell without the customised
> environment variables (here). Maybe wrong... just my idea of inheritance.

This problem is well known and a fair amount of effort has gone into
fixing it, so if your configuration files are set up and you enable
MacVim's 'Launch vim processes in a login shell' option, it should work.
Details:

If you don't have 'Launch vim processes in a login shell' turned on,
MacVim will launch Vim directly, and thus inherit the environment of
LoginWindow (~/.MacOSX/Environment.plist or something like that; you can
set things there if you like; Google it to check exactly how).

If you do have that option turned on (which is the best way to get the
behaviour you want), MacVim will launch Vim using your selected shell
($SHELL) as a login shell (prepending '-' to argv0). I tested this with
at least bash, zsh, tcsh to make sure it works, so I'm sure it does, at
least with those. You can also set MMLoginShellArgument if necessary for
your shell (automatically done for bash). See the end of :help
macvim-preferences for details.

In addition to this, though, you must set your environment in the proper
configuration file for your shell. For bash this tends to mean
~/.profile not ~/.bashrc. But it can get complicated. Check your shell
manual for details. The shell that is started is a login shell, but a
non-interactive one.

> export PATH=/Library/TeX/Root/bin/i386-darwin:$PATH
>
> could be helpful in the general ~/.vimrc.

It is not a good idea to put this in MacVim's vimrc. But you can put it
in your own as something like

let $PATH="/Library/TeX/Root/bin/i386-darwin:".$PATH

Ben.


wishi

unread,
Aug 12, 2008, 8:39:40 AM8/12/08
to vim...@googlegroups.com
Ted Pavlic schrieb:

>> I enabled this option. Nevertheless it's not reflected by $PATH. I use
>> zsh - a custom shell ;).
>
> See
>
> :help macvim-preferences
>
> As documented, you can use:
>
> defaults write org.vim.MacVim MMLoginShellCommand /bin/zsh
>

Wow... you're my LaTeX-MacVim-saver :). I must have overlooked that one
especially. Thanks a lot.

Greetings,
wishi

Nico Weber

unread,
Aug 12, 2008, 8:50:50 AM8/12/08
to vim...@googlegroups.com
On 12.08.2008, at 14:08, Ben Schmidt wrote:

>
>> I think the problem it, that MacVim as a Cocoa app forks vim in its
>> backend through /bin/sh - which is a shell without the customised
>> environment variables (here). Maybe wrong... just my idea of
>> inheritance.
>
> This problem is well known and a fair amount of effort has gone into
> fixing it, so if your configuration files are set up and you enable
> MacVim's 'Launch vim processes in a login shell' option, it should
> work.

You and me both suggested that at the start of this thread; it seems
to not have worked ( http://groups.google.com/group/vim_mac/browse_thread/thread/64ddfcafed3f9795
).

>
wishi needed to set MMLoginShellCommand explicitly (perhaps he didn't
set his default shell correctly? wishi, how did you change your shell?
`chsh`?)

Nico

Reply all
Reply to author
Forward
0 new messages