Linking Citations to corresponding reference in Bibliography

333 views
Skip to first unread message

lreimann

unread,
Mar 28, 2010, 5:38:36 PM3/28/10
to zotero-dev
Hi all,

first I wanted to say that I like Zoteros features very much.

However, writing mainly documents for academic purposes, I would like
to ask:

if there is a possibility to Link an inserted citation (for example
[1] IEEE style) to the corresponding full reference in the
Bibliography in OpenOffice 3.2.

This feature is supported by many other software solutions like LateX.

Then, when you insert a citation, it should be possible to click on a
citation reference (like a link) and be taken to the corresponding
position within the bibliography.

This could be done by inserting internal links within the OO
document.

Maybe there is already a simple way to do this? I've searched this
group and found only old references to a feature request. Adding those
type of links manually is certainly not an option.

Also, an exported PDF may contain those links for easy reference
browsing. However, the Links which are transformed to bookmarks within
the PDF should have a meaningful name (like the original citation ID,
for example [1], [2], and so on.

I am perfectly willing to modify the code myself, but I do not know
there to start in the code at the moment. Perhaps someone could give
me a hint?

Avram Lyon

unread,
Mar 29, 2010, 3:14:54 AM3/29/10
to zotero-dev
Lars,

There is not a simple way of doing this with Zotero as it stands.

If you want to work on adding this feature, the first thing you should
do is try to create links like this from notes in the main text to
specified points in the document manually, then try to make them using
an OpenOffice macro
(http://wiki.services.openoffice.org/wiki/Documentation/FAQ/Writer).
If you can find a reliable way to create such a link using the macro
system, then you're most of the way there. You should then be able to
look at the macros Zotero uses, in the OpenOffice template file that
the word processor plugin installs, and work out how you might add the
linking behavior.

I think that this behavior would be appreciated by many, and I'm sure
you'd find plenty of willing beta testers if you start working on
something.

Avram

2010/3/28 lreimann <lars.r...@googlemail.com>:

> --
> You received this message because you are subscribed to the Google Groups "zotero-dev" group.
> To post to this group, send email to zoter...@googlegroups.com.
> To unsubscribe from this group, send email to zotero-dev+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/zotero-dev?hl=en.
>
>

bmcm

unread,
Aug 20, 2010, 4:46:24 PM8/20/10
to Avram Lyon, zoter...@googlegroups.com
Hey -

I had independently raised this issue some time ago over here:

<http://forums.zotero.org/discussion/7534/hyperlinking-citations-to-
bibliography-in-openoffice/>

but just came on this thread now.

So: since, as far as I can see, nobody else has yet addressed
this (have they?), I have now hacked a very rough
"proof-of-concept". The basic idea is to use CSL to output some
extra (meta-)markup, both in citations and bibliography items,
which contains the information needed to reliably link them (in
this particular use-case, the CSL "citation-number" variable does
the trick: we only need a label for each item that is guaranteed
unique within the one file); then, back in the ooo world we
"just" have to turn this into the correct ODT hyperlinkage.

A sample CSL file is here:

<http://ojs.aishe.org/static/csl/aishe-j-test.csl>

which "works" only in conjunction with this very crude perl
script:

<http://ojs.aishe.org/static/tools/zotero-bib-tweak.perl>

which is used to post-process the resulting ODT file to turn the
(meta-)markup into "real" ODT internal hyper-links.

(NB: That script is offered "AS IS": no warranties, support,
etc. etc. It is a proof of concept. Please don't even think of
using it in any real live workflow!)

Of course, what we really want is *not* such a standalone script,
but rather to integrate the postprocessing into the ooo zotero
extension, so that it automatically and transparently happens
"there and then" whenever citations and bibliography are touched
(rather than, as now, exposing the ugly meta-markup to the user,
until s/he closes ooo and manually re-runs the script).

Unfortunately, with the (very limited) digging I have done, I
can't immediately see where/how to integrate this postprocessing
in the ooo zotero extension. (Of course, it doesn't help that I
have never coded an ooo macro in my life...) I'm currently
looking at:

... /Zotero_OpenOffice_Integration.oxt/Zotero/Zotero.xba

and I can see (I think) that requests are all passed to Zotero
there via:

Call SendMessage(ThWnd, WM_COPYDATA, 0, cds)

What I can't see is where the result of the request gets caught
or processed back in oowriter. I'm guessing that maybe the ooo
integration extension back in firefox opens a separate
communication channel back to oowriter and "directly" writes back
into the document. Is that right? (I did try to see if I could
dig into the firefox side of this interaction; but the
integration extension there seems to be coded in java, and all I
can immediately get at are compiled .class files - have not been
able to figure out where I can see the sources of these?)

So: apologies for this probably naive question: but can anyone
help out by identifying where, if anywhere, there are hooks where
I could insert the required post-CSL (and word-processor
specific) processing into "real" hyperlinks?

(There are actually other things that one would like to handle in
a similar way: for example, applying desired, named, ooo styles
to citations or fields in the reference list etc. So I would
quite like to know how to do this...)

Of course, I may be trying completely the wrong approach here: so
if you can see a better way of doing this, please let me know!


Best regards - Barry.

skornblith

unread,
Aug 21, 2010, 4:40:48 AM8/21/10
to zotero-dev
On Aug 20, 1:46 pm, bmcm <barry.mcmul...@dcu.ie> wrote:
> Hey -
>
> I had independently raised this issue some time ago over here:
>
> <http://forums.zotero.org/discussion/7534/hyperlinking-citations-to-
> bibliography-in-openoffice/>
>
> but just came on this thread now.
>
> So: since, as far as I can see, nobody else has yet addressed
> this (have they?), I have now hacked a very rough
> "proof-of-concept".  The basic idea is to use CSL to output some
> extra (meta-)markup, both in citations and bibliography items,
> which contains the information needed to reliably link them (in
> this particular use-case, the CSL "citation-number" variable does
> the trick: we only need a label for each item that is guaranteed
> unique within the one file); then, back in the ooo world we
> "just" have to turn this into the correct ODT hyperlinkage.

This isn't really the nicest way of doing this, especially if you are
hacking the old CSL processor (which is gone in Zotero 2.1) instead of
citeproc-js (which probably doesn't need hacking, since it has APIs to
support something like this already).

There is some complication involving doing this in a nice way, since
ATM any unique item identifier will either require otherwise
unnecessary document updates (e.g. citation-number, since if you add a
new citation in between two old ones you would be forced to update the
links even if you are using an author-date style that doesn't require
you to update all subsequent citations) or could change between users
(e.g. item IDs or URIs). I need to think some more about this (or we
need to implement better item URIs, which Bruce has been nagging us
about for a while now).
Yes, that's correct. Zotero.xba merely contains an extremely ugly but
highly efficient way of telling Firefox to perform the action
associated with a particular button click. You shouldn't need to
change it at all, unless at some point you want to add more buttons to
the toolbar.

> (I did try to see if I could
> dig into the firefox side of this interaction; but the
> integration extension there seems to be coded in java, and all I
> can immediately get at are compiled .class files - have not been
> able to figure out where I can see the sources of these?)

These should be in SVN in integration/xpcom/OpenOffice/branches/3.0/
build (which is an Eclipse project files if you're interested, but you
can use whatever IDE you want).

> So: apologies for this probably naive question: but can anyone
> help out by identifying where, if anywhere, there are hooks where
> I could insert the required post-CSL (and word-processor
> specific) processing into "real" hyperlinks?
>
> (There are actually other things that one would like to handle in
> a similar way: for example, applying desired, named, ooo styles
> to citations or fields in the reference list etc. So I would
> quite like to know how to do this...)

The OpenOffice Integration trunk (integration/xpcom/OpenOffice/trunk
in SVN) edits the OOo Bibliography style and applies it to the
bibliography when used in conjunction with Zotero 2.1. If there is a
reason to do the same for the citations themselves, there's no reason
we can't do that in principle, but at the moment I haven't seen much
demand for it.

It probably makes more sense to tinker with the integration and
extension trunks (which will become Zotero 2.1 and OOo Integration
3.1), since quite a few things have changed and any patches you make
to the 2.0 branch will probably not apply cleanly.

Simon

bmcm

unread,
Aug 22, 2010, 5:47:15 AM8/22/10
to zotero-dev
Hey Simon -

> This isn't really the nicest way of doing this, especially if you are
> hacking the old CSL processor (which is gone in Zotero 2.1) instead of
> citeproc-js (which probably doesn't need hacking, since it has APIs to
> support something like this already).

Thanks! Certainly, what I did was very inelegant. I am playing
only with my installed local zotero (2.0.3), including, I guess,
the "old CSL processor". Though I'm not hacking the "processor"
per se, just a specific CSL style file; but yes, it will be great
if the new processor has built in capabilities that specifically
help with this. Though I still expect some
word-processor-integration specific tweaking will still be
necessary? (Actual implementation of document-internal
hyperlinkages - and, indeed, stylesheets - presumably differs
significantly between ooo, microsoft word etc.; so unless there
is already an abstraction layer in zotero to hide this, we'll
need to tweak the integration layers. Of course, I'm really only
a lurker here, and don't know anything substantive about the
internal zotero architecture...)

> There is some complication involving doing this in a nice way, since
> ATM any unique item identifier will either require otherwise
> unnecessary document updates (e.g. citation-number, since if you add a
> new citation in between two old ones you would be forced to update the
> links even if you are using an author-date style that doesn't require
> you to update all subsequent citations) or could change between users
> (e.g. item IDs or URIs). I need to think some more about this (or we
> need to implement better item URIs, which Bruce has been nagging us
> about for a while now).

Well, yes, there is some potential inefficiency in using
citation-number; but I wouldn't have expected this would be too
severe with "modest" numbers of references. If it were a real
problem, I guess the bookmark/hyperlink processing/updating could
be deferred to when a full "refresh" is explicitly request. But
yes, if we had access to globally unique identifiers for
references we could avoid even that. Not possible with the
current "old" CSL processor, of course...

Anyway: this was only intended as an immediate demonstration of
what the desired end-product-document would look like; and this
implementation, though clunky and fragile, actually does do just
about what I immediately need. So I think I will wait at least
for the new CSL processor to be deployed before having another
look at it.
Reply all
Reply to author
Forward
0 new messages