BibTeX, biblatex and biberPlace a character ahead of a list item

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Place a character ahead of a list item

Post by kaiserkarl13 »

Is there a general, robust way of adding a character to the beginning of all items in the (numbered) bibliography? What I'm looking for is something like

References
S1. Last, First. Title Volume (number): pages (year).
S2. Last2, First2. Title2 Volume2 (number2): pages (year).

This would be similar to redefining table and figures to be Table S1 and Figure S1, etc., which can be done by

Code: Select all

\renewcommand{\thetable}{S\arabic{table}}
\renewcommand{\thefigure}{S\arabic{figure}}
This would be very helpful when preparing references for supplementary information to a journal article (which prevents them from getting confused with the citations from the main text).

Thank you!

P.S. The specific document I'm using now uses the article class with the achemso package and associated BibTeX style.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Place a character ahead of a list item

Post by gmedina »

Hi,

you could make a simple redefinition of the \@biblabel command as defined in the article class. The following code shows this approach:

Code: Select all

\documentclass{article}

\makeatletter
\renewenvironment{thebibliography}[1]
     {\section*{\refname}%
      \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
      \list{\@biblabel{S\@arabic\c@enumiv}}%just add here the character "S"
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother

\begin{document}

\begin{thebibliography}{9}
  \bibitem{key1} test item1 
  \bibitem{key2} test item2 
  \bibitem{key3} test item3 
\end{thebibliography}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Place a character ahead of a list item

Post by localghost »

The thebibliography environment is internally a simple list. Try to redefine the label in the fourth level of that list right before inserting your bibliography section.

Code: Select all

\renewcommand\theenumiv{S\arabic{enumiv}}

Best regards
Thorsten¹
Post Reply