1

I've been searching for this topic quite a while in the internet (including here) but could not find a solution to my specific problem.

Nevertheless, this is my problem: I am currently writing my thesis and need to have a specific literature citation style in my bibliography at the end, which has to look like this:

Tsikalas, F., Faleide, J.I., Eldholm, O., Wilson, J., 2005. Late Mesozoic–Cenozoic structural and stratigraphic correlations between the conjugate mid-Norway and NE Greenland continental margins, geological development of the northeast Greenland shelf. In: Dore, A.G., Vining, B.A. (Eds.), Petroleum Geology: North-West Europe and Global Perspectives –– Proceedings of the 6th Petroleum Geology Conference, vol. 2. Geological Society, London, pp. 785-801.

Meaning:

Last Name, First Name, year, title, journal with volume (no comma in between!), pages

I am especially having problems telling LaTeX to implement book chapters as seen in the last example with "In: Dore, A.G., Vining, B.A. etc.". I am using JabRef. Do you have any ideas on that or code examples, so that LaTeX takes the field of JabRef proposed as the @incollection field?

Another problem is that I need to write "LASTNAME et al." in the text as soon as it says three or more authors.

Do you have any ideas?

This is my code so far (neglecting anything else that doesn't take citations into account):

%--------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%--------------------------------------------------------------------------

\documentclass[
12pt, % The default document font size, options: 10pt, 11pt, 12pt
oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
english,ngerman % ngerman for German
onehalfspacing, % Single line spacing, alternatives: onehalfspacing or doublespacing
%draft, % Uncomment to enable draft mode (no pictures, no links, overfull hboxes indicated)
nolistspacing, % If the document is onehalfspacing or doublespacing, uncomment this to set spacing in lists to single
liststotoc, % Uncomment to add the list of figures/tables/etc to the table of contents
toctotoc, % Uncomment to add the main table of contents to the table of contents
%parskip, % Uncomment to add space between paragraphs
nohyperref, % Uncomment to not load the hyperref package
headsepline, % Uncomment to get a line under the header
%chapterinoneline, % Uncomment to place the chapter title next to the number on one line
%consistentlayout, % Uncomment to change the layout of the declaration, abstract and acknowledgements pages to match the default layout
]{MastersDoctoralThesis} % The class file specifying the document structure

\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage{datetime}
\usepackage{float}
\usepackage{palatino} % Use the Palatino font by default
%\renewcommand*\rmdefault{ppl}
\usepackage{siunitx}
\usepackage{newunicodechar}
\newunicodechar{°}{\degree}
\usepackage{graphicx,wrapfig}

\usepackage[backend=bibtex,style=authoryear,firstinits=true, 
doi=false,isbn=false,url=false,maxbibnames=3,natbib=true]%
{biblatex} % Use the bibtex backend with the authoryear citation style (which resembles APA)

\usepackage[nottoc]{tocbibind}
\DeclareNameAlias{sortname}{last-first}

\newrobustcmd*{\parentexttrack}[1]{%
  \begingroup
  \blx@blxinit
  \blx@setsfcodes
  \blx@bibopenparen#1\blx@bibcloseparen
  \endgroup}

\AtEveryCite{%
  \let\parentext=\parentexttrack%
  \let\bibopenparen=\bibopenbracket%
  \let\bibcloseparen=\bibclosebracket}

\newdateformat{monthyeardate}{\monthname[\THEMONTH], \THEYEAR}

\addbibresource{jabref.bib} % The filename of the bibliography

\usepackage[autostyle=true]{csquotes} % Required to generate language-dependent quotes in the bibliography

\DeclareFieldFormat[inbook,inproceedings,article,misc]{citetitle}{#1}
\DeclareFieldFormat[inbook,inproceedings,article,misc]{title}{#1} 

Thank you very much for your help!

All the best,

Max

MaxPy
  • 49
  • 1
    Regarding the et al abbreviation for references with three or more authors, you can use maxbibnames=3. Additionally, please turen your code fragment into a minimal working example with bibliography (MWEB). – leandriis Apr 15 '18 at 12:39
  • Please edit your posting to provide the bib code for the three entries . – Mico Apr 15 '18 at 13:28
  • 2
    The formatting of the author blocks is not uniform across the three examples you provided. In the first, there's space between the first-name initials, and there's an and immediately before the name of the final author. In contrast, in examples 2 and 3, there's no space between the initials, and there's no "and" between the penultimate and the final author. Is this difference deliberate? – Mico Apr 15 '18 at 13:32
  • 1
    While questions like "how can I get this style " are not unheard of on this site, they don't make for a great Q&A. A good question would revolve around one specific issue, e.g. 'how can I make biblatex only show one name and et al. in citations', or 'how can I get the editor in @incollection before the booktitle'. You are essentially asking people to write an entire style for you: People may do this, but don't count on it. – moewe Apr 15 '18 at 13:44
  • @Mico actually, is there a guide/tutorial somewhere to learn the inner workings of biblatex or how to write one's own bib style? I mean, not totally from scratch, but based on an existing style, maybe. I could read the entire biblatex documentation, but that's hardly written in a tutorialesque format. – thymaro Apr 15 '18 at 21:54
  • @Mico First, thank you all for your responses! In fact, I am looking for a citation style as proposed in the last example with "Tsikalas, F. ..."; I've just edited my post. I've also edited my code so that it outputs "... et al." with more than three authors. – MaxPy Apr 17 '18 at 11:55
  • @MaxPy - Please see the answer I posted a short while ago. It employs BibTeX, the natbib citation management and the bibliography style called elsarticle-harv (optionally modified). – Mico Apr 17 '18 at 15:57
  • 1
    You may want to consider that despite the name "MastersDoctoralThesis" is not considered the pinnacle of creation when it comes to LaTeX document classes. In fact some people, amongst which I definitely count myself, would advise others not to use this class. For a bit of background read https://github.com/johannesbottcher/templateConfusion and (in German, sorry, maybe you can read German, you load ngerman after all) https://komascript.de/latexvorlage. For an example why the class is bad, see https://tex.stackexchange.com/q/383150/35864 (could be about an older version). – moewe Apr 17 '18 at 19:26
  • @moewe any suggestions to make that class better are welcome. That was how I got into this however. – Johannes_B Apr 20 '18 at 04:48
  • @Johannes_B There are still a lot of unprotected line ends, the version information in the header and \ProvidesClass don't match in the LaTeXtemplates version. Other things are just my personal opinion (does it really need \graphicspath{{Figures/}{./}}?) The license of the template and its parts could be stated more clearly: As I see it now the .cls is LPPL while the .tex is CC, that makes sense, but should made clearer in a README or LICENSE file - and the reasoning could be explained. Normally LPPL license notices look different and list the status (maintained, author-maintained) ... – moewe Apr 20 '18 at 05:56
  • ... as well as the maintainer. But I guess that could be inferred from the rest of the header. My other problems with this class/template are just conceptional: It tries to do too many things, but of course it can't do anything. So the average user will end up adding features and packages that are not there, while at the same time using only a fraction of what the class provides. The class also has no official documentation, no changelog and the LaTeXtemplates download page does not even list the version number and date. – moewe Apr 20 '18 at 06:01
  • @moewe You seem to be the first one who noticed the version mismatch. Considering the license: At least there is a proper license, there was none before. Line ends, i would correct them, if i knew which ones need to be escaped. To the other stuff, it is a template. That is what templates do. I inherited a bunch of silly stuff and tried to kick out the worst parts. You know i am not a friend of templates myself and i am regretting having touched that thing. You do know the history: https://github.com/johannesbottcher/templateConfusion/blob/master/ourFamousThesisTemplate.md – Johannes_B Apr 22 '18 at 06:07
  • Moewe pointed out what is wrong with the class. I cannot recommend to use it. He also gave you alternatives. But reading your comments, you do not know how LaTeX works. I recommend to read an introduction. You do not need a template for a thesis. -> https://en.wikibooks.org/wiki/LaTeX/Scientific_Reports – Johannes_B Jun 16 '18 at 06:11

2 Answers2

2

The standard styles place the editor after the booktitle in @incollections. You can either use one of the solutions in Move names of editors followed by (Ed./Eds.) and a comma before title in biblatex or you can try one of the styles of my biblatex-ext bundle. biblatex-ext has an option innamebeforetitle that moves the editor name before the booktitle. That style also offers a simple interface to remove the parentheses around the year in the bibliography and for square brackets in citations. Have a look at the documentation of biblatex-ext for more.

The modifications are straightforward to understand if you search for the modified item in the biblatex documentation and the biblatex-ext documentation.

\documentclass[british]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage{babel}
\usepackage[autostyle=true]{csquotes}

\usepackage[backend=biber, style=ext-authoryear,
  giveninits=true, uniquename=init, maxbibnames=999, maxcitenames=3,
  doi=false, isbn=false, url=false,
  innamebeforetitle=true, articlein=false,
  natbib=true,
]{biblatex}

\DeclareOuterCiteDelims{parencite}{\bibopenbracket}{\bibclosebracket}

\DeclareNameAlias{default}{family-given}
\DeclareNameAlias{sortname}{default}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\renewrobustcmd*{\bibinitdelim}{}

\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareDelimFormat{translatortypedelim}{\addspace}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareFieldFormat{translatortype}{\mkbibparens{#1}}

\DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}

\DeclareFieldFormat{biblabeldate}{#1}

\DeclareFieldFormat*{citetitle}{#1}
\DeclareFieldFormat*{title}{#1}
\DeclareFieldFormat*{booktitle}{#1}
\DeclareFieldFormat*{journaltitle}{#1}

\DeclareDelimFormat[bib,biblist]{innametitledelim}{\addcomma\space}

\renewbibmacro*{pubinstorg+location+date}[1]{%
  \printlist{#1}%
  \setunit*{\publocdelim}%
  \printlist{location}%
  \setunit*{\locdatedelim}%
  \usebibmacro{date}%
  \newunit}

\DeclareFieldFormat[article,periodical]{pages}{#1}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{tsikalas,
  author    = {Tsikalas, F. and Faleide, J. I. and Eldholm, O. and Wilson, J.},
  title     = {Late {Mesozoic--Cenozoic} structural and stratigraphic correlations between the conjugate {mid-Norway} and {NE} {Greenland} continental margins},
  editor    = {Doré, A. G. and Vining, B. A.},
  booktitle = {Petroleum Geology: {North-West} {Europe} and Global Perspectives},
  booktitleaddon = {Proceedings of the 6th Petroleum Geology Conference},
  volume    = {2},
  pages     = {785--801},
  year      = {2005},
  doi       = {10.1144/0060785},
  publisher = {Geological Society},
  location  = {London},
}
\end{filecontents}

\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
\autocite{sigfridsson,westfahl:space,pines,moraux,tsikalas}
\printbibliography
\end{document}

enter image description here

edit: biblatex-ext v0.4 changes the names of a few macros. Use the new names.

moewe
  • 175,683
  • I suspect the author's formatting requirements include not showing the prefix "pp." before the pages field in entries of type @article. – Mico Apr 17 '18 at 16:19
  • 1
    @Mico Possibly, this is changed now, thanks for the heads-up. The question has been edited multiple times though, and as you noted yourself some of the original desiderata were inconsistent. I didn't expect to get everything right at the first pass with that little information to go by. – moewe Apr 17 '18 at 19:07
  • Thank you very much for your response! This is actually exactly what I am looking for. However, I implemented your code and it is not running. I guess the class MasterDoctoralThesis and "usepackage babel" don't like each other. Furthermore, it does not find the biblatex.sty file. The error messages are actually very long (up to 100). – MaxPy Apr 24 '18 at 18:55
  • @MaxPy I deliberately did not use MasterDoctoralThesis in my MWE, because I advise people not to use it. Anyway, MasterDoctoralThesis loads babel already so you don't need to load babel as I do in my MWE. It is also not unlikely that you system may be too old and/or does not have biblatex-ext installed. Do you use MikTeX or TeX live? Make an update of your system report back with the first error. – moewe Apr 24 '18 at 19:22
  • @moewe Thanks for your quick response! I use Texmaker 4.5 (compiled with Qt 4.7.2 and Poppler 0.22.5) on a Macbook Pro. Initially, I downloaded the MasterDoctoralThesis as a template and adapted it to my needs. However, if I comment the MasterDoctoral command, it - of course - crashes. The errors occur at literally every line when adding the new code lines. It does not recognize the ext-authoryear style nor any other written in that command. Furthermore, the \DeclareDelimFormat commands cannot be read as well. It works if I use my initial \usepackage{backend=bibtex etc. ...} command. – MaxPy Apr 25 '18 at 13:24
  • @MaxPy Texmaker is only your editor, I would need to know the TeX distribution that you installed. Since you have a Macbook I assume it is TeX live/MacTeX. On that system biblatex-ext is not available yet. If you have adapted MasterDoctoralThesis without renaming the file you may be in breach of the license agreement (IANAL, I assume this is not a problem for personal use). You can't comment out the MasterDoctoralThesis line, you need a \documentclass after all. If your system is outdated, some of the commands I used will be unknown to your system. – moewe Apr 25 '18 at 13:33
  • @moewe So this means that I would have to re-write my code for a class other than MasterDoctoralThesis? ... Yes, it is TeX Live. Are there any other options to implement your code into my system with some minor changes? Thank you for your response in advance! – MaxPy Apr 25 '18 at 15:56
  • 1
    @MaxPy I would strongly advise you not to use MasterDoctoralThesis, but rather to start with one of the standard or KOMA classes. Unfortunately the modification needed to implement this without biblatex-ext are not going to be minor. I explicitly used that package to allow for a simple solution. It is entirely possible though and I might have a look if I'm bored tomorrow. Since I don't know how outdated your system is, I don't know what commands can be used, so that could be problematic. – moewe Apr 25 '18 at 16:05
  • @moewe Instead of the MasterDoctoralThesis class, which class would you recommend for my thesis? Since this was a template, the class was unfortunately the last thing that caught my attention. However, I had some minor problems in the past with this class but could figure it out. Do you have any suggestions on how to re-write it to an appropriate class? Thank you! – MaxPy Apr 25 '18 at 17:55
  • @MaxPy Depends on what you want. I would certainly look at scrreprt and scrbook (or report/book): https://komascript.de/latexvorlage – moewe Apr 25 '18 at 19:50
  • @moewe Thank you for your advice. However, I do not see myself re-writing the whole Latex code from the MasterDoctoralThesis class to a e.g. scrbook class. Aren't there any possibilities to quickly transform the needed citation style with the MasterDoctoral class? Even if things are worked out anyhow? – MaxPy Apr 26 '18 at 09:44
  • @MaxPy What version of biblatex do you use? – moewe Apr 26 '18 at 10:07
  • @MaxPy You could try https://gist.github.com/moewew/e34a6c17903ad0f7483b8fcb5872534e. That version works without biblatex-ext and tries to be compatible with older biblatex versions as well. No guarantee that everything works as expected, though, since I only have biblatex 3.11 and did the backwards compatibility based on my recollection of how things used to be. – moewe Apr 26 '18 at 10:55
  • @moewe Sorry for the stupid question, but where can I check the biblatex version? – MaxPy Apr 26 '18 at 16:47
  • @MaxPy Run a document with the contest \listfiles\documentclass{article}\usepackage{biblatex}\begin{document}Hallo\end{document} and check the reported version at the end of the .log file. (EDIT: It's \listfiles with an s, I forgot that initially, sorry) – moewe Apr 26 '18 at 16:48
  • @moewe Thank you, I will check that immediately! Meanwhile a totally different question since I am still working on my citation style: If you have a look at: Blystad, P., H. Brekke, R. Færseth, B. Larsen, J. Skogseid, and B. Tørudbakken (1995). Structural elements of the Norwegian continental shelf Part II: The Norwegian Sea Region. Norwegian Petroleum Directorate Bulletin No. 8. ... my question now is: How do I get rid of 1) the comma before the "and" and 2) exchange the "and" with a "&" not only in the text (I already did that) but also in the reference list? – MaxPy Apr 26 '18 at 17:15
  • @moewe This is what I got when I ran your code line: This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex 2015.7.17) – MaxPy Apr 26 '18 at 20:44
  • @MaxPy I need the biblatex version it will be shown towards the end of the .log for the example I showed you. But TeX live 2015 is already quite old. Chances are you don't even have version 3.3. The current version is 3.11! Any chances for an update? (Remember: updates are always risky, especially if you are half-way into an important document and the deadline is near) – moewe Apr 26 '18 at 21:25
  • @moewe You are absolutely right with your last sentence. Therefore, I would rather not risk it. However, I have adapted my document so far, but there are still some questions left. Maybe, we could go through them instead quickly? ... Basically, this is what I have so far: Cloetingh, S. and H. Kooi (1992). Intraplate stresses and dynamical aspects of rifted basins. In: Tectonophysics 215.1-2, 167–185. ... BUT, I want it like this: Cloetingh, S. & H. Kooi (1992): Intraplate stresses and dynamical aspects of rifted basins, Tectonophysics 215, 1-2, 167–185. Do you have any ideas? – MaxPy Apr 26 '18 at 22:16
  • @MaxPy Please consider asking a new question with a proper MWE/MWEB (compare the code in your question to the code in Mico's or my answer) for that. This has become quite long already and I would really need to so what you have so far and what you are trying. – moewe Apr 26 '18 at 22:18
  • @MaxPy FWIW https://gist.github.com/moewew/e34a6c17903ad0f7483b8fcb5872534e is a version of my answer above that should work with your ancient version of biblatex. Of course I can't test so I had to rely on guessing. Not everything will work. – moewe Apr 27 '18 at 08:23
1

If you can make do with a BibTeX/natbib-based solution, the elsarticle-harv bibliography style comes extremely close to your formatting requirements.


The only salient difference I can readily detect between your stated formatting requirements and what's produced by the elsarticle-harv is that elsarticle-harv inserts spaces between adjacent given-name initials. If you wanted to "fix" this minor discrepancy, I suggest you proceed as follows:

  • Find the file elsarticle-harv.bst in your TeX distribution. Make a copy of this file and call the copy, say, elsarticle-harv-mod.bst. (Feel free to pick a snazzier name...) Don't edit an original file of the TeX distribution directly.

  • Open the file elsarticle-harv-mod.bst in a text editor -- the editor you use to edit your tex files will do fine -- and locate the function format.names. (In my copy of the file, this function starts on line 377.)

  • In this function, locate the following line:

          "{vv~}{ll}{, jj}{, f.}" format.name$
    

    Change it to

          "{vv~}{ll}{, jj}{, f{.}.}" format.name$
    

    Note the extra {.} particle.

  • Optional: If you wish to suppress the issue number in entries of type @article, you should locate the function format.vol.num.pages (it starts on line 799 in my copy of the bst file) and comment out (or just delete...) the following 10 lines of code (lines 809 to 818 in the file):

      number empty$
        'skip$
        {
          "~(" number * ")" * *
          volume empty$
            { "there's a number but no volume in " cite$ * warning$ }
            'skip$
          if$
        }
      if$
    
  • Save the file elsarticle-harv-mod.bst either in the directory where your main tex file is located or in a directory that's searched by BibTeX. If you choose the latter method, be sure to update the filename database of your TeX distribution suitably.

  • In your main tex file, load the natbib package with the option authoryear. Doing so ensures that the citation call-outs will be formatted as "FirstAuthor et al" whenever an entry has three or more authors (or editors).


Here's how entries of type @article and @incollection would look like:

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{mybib.bib}
@incollection{uuu,
  author       = "Tsikalas, Filippos and Faleide, Jan Inge
                  and Eldholm, Olav and Wilson, Jonas",
  editor       = "Anthony G. Dor{\'e} and Bernie A. Vining",
  title        = "Late {Mesozoic--Cenozoic} structural and
                  stratigraphic correlations between the
                  conjugate mid-{Norway} and {NE
                  Greenland} continental margins,
                  geological development of the northeast
                  {Greenland} shelf",
  booktitle    = "Petroleum Geology: North-West Europe and
                  Global Perspectives---Proceedings of
                  the 6th Petroleum Geology Conference",
  year         = 2005,
  publisher    = "Geological Society",
  address      = "London",
  volume       = 2,
  pages        = "785--801",
}
@article{vvv,
  author       = "Anna Maria Author and Brenda Michelle
                  Buthor and Carla Miranda Cuthor",
  title        = "Thoughts",
  year         = 3001,
  journal      = "Circularity Today",
  volume       = 1,
  number       = 2,
  pages        = "3--4",
}
\end{filecontents}

\documentclass{article}
\usepackage{geometry}
\usepackage{newpxtext,newpxmath} % Palatino text and math font
\usepackage[authoryear]{natbib}
\setlength{\bibhang}{0pt}
\bibliographystyle{elsarticle-harv-mod}

\begin{document}
\citep{uuu}, \citet{vvv}
\bibliography{mybib}
\end{document} 
Mico
  • 506,678