BibTeX, biblatex and biberBibTeX and \providecommand cause a problem

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
nhauser
Posts: 1
Joined: Thu Mar 25, 2010 2:06 pm

BibTeX and \providecommand cause a problem

Post by nhauser »

Hi,

I have a weird and complicated problem, and I am not sure if the BibTeX forum is the right one at all because the problem is probably not caused by BibTeX - but it origins in something that I do in BibTeX so I need help by someone who is firm in BibTeX also.

Situation
- multiple bibliographies (planned) with multibib-sty
- at this moment one .bib-File (bib-alltest.bib) and one .bst-File (bib-alltest.bst) which I implemented myself
- compiling via MikTeX from TeXnic Center

The source code ist generated in the file all.bbl and seems alright to me. In the source code which I generate via the bib-alltest.bst there is a \providecommand line which generates a command which is named according to some labels in the bib-alltest.bib entry. That is: In bib-alltest.bib there is a label 'author' and a label 'yearalph', and the resulting name of the command is \<author>Y<yearalph>.
(In the example it is \KneserYaijd - please do not care about the strange name.)


And now what I do:

I am using the bib-alltest.bst-File also for the formatting of the reference form, and for that reason I generate the new (or provided) command which produces the reference form that I want.

[The reason is the international standard family called 'Harvard Style' which demands different forms for the first and the further references, and I need to reimplement this myself, because I need a special form of the Harvard Style.]


And now the problem:

- If I look into the all.bbl the code seems allright. The \providecommand generates the command I want, and it also works.

- There is *NO* message from that MikTeX about a *LaTeX* error
(like "command \KneserYaijd already defined")
So the compiler accepts the \providecommand and accepts that the command is already there when it reaches this point for the second time.

- No!! There ist a TeX error message. The whole message text is:

Code: Select all

\c@KneserYaijd=\count92
) (all.bbl

! LaTeX Error: Command \c@KneserYaijd already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.16 ...nelse{\equal{571-625}{}}{}{, S. 571-625}.}
                                                  
Your command was ignored.
And I do not know why. Is there a problem which is caused by the \providecommand ?

By the way: the "l.16" is line 16 in all.bbl, and there is no \providecommand at all in this line ...

Please, can anyone help me ??


As attachment you will find
1) the mainfile Test.tex
2) the file with the literature bib-alltest.bib and the file all.bbl which was generated
[they are together in one file, because I can add only 3 attachments]
3) the file bib-alltest.bst (which is a little bit longer, I am afraid)


Yours,
Nico, Frankfurt, Germany
Attachments
Test.tex
Main file
(464 Bytes) Downloaded 225 times
bib-alltest.bib.txt
literature file and generated all.bll file
(1.29 KiB) Downloaded 223 times
bib-alltest.bst.txt
bib-style file
(2.35 KiB) Downloaded 260 times

Recommended reading 2024:

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

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

olofos
Posts: 56
Joined: Tue Nov 24, 2009 10:37 pm

Re: BibTeX and \providecommand cause a problem

Post by olofos »

1) When I try to compile your sample, bibtex gives me a bunch of errors. After adding the 'pages' fields to the first argument of ENTRY in bib-all.bst, it compiles OK.

2) Why do you manually input all.bbl? \bibliography already should do that for you. This is probably why \KneserYaijd gets defined twice.

3) Removing the \input command, latex instead complains that \KneserYaijd is undefined.

If I change the file from using multibib to the standard latex bibliography commands it compiles and seems to kind of work. The first \KneserYaijd gives a full reference, while another one gives an abbreviated form. However, there is no list of references.

It's not totally clear what your code is supposed to do. However, I think it would be better to not put the macros controlling the form of the citation directly in the .bbl file. This file isn't normally inputed until it is time to write out the bibliography, and I suppose you want actually cite some of the references in the text before that. Instead I think it would be better to have the .bbl file write these commands to some .aux file that is then read in at the start of the document so that your new macros are available through out the text.

Olof
Post Reply