Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install a LaTeX .sty file on OSX?

Tags:

macos

latex

I have a LaTeX project set up:

tex/
  - documents/
      - some_file.tex
  - support/
      - todonotes.sty

where some_file.tex uses todonotes:

\usepackage[colorinlistoftodos,textwidth=0.9\marginparwidth]{todonotes}

But I get "LaTeX Error: File `todonotes.sty' not found" when I try to build the PDF in TextMate. How do I tell LaTex or TextMate about my .sty file?

Later

To be specific, I'm using tetex from MacPorts, though given the answers so far, I might try another distribution.

like image 290
James A. Rosen Avatar asked Sep 07 '09 20:09

James A. Rosen


People also ask

How do I install LaTeX packages on Mac?

To install LaTeX applications on your Mac: Visit http://tug.org/mactex/ and click on the MacTex Download link, the on the MacTeX. pkg link to download the installer (if prompted, click Keep). The file is quite large (~4 GB), so be prepared to wait a bit while it downloads.

How do I use .STY files?

sty ) into your document in two ways: If you have it in your path or in the same folder as the . tex file, simply include this line in your preamble: \usepackage{mystyle} If you have it in a different folder, you can access using its full path as \usepackage{/path/to/folder/mystyle}

What is .STY file in LaTeX?

sty files are loaded by LATEX to provide and improve methods that are used to create documents. Generally speaking, class files implement the specific structure of the document, whereas packages are used to provide either generic functionality to any document, or to 'style' the methods provided by a specific class.


4 Answers

In Mac OS X (Snow Leopard 10.6.7) put your .sty file in

/usr/local/texlive/2010basic/texmf-dist/tex/latex/base/

Then, run texhash command. Don't forget to stay as a root user (like sudo -s )

like image 172
felix marin Avatar answered Oct 18 '22 23:10

felix marin


Or you can just put the style file in the same directory as your document instead of in "support." now... if you're on OS X, you should probably be using texlive 2008. If you are using texlive 2008, pop open a terminal and type:

sudo tlmgr install todonotes

replace "todonotes" with the package name you want to install.

like image 32
Mica Avatar answered Oct 18 '22 21:10

Mica


You can put style files in ~/texmf/tex/ and standard LaTeX distributions should find them. If you prefer to install them system-wide, you can put them in the corresponding texmf/tex folder within your LaTeX installation (the location of this installation on OS X varies depending on which LaTeX distribution you used).

You can use tlmgr conf at the command line to list all of the distribution configuration information. The TEXMFHOME variable gives the path to your texmf tree.

like image 12
Barry Wark Avatar answered Oct 18 '22 23:10

Barry Wark


As said before just put the custom .sty into ~/texmf/tex or in /usr/share/texmf-texlive/tex/ but don’t forget to run mktexlsr or texhash to update the local package database of LaTeX. Otherwise LaTeX won’t find it at all, unless it is in the same directory of the processed file.

like image 4
Frakturfreak Avatar answered Oct 18 '22 22:10

Frakturfreak