RTF/ODF Scan for Zotero

  • right, that's the title we used for the add-on originally, since it adds ODF scan functionality to the RTF scan box. Either way -- as a general rule for the Zotero forums, when in doubt better to start a new thread.
  • Can the setting "extensions.zotero.translators.ODFScan.includeTitle" be adjusted to IncludeShortTitle instead? Thx, Mark
  • I just realized that mutliple citations do not work particularly well with reverse scanning. I see that when I reverse scan a document, they multiply. Specifically something that used to be
    { | Shen-Orr, et al., 2010 | | |zu:2130326:GDBTIV54}{ | Sugino, et al., 2014 | | |zu:2130326:8J8XND8X}
    {| Sugino, et al., 2014; Shen-Orr, et al., 2010 | | |zu:2130326:GDBTIV54}{ | Sugino, et al., 2014; Shen-Orr, et al., 2010 | | |zu:2130326:8J8XND8X}

    Is there a way to prevent this from happening?
  • @OganM: Yeah, that's a known anomaly. It's not actually replicating the cites, only the human-readable placeholder text, which isn't relevant to the conversion. When the Zotero conversion is run again, the citations will be correct.

    We could actually try to fix this up a little, by splitting the text on the semicolon delimiters and redistributing the cites across the ODF Scan objects. I'll make a note to look into that the next time I dig into the code, but for now it at least isn't breaking the round-trip conversion.
  • @mbruffey: That's a good idea.
  • @Frank: Thanks! Or, set it to include the contents of the "extra" field, where a custom code could be located: IncludeExtra ??
  • edited November 14, 2018
    I am having trouble with the hyperlink function. My cites look like this:

    { | Kysar, et al., (2006) |115| |zotero://select/items/0_SG5DM29B}

    Previously, when I right clicked on the zotero://select/items/0_SG5DM29B, it would take me to the item in freestanding Zotero.

    I then reinstalled Firefox for other purposes, and the link would then open Firefox. I have now removed Firefox, but now nothing works with the hyperlink.

    Could somebody please advise me how to set up the hyperlink function again?

    EDIT: In case the 'Open URL' functionality is useful to anybody else, I've found how Frank advised me to do it. It was using the RCDefaultApp program: http://www.rubicode.com/Software/RCDefaultApp/ though I think there have been some issues with getting RCDefaultApp to work with the latest versions of Mac OSX. That said, I've reinstalled OSX and the 'Open URL' functionality for cites in the above hyperlink format seem. to work right out of the box with Zotero.

    NB: As Sebastian has kindly pointed out, you can switch between the zu:12345 and the hyperlink functionality (zotero://select/items/0_SG5DM29B) as follows:

    Set the hidden prefence extensions.zotero.translators.ODFScan.useZoteroSelect to true (hidden preferences are accessible from Advanced Configuration / Config Editor in the Advanced tab of the Zotero preferences).
  • I'm no longer able to make this work. I save a Google Docs file to odt. No problems. When I open the doc, I 'see' the live links that refer to the Zotero group library. They're highlighted in dark grey, and when I hover over them, I see the link on the zotero.org website. But from then on, whatever I try to do, I don't 'see' anything. When I try to change styl,s nothing happens. When I try to generate a bibliography, I just get {Bibliography}. Also, when I try to edit a cite, I get an error box "You must place the cursor in a Zotero citation to edit it" (despite the fact that my cursor WAS in the citation). And when I then try to save into Word, all live fields get lost. Any ideas about what I could be doing wrong? Thanks
  • it sounds like you're maybe missing a step. Could you say exactly what you're doing step by step?
  • (those instructions are missing a step to convert Reference Marks to Bookmarks before opening in Word, but that doesn't seem like it'd matter for the issue before).

    So, have you made sure the LibreOffice add-on is still working otherwise (like you're able to add citations and insert a bibliography)?

    Is this true for a minimal working example with just a couple of citations?
  • edited November 16, 2015
    I just tried adding a citation. The dialogue box opens. When I type in an author (from that Zotero group), it finds it and inserts it (Author, Yr). But then it starts going through the entire document and telling me that the 'highlighted citation no longer exists in your Zotero database'. Does that provide any additional clues?And btw - that step you mention with picking the 'bookmarks'is not documented here either - http://zotero-odf-scan.github.io/zotero-odf-scan/ I did find it in the forum, and tried it. But first off, it was greyed out for the 'standard' citation style we used; and secondly, when I selected another style where I COULD select bookmark, it made no difference.
  • how about that minimal working example? What you're seeing when inserting a new item sounds like what'd happen when the items in the group aren't synced to the Zotero version you have LibreOffice connected to.

    (Bookmarks are only necessary for using the document in Word. That's generally the case for all Zotero documents used in both LibreOffice and Word and so we don't document it separately. Bookmarks don't work for footnotes in LibreOffice, so that makes the moving back&forth rather more complicated if you're using such a style, but that has nothing to do with ODF scan).
  • edited November 16, 2015
    Ha. I think the sync may indeed be the problem. Just noticed the yellow exclamation triangle saying that there was a storage issue. So that must be it then. I should be able to fix that tomorrow.
    On the 'bookmarks' issue - is there a workaround? Could we temporarily convert all footnotes to endnotes in LibreOffice (Tools|Footnotes & Endnotes|Footnotes|End of document); apply the style, save it as a word doc; and then reconvert the endnotes to footnotes there?
    Also, what do you recommend on the 'store references in documents' options for those of us who use Zotero groups in teams?
    And just to sketch our user case: we work with teams from across the world, who work collaboratively on Google Docs with scannable cites from shared Zotero groups. Once we have the final text ready, we take it from Google Docs into Microsoft Word for the final formatting bits. This is where this entire issue arises. So any help would we grealy appreciated. And we'd be happy to adjust 'our' (more detailed step-by-step) instructions and to share those with others who run into similar problems.
  • storage shouldn't really affect sync, but let us know if that doesn't fix it.

    As for Word -- one question is if you need live Zotero citations in Word. If you don't, all of this is mute. Using Word won't remove the text, it'll just remove any connection to Zotero.

    If you do need live Zotero citations, I think the only method is to change to an in-text style (doesn't matter which), switch to bookmarks, open in Word, switch to fields (the analogue to Reference Marks in LO), and switch back to your preferred style. I'm pretty sure just using Endnotes won't do.
  • I will let you know.

    And as to Word, yes, we would like live citations. I'll try what you recommend tomorrow and will report back. Thanks Sebastian!
  • As I was still struggling with this, I noticed that some of the first (Chicago full note) references were linked to a personal and not a group library. That probably threw Zotero 'off'. I have now extracted a few pages that have the 'right' links to the group, and with that smaller excerpt at least the usual bibliographical functions like inserting a note, creating a bibliography, switching of styles, etc. all work swimmingly. Including Sebastian's suggestions. So we now have 'live', 'full note' citations in Word! Thanks much...
    So if any of this doesn't work for some of you: try to double-check whether all 'live' links are correct! That's where we made the mistake, which we can now 'fix'.
  • I am using this great plugin to format citations exported in a document exported from another format. This is for course syllabi, with online readings, so I want to have clickable "live" URL's in the document. Currently, in order to do this, I need to put hte cursor at the end of each URL and activate autoformat by pressing the space key. This gets tiresome.

    Is there any way to get Zotero to create these links automatically? Can I, for instance, change the CSL stylesheet to do this? The difference in content.xml is pretty simple -- this:

    <text:span text:style-name="T3">, December 11, 2015, https://medium.com/backchannel/how-elon-musk-and-y-combinator-plan-to-stop-computers-from-taking-over-17e0e27dd02a#.oj5fflmmn.</text:span>;

    vs this:

    <text:span text:style-name="T3">, December 11, 2015, </text:span>
    <text:a xlink:type="simple" xlink:href="https://medium.com/backchannel/how-elon-musk-and-y-combinator-plan-to-stop-computers-from-taking-over-17e0e27dd02a#.oj5fflmmn" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">https://medium.com/backchannel/how-elon-musk-and-y-combinator-plan-to-stop-computers-from-taking-over-17e0e27dd02a#.oj5fflmmn</text:a>;
    <text:span text:style-name="T3"> .</text:span>

    (Zotero forum seems to add links just fine! but of course I am trying to show just plain-text xml here.)

    I appreciate any hints!
  • Coding html or xml into CSL styles doesn't really work, no. Zotero tries to treat anything you put into affixes as plain text, which means it'll escape elements like < or >, so you just end up with gibberish.

    But if you're in LibreOffice, just selecting the whole document and doing Format-->AutoCorrect-->Apply should work to activate URLs.
  • Thanks Adam. AutoCorrect --> Apply didn'tseem to get it for some reason, but I wrote a short macro that sort of works. will stick with that for now I guess. Many thanks!
  • @adamsmith, way back on February 23, 2014 (https://forums.zotero.org/discussion/29308/5/rtfodf-scan-for-zotero/), you said, "We use ODF because we're both using linux, so it's the obvious choice, but if someone were motivated to do it, the same functionality could be implemented for DOCX, which is also an xml format. It just won't be either Frank or me."

    I use Microsoft Word because it has many advanced features (including some proprietary addins that I regularly use), and all my coauthors either use Word or Latex--none uses LibreOffice. So, I would really love to have a DOCX Scan feature.

    I'm willing to consider extending the code to add DOCX scan functionality (emphasis on "consider"). Could you please point me to how I could look into what would be involved (i.e. codebase, documentation, etc.)?
  • The code lives here:
    and the key part to modify would be
    in particular rtfScan.js

    (just to be clear -- you are aware that there is a Word add-on for Zotero itself, right? My above statement refers specifically to this add-on).
  • Thanks. I'll study the code a bit and then see if it's feasible (for me).
    (just to be clear -- you are aware that there is a Word add-on for Zotero itself, right? My above statement refers specifically to this add-on)
    Yes, I fully understand that we're talking about extending the RTF/ODF Scan addon to scan a Microsoft Word document with plain text codes like
    {See | Smith, (2012) |p. 45 | for an example |zu:2433:WQVBH98K}
    and turning them into Microsoft Word Zotero fields like
    (See Smith, 2012, p. 45 for an example)
  • @chituokol1: It would be really nice to get the scan working with DOCX files. I'd be happy to advise if the code needs explaining.
  • @fbennett: Thanks for the offer. I don't have the time right now, but later this summer I hope to look into this more in-depth.

    Actually, based on my initial examinations, I'm wondering whether updating this plugin for Word scanning might be the best way to go. I'm considering that it might be more effective (and much easier) to directly add Visual Basics for Applications (VBA) code in the zotero.dotm macro file to do the scanning and field creation. I'm thinking of using the same first step as RTF/ODF Scan to create the text codes using the same format, but then doing the scanning from within the [modified] existing Word Integration plugin.

    One main advantage of this approach is that it would be possible to take advantage of the Microsoft-provided tools and API for searching and modifying their own text and creating fields, rather than trying to parse their XML format from scratch. (Parsing their XML from scratch, among other things, would involve trying to adapt or replicate your amazing [crazy amazing] regex, but Office XML has some revision tracking features that would probably make parsing it much more complicated than parsing ODT.)

    Would you have any thoughts on this general approach? I know it's fundamentally different from the approach you've taken for ODF, but I'm wondering if it might make more sense for Word files.
  • I think using VBA makes a lot of sense. The only trouble might be finding the markers in the scanned document. I haven't done much VBA, but I've found the regex support wanting, to put it mildly (but maybe that's just because I didn't look in the right places).
  • I'll look into this in more detail when I have some time later this summer. I haven't done regex in VBA before, but I don't think it should be a problem.
  • The regexp in the plugin is indeed crazy - working in DOM or a DOM-like structure (which I guess is what a VBA implementation would do) is better engineering, and would assure that inserts are valid.

    The reason I went with regexp against the serialized document for ODT was that the word processor scatters span tags (in a variety of patterns) between the squiggly braces. It was easy to ignore them with regexp, but I wasn't able to figure out how to reliably identify the fragmented text pattern in the DOM. If you're able to work it out in VBA, that would be great; the conversion itself should be straightforward.
  • The plugin used to work till recently, but now I can't select a file (the field for file selection is greyed out). Running Firefox 46.0 on Ubuntu 14.04 and Zotero The latter two have not been updated since the last time this worked. Not sure Firefox has been updated since then.
  • edited May 5, 2016
    There was some legacy code in there. I've patched things up and made a release. If you reinstall from here it will work again.
Sign In or Register to comment.