3

I had to create my own bibliography style to format my .bib database using custom-bib and an external language file.

I have a couple of problems left, one is that when I have an entry with a URL, the style inserts the text 'URL' before the URL so it looks like e.g.:

URL https://tex.stackexchange.com/questions/ask.

Is there an easy way to edit the .bst file to remove the prefix 'URL'?

The .bst file has the following function:

FUNCTION {write.url}

{

  url

  duplicate$ empty$

   { pop$ }

   { "\newline\urlprefix\url{" swap$ * "}" * write$ newline$ 

}

I'm using LyX and I'm not a programmer so if it gets too hairy it's probably not worth it.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – CarLaTeX Oct 9 '17 at 2:05
5

Is there an easy way to edit the .bst file to remove the prefix 'URL'?

Good news: You needn't edit your bespoke bibliography style file. It suffices to issue the instruction

\def\urlprefix{}

somewhere in the preamble. After making this change, be sure to re-run LaTeX, BibTeX, and LaTeX twice more to fully propagate the change.


If you wanted to edit the bst file, you could proceed as follows: Open the bst file in an editor and locate the function format.url. It should look like this:

FUNCTION {format.url}
{ url empty$
    { "" }
    { "\urlprefix\url{" url * "}" * }
  if$
}

Delete the substring \urlprefix. Then, save the bst file and rerun BibTeX and LaTeX. If, instead, the makebst utility created a function called write.url, simply delete the substring \urlprefix from that function.

  • 1
    Great you saved me much time, adding \def\urlprefix{} in the preamble was enough I didn't have to do anything else. – Holger Oct 9 '17 at 2:09

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.