LaTeX From Command Line

Discussion in 'Mac Programming' started by gravity black, Nov 16, 2011.

  1. gravity black macrumors newbie

    Joined:
    Oct 18, 2011
    #1
    Hi all,

    I've been using LaTeX for a while now with the TeXShop program, but lately I've been doing a lot of programming work and have started to really enjoy using the Emacs editor, so I thought I'd try to start writing my LaTeX documents in it. What I want to do is be able to open terminal, write the documents in LaTeX, and then typeset them in pdf format (ideally opening up a preview window with the document at the same time), all from the command line. However, after writing the document, when I try the command:

    Code:
    latex document.tex
    ..., I get the error:

    Code:
    -bash: latex: command not found
    I've done some research, and it seems that it's not sourcing my path right or something, because again I think I have all the proper commands in the /usr/texbin directory. However, I'm pretty new to this, and while I've changed some path variables successfully in the past, I'm often unable to replicate that success.

    So far, I've added '/usr/texbin' to /etc/paths, and I've added the file 'TeX' with the one line of '/usr/texbin' to /etc/paths.d, but neither of these things did anything.

    I would like to get the 'latex' command to work right, but if possible I would like to understand where the commands are coming from, where I should go each time to check the path variables, etc., so that I have some understanding of what's going on. (I'd be happy to problem fixed, but happier if I could learn something in the process.)

    Thanks in advance!
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    I've not used the /etc/paths file or the /etc/paths.d directory under Mac OS X. I didn't know they existed.

    Under Mac OS X I've just created a .bash_profile file under my home directory with something like this.
    Code:
    export PATH=/usr/texbin:$PATH
    
     
  3. gravity black thread starter macrumors newbie

    Joined:
    Oct 18, 2011
  4. Sander macrumors 6502

    Joined:
    Apr 24, 2008
    #4
    NB: You may need to set some paths for LaTeX itself as well, so it can find all its .cls files, format files etc.
     

Share This Page