60

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.

1
  • 1
    sorry I didn't see you were using tetex. Its probably pretty old... check out MacTeX, its quite nice, and the package manager is pretty good.
    – Mica
    Sep 10, 2009 at 18:33

7 Answers 7

56

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 )

4
  • how do I see /usr/local... I could not find it
    – Aku
    Jan 6, 2012 at 2:28
  • 1
    Or type Cmd-Shift-G in Finder to open the "Go to path" menu May 2, 2012 at 18:59
  • 4
    @Aku: You may not actually have that particular directory. For example, mine is "/usr/local/texlive/2012/texmf-dist/tex/latex/base/". Try looking through those folders on the command line (e.g. using the Terminal app as Mikey suggested), but be prepared for the exact folder to not match exactly -- especially the directory underneath "/usr/local/texlive/".
    – jvriesem
    Jun 12, 2013 at 17:39
  • 2
    Correct directory for me was /usr/local/texlive/2014/texmf-dist/tex/latex/base/.
    – James M
    Nov 24, 2014 at 17:15
40

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.

2
  • 3
    And the nicest way to install TeXLive 2008 on Mac OS X is MacTeX: tug.org/mactex MacTeX includes the TeX Live Utility, which is a native Mac OS X graphical interface for tlmgr.
    – las3rjock
    Sep 9, 2009 at 2:27
  • 1
    or if you have perl/tk installed, in the terminal type: sudo tlmgr --gui
    – Mica
    Sep 9, 2009 at 16:12
12

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.

4
  • 17
    ~/Library/texmf/tex/latex/ is the place to put it in MacTeX. Sep 8, 2009 at 0:43
  • Thanks, Will. The inconsistency in texmf, especially on the Mac, is a bummer. The ~/texmf/... works for Unix-y installations (like from Fink or MacPorts), so thanks for adding info about MacTeX.
    – Barry Wark
    Sep 8, 2009 at 15:45
  • 2
    Yes, tlmgr conf. I'll edit the answer to include that info.
    – Barry Wark
    Feb 5, 2010 at 1:18
  • 2
    Just by way of making this more up to date. As of at least MacTex 2011 ~/texmf will work just fine. Mar 19, 2012 at 1:34
4

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.

1
  • 1
    Thanks for the tip, @Frakturfreak! May be clear to every one, but any problems with writing permissions, just run with sudo mktexlsr.
    – Rubens
    Apr 2, 2013 at 15:13
1

I had this issue using BasicTex 2015 and none of the above solved it, so I wrote up a solution here

In short: sudo tlmgr install preprint will fix it and kpsewhich fullpage.sty will confirm the fix

0

This page on LaTeX packages says you'll need to install the .sty file in the LaTeX installation directory (my installation of Ubuntu seems to be /usr/share/texmf-texlive/tex/latex/), or you need to have a copy of the .sty file in each file containing LaTeX source -- i.e. in your tex/documents folder, at the very least.

-6

I tried this one it is works for me:

sudo apt-get install texlive-full.

1
  • On the whole this is not an answer for OSX, more likely for Ubuntu or some other Debian-based Linux distro.
    – Tom Bush
    Aug 24, 2022 at 1:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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