1

I am currently writing my PhD thesis and I am haunted by the choice of a convenient bibliography package/style/etc to meet exactly my needs of a custom list of references.

\documentclass{book}
\usepackage[sort]{natbib}

\begin{document}
Trying citations
\citep{pollock} and \citet{pollock}

\bibliographystyle{plainnat}
\bibliography{articles}

\end{document} 

with the following articles.bib file:

@article{pollock,
year={2050},
journal={My Journal A},
volume={27},
number={4},
title={The breakdown of single-crystal solidification},
url={https://tex.stackexchange.com/posts/213463},
author={Pollock, T.M. and Murphy, W.H.},
pages={1000-2000},
}

My requirements were basically met by natbib's plainnat or apalike with authordate setting:

  • Cite using author names instead of alpha-style, e.g. [Bao98]
  • Textual citations whenever needed, if not normal parenthical citations
  • Generate a list of references that would include usual items + URL + (most importantly:) a bracketed identifier to the left of the reference, which is generated using alpha style in natbib

The last point is not possible though, which is why I tried searching for alternate solutions, without really finding a suitable one:

  1. dinat solution is great but it supports german citations (produces german words inside the citation and references!) enter image description here
  2. Created a custom style.bst using latex makebst tool, however the new promising style produces an error similar to this question but cannot be fixed even after trying the suggested answers ans solutions. Maybe I should have loaded some additional packages before using it

Bottom line, is it possible or is it too much to ask from LateX ? In the meantime, I am 'procrastinating' in these links:

  • Is biblatex an option? If you provided a minimal working example (MWE) that would be very helpful. – cfr Nov 22 '14 at 18:35
  • I agree with @cfr. biblatex may help you solve this. And a MWE will help other people try solutions to the problem. – Smarzaro Nov 22 '14 at 18:43
  • I ve edited the question adding a mwe. I dont mind using biblatex, however I still want a solution compatible with the bibiliography exported by zotero (bibTeX). I need to read more about biblatex – SAAD Nov 22 '14 at 18:45
  • If the combination of natbib and dinat.bst deliver everything you need but for the use of German-language terms, have you considered making a copy of dinat.bst in which you replace the German terms with equivalent English terms? – Mico Nov 22 '14 at 19:33
  • To make full use of biblatex, you need to use special fields in the .bib file. However, biblatex and biber are fully compatible with BibTeX .bib files. So that shouldn't stop you from trying biblatex. However, as Mico says, if BibTeX does what you need, there is no reason to switch. (If it ain't broken...) – cfr Nov 22 '14 at 20:09
1

Using Natbib


Considering the comments to my question, the fastest way was to hack the dinat.bst file changing the following:

  • German to english words
  • Authors name font
  • Volume/number/year format
  • Removed urldate field
  • Removed unnecessary dashes
  • Modify spacing between label and reference

Final output: enter image description here

Using BibLateX


\usepackage[american]{babel}% Recommended
\usepackage{csquotes}% Recommended
\usepackage [backend=bibtex,style=authoryear]{biblatex} %style=authoryear %style=apa

\newcommand{\citep}[1]{\parencite{#1}}
\newcommand{\citet}[1]{\textcite{#1}}

\ExecuteBibliographyOptions{hyperref=true,backref=true,firstinits=true, isbn=false, eprint=false,
                            url=true, doi=false, sorting=nyt, minnames=1, maxcitenames=2, maxbibnames=2, 
                            alldates=short, punctfont=true, autopunct=false, block=none, dashed=false}

% Path to bib file (with extension)
\addbibresource{articles.bib}

% Spacing in list of references
\setlength{\bibitemsep}{15pt} %vertical spacing
\setlength{\bibhang}{1cm} %label alignment (0 for perfect align)

% Disable URL dates and language
\AtEveryBibitem{%
    \clearfield{urldate}%
    \clearfield{urlday}%
    \clearfield{urlmonth}%
    \clearfield{urlyear}%
    \clearlist{language}
}%

%Fix the comma problem after the journal name (via addcomma)
\DeclareFieldFormat{journaltitle}{\mkbibemph{#1\isdot}\addcomma\space}

%Fix number and volume format
\renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
%  \setunit*{\adddot}% DELETED
  \setunit*{\addnbspace}% NEW (optional); there's also \addnbthinspace
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

%Disable In prefix
\renewbibmacro{in:}{}

% Define brackets instead of parenthesis
\makeatletter
\newrobustcmd*{\parentexttrack}[1]{%
  \begingroup
  \blx@blxinit
  \blx@setsfcodes
  \blx@bibopenparen#1\blx@bibcloseparen
  \endgroup}

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

%define label before reference in list  
\renewbibmacro{begentry}{%
\textbf{[\printnames[][-\value{liststop}]{labelname}~\printfield{labelyear}\printfield{extrayear}}]\\}

%define full hyperlink for textcite
\DeclareCiteCommand{\textcite}
  {\boolfalse{cbx:parens}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{\usebibmacro{textcite}}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}%
   \multicitedelim}
  {\usebibmacro{textcite:postnote}}

%define full hyperlink for parencite  
 \DeclareCiteCommand{\parencite}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
    \printtext[bibhyperref]{\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

The command \printbibliography in the document body will print the list of references with labels. enter image description here

  • I shall add that one reason for not adopting biblatex from the beginning, is because I knew that Zotero (online chrome connector) could only export in BibTeX, but actually the desktop application supports a wide array of formats including biblatex (even if in the comments @cfr confirms that biblatex is compatible with bibTeX) – SAAD Nov 23 '14 at 16:20
  • 1
    bibtex is the name of the database format. – Johannes_B Nov 25 '14 at 17:32
  • 1
    btw: you should rename your modified file. It will get lost when the next update comes. – Johannes_B Nov 25 '14 at 17:32
  • I meant BibTex as a backend ... As for the modifed file, it is local to my work folder so it is not affected by further updates – SAAD Nov 25 '14 at 17:41

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.