3

How do I separate author names with "/" (slash) instead of commas using natbib (in LaTeX)? My question relates to citation (in footnotes) as well as the bibliography. Do I have to configure this in \setcitestyle or \bibpunct?

An example for comprehension: as is now:

Lastname1, Lastname2, and Lastname3 (Year), p. X-Y

as it should be:

Lastname1 / Lastname2 / Lastname3 (Year), p. X-Y

% Begin preamble
\documentclass[12pt, a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[english, german]{babel}
\usepackage[textwidth = 160mm, top = 25mm, bottom = 20mm]{geometry}
\usepackage[round]{natbib}
\bibliographystyle{abbrvnat}


\title{Some Thesis}
\author{Onyx}
\date{March 2019}
% End preamble 
\begin{document}
%\tableofcontents
\begin{titlepage}
\maketitle
\end{titlepage}
% Plots the preamble
%\citep or \citet* for citation


\input{chapters/abstract}

\bibliographystyle{plainnat}
\bibliography{sources}

\end{document}
  • AFAIK this is something that the bibliography style you use controls. It is possible that there is a simple way to customise this by redefining a macro, but for most styles you would have to edit the .bst file directly. With biblatex that would be easier. Which style do you use? Can you show us an MWE of the status quo (tex.meta.stackexchange.com/q/228/35864, tex.meta.stackexchange.com/q/4407/35864)? – moewe Mar 21 '19 at 10:47
  • I've added the MWE. As you can see I'm right in the beginning of writing my thesis... Currently bibliographystyle is plainnat. I'll try to stick with natbib as my supervisor recommended using it. How much effort is it for a beginner to edit the .bst file? – Onyx Mar 21 '19 at 11:12
  • .bst files have their own language that is nothing like TeX or LaTeX. It is some sort of stack-based reverse Polish notation, which can be quite daunting for beginners at first (and not only for beginners, I've played around with it for years, but I still can't get most things right on a first attempt). biblatex as suggested in the answer is usually much easier to handle due to its LaTeX-like syntax. It is also more flexible. – moewe Mar 21 '19 at 11:15
  • Would you then recommend using biblatex? Is there a simple solution then? – Onyx Mar 21 '19 at 11:18
  • Yes, in general I recommend biblatex (though I might be biased). The only reason to stick to BibTeX in my opinion are external requirements (e.g. a publisher/journal provides a template with a ready-made style, or a supervisor forces you to use natbib, your university wants you to use a particular .bst file). There would be an easy solution to the question (the answer below shows one). The output you get with biblatex will not be exactly the same you get with natbib's plainnat, but most things can be customised if you want them to look different. – moewe Mar 21 '19 at 11:21
2

If you want to use the / ("slash") symbol as the name divider that's in use in the formatted bibliography, I suggest you proceed as follows:

  • Locate the file plainnat.bst in your TeX distribution. Make a copy of this file and call the copy, say, plainnat-slash.bst.

  • Open the file plainnat-slash.bst in a text editor. The editor you employ to edit your tex files will do fine.

  • In the file plainnat-slash.bst, locate the function format.names. (In my copy of this file, the function starts on line 216.)

  • In the function format.names, change the line

               { ", " * t * }
    

    to

               { "\slash " * t * }
    

    Next, change the line

                  { "," * }
    

    to

                  { "\slash " * }
    

    You may be wondering why I don't suggest changing the line to

                 { "/" * }
    

    The reason is that line breaks are allowed after \slash but not after /.

    Finally, change the lines

                   { " et~al." * }
                   { " and " * t * }
    

    to

                   { "et~al." * }
                   { "" * t * }
    
  • Save the file plainnat-slash.bst either in the foldere where your main tex files are located or in a directory that's searched by your TeX distribution. If you choose the latter option, be sure to update the filename database of your TeX distribution suitably.

  • In your main tex file, change the instruction

    \bibliographystyle{plainnat}
    

    to

    \bibliographystyle{plainnat-slash}
    

    While you're at it, you should also delete the line

    \bibliographystyle{abbrvnat}
    
  • Be sure to rerun LaTeX, BibTeX, and LaTeX twice more after the changing the argument of \bibliographystyle.

Happy BibTeXing!

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{sources.bib}
@misc{lll,  
    author = "First1 M1. Last1 and First2 M2. Last2 and First3 M3. Last3",
    title  = "Thoughts",
    year   = 2019,
}
\end{filecontents}

\documentclass[12pt, a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[english, german]{babel}
\usepackage[textwidth = 160mm, top = 25mm, bottom = 20mm]{geometry}
\usepackage[round]{natbib}
%\bibliographystyle{abbrvnat} % Never allow more than one \bibliographystyle directive
\bibliographystyle{plainnat-slash}

\begin{document}
\citet{lll}
\bibliography{sourcesx}
\end{document}
| improve this answer | |
  • This seems to be extremely useful. Thanks Mico. I work with my university ShareLatex editor. Is it possible to edit TeX distribution for sharelatex? – Onyx Mar 21 '19 at 12:55
  • @Onyx - The whole point of finding the file plainnat.bst and making a copy (suggested name: plainnat-slash.bst) is so that there is no need to edit the TeX distribution. If, for some reason, you cannot locate the file in your TeX distribution, you can obtain a copy from the CTAN, viz., tug.ctan.org/tex-archive/macros/latex/contrib/natbib/…. – Mico Mar 21 '19 at 13:36
  • excuse my lack of knowledege in this matter, but ShareLatex is clearly a cloud service, so i did not download anything... I just don't know where to copy and edit the file – Onyx Mar 21 '19 at 14:12
  • @Onyx - I'm afraid I'm absolutely unfamiliar with ShareLaTeX. That said, there must be a folder where you keep the main tex file, right? Copy the modified bibliography style file to that folder, make the 3 changes I suggested, and you should be in business. – Mico Mar 21 '19 at 15:16
  • @Onyx - A separate comment: If your computing setup is slightly non-standard (such as the fact that you don't have a TeX distribution installed on your system), it's probably a really good idea to mention it up-front. – Mico Mar 21 '19 at 15:18
1

I would recommend using biblatex with Biber like this:

\usepackage[
backend=biber,
style=authoryear,
sorting=ynt,
dashed=true, 
maxbibnames=99,
maxcitenames=3
]{biblatex}
\addbibresource{test.bib}

\DeclareDelimFormat{multinamedelim}{\space\slash\space}
| improve this answer | |
  • Note that one would probably also need \DeclareDelimAlias{finalnamedelim}{multinamedelim}. And I would probably say {\addspace\slash\space} instead of {\space\slash\space}, though one may want to use a non-breakable space for one of the two spaces or no space at all. – moewe Mar 21 '19 at 11:00
  • dashed=true is the default. sorting=ynt, is a bit unusual for an authoryear style. The default sorting=nyt seems more appropriate. – moewe Mar 21 '19 at 11:01

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.