The n.dashify
function is used for both page number ranges and other elements like ISBN numbers, so in order to get the style to work the way you want, we need to separate out those two uses in the style. The simplest way to do this is to create a version of the function for page ranges (which we will call n.dashify
) and create a new version (like the previous n.dashify
which we will call n.dashify.plain
. Additionally, we need to change the functions that process non-page number ranges to use the n.dashify.plain
function instead of our new function.
First, make a copy of natdin.bst
and put it in your local texmf
folder (on a TeX Live system this is usually ~/texmf/tex/bibtex/bst
(~/Library/texmf/tex/bibtex/bst
on a Mac)).
Then, make a copy of the original n.dashify
function in the file and give it a new name: n.dashify.plain
Next, replace the old n.dashify
function with the following one:
FUNCTION {n.dashify}
{ 't :=
""
{ t empty$ not }
{ t #1 #1 substring$ "-" =
{ t #1 #2 substring$ "--" = not
{ "\,--\," *
t #2 global.max$ substring$ 't :=
}
{ { t #1 #1 substring$ "-" = }
{ "" *
t #2 global.max$ substring$ 't :=
}
while$
"\,--\," * }
if$
}
{ t #1 #1 substring$ *
t #2 global.max$ substring$ 't :=
}
if$
}
while$
}
You should now have two n.dashify
type functions in the .bst
file: n.dashify
and n.dashify.plain
.
Finally, change the following two functions (which format URLs and ISSN/ISBNs) to use the n.dashify.plain
function:
FUNCTION { format.doi.urn }
{ urn empty$
{ doi empty$
{ "" }
{ "DOI" doi n.dashify.plain tie.or.space.connect }
if$
}
{ "URN" urn n.dashify.plain tie.or.space.connect }
if$
}
FUNCTION { format.isbn.issn }
{ isbn empty$
{ issn empty$
{ "" }
{ "ISSN" issn n.dashify.plain tie.or.space.connect }
if$
}
{ "ISBN" isbn n.dashify.plain tie.or.space.connect }
if$
}
Here's a sample document. I've duplicated the bib entries to show the behaviour with pages entries of the form n--m
and n-m
in the .bib
file (see discussion in the comments above) and added some ISBN numbers to check that things work as expected.
\begin{filecontents}{\jobname.bib}
@article{Nescio.2000,
author = {Nescio, Nomen and Public, John Q. and Else, Somebody},
year = {2000},
title = {What Miscellaneous Anomaly is This? A Field Guide for the Utterly Confused},
pages = {95--105},
volume = {08/15},
journal = {Internationale Zeitschrift für Tetrapilotomie und Potiosektion},
isbn = {1-84356-028-3}
}
@article{Nescio.2000b,
author = {Nescio, Nomen and Public, John Q. and Else, Somebody},
year = {2000},
title = {What Miscellaneous Anomaly is This? A Field Guide for the Utterly Confused},
pages = {95-105},
volume = {08/15},
journal = {Internationale Zeitschrift für Tetrapilotomie und Potiosektion},
issn = {1-84356-028-3}
}
\end{filecontents}
\documentclass[paper=a4]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,ngerman]{babel}
\usepackage[square]{natbib}
\usepackage{lipsum}
\begin{document}
\section{Lorem Ispum}
According to \citet{Nescio.2000b,Nescio.2000} we find that
\lipsum[1]
\bibliography{\jobname}
\bibliographystyle{natdin-copy}
\end{document}
This kind of custom bibliography style is exactly the type of thing that the new Bibulous project is probably the best tool for. Using a subset of the OP's suggested database file (main.bib
),
@article{Abrahams1986,
title = {Scaling description of the dielectric function near the mobility edge},
author = {Abrahams, Elihu and Lee, P. A.},
journal = {Phys. Rev. B},
volume = {33},
issue = {2},
pages = {683--689},
year = {1986},
month = {1},
publisher = {American Physical Society},
url = {http://link.aps.org/doi/10.1103/PhysRevB.33.683}
}
@book{Nakayama2003,
title = {Fractal Concepts in Condensed Matter Physics},
series = {Springer Series in Solid-State Sciences},
volume = {140},
author = {Nakayama, Tsuneyoshi and Yakubo, Kousuke},
address = {New York},
publisher = {Springer},
issn = {0171-1873},
year = {2003}
}
@article{Chalker1988,
title = {Scaling, diffusion, and the integer quantized Hall effect},
author = {Chalker, J. T. and Daniell, G. J.},
journal = {Phys. Rev. Lett.},
volume = {61},
issue = {5},
pages = {593--596},
year = {1988},
month = {8},
publisher = {American Physical Society},
url = {http://link.aps.org/doi/10.1103/PhysRevLett.61.593}
}
@article{Chalker1990,
journal = {Physica A: Statistical Mechanics and its Applications},
volume = {167},
issue = {1},
month = {8},
year = {1990},
day = {1},
pages = {253-258},
title = {Scaling and eigenfunction correlations near a mobility edge},
author = {J. T. Chalker}
}
@article{Pook1991,
year = {1991},
issn = {0722-3277},
journal = {Zeitschrift für Physik B Condensed Matter},
volume = {82},
number = {2},
title = {Multifractality and scaling in disordered mesoscopic systems},
url = {http://dx.doi.org/10.1007/BF01324339},
publisher = {Springer-Verlag},
author = {Pook, Werner and Janßen, Martin},
pages = {295-298}
}
we can put together the following (Bibulous format) style file (main.bst
)
TEMPLATES:
article = \textbf{<au>, (<year>[-<month.monthabbrev()>[-<day>]]):}\\ [\href{<url>}{<title>}|\href{<doi>}{<title>}|<title>|], \textit{<journal>} \textit{<volume>}([<number>|<issue>|]), [<startpage>--<endpage>|<startpage>|<eid>|].
book = \textbf{[<au>|<ed>|], (<year>[-<month.monthabbrev()>[-<day>]]):}\\ \textit{<title>}[, <edition_ordinal>~ed.][, <series>][ <issn>], <address>: <publisher>.
SPECIAL-TEMPLATES:
authorlist = <author.to_namelist()>
editorlist = <editor.to_namelist()>
authorname.n = [<authorlist.n.prefix> ]<authorlist.n.last>, <authorlist.n.first.initial()>.[ <authorlist.n.middle.initial()>.][, <authorlist.n.suffix>.]
au = <authorname.0>, ...{ \& }<authorname.9>
editorname.n = [<editorlist.n.prefix> ]<editorlist.n.last>, <editorlist.n.first.initial()>.[ <editorlist.n.middle.initial()>.][, <editorlist.n.suffix>.]
ed = <editorname.0>, ...{ \& }<editorname.5>
citelabel = <authorlist.0.last>-<year>
sortkey = <citelabel>
(Note that the above block of code gives the entire file.) Finally, achieving the requested format of a hanging indent for the formatted reference entries requires adding some code to the main.tex
file preamble. Taking from @egreg's proposed solution, we can use
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[paper=letterpaper, text={5.8in,8.5in},centering]{geometry}
\usepackage[colorlinks=True,urlcolor=blue,citecolor=black,breaklinks=true]{hyperref}
\usepackage{enumitem}
\makeatletter
\renewcommand{\@biblabel}[1]{}
\renewenvironment{thebibliography}[1]
{\section*{\refname}%
\@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
\begin{enumerate}[label={},itemindent=*,leftmargin=3em]
\@openbib@code
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\end{enumerate}}
\makeatother
\begin{document}
{\noindent}Citations: \cite{Abrahams1986,Nakayama2003,Chalker1988,Chalker1990,Pook1991}
\bibliography{example8}
\bibliographystyle{example8}
\end{document}
To produce the formatted result shown below:
Best Answer
I couldn't figure out BibLaTeX (it doesn't seem to run in TeXWorks or there was a problem with the Package or something...) but I found a solution here: https://tug.org/pracjourn/2008-1/calleecharan/
Minimal examples: The Tex File
The bib file:
the bst file:
I would like to find a way to include the
\url
formatting in the BST instead of the bib file but haven't figured out how to. This isn't as elegant a solution as I had hoped but it will do a job.If anyone has any suggestions on how to tidy the code it would be much appreciated. I don't really know what I'm doing...