RTF/ODF Scan for Zotero

  • Yeah, this is in MLZ. Sorry if I posted to wrong forum.

    I am pretty excited about punctuation suppression. Thanks!

    I tend to write long footnotes with references interspersed. Sometimes I want a period, sometimes a comma, sometimes a hyphen, sometimes a colon. Double punctuation is not always detected. So I figured that if it could simply be turned off, I could punctuate my own notes, since everything is prepared in advance for output from Scrivener.

    The add-in note editor is easy to use, of course, but what I do there is not replicated back into Scrivener. I want everything "just so" in Scrivener. Sometimes, to make the flow of the text in the note "work," I have to put my comments in the suffix field attached to a different source. That makes it hard to rearrange stuff. Does this make sense? If I can control punctuation, then I can keep all comments right with the source for those occasions when I rearrange the order of a long footnote.

    It's slightly possible that I am too thick-headed to use it as is . . . .

    Thx M
  • It makes a lot of sense. Can you give an example of a case in which the comment to a source needs to be placed on the suffix of the preceding cite for things to come out correctly?
  • Example One

    (Note 1)

    Methodists: { | Dunnett, Dialogue between a Universalist and a Methodist, (1852) | | |zu:1297786:PQDTMRHS}{ | Latham, & Cook, Discussion between Rev. A. Latham, Methodist, and Rev. J. M. Cook, Universalist, (1847) | | |zu:1297786:EZVW6D2W}{ | George, An Examination of Universalism, Embracing Its Rise and Progress, and the Means of Its Propogation, (1846) | | |zu:1297786:9QQ8DF27} Baptists: { | Bulkley, & Hutchins, A Report of the Discussion Held in Newmarket, N. H. between Rev. S. C. Bulkley, Universalist, and Elias Hutchins, Freewill Baptist—Including a Reply to a Letter from Mr. Balfour, (1842) | | |zu:1297786:QG69GTFZ} Presbyterians: { | Morse, Sermons in Vindication of Universalism, By Pitt Morse, Pastor of the First Universalist Church and Society in Watertown, N.Y. 'Omnia Explorate: bonum tenete'. In Reply to 'Lectures on Universalism, By Joel Parker, Pastor of the 3d Presbyterian Church, Rochester', (1831) | | |zu:1297786:FRM76DJG} Congregationalists: { | Balfour, Letters to Rev. Moses Stuart, Associate Professor of Sacred Literature, in the Theological Seminary at Andover, (1833) | | |zu:1297786:ZRHW92SQ}{ | Rayner, Review of the Rev. Mr. Taylor's Sermon on Regeneration, Preached and Published at New Haven, 1816., (1817) | | |zu:1297786:A5NWNSPG}

    >>To get a period after each denominational list (after the Methodists list and before the word "Baptists" for instance), I had to insert "Baptists: " outside the brackets. Not ideal. Suppose I decided to swap the Methodists and Baptists list. It would be nice if I had "Methodists: " in the prefix field of the Methodist list. But I wanted a period separating the lists, since semicolons separate the items in the Methodist list--which happens to have multiple items. If I am thinking correctly, by suppressing all MLZ autopunctuation in this one multi-citation, I just put a semicolon after each source and a period in the suffix field of the final entry for each of my three lists (Methodist, Baptiist, Presbyterian) and be done with it. If I want to re-arrange lists, it is easy. The drawback, as I see it, is that it is not possible to switch seamlessly between citation styles. But I only use Chicago Full. Those nasty little competing priorities!

    Example Two

    (Note 2)

    {For example, on Father Nash, see | Finney, et al., The Memoirs of Charles G. Finney: The Complete Restored Text, (1989) | 130 |, esp. 130n64, n66|zu:1297786:TVA7VIWF}{ and | Parker, Lectures on Universalism, (1830) | |; republished in 1841 |zu:1297786:E22TQMNB}

    but suppose I wanted to say,

    (Note 3)

    {On the one hand, see | Finney, et al., The Memoirs of Charles G. Finney: The Complete Restored Text, (1989) | 130 |, esp. 130n64, n66 for Father Nash|zu:1297786:TVA7VIWF}{ On the other hand, consider | Parker, Lectures on Universalism, (1830) | |; republished in 1841 |zu:1297786:E22TQMNB}

    >>In [Note 2]

    instead of
    ". . . n66; and Joel Parker . . ."

    I want
    " . . . n66, and Joel Parker . . ."

    >>In [Note 3]

    instead of
    ". . . n66 for Father Nash; On the other hand . . ."

    I want
    ". . . n66 for Father Nash. On the other hand . . ."

    **>>It *seems* as if it would be easier to manage all inter-source punctuation myself, for selected citations. But this is purely on account of using Scrivener, and wishing to have everything "just right" in the Scrivener project. I don't know if it would be productive to suppress universally in the doc, however, seeing that the bulk of my citations are "normal."

  • To adjust inter-cite joins in a multiple citation, you can put the (internal) punctuation in the prefix. A period will override the semicolon, so you could say ". Baptists:" to keep everything inside the braces. If you rearrange things, the leading punctuation may need to be adjusted in the affected cites, but that's probably unavoidable anyway.
  • To Scrivener users,

    I think I have a fix in place for the font-size and font-family anomalies in converted documents. The fix should be tested before we make an official release.

    I have put up a copy of the modified plugin here that includes the fix. This is a temporary copy, and will be removed in a week's time. Meanwhile, if you are a Scrivener user and have run into this problem, please give the new version a try, and report back here on your results. If it does the job, we'll make a fresh release in the official channel.
  • Frank:

    Suppression. Okay; I'll use as is. Which is really pretty snazzy. Thx

    Scrivener Plugin. I'll give it a whirl.

  • Strange. When I click the cog, sometimes the pulldown list shows "RTF Scan" and sometimes it shows "RTF/ODF Scan." I noticed this a couple of days ago, before downloading the modified plugin. When it shows "RTF Scan," I do get a different menu than when it shows "RTF/ODF Scan." I am in MLZ. M
  • RTF/ODF Plugin [Don't know why I typed "Scrivener Plugin" above. No such animal.] Seems to be working okay for me. At some point previously, font sizes sometimes differed within footnotes, as I recall. They look consistent now, in a doc with about 45 lengthy footnotes. My method is (1) compile from Scrivener to RTF. (2) Open RTF in LibreOffice and save as ODT. (3) Run the ODT thru RTF/ODF Scan. (4) Open product in Libreoffice and refresh with Zotero plugin. Looks Good.

    [Off topic, but does anyone know how to eliminate the space between the footnote number and the text of the note in LibreOffice (other than manually)?]

  • edited October 7, 2014
    Tried the new version of the plugin with a Scrivener document of a 100+ endnotes – exactly in the steps mbruffey has just mentioned. Pleased to say that a) the endnotes are consistently recognized as endnote style in LibreOffice b) they are even, both in appearance (font, size) and in behaviour. This is great news; thanks. [What did the job?]
  • edited October 7, 2014
    @kithairon: Excellent, that's very good to hear!

    In an ODF file, there are styles of two types: internal (defined in the header, referenced only in document nodes); and external (defined by the word processor, referenced in the document by a standard name, like "Footnote"). Scrivener includes font-family and font-size attributes on the internal styles that it explicitly assigns to runs of text in footnotes, which are wrapped in the "Footnote" external style.

    The regexp that we use to force in the Zotero integration markup eliminates this explicit styling in footnotes that contain only a Zotero reference. LibreOffice is apparently then unable to determine what should be the default styling within Footnote nodes, and assigns the Scrivener-provided internal style to some, and the LibreOffice document default (not the LO Footnote default!) to others. One or both are set as explicit modifications of the default, so control through the Styles mechanism breaks.

    As a solution, we now convert the XML of the document content to DOM after the Zotero markup is in place, and then walk the Footnote nodes to collect the internal style attributes assigned in them. We then walk the internal styles in the document header, and remove the font-family and font-size attributes from those styles. This releases LibreOffice to assign its own default values, which can then be controlled through Styles in the usual way.

    I was stuck for a solution previously because of the awkwardness of regexp editing in the XML. There are good reasons for using regexp to add the Zotero integration markup, but it took me awhile to realize that this does not preclude a normal DOM-based transform at the final stage. D'oh.
  • @fbennet: Thanks for your work and the detailed description!
    Just left a post of the good news over in Scrivener's forum with a link to your test version.
  • edited October 8, 2014
    Thanks. If you can follow that up with a notice once the actual release comes out (so that people can reinstall to get back into the update channel), all should go smoothly. Here's hoping for a smooth road forward!
  • Will do so – and mention to re-install for reconnecting with the update channel. Was hoping to get more Scrivenerites to be testing the latest version of your plugin – and share news of your good work.
  • Yep - this is all good. Sebastian should be able to take a look during the weekend, and we'll likely release next week.
  • edited October 9, 2014
    Thanks for this plugin!!
  • The plugin is now up on the RTF/ODF Scan site, with thanks to Scrivener users who trialled the fix. If there are any problems, just let us know.
  • I'm sorry this is such a total noob question, but I'm having a hard time getting started with this. I have just started using Scrivener, although I'm pretty familiar with using Zotero along with Word. I've figured out the basic, straight-RTF route by inserting citations in Scrivener using curly brackets. But I'd like to be able to maintain active citations, and use prefixes and suffixes automatically in my in-text citations.

    I'm using Zotero Stand-alone, on Windows 7. On the zotero-odf-scan github page, it says (under Inserting Citations/From Zotero Client):

    "...You can now insert citation markers by either draging&dropping items or by using ctrl+alt+c (cmd+shift+c on Mac) to copy them to your clipboard and the paste them using ctrl/cmd+v or the right-click context menu."

    But dragging and dropping what, from what to what?
  • note that this is shift+ctrl+c now.

    Drag and drop from Zotero to Scrivener (or google doc or whatever else you're using).
  • edited October 22, 2014
    Thank you, adamsmith, for the information and for your promptness. I was just on my way back here to edit (or even delete abashedly?) my post, based on what I found here:


    which does clarify the dragging-and-dropping routine, and the syntax for the citation marker.

    It seems clear that one must have Libre Office for the next step. That's something I'll postpone for the moment, and get by with the basic Scrivener-to-RTF citation format. It seems to work fine for the basics, and contrary to indications I've stumbled across elsewhere, seems to have no problem with same-author-same-year entries.

    Thank you!
  • edited November 23, 2014

    I'm attempting to use Zotero Standalone, Scrivener, and Nisus Writer Pro on Mac OS 10.9.5 (Mavericks). Things were going just peachy (including built-in RTF scan on Zotero 4.0.23; I had been using an APA style template I modified to generate curly braces in in-text citations, and then running RTF scan to generate the bibliography and render the braces as parens.)

    Then I realized I need to cite same author/same year sources, so I downloaded RTF/ODF-Scan for Zotero (v 1.0.22) and installed in standalone. I'm noticing some odd behavior:

    1) Cmd-Shift-C does nothing (a change from prior behavior, which properly copied citation).
    2) Cmd-Shift-A copies a citation and unique identifier, e.g. { | Huxter, 2007 | | |zu:1743170:J8A4CFP7} [expected behavior is for command-c to do this?]
    3) RTF scan no longer does anything to Nisus RTF documents, nor to Scrivener-generated RTF documents. (A big problem, of course.)

    I have been simply pasting the curly-braced citations in-line into text, so the issue isn't related to RTF rendering of footnotes or endnotes (I'm using APA 6th ed.). Whether I do this from a direct-compile Scrivener RTF or a Nisus-created RTF seems to make no difference... I even created an RTF with Bean without luck.

    Please advise! I have been so happy with Zotero... and then I broke it trying to access a needed feature. Thanks.
  • I can't speak to the keyboard issues, but ODF/RTF Scan codes work only with Open Document Format files (ODF). You can save in RTF first, but it needs to be converted to ODF format before scanning. The simplest way to do that is to use LibreOffice to open and resave the file.
  • (haven't tested on a Mac but cmd+shift+c and cmd+shift+a should both work and produce the same output - that's definitely the case for the equivalent ctrl+shift+c/a on other systems. cmd+c won't do anything, though)
  • edited November 24, 2014
    Why was the addon named RTF/ODF Scan? I thought there was an RTF component to it, no?
  • The add-on does nothing with RTF, no.
    The name comes from the fact that it hooks into RTF scan and so you go from just RTF scan to ODF/RTF Scan, but it's not like we spend much time thinking about the name.
  • edited November 26, 2014
    Ah, OK. I'll convert with NeoOffice, thanks much for your prompt & kind replies.

    I'm still having this strange citation copying behavior.
    In Zotero Standalone (with the RTF/ODF and LibreOffice Integration extensions enabled, and using the Scannable Cite style), Shift-Command-C does nothing (nothing gets put on the clipboard), and Shift-Command-A copies the short in-text citation. When I disable the extensions and switch back to my modified APA style, it behaves as expected (like you said, @adamsmith).

    If I use the insert citation tool in NeoOffice, I don't run into these kinds of problems. But Scrivener is my tool of choice, and that's what I really need to have work well with Zotero. Perhaps I should just go and hit Cmd-Shift-A, but it would be better if behavior were consistent across states/styles.
  • edited November 26, 2014
    technically, Scannable Cites isn't a style but an export format, which is why its behavior is going to be the same between A and C. So there isn't any downside in using Cmd+shift+A. But obviously it should work regardless.

    I'm curious, if you leave the extension enabled and test the APA style, can you get both shortcuts to work (producing an in text citation with A and a bibliography entry with C)

    Edit: could you actually try if cmd+shift+c works for bibtex (with the ODF Scan add-on disabled, to be safe)
  • edited November 26, 2014
    APA style with extension enabled-- C and A both work as expected (short and long entries).

    Same situation, Scannable Cite format-- no response with C, A puts a citation with unique identifier and pipes on the clipboard.

    Extension disabled, Bibtex format-- no response with C, A puts a citation in SGMLish block on the clipboard.

    (I guess 'expected' just means 'habitual,' really...)
  • Extension disabled, Bibtex format-- no response with C, A puts a citation in SGMLish block on the clipboard
    OK, the issue is unrelated to our add-on then and should be reported in a separate thread.
  • Interestingly, I see the opposite behavior. Ctrl+Shift+C copies the citation, while Ctrl+Shift+A does nothing. What are your settings under Preferences -> Shortcuts? Copying a _citation_ with an export style is _not_ supposed to work though https://github.com/zotero/zotero/blob/4.0/chrome/content/zotero/zoteroPane.js#L1858 (we should probably fix that so that both shortcuts do the same thing)
  • Hey guys, first, thanks for the effort you put into this add on - it certainly is far superior to the RTF scan capabilites of vanilla Zotero.

    I just wanted to ask/suggest a thing that I've encountered when trying to cite book sections (itemType: "bookSection"): When doing this, it will take into account all creatorTypes, thus not only the author(s) but also editors, translators etc. when copying a citation into a document. While this will not affect the correct format of citation in the end, for my own convenience it makes a lot of sense to have the actual author(s) of a book section in the citation.

    Is there any way this could be implemented in future releases, so that book sections ignore the editors of the superordinated book?

    I have "tampered" with the JS myself, and made a special condition for the itemType "bookSection", and it works for now, but I am sure you can make this a way better solution.
Sign In or Register to comment.