1

I am trying to find the apacite.bst file in my document in order to create a modified copy of it and thus be able to change my bibliography style (according to the description in the comments of the following link: How to change the apacite bibliography style to list all authors ). My initial issue is the same as the one described in the link, since I would like to list all authors in the bibliography. However, I am total LaTeX beginner and really confused about where to find the apacite.bst file...

Alan Munn
  • 218,180
stefan.0s
  • 21
  • 1
  • 4
  • 1
    Run kpsewhich the apacite.bst in terminal, and you will get the full path to file apacite.bst. – muzimuzhi Z Jul 13 '20 at 15:54
  • 1
    Or, you can compile a file using apacite bib style, and then search for apacite.bst in the corresponding .log file. This gives you the full path to apacite.bst as well. – muzimuzhi Z Jul 13 '20 at 15:57

2 Answers2

6

With a local TeX distribution

If you have a TeX distribution on your computer, the easiest way to find the location of a file in your distribution is to use the command line command kpsewhich. Open a Terminal window (or equivalent) and type:

kpsewhich apacite.bst

This should return the full path of the copy of apacite.bst which TeX will load. If you don't have a local copy this should be something like (on TeXLive).

/usr/local/texlive/2020/texmf-dist/bibtex/bst/apacite/apacite.bst

You can then open the file in an editor and save a copy in your local texmf folder or in your document folder (if you need this for only one document or are working on Overleaf). You should always rename modified files so that the original will not be overridden, since a local copy of the same name will always take precedence over the distribution installed version.

If using Overleaf

If you are using Overleaf, you need to use a different method for getting the relevant file. The method relies on the fact that your Overleaf project runs latex on a virtual machine, and therefore you can get it copy files to your project folder using the shell escape commands within your source file. Because of the way the file structure works it's still a little convoluted, but it works quite well.

Getting the file into Overleaf

In an existing project or a new project, simply add the following line before the \begin{document} line:

\immediate\write18{cp `kpsewhich apacite.bst` .}

What this does is tells the shell to copy the apacite.bst file that is being used by Overleaf into your project folder. You only need to compile with this line once; after it runs you can delete it from your source file altogether.

What this command does is copies apacite.bst to your project folder. It will appear in the list of "Other Files and Logs" as in the following image:

overleaf list of aux files

Adding the file to your project so that you can edit it

If you choose this file from the dropdown menu, you will be able to download it to your computer. You can then re-upload it to your project on Overleaf to edit it. It's still better to rename it to something else. There's no way to directly copy it to your project folder due to the way Overleaf organizes files.

Once you've done this, delete the Cache files.

You can now use your modified copy of the .bst file with your Overleaf project.

Thanks to 'yo of Overleaf support for suggesting the direct copying approach.

Warning:

This method is safe to use with Overleaf since everything runs in a virtual machine. It's not a good idea to use \write18 like this if you are using a local distribution; you should just make a copy as described in the first part of the answer.

Alan Munn
  • 218,180
  • Thank you for the answer Alan, since I am using Overleaf, it is apparently not possible to get the apacite.bst file, if I got it right? – stefan.0s Jul 13 '20 at 19:59
  • @stefan.0s Yes it is possible. That's what the second part of my answer says. So download a copy from the link I show, and then upload it with a new name (e.g. myapalike.bst ) to your project folder, and then use \bibliographystyle{myapalike}. What you can't do in Overleaf is retrieve the files it uses from Overleaf directly. – Alan Munn Jul 13 '20 at 20:07
  • I understood that, but then I will get another citation style than I used before (since I used apacite not apalike) – stefan.0s Jul 13 '20 at 20:32
  • @stefan.0s Sorry I misread your question, but the principle is exactly the same. I'll change the link. – Alan Munn Jul 13 '20 at 20:40
  • 1
    @stefan.0s Actually because of the way apacite is distributed on CTAN, it's not trivial to get the .bst file. It will take a bit of time to update the answer appropriately. – Alan Munn Jul 13 '20 at 20:46
  • Thanks a lot for the help, I have just found the content of the apacite.bst file and copied it into my file! – stefan.0s Jul 13 '20 at 21:04
0

As an aside that might be helpful to others in the future (since I couldn't find the exact solution)

I came to this link with a similar issue, I was trying to remove doi: from doi: https://doi.org/10.0000/XX-10-1000-1000 in the output pdf, so that it would appear as https://doi.org/10.0000/XX-10-1000-1000 (just the URL) in Latex using Overleaf.

I followed the instructions @AlanMunn had, and modified line 3894 of apacite.bst from

\doi{" doi * "}" *

to

\doi{" doi "}" *

By getting rid of the asterisk within the most inner quotations, I was able to get rid of the doi: in my output file. (But this also offset some of the output which was undesirable).

Eventually, I simply added, in my agujournal2019.cls file, after line 1091:

\bibliographystyle{apacite}
\renewcommand{\doiprefix}{} 

This solved the problem. (Other references: doi hyperlinks show up as "doi:doi" in my references)

Thanks Alan for the helpful instructions.

Thruston
  • 42,268