The solution uses Bibulous project script.
Style file is declared as follows:
OPTIONS:
allow_scripts = True
VARIABLES:
formatdate = format_date_style(entry, options)
formatpages = format_pages_style(entry, options)
formatvolume = format_volumes_style(entry, options)
DEFINITIONS:
def format_date_style(entry, options):
"""
Return correct year for ieej-jia -> (month if present, year) in parentheses
"""
if ('year' not in entry):
return(options['undefstring'])
else:
if ('month' not in entry):
return('(' + str(entry['year']) + ')')
else:
return('(' + entry['month'].title() + ', ' + str(entry['year'])+ ')')
def format_pages_style(entry, options):
"""
Returns pages if present
"""
if ('pages' in entry):
return(str(entry['pages']) + ', ')
else:
return('')
def format_volumes_style(entry, options):
"""
Return Volume, Number
"""
ret = ''
if ('volume' in entry):
ret = ret + str(entry['volume']) + ', '
if ('number' in entry):
ret = ret + str(entry['number']) + ', '
return(ret)
TEMPLATES:
article = <au>: ``<title>'', <journal>, <formatvolume> <formatpages> <formatdate>
book = <au>: ``<title>'', <publisher>, <formatpages> (<year>)
electronic = <au>: ``\href{<url>}{<title>}'', (<year>)
inproceedings = <au>: ``<title>'', <booktitle>, <formatpages> (<year>)
incollection = <au>: ``<title>'', <booktitle>, <publisher>, <formatpages> (<year>)
sortkey = <citekey>
and reference to this file is inserted in main tex file
\bibliographystyle{previous_file}
Compilation requires three commands (example with pdflatex
):
pdflatex main.tex # to generate aux file
bibulous.py main.aux # to generate bbl
pdflatex main.tex # to generate final pdf
Hope it helps.
Best Answer
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
),we can put together the following (Bibulous format) style file (
main.bst
)(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 useTo produce the formatted result shown below: