BibTeX, biblatex and bibersuppress label in \bibitem

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
alt78
Posts: 2
Joined: Fri Dec 12, 2014 5:23 pm

suppress label in \bibitem

Post by alt78 »

Hello all!

BiBtex generates bibitem with optional label field, in []:

Code: Select all

\bibitem[Christen and
  Carlen(2000)]{ChristenCarlen2000}\selectlanguageifdefined{english}
\BibEmph{Christen~T., Carlen~M.~W.} Theory of ragone plots~//
  \href{http://dx.doi.org/10.1016/S0378-7753(00)00474-2}{\BibEmph{Journal of
  Power Sources}}. \BibDash
\newblock 2000. \BibDash
\newblock Vol.~91, no.~2. \BibDash
\newblock P.~210--216.
I need bibitem without label, like this:

Code: Select all

\bibitem{ChristenCarlen2000}
\selectlanguageifdefined{english}
\BibEmph{Christen~T., Carlen~M.~W.} Theory of ragone plots~//
  \href{http://dx.doi.org/10.1016/S0378-7753(00)00474-2}{\BibEmph{Journal of
  Power Sources}}. \BibDash
\newblock 2000. \BibDash
\newblock Vol.~91, no.~2. \BibDash
\newblock P.~210--216.
What should I do?

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

suppress label in \bibitem

Post by Stefan Kottwitz »

Hi,

and welcome to the forum!

Do you have a small compilable example showing the topic where we can work on making the desired fix?

Well, mir first idea is to redefine \bibitem so that it just does takes the optional argument but does nothing with it.

Stefan
LaTeX.org admin
alt78
Posts: 2
Joined: Fri Dec 12, 2014 5:23 pm

suppress label in \bibitem

Post by alt78 »

:) Solve problem with perl, simply cutting construction in [] brackets after \bibitem:

Code: Select all

#!/usr/bin/perl
#(k)

$newfile = $ARGV[0]."_cpy";
rename $ARGV[0], $newfile;
unlink $ARGV[0];
open(my $fh, '>', $ARGV[0]);


open (CONF1, $newfile);
@lines_text = <CONF1>;
close CONF1;

$flag=0;
foreach $line (@lines_text){
   if ($flag==1) {
   	$line_obr=~s/\n//g;
   	$line_obr = $line_obr.$line;} #concatenate with prev str
   else {$line_obr=$line;} #read new string
   
   if ($line_obr=~m/^\\bibitem/ and $line_obr=~m/\]/ and $line_obr=~m/\[/){
    	#Here \bibitem, [, ] - cut symbols between []
    	$line_obr=~s/(.*)\[.*\](.*)/$1$2/;
    	$flag=0;}
   elsif ($line_obr=~m/^\\bibitem/ and $line_obr=~m/\[/){
   	$flag=1;} # begin concatenate

   if ($flag==0) { print $fh "$line_obr";}
}
unlink $newfile;
close $fh;
Last edited by Stefan Kottwitz on Sun Dec 28, 2014 2:09 pm, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: suppress label in \bibitem

Post by Stefan Kottwitz »

Perl is great! I added Perl syntax highlighting. :-)

Thank you for telling us your solution!

Stefan
LaTeX.org admin
Post Reply