HOWTO: edit citation styles for use in Mendeley

[Editor’s Note–We thought you’d like to know: this 2011 post is a bit dated. Find current info on Mendeley’s citation abilities here, and details about editing citation styles in the Mendeley Guides.]

Mendeley uses the Citation Style Language v1.0 to format citations and bibliographies in our Word and OpenOffice plugins. Although we provide styles for 1000+ journals, we realize this isn’t enough for everyone. If you need to customize a citation style and are not scared of editing a little XML (it’s actually not that difficult), read on…

Default styles location

After first installing Mendeley Desktop, 15 commonly used .csl files are placed in the following location: (may differ depending on your system configuration)

  • Windows

C:Program FilesMendeley DesktopcitationStyles-1.0

  • GNU/Linux with Debian packages

/opt/mendeleydesktop/share/mendeleydesktop/citationStyles-1.0

  • Generic GNU/Linux

<INSTALL_PATH>/citationStyles-1.0

  • Mac OS X

/Applications/Mendeley Desktop.app/Contents/Resources/citationStyles-1.0

Custom styles location

To search for more styles, go to the View menu and choose Citation Style -> More Styles….

These additional style files will be placed here: (may differ depending on your system configuration)

  • Windows Vista and Windows 7

C:Users<USER_NAME>AppDataLocalMendeley LtdMendeley Desktop citationStyles-1.0

  • Windows XP

C:Documents and Settings<USER_NAME>Local SettingsApplication Data
Mendeley LtdMendeley DesktopcitationStyles-1.0

  • GNU/Linux

~/.local/share/data/Mendeley Ltd./Mendeley Desktop/citationStyles-1.0

  • Mac OS X

/Users/<USER_NAME>/Library/Application Support/Mendeley Desktop/
citationStyles-1.0

Tutorial: Editing an existing style

Let’s say you’re writing a paper for a new conference, where the organizers have demanded you use the “American Sociological Association” style, but using square brackets instead or parentheses for in-line citations. So instead of this:

(Andersson et al. 2004)

You need to write this:

[Andersson et al. 2004]

Step 1: Create a new style file

Locate the asa.csl file by referring to the “Default styles location” above. Copy this file to the “Custom styles location” above.

NOTE: Never edit the installed files directly, always create a copy first.

Give the file a new name, say asa_custom.csl

Open the file in your favorite text editor (for Windows, try Notepad++) and change the 4th and 5th lines from:

<title>American Sociological Association</title>

<id>http://www.zotero.org/styles/asa</id&gt;

to:

<title>American Sociological Association (custom)</title>

<id>http://www.zotero.org/styles/asa_custom</id&gt;

(or something of your own choosing, the important thing is to ensure the id is unique. No two styles are allowed to have the same id, as Mendeley will not be able to load one of them)

Step 2: Customize the style formatting

Don’t worry about understanding everything in the CSL files right away. For now, just know that the bit describing the format of in-line citations starts with “<citation …>” and ends with “</citation>”, which is from line 120 to 130 in your asa_custom.csl file.

To change the parentheses to square brackets, change line 121 from:

<layout prefix=”(” suffix=”)” delimiter=”; “>

to:

<layout prefix=”[” suffix=”]” delimiter=”; “>

Save your edited style file.

Step 3: Use the new style in Mendeley

Restart Mendeley Desktop. Open a new Word or OpenOffice document and select “More Styles…” from the citation style drop-down box. In the dialog that appears you should select “American Sociological Association (custom)” and click Use this Style and then click Done.

Congratulations! You can now cite in your custom style. Here’s a short video showing the process.

http://www.youtube-nocookie.com/v/Rgb0Ldb6LhM?fs=1&hl=en_US&hd=1

To learn more about editing CSL files, check out the official guide as well as reading and experimenting with the styles included with Mendeley (but remember to create copies first as in step 1!) If you’d like more tutorials going into more depth on CSL, please drop us a comment below.

We plan to make the process of editing styles simpler in future, and to expand our database of downloadable citation styles.

Happy Citing!

67 thoughts on “HOWTO: edit citation styles for use in Mendeley

  1. Is there a way to add an all new type? Mendeley insists on not having a “conference paper” type (“paper presented at the XXX conference…”), and I considered adding one myself, but wasn’t sure how to do that.

  2. Yes, you can add a completely new type. Basically, what you need to do is examine the code that specifies how a journal is formatted differently from a book, and make the corresponding changes so that the citation style is rendered in the conference proceeding format. There’s more information at http:://citationstyles.org on how to make large changes like this.

  3. but I don’t know how the types in Mendeley are mapped onto the types in the CSL format. Looking at Chicago, for example, there IS a different “paper-conference” type, but changes to it don’t affect that type in Mendeley. Conference proceedings just copies the functionality of “chapter”. The whole mapping thing is screwed up, and as far as I can tell, there’s no way to map types on Mendeley to types in the CSL file, and no way to tell which CSL types are mapped to each Mendeley type.

  4. It is repetitively claimed that Mendeley Desktop application can format citations and bibliographies in word processors for >1000 journals. However this affirmation is not really true for a majority of the provides styles (e.g. Science, Nature, Cell, the Lancet, and this list is far from being exhaustive). Indeed, Mendeley Desktop cannot deal with journal name abbreviation. Therefore, it requires the user to manually edit each citation one by one in the word processor, a really cumbersome job!

    This feature was requested for more than 2 years (see: http://feedback.mendeley.com/forums/4941-mendeley-feedback/suggestions/83173-journal-abbreviations?ref=title). Hope that this top priority feature will be implemented in the next release of Mendeley Desktop (v. 1.0?). Otherwise Mendeley will just remain a PDF organiser/browsing tool and we will still need to employ an external reference manager that can deal with journal name abbreviations (e.g. EndNote, Reference Manager, etc.).

  5. Dubi – that may in fact be a bug. I’ll take a look. Would you email a description to support as well, including your operating system and Mendeley log file?

  6. when i merge the citations in “Elsevier format” it give me result [1,2] but in one conference they it should be [1, 2] (space after comma) can i edit like this?

  7. Gaston is right. The fact that Mendeley Desktop does not have a journal abbreviation field for citation styles to map to is a MASSIVE problem. In my opinion it is the biggest drawback to using Mendeley as a reference manager. Why it was absent in the first place (given that it is supported by other reference managers and so many major journals require journal name abbreviations in their bibliography) and why it is seemingly so difficult (or such a low priority) for Mendeley developers to add such a field is a bit of a mystery from a users point of view.

    Please comment publicly on this issue. The last admin comment on this issue in the feedback forum was 9 months ago. Are we likely to see journal abbreviations supported in the near future?

    Also, does this blog entry on editing citation styles via a text editor mean we are unlikely to see a GUI for editing citation styles in the near future? If this is the case then, yes, I would like to see more in depth tutorials on manually editing CSL.

  8. Hi Dubi, good point about documenting the mapping of types. We are working on a knowledgebase where we can put all this kind of info online, in the meantime, here’s the mapping you’re looking for:

    (Mendeley type on left, CSL type on right)

    Generic -> article
    Bill -> bill
    Book -> book
    BookSection -> chapter
    Case -> article
    ComputerProgram -> article
    ConferenceProceedings -> paper-conference
    EncyclopediaArticle -> entry-encyclopedia
    Film -> motion_picture
    Hearing -> speech
    JournalArticle -> article-journal
    MagazineArticle -> article-magazine
    NewspaperArticle -> article-newspaper
    Patent -> patent
    Report -> report
    Statute -> legislation
    Thesis -> thesis
    TelevisionBroadcast -> broadcast
    WebPage -> webpage
    WorkingPaper -> article

  9. Hi Dubi, good point about documenting the type-mapping. We are working on a knowledgebase where we can put all this kind of info online, in the meantime, here’s the mapping you’re looking for:

    (Mendeley type on left, CSL type on right)

    Generic – article
    Bill – bill
    Book – book
    BookSection – chapter
    Case – article
    ComputerProgram – article
    ConferenceProceedings – paper-conference
    EncyclopediaArticle – entry-encyclopedia
    Film – motion_picture
    Hearing – speech
    JournalArticle – article-journal
    MagazineArticle – article-magazine
    NewspaperArticle – article-newspaper
    Patent – patent
    Report – report
    Statute – legislation
    Thesis – thesis
    TelevisionBroadcast – broadcast
    WebPage – webpage
    WorkingPaper – article

  10. Hi Gaston and osm, we hear you, journal abbreviations are important and long overdue, we will work on getting this feature released soon.

  11. Osm: yes unfortunately the CSL editor GUI has been postponed for the time being, due to the amount of work required to make it both flexible enough and easy to use. I’ll work on some more CSL tutorials in the meantime!

  12. Hi Everyone,

    I was asking for journal abbreviation feature for quite sometime and was in contact with software engineers at Mendeley working on this feature. According to my last communication with Carles Pina they are working on this. But I have no idea about their progress. I honestly believe Mendeley should stop worrying too much about citation style editor and focus on implementing abbreviations ASAP. As a community we can help Mendeley to curate citation styles as soon as they develop a working version of abbreviations. I already suggested a viable method for abbreviations feature. I have a group named StyleWiz for curating CSL files and hope those interested will join this group. At the moment I am quite busy with my PhD and will not have much time to devote to this cause. But I am hoping to get on it as soon as I get more time to spent.

    Lochana

  13. Yay! I figured it out! What a lovely way to procrastinate.

    And yes, Steve, some tutorials to save people like me the time I just wasted will be most welcome.

  14. Hey Adeel,

    You sure can! It’s very similar to the above process. Assuming you’re using the elsevier-with-titles.csl file – create a copy as described above and look for the <citation …>…</citation> block of code and within this change the line:

    <layout prefix=”[” suffix=”]” delimiter=”,”>

    to:

    <layout prefix=”[” suffix=”]” delimiter=”, “>

    (this is on line 74 of the version of elsevier-with-titles.csl bundled with Mendeley 0.9.9)

  15. Steve, thanks for the replies. I agree with Lochana that supporting abbreviations should be prioritised over a citation style editor. Although the latter has 3 times more votes on the feedback forum, I suspect a significant number of voters assume that a style editor built into the desktop app would automatically solve the abbreviations issue, which of course, it wouldn’t. Furthermore, the abbreviations issue is entirely out of users hands, whilst the citation style issue, as shown by this blog post, is not.

  16. Actually, there’s a workaround for the abbreviations issue which we’ll be discussing shortly here and in the feedback forum.

  17. This looks like a poor man’s solution to a real issue. The request to add a citation style editor is #2 on the feedback forum, yet the developers don’t seem to find the time to give us (the users…) an estimation of the time we will still have to wait. This is annoying, as meanwhile we continue to struggle with the ridiculously low number of citation styles available instead of being productive. Way to go…

  18. I am trying to edit a citation style. I have found the default location of the *.csl files, but the custom directory does not exist where it says it should. A search of my entire hard drive for ANY *.csl file gives me only those default files in the Program Files directory, even though I have installed numerous citation styles from the “get more styles” GUI function. There CSL files just don’t seem to exist.

    Can you please help me out in tracking down where Mendeley might be putting my custom CSL files? Can I simply edit the default CSL files, saving as a different file in the default location?

    Thanks,
    Scott Hatcher

  19. Scott- what’s your OS? Under Win7, the directory is in the following catchy location:

    C:UsersOwnerAppDataLocalMendeley LtdMendeley DesktopcitationStyles-1.0

    (Owner could be your username is you changed from the default).

  20. A GUI for CSL editing is incredible easy to implement; build a GUI by my own in 2 weeks. As for the abbreviations, I use the list from isiknowledge, and after finishing the document, I parse it and change the names in the bibliography field to what I want, automatically. Geez Mendeley, you should be ashamed.

  21. I would like to edit a CSL file that is close to my desired style for formatting the bibliography and would appreciate guidance on the following. The CSL appears to be using a set of macros to specify formatting for the bibliography. How should I edit the CSL file to:

    1. Force abbreviated journal name to appear without full stops when they have full stops within loadabbrevs.js (e.g. force J. Neurosci. to appear as J Neurosci in the bibliography)

    2. Make the journal volume appear in bold font.

    3. Stop the URL of journal articles from being shown in the bibliography.

  22. Steve: Your list is limited to the mapping between CSL item types & Mendeley item types. What about a list providing the mapping between CSL variables & Mendeley field names?

    A specific issue I am stuck on is trying to figure out what the CSL variable “genre” maps to in Mendeley.

  23. My installation has apparently not created the custom styles location as described in this post. I have searched my hard drives for “citationStyles-1.0” and it only detects the one in Program Files. This is possilby due to the operating environment prescribed by my employer, but since most other programs can get around it and find the user Application Data folder, why can’t the Mendeley installation? Is there anything i can do?

    Windows XP user

  24. I’m still honing down the original Chicago style to actually conform with Chicago, and was wondering if you could help me figure out something:

    Chicago requires different texts by the same author to be collapsed (e.g. “Smith 2001, 2002” instead of “Smith 2001; Smith 2002). However, it requires a comma between collapsed items but a semi-colon between non-collapsed items (e.g. “Smith 2001, 2001; Cohen 2002, 2002; Jackson 1999; Fields 2009”). I couldn’t figure out a way to do it. When I set delimiter to comma and “after-collapse-delimited” to semi-colon, it only placed the semi-colon after collapsed groups of texts, and places a comma between non-collapsed items (in the above example, between Jackson and Fields, it places a comma). Any idea how to fix it?

  25. Hi David, the Local SettingsApplication Data folder is hidden by default in Windows. Here’s how to find it

    1. Click Start->Run…

    2. Type %HOMEPATH% and press ENTER.

    3. In the window that appears select Tools->Folder Options…

    4. Select the View tab and select the “Show hidden files and folders” option within “Hidden files and folders”.

    5. Press OK.

    6. You should now be able to navigate from here to “%HOMEPATH%Local SettingsApplication DataMendeley LtdMendeley DesktopcitationStyles-1.0”

  26. Hi dubi, I’ve just tried this and it appears there’s bug in the released version. The good news is that it’s fixed now will insert commas and semicolons in the correct place in the next dev-preview release of Mendeley Desktop, if you include the collapse=”true” attribute in the element.

  27. Hi osm,

    1. To remove periods, add the strip-periods=”true” attribute to the element

    2. To make a element bold, add the font-weight=”bold” attribute, you could put this in all the elements, or, since some styles define a “locators” macro, you could apply the attribute to the element instead, up to you.

    3. To stop the URL of articles appearing in the bibliography, select More Styles… and at the bottom of the window change “Include URLs and Date Accessed in Bibliographies” to “Only for Webpages” (the UI here sucks, we need to make this more intuitive and perhaps have it switched to “Only for Webpages” by default)

  28. Hi osm,

    Here’s the mapping from Mendeley field (left) to CSL field (right)

    Author – author
    Abstract – abstract
    Chapter – chapter-number
    City – publisher-place
    DateAccessed – accessed
    Doi – DOI
    Edition – edition
    Editor – editor
    Genre – genre
    Isbn – ISBN
    Issue – issue
    Note – note
    Pages – page
    Publication – container-title
    Publisher – publisher
    ShortTitle – shortTitle
    Title – title
    Translator – translator
    Type – type
    Volume – volume
    RevisionNumber – number
    Year, Month – issued

    To see the Genre field in Mendeley, go to Tools->Options->Document Details, select the document type you wish to change the view for at the top and then tick the “Genre” checkbox. Genre will now appear in the Document Details pane on the right for any documents of the appropriate document type you select.

  29. @Steve. Thanks for this list, it is very helpful. I have a couple of comments about it. I previously sent similar comments to support (sorry for repeating myself; but now that I’ve seen the table I can be more clear).

    This table apparently pertains to mapping between Mendeley fields and CSL variables,

    1. However, the Type – type mapping in this list is confusing. The Type field in Mendeley does not map to a type variable in CSL. As far as I can tell, there is no type variable in CSL – http://citationstyles.org/downloads/specification.html#appendix-i-variables. The item type (book, journal article etc) can be accessed in CSL conditional statements – http://citationstyles.org/downloads/specification.html#choose – but this is not accessing the Mendeley Type field.

    2. In Mendeley, the Genre field is hidden by default whilst the Type field is visible by default (at least, for the Thesis item). However, since the Mendeley Genre field is, as far as I can tell, the only one of these two that maps to a CSL variable (genre), it should be the one that is visible by default & the Type field should be removed from Mendeley as it seems redundant. Alternatively map the Type field to CSL genre (which is what Zotero does – http://gsl-nagoya-u.net/http/pub/csl-fields/thesis.html) and get rid of with the Mendeley Genre field.

    3. Short title: As far as I can tell these is no shortTitle in CSL, there is a short form attribute. http://citationstyles.org/downloads/specification.html#text Clarification about that entry in the table would be helpful.

  30. Trying to add a “ASTM Standard” Type to the library but can’t find the file that I need to edit.
    Is it possible to add a new Type to the drop down menu or should I alter the CSL output for a type already present to get the required format?

  31. Hi osm,

    Sorry for the confusion.

    1. The conditionals in CSL which depend on the document type do get affected by the Mendeley document type (see mapping in my comment from May 4th above), so it’s definitely not redundant. If the CSL type isn’t getting updated when changing the type in Mendeley this is possibly a bug, so please get in touch with exact reproduction instructions.

    2. The Mendeley “type” maps to “type” in CSL conditional statements.

    3. Yes, you’re right, citeproc-js expects “shortTitle” as the variable name, but to access this from a CSL file you need to use an element like this:

    Please get in touch if you have any other questions.

  32. Hi Steve, Thanks for the reply.

    1. I think we are talking about different things. I understand that “document Type” is fundamental and absolutely not redundant. But it seems to me there is completely different “Type” field which serves no obvious purpose (and was the reason I wanted to know about the field mapping in the first place). For example, if you create an entry that is a thesis “document type”, there is a field between the “university” field and the “URL” field called “Type”. Since this is empty and not auto-populated with the name of the “document type”, it seems to me this “Type” field is completely different from the drop-down list “document type” field. Because “genre” was not visible by default, I assumed I could enter into the “Type” field field the thesis type (PhD, MSc etc) and be able to map that to a CSL variable (which is what I did in Zotero: “Type” –> genre variable). However, to do this in Mendeley you need to use the initially hidden genre field. Therefore, it is this “Type” field (not the “document type”) that I was referring to as potentially redundant and confusing.

    3. Did you miss something out at the end of your sentence?

  33. Hi,

    I’m trying to make it so that URLs appear within , but I can’t find which macro refers to URLs… Help?

  34. “Chicago Manual of Style (Author-Date format)” is an example of a style that displays URLs for most document types when they are available. To do so, it uses the command (within a macro called “Access”). Mendeley desktop has a setting that can override styles’ URL instructions and prevent display of URLs for documents that are not web-pages. The setting is at View….Citation Styles….More Styles.

  35. I guess encassing characters are somehow leading to commands being hidden in comments. One more try (without encassing characters):
    text variable=”URL”

  36. Dear all,

    NB: I agree with the comments above: journal abbreviations are crucial!!

    I have a question regarding the citation style: how can I change the font style of the ‘et al.’ to italics? I managed to adapt the APA style to my needs, e.g. change the number of author when it switches to et al., but I see no way how to change the ‘et al.’ font style.

    Any help would be greatly appreciated! Thanks, xbeck

  37. Hi xbeck – If you’ll look at Lochana’s post, above, he explains how to add journal abbreviations to Mendeley.

  38. Hi osm!

    Thanks for the links. I am using the APA style as shown here

    http://www.zotero.org/styles/apa

    I tried to insert either
    directly after names / name or after citation (that’s were the et al appears). No success. Where exactly is this line supposed to go in the APA style?

    Thanks, Tobias.

  39. Hello,

    I would like to use Mendeley for writing a paper in German. Does anybody know if there is an option for citing in other languages than English?

    And if not:
    If I edit an english style to fit my needs: Is there a possibility of changing “2nd ed.” to “2. Aufl.”?

    Thanks a lot for your help,
    Kati

  40. adam, it’s just shorthand for “you can get 1000s of CSL styles from a shared repository via our application”. We do lots of discussion about CSL, why it matters, who the original people behind it are, etc etc. I’ve blogged about it numerous times right here, we include a link in every download of the client, etc. If you like, I’ll send you the slides I use in every webinar I give, where I explicitly talk about CSL, the fact that we don’t own the format, and how the styles are owned by the scholarly community not us, and explicitly crediting Zotero and the community around it as the people who really got things going with CSL.

    I understand your feelings about this, but I think we do a pretty good job of getting me message out about what CSL is. That said, I’m always open to suggestions about how we can improve things.

  41. William – thanks, I l’ll take your word for it. I probably should have looked around the blog more for other posts on this. I don’t come here much and so this seemed like a typical treatment, but I agree if you have said “the CSL styles created by an international community of volunteers and provided for use by Mendeley” the last half a dozen times you wrote about it it’s fair enough to shorten it.

  42. xbeck,
    It should go between lines 88 & 89 in the csl file that you linked to. This is within the author-short macro (see the example at the link in my previous comment).

    William/Steve,
    It says here that Mendeley’s styles are from Zotero’s repository: http://www.mendeley.com/citationstyles/
    However, the styles available through Mendeley are only a portion of the styles in Zotero’s repository (e.g. a search of Zotero’s repository for styles with ‘neuroscience’ in the title finds 10 styles, whilst a search in Mendeley desktop (current stable version) finds only 6 styles). I mentioned this a couple of months ago to Mendeley support and heard that you will eventually use a common repository with Zotero. Any news on when this will be? and what exactly is Mendeley currently using? – an old snapshot of Zotero’s repository perhaps? You seem to be shooting yourself in the foot somewhat by not making available all these styles (and presumably ongoing style updates) in Mendeley desktop.

Comments are closed.