1

New to LaTeX, running Mountain Lion on Mac. I have seen plenty of posts which all suggest that to use packages, they should be included in the ~/Library/texmf/tex/latex/ folder, such as on this question: Installing new style packages on a Mac

However, I have been using various packages and they've been working fine, such as natbib and the apalike style, even though I didn't have a texmf folder until just a moment ago when I created it. My bibliography was working, but as far as I can tell, I didn't have the apalike style on my Mac anywhere (including hidden files), so it shouldn't have been?

Firstly, how can LaTeX use natbib's apalike style if, apparently, it's not on my Mac?

Secondly, how can I go about locating, and editing, whichever apalike style I'm actually using?

I'm struggling a little with some of the logic around LaTeX, like its use of a style file which is apparently not on my Mac.

Edit: The reason this is bugging me is because I'd actually like to edit the apalike style, but all of the instructional guides I can find talk about editing the existing file (which also makes more sense than a newbie like me trying to write it from scratch).

6
  • 5
    In TeXLive, it's probably installed by default in which case it'd be somewhere in /usr/local/texlive. kpsewhich will tell you exactly where. – You Oct 14 '13 at 12:00
  • 1
    If you installed MacTeX (which you probably did) you definitely have it. To clarify how to use kpsewhich, open a Terminal session and type kpsewhich apalike.bst. On a 2013 MacTeX system it should return /usr/local/texlive/2013/texmf-dist/bibtex/bst/base/apalike.bst. – Alan Munn Oct 14 '13 at 12:15
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. That said, please don't just alter apalike.bst — this directly compromises document portability. (That is, if you share your document with someone else, it will compile differently on their system.) Instead, make a copy of it, such as myapalike.bst (or whatever the steps are to make a new BibTeX style), and work from there, distributing this bst with the document. – Sean Allred Oct 14 '13 at 14:31
  • @You & Alan Munn: thanks for that, it appears I did have it, but it was some years ago I was using Terminal so forgot how to find it. – Pwdr Oct 14 '13 at 14:49
  • @ Sean: thanks, I actually created the texmf folders in my Library, and added apalike-url.bst which I found online. I edited that, then thanks to your post I renamed it to avoid future confusion. – Pwdr Oct 14 '13 at 14:50
3

TeX Live (including MacTeX) uses several distinct hierarchies of files ('texmf trees'). The contents of the trees is managed and searched differently.

Although this can be customised differently, the chances are that you are using the default. In that case, the main 3 trees you have to think about will be the following.

  • The main distribution tree installed and updated by MacTeX/TeX Live Utility, usually at /usr/local/texlive/YYYY/texmf-dist/ where YYYY is the year of the version of TeX Live you are using e.g. 2015.

    • You should not alter the contents of the files in this tree. Nor should you add or remove files manually.
    • The tree is managed by the tools provided to administer your installation of TeX. (TeX Live Utility or tlmgr etc.)
  • The local tree which contains files installed locally and available to all users of the system, usually at /usr/local/texlive/texmf-local/.

    • This is probably best used for packages you download because TeX Live doesn't provide them, especially if you want them to be available for a while and generally or don't want to accidentally edit them, for example.
    • When you install packages here, you need to update the file name database so that TeX can find them.
  • Your personal tree which contains files you install or write for your personal use, at ~/Library/texmf/ in your case.

    • This is best used for cases where you make a renamed copy of a file to edit it or create your own files.
    • The exception would be if you install a font package, when it would be better to use the local tree even for your own idiosyncratic creations. However, you don't need to worry about this if you are new to LaTeX because the creation of custom font packages is not something you are likely to tackle any time soon ;).

The styles you have been using are not in your personal tree because they are supplied by your TeX distribution and installed into the main, distribution tree.

To discover the location of a file or to determine which file TeX is using:

kpsewhich <filename>.<extension>

For example, on my system

kpsewhich apalike.bst

returns

/usr/local/texlive/2015/texmf-dist/bibtex/bst/base/apalike.bst

which shows the file is in the main, distribution tree, whereas

kpsewhich splncs03.bst 

returns

/home/<username>/texmf/bibtex/bst/journals/llncs2e/splncs03.bst

where <username> is my user name, which shows that the file is in my personal tree.

To discover the location of a tree, you can ask kpsewhich for the value of the relevant variable.

For example,

kpsewhich -var TEXMFDIST ; kpsewhich -var TEXMFLOCAL ; kpsewhich -var TEXMFHOME  

returns

/usr/local/texlive/2015/texmf-dist
/usr/local/texlive/texmf-local
/home/<username>/texmf

on my system. On yours, the final result will presumably give something equivalent to ~/Library/texmf.

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.