https://tex.stackexchange.com/q/429297/35864 - ONLY RUN THIS IN AN EMPTY FOLDER - FILES WILL BE OVERWRITTEN WITHOUT PREVIOUS WARNING
\documentclass[british]{article} | |
\usepackage[T1]{fontenc} | |
\usepackage[utf8]{inputenc} | |
\usepackage{babel} | |
\usepackage{csquotes} | |
\usepackage{filecontents} | |
\begin{filecontents}{custom-abbrv.bbx} | |
\ProvidesFile{custom-abbrv.bbx}[2017/10/18 v1.0.0 Custom abbrv Bibliography Style] | |
\RequireBibliographyStyle{trad-standard} | |
% %%%%%%%%%%%%% | |
% Basic Options | |
% %%%%%%%%%%%%% | |
\ExecuteBibliographyOptions{ | |
abbreviate = false, | |
arxiv = false | |
autolang = hyphen, | |
backref = false, | |
dateabbrev = true, | |
eprint = false, | |
hyperref = true, | |
labelnumber = true, | |
maxnames = 3, | |
minnames = 3, | |
sorting = none, | |
} | |
% %%%%%%%%%%%%%%%%%%% | |
% trad-abbrv Settings | |
% %%%%%%%%%%%%%%%%%%% | |
\@ifpackagelater{biblatex}{2016/03/01}{% | |
\@ifpackagelater{biblatex}{2016/05/14}{% | |
\DeclareNameFormat{abbrv}{% | |
\usebibmacro{name:given-family}% | |
{\namepartfamily}% | |
{\namepartgiveni}% | |
{\namepartprefixi}% | |
{\namepartsuffixi}% | |
\usebibmacro{name:andothers}% | |
}% | |
}{% | |
\DeclareNameFormat{abbrv}{% | |
\nameparts{#1}% | |
\usebibmacro{name:given-family}% | |
{\namepartfamily}% | |
{\namepartgiveni}% | |
{\namepartprefixi}% | |
{\namepartsuffixi}% | |
\usebibmacro{name:andothers}% | |
}% | |
}% | |
}{% | |
\DeclareNameFormat{abbrv}{% | |
\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}% | |
\usebibmacro{name:andothers}% | |
}% | |
}% | |
\DeclareNameAlias{default}{abbrv} | |
\DeclareFieldFormat{bibentrysetcount}{\mkbibparens{\mknumalph{#1}}} | |
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}} | |
\DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} | |
\@ifpackagelater{biblatex}{2016/05/14}{% | |
\defbibenvironment{bibliography}% | |
{% | |
\list{% | |
\printtext[labelnumberwidth]{% | |
\printfield{labelprefix}% | |
\printfield{labelnumber}% | |
}% | |
}{% | |
\setlength{\labelwidth}{\labelnumberwidth}% | |
\setlength{\leftmargin}{\labelwidth}% | |
\setlength{\labelsep}{\biblabelsep}% | |
\addtolength{\leftmargin}{\labelsep}% | |
\setlength{\itemsep}{\bibitemsep}% | |
\setlength{\parsep}{\bibparsep}% | |
}% | |
\renewcommand*{\makelabel}[1]{\hss##1}% | |
} | |
{\endlist} | |
{\item}% | |
}{% | |
\defbibenvironment{bibliography}% | |
{% | |
\list{% | |
\printtext[labelnumberwidth]{% | |
\printfield{prefixnumber}% | |
\printfield{labelnumber}% | |
}% | |
}{% | |
\setlength{\labelwidth}{\labelnumberwidth}% | |
\setlength{\leftmargin}{\labelwidth}% | |
\setlength{\labelsep}{\biblabelsep}% | |
\addtolength{\leftmargin}{\labelsep}% | |
\setlength{\itemsep}{\bibitemsep}% | |
\setlength{\parsep}{\bibparsep}% | |
}% | |
\renewcommand*{\makelabel}[1]{\hss##1}% | |
}% | |
{\endlist}% | |
{\item}% | |
} | |
\defbibenvironment{shorthands}% | |
{% | |
\list{% | |
\printfield[shorthandwidth]{shorthand}% | |
}{% | |
\setlength{\labelwidth}{\shorthandwidth}% | |
\setlength{\leftmargin}{\labelwidth}% | |
\setlength{\labelsep}{\biblabelsep}% | |
\addtolength{\leftmargin}{\labelsep}% | |
\setlength{\itemsep}{\bibitemsep}% | |
\setlength{\parsep}{\bibparsep}% | |
\renewcommand*{\makelabel}[1]{\hss##1}% | |
}% | |
}% | |
{\endlist}% | |
{\item}% | |
\DeclareBibliographyDriver{set}% | |
{% | |
\entryset% | |
{% | |
\ifbool{bbx:subentry}% | |
{% | |
\printfield[bibentrysetcount]{entrysetcount}% | |
\setunit*{\addnbspace}% | |
}% | |
{}% | |
}% | |
{}% | |
\newunit\newblock% | |
\usebibmacro{setpageref}% | |
\finentry% | |
} | |
% %%%%%%%%%%%%%%%%% | |
% Appearance Styles | |
% %%%%%%%%%%%%%%%%% | |
% Name | |
\renewcommand{\labelnamepunct}{\addcolon\space} | |
% Title | |
\DeclareFieldFormat*{title}{\enquote{#1}\isdot} | |
\DeclareFieldFormat{journaltitle}{\mkbibemph{#1},} | |
% Volume | |
\DeclareFieldFormat[article]{volume}{#1} | |
% Number | |
\DeclareFieldFormat*{number}{\mkbibparens{#1}} | |
% Pages | |
\DeclareFieldFormat*{pages}{\space#1\space} | |
\renewcommand*{\bibpagespunct}{\addspace} | |
% Year | |
\DeclareFieldFormat{date}{\textbf{#1}} | |
% URL | |
\DeclareFieldFormat{url}{URL:\space\url{#1}} | |
% ISSN / ISBN | |
\DeclareFieldFormat{issn}{ISSN:\space\url{#1}} | |
\DeclareFieldFormat{isbn}{ISBN:\space\url{#1}} | |
% DOI | |
\DeclareFieldFormat{doi}{% | |
DOI\addcolon\space | |
\ifhyperref | |
{\href{http://dx.doi.org/#1}{\nolinkurl{#1}}} | |
{\nolinkurl{#1}}% | |
} | |
% Item Separation | |
\setlength\bibitemsep{.5\baselineskip} | |
% Alignment | |
\AtBeginBibliography{\raggedright} | |
% %%%%%%%%%%%%%%%%%%%%%%% | |
% Changes in the position | |
% %%%%%%%%%%%%%%%%%%%%%%% | |
% Change the position of the year to be in front of the volume | |
\renewbibmacro*{journal+issuetitle}{% | |
\usebibmacro{journal}% | |
\usebibmacro{date}% Added the date, right after the journal | |
\newcommaunit*% | |
\iffieldundef{series} | |
{} | |
{% | |
\newunit | |
\printfield{series}% | |
\setunit{\addcomma\space}% | |
}% | |
\usebibmacro{volume+number+pages+eid}% | |
\newcommaunit | |
% \setunit{\addspace}% | |
\usebibmacro{issue+date-parens}% | |
\setunit*{\addcolon\space}% | |
\usebibmacro{issue}% | |
\newunit% | |
} | |
% Remove the date after the volume | |
\renewbibmacro*{issue+date-parens}{% | |
\iffieldundef{issue}% | |
{% | |
% \usebibmacro{date} | |
}% | |
{% | |
\printfield{issue}% | |
\newcommaunit*% | |
% \usebibmacro{date} | |
}% | |
\newunit% | |
} | |
\end{filecontents} | |
\usepackage[style=trad-abbrv, bibstyle=custom-abbrv, backend=biber]{biblatex} | |
\usepackage{filecontents} | |
\begin{filecontents}{\jobname.bib} | |
@misc{appleby, | |
author = {Humphrey Appleby}, | |
title = {On the Importance of the Civil Service}, | |
date = {1980}, | |
url = {http://example.com/~sirhumphrey/cc.pdf}, | |
urldate = {2018-04-30}, | |
} | |
\end{filecontents} | |
\addbibresource{\jobname.bib} | |
\addbibresource{biblatex-examples.bib} | |
\begin{document} | |
\cite{sigfridsson,appleby} | |
\printbibliography | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment