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).
Best Answer
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/
whereYYYY
is the year of the version of TeX Live you are using e.g.2015
.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/
.Your personal tree which contains files you install or write for your personal use, at
~/Library/texmf/
in your case.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:
For example, on my system
returns
which shows the file is in the main, distribution tree, whereas
returns
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,
returns
on my system. On yours, the final result will presumably give something equivalent to
~/Library/texmf
.