Combined as one! Emacs and LaTeX! Together at last! Here’s everything you need in one place to compile, preview and edit LaTeX files in Emacs, and view the generated PDF.
To get LaTeX on Linux, install something called “Tex Live” from this webpage: http://www.tug.org/texlive/acquire-netinstall.html Download the tarball called
install-tl-unx.tar.gz and unpack it!
Install. But first, are you root?
Now that you’ve unpacked your tarball with
tar -xvf install-tl-unx.tar.gz, you have to enter the folder and begin the installation.
Then a very long series of statements go by as the pre-intallation set up will occur. You’ll see this: Enter command: Type in “i” so it looks like this
Enter command: i and press ENTER.
Then, Tex Live should download its files off the internet (WARNING: This takes hours upon hours) and install.
However, this ERROR may happen:
1 2 3
Its not installing it because you’re not established as “Root”. But seriously, “Goodbye”?!
You can either try
sudo ./install-tl or switch to your root account with the command
sudo -i It’ll probably make your life easier to just use sudo before the installation command.
Welcome to TexLive! Now add MANPATHS!
1 2 3 4 5 6 7 8
I had no idea what this meant at first. I used the command
sudo emacs /etc/environment to get to the MANPATH and INFOPATH. Make sure its spelled etc and not ect. The only listing I had there was this jumble: PATH=“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games”
To make the Tex executables work, I had to add /usr/local/texlive/2009/bin/x86_64-linux to the path like so, with a colon separatating the new addition from the rest. Look for “/usr/local/sbin” to make sure you’ve installed it in front correctly.
Add the two new lines under it so your /etc/environment looks like this:
1 2 3
Now you can get started with getting Emacs to harness the power of LaTeX. Open up a terminal, and use the following command:
sudo apt-get install auctex preview-latex
After it installs, go to your .emacs file with the command
Make sure these lines are at the very end of your .emacs file!
1 2 3
The “require ‘tex-site” is what will activate AucTex. Feel free to add a few more hooks to your .emacs file to improve your Emacs/LaTeX use.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Where is it?
Open up a .tex file. If you want a test file, use the command
C-x C-f test.tex You will see a cute little lion icon with the words “Latex” next to it, and a glasses icon with “View” next to it.
The default preview mode is DVI. You can toggle between DVI and PDF mode with the command in emacs:
Ctr-c-t-p, meaning you press on the control button with your pinky and type the three letters “c, t, p” Finally, to view your compiled DVI/PDF, use the command