22

Is it possible to change the behaviour/settings of bibtex so that the title (of a book, article, paper, thesis, etc.) is always italic and everyhing else (e.g. author, journal, edition, etc.) is always upright?

Basically: enter image description here

Minimal working example:

Latex File:

\documentclass{article}
\begin{document}
I cite ~\cite{Bre89}.
\nocite{*}
\bibliography{Master}
\bibliographystyle{alpha}
\end{document}

Master.bib:

@book {Bre89,
    AUTHOR = {Bressoud, David M.},
     TITLE = {{Factorization and Primality Testing}},
    SERIES = {Undergraduate Texts in Mathematics},
 PUBLISHER = {Springer-Verlag},
   ADDRESS = {New York},
      YEAR = {1989},
}
@article {CEP83,
    AUTHOR = {Canfield, E. R. and Erd{\H{o}}s, Paul and Pomerance, Carl},
     TITLE = {On a problem of {O}ppenheim concerning ``factorisatio
              numerorum''},
   JOURNAL = {J. Number Theory},
  FJOURNAL = {Journal of Number Theory},
    VOLUME = {17},
      YEAR = {1983},
    NUMBER = {1},
     PAGES = {1--28},
}

My bib-file is actually much larger, so solutions that would involve me changing every single entry would not be ideal.

2 Answers 2

20

Make a copy of alpha.bst and call it myalpha.bst. In myalpha.bst, search for

FUNCTION {format.title}
{ title empty$
    { "" }
    { title "t" change.case$ }
  if$
}

and replace it with

FUNCTION {format.title}
{ title empty$
    { "" }
    { title emphasize "t" change.case$ }  
  if$
}

Note that addition of emphasize.

Now search for

FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { journal emphasize "journal" output.check
      format.vol.num.pages output
      format.date "year" output.check
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  new.block
  note output
  fin.entry
}

and replace with

FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { journal "journal" output.check
      format.vol.num.pages output
      format.date "year" output.check
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  new.block
  note output
  fin.entry
}

Here, emphasize is removed from the line: journal emphasize "journal" output.check to prevent journal title from becoming emphasized.

Don't forget to use \bibliographystyle{myalpha}.

Code:

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{Master.bib}
@book {Bre89,
    AUTHOR = {Bressoud, David M.},
     TITLE = {{Factorization and Primality Testing}},
    SERIES = {Undergraduate Texts in Mathematics},
 PUBLISHER = {Springer-Verlag},
   ADDRESS = {New York},
      YEAR = {1989},
}
@article {CEP83,
    AUTHOR = {Canfield, E. R. and Erd{\H{o}}s, Paul and Pomerance, Carl},
     TITLE = {On a problem of {O}ppenheim concerning ``factorisatio
              numerorum''},
   JOURNAL = {J. Number Theory},
  FJOURNAL = {Journal of Number Theory},
    VOLUME = {17},
      YEAR = {1983},
    NUMBER = {1},
     PAGES = {1--28},
}
\end{filecontents*}
\begin{document}
I cite ~\cite{Bre89}.
\nocite{*}
\bibliography{Master}
\bibliographystyle{myalpha}
\end{document}

enter image description here

Follow the same strategy to add/remove emphasizing/removing emphasis as your wish.

7
  • 1
    Thanks, Harish. Your answer teaches something to me, too. +1 :-) Jul 7, 2013 at 5:17
  • one follow-up question: where do i safe this new myalpha.bst? in the same folder as my tex-file or in the original folder C:\Program Files\MiKTeX 2.9\bibtex\bst ?
    – Phil-ZXX
    Jul 7, 2013 at 11:00
  • Ah, I left it in the original bibtex\bst folder and refreshed my Miktex settings: "Refresh FNDB" and "Update Formats". Now it works!
    – Phil-ZXX
    Jul 7, 2013 at 11:04
  • @Tom That is a bad idea to put your personal things in miktex folder. That is why we have the concept of localtexmf. Please search this site for details and use it for this case also. Or if it only for once, put the bst file in the same folder as your tex file.
    – user11232
    Jul 7, 2013 at 12:55
  • @karlkoeller You made me to blush. I don't think I know as much as you do. Thanks for the kind words :)
    – user11232
    Jul 7, 2013 at 12:56
5

One solution, if you don't want to manually create a .bst file on your own, is to replace the alpha style with the corresponding one provided by the AMS: the amsalpha style.

So, just replace

\bibliographystyle{alpha}

with

\bibliographystyle{amsalpha}

and you should have what you want.

Note, however, that this style changes also other things in the formatting of the bibliography entries.

2
  • Mhm, amsalpha changes more things than i would like it to. But you mentioned .bst files. Could I just use the alpha.bst as a draft for my own bst-file so that titles will always be italic?
    – Phil-ZXX
    Jul 6, 2013 at 15:27
  • I'm not skilled in creating .bst files, but the answer is yes, if you are. Otherwise, you can try to run tex makebst for creating your own bibliography style. Jul 6, 2013 at 15:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .