Edit Vancouver with Brackets Style to include PMIDS from Pubmed

Hi Everyone:
I have a library patron who has written some book chapters for publication and used Zotero for citations and bibliography. Upon submission of the manuscripts, they were instructed to include pmids from Pubmed with the citations in the bibliography.

It looks like the pmids are stored in the Extra field in the Zotero citation Info pane. What is the best way to achieve this? The style used is Vancouver (brackets)--I guess the style needs to be edited to add the Extra field?
Thank you!
  • edited July 10, 2017
    Hi Adam!
    i took this from the nlm grant style (changing the macro to get pmid first and alternatively PMCID):
    <macro name="pmid">
    <text variable="PMID" prefix=" PMID: "/>
    <choose>
    <if variable="PMID" match="none">
    <text variable="PMCID" prefix=" PMCID: "/>
    </if>
    </choose>
    </macro>

    and inserted it into the vancouver brackets style in notepad++. i saved it as csl. When i try to install it in my zotero standalone (the new beta version)--i get this message:
    Install style "Vancouver (brackets) with pmid" from (null)?

    If i click install i get this message:

    "%S" is not a valid CSL 1.0.1 style file, and may not work properly with Zotero...are you sure you want to continue?

    i finally got it to save in zotero after several tries but it is not inserting the pmid into bibliography! I'm sure of done something wrong!
  • edited July 10, 2017
    the code did not load apparently:

    <macro name="pmid">
    <text variable="PMID" prefix=" PMID: "/>
    <choose>
    <if variable="PMID" match="none">
    <text variable="PMCID" prefix=" PMCID: "/>
    </if>
    </choose>
    </macro>
  • removed greater than less than from the code....

    macro name="pmid"
    text variable="PMID" prefix=" PMID: "/
    choose
    if variable="PMID" match="none"
    text variable="PMCID" prefix=" PMCID: "/
    /if
    /choose
    /macro
  • edited July 10, 2017
    you need to put code in <code> </ code> brackets for it to render. But the %S suggests something more fundamentally is going wrong. Have you tested the style in the editing pane? https://www.zotero.org/support/dev/citation_styles/reference_test_pane
  • Hi Adam!
    Thank you for the test pane suggestion---It helped to test it and I think the style is working now. I looked in more detail in the xml and had left out a line further into the style. Adding that line--text macro="pmid"/--to the csl file makes it insert the pmid into the references in the bibliography.

    I still get those messages though when I load the csl file into Zotero! Even though it seems to be working ok---do you think those messages might still mean something is wrong?
  • yeah, the messages means something is still wrong, most likely with the info section. If you paste the style to gist.github.com (no need to register)--> Create secret gist --> post the URL here I can take a look
  • Hi Adam:
    here is the github link:
    https://gist.github.com/anonymous/c09dba7377e4de96aeb23a851e811262

    Specifically, I edited lines:
    3-4 (added the text "with pmid")
    283-290 inserted these lines from the NLM grant style you suggested. Changed the original macro by changing PMCID to PMID so that it would insert PMID first then PMCID
    362 changed the text macro from pmcid to pmid

    I really appreciate you looking at this!
  • edited July 11, 2017
    Use this to make your style indented properly: http://formatter.citationstyles.org/
    and I would keep ID and self-link as: ...vancouver-brackets-with-pmid (not sure if it allows spaces, but they should match anyway)
  • yeah, the ID needs to be a URI; the spaces are causing that weird message you're getting (the formatting is just helpful, not required).
  • Thank you all very much for your help with this!
Sign In or Register to comment.