# How to customize a .bst bibliographic style created with custom-bib for dealing with entries with no year and/or no author

I am using natbib with author-year-like cites style and with a custom references style (a .bst file) that I created with custom-bib. That style file for references is also author-year oriented, of course.

I am not an expert on .bst files and so on. The style I created with custom-bib is perfect for me, but there are two cases in which it could (and should) be improved:

1. entries without year and
2. entries without author, and also a not so important improvement:
3. entries that have an URL (for the records) but are not online websites.

I copy here my MWE (maybe not so minimal), and a link to my .bst file:

\begin{filecontents}{mybib.bib}
@book{GAMSCPLEX,
publisher = {GAMS Development Corporation},
title = {{GAMS/CPLEX} 10 Solver Manual},
url = {http://www.gams.com/dd/docs/solvers/cplex.pdf}
},
@book{GAMSSBB02,
publisher = {GAMS Development Corporation},
title = {{GAMS/SBB} Solver Manual},
url = {http://www.gams.com/dd/docs/solvers/sbb.pdf},
year = {2002}
},
@book{GAMSCONOPT,
author = {Drud, A},
publisher = {{ARKI} Consulting and Development},
title = {{GAMS/CONOPT} Solver Manual},
url = {http://www.gams.com/dd/docs/solvers/conopt.pdf}
},
@article{Chou2006,
author = {Chou, C. Y. and Chen, C. H.},
journal = {Expert Systems with Applications},
number = {2},
pages = {233--242},
title = {Economic design of variable sampling intervals {$T^2$} control charts using genetic algorithms},
volume = {30},
year = {2006}
},
@article{DRUZOVEC98,
author = {Dru\v{z}ovec, M and \v{S}ostar, A and Godina, A},
journal = {Strojni{\v{s}}ki Vestnik-Journal of Mechanical Engineering},
number = {1-2},
pages = {29--34},
title = {{MPC} process control procedure},
volume = {44},
year = {1998}
}
\end{filecontents}

\documentclass[11pt]{book}
\usepackage[a4paper,showframe]{geometry}

\RequirePackage[latin1]{inputenc}

%\usepackage{amsmath}

\usepackage[spanish]{babel}

\usepackage[autostyle=true]{csquotes}

\usepackage[round,semicolon,authoryear,longnamesfirst]{natbib}

\usepackage[%implicit=false,
pdftex,hyperfootnotes=false,
\pdfcompresslevel=9

\hypersetup{hyperfootnotes=false,
filecolor=red, urlcolor=red,
pdfpagemode=UseOutlines, pdfpagelayout=SinglePage,%
pdfhighlight=/N, pageanchor=true,%

\begin{document}

Referencias:

\begin{itemize}
\item \cite{Chou2006}.
\item \cite{DRUZOVEC98}.
\item \cite{GAMSCPLEX}.
\item \cite{GAMSSBB02}.
\item \cite{GAMSCONOPT}.
\end{itemize}

\bibliographystyle{mycustom}
\bibliography{mybib}

\end{document}


This is the link for mycustom.bst: https://dl.dropbox.com/u/155485/mycustom.bst

These are the results I get for the reference list:

OK, so my questions are obviously the following:

1. How can I tweak my .bst file (or the preceding .dbj file) in order to hide those ugly empty round brackets in the case there is no year for the item??

2. How should my .bst file deal with items without author? Should it take the publisher info? I suppose the right order could be: authors, if not then editors, if not then publisher or institution. How can I get that done in my custom style?*

3. I don't know what exactly to do with URL information. In the cases I am showing in my example, they are in fact online documents, so I think it's not wrong to show the links to them. But in other cases you have an URL address in your .bib file just for your information... Anyway, my question in this case is easier: How can I get rid of that ugly "URL" label before the URL address?

EDIT: Although this is not the goal of this question, I would also like to ask you the following:

Do you know any (natbib or just bibtex) existing style that is the same or nearly the same as my custom bib style?? I was no able to locate such a style, but maybe I missed something.

• I have also seen "n. d." (for "no date") for publications without given publication date. Nov 5, 2012 at 19:12
• I have a style file made from custom-bib that does not show the problems you have. I guess you used option pub-date that causes all that. To make that all easier, could you please post your .dbj file, so I can compare?
– mafp
Dec 26, 2012 at 23:14

1. To start, there are several things wrong with your bib file. Following the BibTeX manual, the book entry requires year, and author or editor. So I suggest to turn the first three entries into manual, which just requires title.
2. For those manuals, in particular when the author is missing, one should provide a key entry that BibTeX can use to sort the entries, and that is sometimes shown instead of the author (depends on the style).
3. I would also change the publisher fields of the manuals into organization fields, as those are optional fields of manual, while publisher is not.

The resulting database would then look like:

@manual{GAMSCPLEX,
key = {GAMS/CPLEX},
organization = {GAMS Development Corporation},
title = {{GAMS/CPLEX} 10 Solver Manual},
url = {http://www.gams.com/dd/docs/solvers/cplex.pdf}
},
@manual{GAMSSBB02,
key = {GAMS/SBB},
organization = {GAMS Development Corporation},
title = {{GAMS/SBB} Solver Manual},
url = {http://www.gams.com/dd/docs/solvers/sbb.pdf},
year = {2002}
},
@manual{GAMSCONOPT,
key = {GAMS/CONOPT},
author = {Drud, A.},
organization = {{ARKI} Consulting and Development},
title = {{GAMS/CONOPT} Solver Manual},
url = {http://www.gams.com/dd/docs/solvers/conopt.pdf}
},
@article{Chou2006,
author = {Chou, C. Y. and Chen, C. H.},
journal = {Expert Systems with Applications},
number = {2},
pages = {233--242},
title = {Economic design of variable sampling intervals {$T^2$} control charts using genetic algorithms},
volume = {30},
year = {2006}
},
@article{DRUZOVEC98,
author = {Dru\v{z}ovec, M. and \v{S}ostar, A. and Godina, A.},
journal = {Strojni{\v{s}}ki Vestnik-Journal of Mechanical Engineering},
number = {1-2},
pages = {29--34},
title = {{MPC} process control procedure},
volume = {44},
year = {1998}
}


Regarding the empty parentheses for non-existing years I have three suggestions:

1. Remove the yr-par option from your dbj file to remove all parentheses around years. (maybe not an option for you)
2. Just provide a year! If you use a specific version of, say, GAMS/CPLEX, look up its release date, and use that. It is reasonable to assume that the manual was released alongside the software release. (maybe not an option for you)
3. bst hackery: Although year is an optional field of manual, your style file does not check properly if the year is present. This is a bug in custom-bib. To circumvent it, add the indicated five lines to your style file, in function format.date:

FUNCTION {format.date}
{ year "year" bibinfo.check duplicate$empty$
{
}
'skip$if$
extra.label *
before.all 'output.state :=
duplicate$empty$     %% added
{ pop$"{}" } %% added { %% added " (" swap$ * ")" *
if$%% added }  In principle, this could be added to merlin.mbs, to fix all derived styles. With this hack, and the proposed changes to your database, I get: I want to add an answer to a part of my own question. But there still are open questions. About how to get rid of "URL" label (question 3), I just opened the .bst file I created (that I linked to in my question) and then I realized that this could work: \providecommand{\urlprefix}{ }  This line should be added before calling the .bst style, I mean, not after the line where \bibliographystyle{mycustom} is, in my case. For example, it can be added before \begin{document}. And as for question 2, I must say that a possible workaround here is manually adding an editor field to those entries without author and without editor. This editor could have the same content as the publisher field, and in fact it should replace it. This way, I've checked that my bib style takes the editor field as a kind of author when author field is empty. But that's not a good solution. Please, I am not an expert in LaTeX or BibTeX coding, so any other answer will be appreciated. • Please provide your dbj file, without it it is hard to tell what needs to be changed. – mafp Jan 18, 2013 at 22:56 Bst files are written in postfix language that's not too hard to figure out, if you're a little motivated, so you could wade in and add code to handle missing authors gracefully (I believe it already sorts such records by title, so there's not much that needs fixing). But it's probably best to hack your generated file as little as possible. 1. Many citation styles use no date or n.d. in place of the date for documents that don't have one. If you do that in your bibliography, you won't have to adjust the style. 2. No good solution to the missing-author problem comes to mind at the moment, besides editing the generated bst. 3. The ugly "URL" label at the front is the content of the macro \urlprefix. You could get rid of it by redefining \urlprefix in the preamble of each document that uses it. For a permanent fix, edit the .bst you generated and look for this snippet (in FUNCTION {begin.bib}):  "\expandafter\ifx\csname urlprefix\endcsname\relax\def\urlprefix{URL }\fi" write$ newline\$ 
It sets the default \urlprefix if your document hasn't already defined it, so you can change it to another prefix (including \relax).
3a. If I recall correctly, whether to always show the url field is controlled by an option during the custom-bib run. I suggest re-running custom-bib to generate your style without the option; it might do exactly what you want. If this doesn't work, the easiest work-around is to use a custom field name like myurl for urls you don't want to typeset.