I'm on Windows 7, running GNU Emacs 24.4.1, and I have also installed Cygwin and I am trying to use Cygwin as the shell in Emacs. I followed the answer here:


And have this in my init-file

(setq shell-file-name "C:/cygwin64/bin/bash")
(setq explicit-shell-file-name shell-file-name)
(setenv "PATH"
(concat "~/bin:/usr/local/bin:/usr/bin:"
    (replace-regexp-in-string " " "\\\\ "
        (replace-regexp-in-string "\\\\" "/"
            (replace-regexp-in-string "\\([A-Za-z]\\):" "/\\1"
                (getenv "PATH"))))))

When I try to compile on Latex, I get this error: "ERROR: LaTeX Error: File `fullpage.sty' not found."

Disabling cygwin in my init file fixes the problem. I feel like enabling Cygwin might mess up Emacs with path names, so it can't find the fullpage.sty and other Latex packages. Anyone ideas on how to fix this?

  • 1
    Is this an Emacs problem or a Cygwin problem? It sounds more like the latter, and if so, we could migrate this to Stack Overflow. – Dan Apr 27 '15 at 20:24
  • I think this is an Emacs problem with how my Emacs is setup to incorporate Cygwin. – bkmoney Apr 27 '15 at 20:30
  • First of all, your problem is that you are trivially missing a LaTeX package (*.sty files are the LaTeX package files, well, in the first approximation). Either download it from ctan.org/pkg/fullpage or use Cigwin to locate the package and install it using Cygwin (I bet the later will be easier, but you might as well do the former to get acquainted with the way LaTeX packages are installed.) – wvxvw Apr 27 '15 at 20:30
  • @wvxvw When I remove the Cygwin part from my .emacs file, there is no error and it can build the Latex file fine, so I'm pretty sure I have the necessary .sty files – bkmoney Apr 27 '15 at 20:31
  • There could be more than one explanation to it: you have installed TeXLive from Cygwin repository and now you are dealing with a different LaTeX setup. Or, LaTeX itself had been installed for Windows, and doesn't know where to find its parts, if run from a *nix shell. I'm not sure if you can set up a Windows version of LaTeX to be able to locate files when run from a *nix shell. I'd rather look at the tex.stackexchange.com for the answer to that. – wvxvw Apr 27 '15 at 20:36

The problem is that .bashrc is only loaded in interactive mode. Doing a C-c C-b to compile in latex mode executes a shell-command, which is by default non interactive. If you add these lines to your emacs init file:

(setq shell-file-name "bash")
(setq shell-command-switch "-ic")

Now any shell-commands will be run interactively. Also as a side note maybe people should enable this anyways because it allows you to use your bashrc aliases when executing shell-command.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.