0

I am using BibTeX in Lyx with the IEETrans.bst style. This works fine and I have made some changes, like no URLs and that the year appears bold with this added function:

%bolden Function
FUNCTION {highlight.bolden}
{ duplicate$ empty$
     { pop$ "" }
     { "\textbf{" swap$ * "}" * }
   if$
}

I call the function in the different types like articles

FUNCTION {article}
{ std.status.using.comma
  start.entry
  if.url.alt.interword.spacing
  format.authors "author" output.warn
  name.or.dash
  format.article.title "title" output.warn
  format.journal "journal" bibinfo.check "journal" output.warn
  format.volume output
  format.number.if.use.for.article output
  format.pages output
  format.date "year" output.warn
  highlight.bolden %bolden year
  format.note output
%  format.url output
  fin.entry
  if.url.std.interword.spacing
}

So this works totally fine and no problem so far. But for the book entries, I need the year in bold, but not the publisher! And I have to mention the publisher, so I have trouble to call the bolden function to make only the year bold. For the book:

FUNCTION {book}
{ std.status.using.comma
  start.entry
  if.url.alt.interword.spacing
  author empty$
    { format.editors "author and editor" output.warn }
    { format.authors output.nonnull }
  if$
  name.or.dash
  format.book.title.edition output
  format.series output
  author empty$
    { skip$ }
    { format.editors output }
  if$
  format.address.publisher.date output
  highlight.bolden %bolden year
  format.volume output
  format.number output
  format.note output
%  format.url output
  fin.entry
  if.url.std.interword.spacing
}

When I used it like that, the output generated is a bold publisher and a bold year, which makes sense, but I would like to have only the year in bold. Any suggestions here?

The format.address.publisher.date output calls the format.address.org.or.pub.date....

FUNCTION {format.address.publisher.date}
{ publisher "publisher" bibinfo.warn format.address.org.or.pub.date }

...so, I also tried to change the function FUNCTION {format.address.org.or.pub.date} with pasting the highlight.bolden function into it somewhere... but somewhere is the problem. Wherever I have pasted it, the year disappeared or year and publisher were bold or none... Since I have really only basic knowledge about this, it is hard to find the right spot.

FUNCTION {format.address.org.or.pub.date}
{ 't :=
  ""
  year empty$
    { "empty year in " cite$ * warning$ }
    { skip$ }
  if$
  address empty$ t empty$ and
  year empty$ and month empty$ and
    { skip$ }
    { this.to.prev.status
      this.status.std
      cap.status.std
      address "address" bibinfo.check *
      t empty$
        { skip$ }
        { punct.period 'prev.status.punct :=
          space.large 'prev.status.space :=
          address empty$
            { skip$ }
            { ": " * }
          if$
          t *
        }
      if$
      year empty$ month empty$ and
        { skip$ }
        { t empty$ address empty$ and
            { skip$ }
            { ", " * }
          if$
          month empty$
            { year empty$
                { skip$ }
                { year "year" bibinfo.check * }
              if$
            }
            { month "month" bibinfo.check *
              year empty$
                 { skip$ }
                 { " " * year "year" bibinfo.check * }
              if$
            }
          if$
        }
      if$
    }
  if$
}

Has anyone an idea where to place the highlight.bolden function? Any hint would be very helpful. I still could not figure out where to place it for a working solution... Thanks

  • Still having trouble finding a working solution for this :/ If anyone has an idea, I would really appreciate it.... – Richard Oct 19 '19 at 0:27
0

So, I managed to find a solution!

For the FUNCTION {book}, I added the year separately: format.date "year" output.warn and added my highlight.bolden function.

FUNCTION {book}
{ std.status.using.comma
  start.entry
  if.url.alt.interword.spacing
  author empty$
    { format.editors "author and editor" output.warn }
    { format.authors output.nonnull }
  if$
  name.or.dash
  format.book.title.edition output
  format.series output
  author empty$
    { skip$ }
    { format.editors output }
  if$
  format.address.publisher.date output
  format.date "year" output.warn   %added this line
  highlight.bolden                 %bolden year
  format.volume output
  format.number output
  format.note output
%  format.url output               %No URL Output
  fin.entry
  if.url.std.interword.spacing
}

Not to get a double year entry, I deleted the following part in the format.address.publisher.date:

FUNCTION {format.address.publisher.date}
{ publisher "publisher" bibinfo.warn } %format.address.org.or.pub.date -> deleted

So this works fine for me :) If anyone run into the same problem: Hope this helps you! Cheers

| improve this answer | |

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.