# above n references broken

EDIT: Added the complete cite macro from my aglc2.cbx file.
EDIT: Added the cite:save macro as suggested by domwass
UPDATE: I think I have this solved now. Key was as @domwass suggested to create a cite:save macro. Updated code is below

• tmp.tex - contains sample code
• tmp.pdf - this is what it looks like
• bibliography.bib - needs no introduction
• lawessay.cls - lawessay style I use for the tex source (adapted from Will Hardy's style)
• aglc2.bbx - BBX file for the lawessay style
• aglc2.cbx - CBX file. The code snippet below comes from this

Hi, I think this is a newbie question. In my biblatex cite macro I have this code:

\newbibmacro*{cite:save}{%
\csxdef{cbx@\thefield{entrykey}}{\the\value{instcount}}%
\label{cbx@\the\value{instcount}}%
}

\newbibmacro*{cite}{%
\global\boolfalse{cbx@loccit}%
\ifciteseen
{%
\iffieldundef{shorthand}
{%
\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{%
% citeibid is true and this citation has been seen on this page previously
% and citation is in a footnote
\usebibmacro{cite:ibid}%
} {%else
% either citeibid is false or this is the first time the citation appears
\ifthenelse{$$\equal{\thefield{entrytype}}{jurisdiction}\or% \equal{\thefield{entrytype}}{legislation}\or% \equal{\thefield{entrytype}}{legal}$$%
\or\not\ifciteseen}
{%
% If the entry is a jurisdiction or legislation or legal
% or if the citation has not been seen before
% ie: this is how to print a first citation.  Legislation, legal and
% jurisdictions are always printed as though they were a first citation.
\usebibmacro{cite:short}%
} {% else
% Must be something else or a subsequent citation
\usebibmacro{author/editor:surname}%
\ref{cbx@\csuse{cbx@\thefield{entrykey}}}%
}
} {%
% shorthand field is defined
\usebibmacro{cite:shorthand}%
}
}
} {%
% citation has not been seen before
\usebibmacro{cite:full}
}
}


So when a footnote is printed as ...'above n xx' the xx is the page number. How can I set it to be the footnote number?

-
You are explicitly asking for the page number because of the pageref. – Martin Scharrer Apr 12 '11 at 10:58
Yes but I want the footnote number instead. How do I do that? – Mark Ferraretto Apr 12 '11 at 11:01
No idea. You should add a minimal example that shows how you are using \cite with \footnote. At the moment it is very hard to see what's going on. – Martin Scharrer Apr 12 '11 at 11:06
@Martin I have edited the original post – Mark Ferraretto Apr 12 '11 at 11:17
Oh sigh I have been on this all morning and it's driving me nutty. If I replace \printlist[last]{pageref} with \the\value{instcount} I get the footnote number of the previous time the item is cited but not the first time it is cited. – Mark Ferraretto Apr 13 '11 at 3:51

Before you refer back to the first citation of an entry, you have to save the information. In order to do that, you could create a bibmacro:

\newbibmacro*{cite:save}{%
\csxdef{cbx@\thefield{entrykey}}{\the\value{instcount}}}


You then have to call this bibmacro in the cite-bibmacro, in the second mandatory argument of the \ifciteseen test (and thus, only when the entry is cited for the first time):

\newbibmacro*{cite}{%
[…]
\ifciteseen
{[…]}
{[…]
\usebibmacro{cite:save}}}


Now, every time you want to refer back to the first entry, you use the following lines:

\bibstring{seenote}\addnbspace
\ref{cbx@\csuse{cbx@\thefield{entrykey}}%
***\label{cbx@\the\value{instcount}}***}


Thus, the bibmacro that you posted could be modified as follows (I have not tested it!):

\newbibmacro*{cite:save}{%
\csxdef{cbx@\thefield{entrykey}}{\the\value{instcount}}}

\newbibmacro*{cite}{%
\global\boolfalse{cbx@loccit}%
\ifciteseen
{%
\iffieldundef{shorthand}
{%
\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{%
% citeibid is true and this citation has been seen on this page previously
% and citation is in a footnote
\usebibmacro{cite:ibid}%
} {%else
% either citeibid is false or this is the first time the citation appears
\ifthenelse{$$\equal{\thefield{entrytype}}{jurisdiction}\or% \equal{\thefield{entrytype}}{legislation}\or% \equal{\thefield{entrytype}}{legal}$$%
\or\not\ifciteseen}
{%
% If the entry is a jurisdiction or legislation or legal
% or if the citation has not been seen before
% ie: this is how to print a first citation.  Legislation, legal and
% jurisdictions are always printed as though they were a first citation.
\usebibmacro{cite:short}%
} {% else
% Must be something else or a subsequent citation
\usebibmacro{author/editor:surname}%
\ref{cbx@\csuse{cbx@\thefield{entrykey}}}%
}
} {%
% shorthand field is defined
\usebibmacro{cite:shorthand}%
}
}
} {%
% citation has not been seen before
\usebibmacro{cite:full}%
\usebibmacro{cite:save}%
}
}


But note that this does only work if every citation is inside a footnote. If you also cite in the text, and the first citation of an entry is in the text and not in a footnote, the reference won’t work. This is why biblatex’s style verbose-note differentiates between citations in footnotes and citations in the text. Thus, the code there is a little bit more complicated.

-
many thanks. I will try this and let you know how it goes. I had another question. How do you know this? I have been through biblatex.pdf and have been searching but I can't find any instruction on anything like what you just did. Is this kind of stuff documented anywhere? – Mark Ferraretto Apr 13 '11 at 15:26
@Mark: Well, I use biblatex quite from the outset of its development, and I have written some biblatex styles, so I know of some internals that a normal user does not have to bother with. In this particular case, I knew that a similar functionality is provided by verbose-note, and thus I had a look into verbose-note.cbx and adapted the code a bit. – domwass Apr 13 '11 at 15:34
It has been a long time but I finally got round to implementing this (another assignment due!). From what I can gather the cite:save macro runs correctly and only runs the first time. But the subsequent references show a '??' instead of the number. I suspect this means it either isn't saving the reference or can't retrieve it. Would you mind sending some pointers on how I can debug this? I have worked out that entrykey' and instcount' are correct at the time cite:save' is run but I can't work out how to troubleshoot the retrieval part. – Mark Ferraretto Apr 3 '12 at 8:35
Could you add a minimal example with the code that you have so far? – domwass Apr 3 '12 at 14:23
I have this sorted I think. The cite:save macro was missing a label command (I found this in your footref macro in footref-dw). Adding that \label` seems to have fixed things. I have modified the snippet above to reflect this. – Mark Ferraretto Apr 3 '12 at 23:58