How to use special characters in csl

How can I use special characters in a csl style, e.g. the non-breaking space or a m-dash? I'd like to use e.g. the non-breaking space between the prefix "S." and the page numbers.
  • edited January 28, 2010
    CSL is written in XML, so numeric entities should work. A non-breaking space would look something like this:<text variable="locator" prefix="&amp;#x00A0;"/>Note that you need to use numeric character references for most things, rather than named entities. Wikipedia (among other sources) has a list of codes.
  • edited February 9, 2010
    I am new to modifying CSL. I would like to use hard returns within a citation, and I'm having difficulty finding the correct code that Word will correctly interpret. When I use suffix="& # x 0 D;" (without the spaces, of course) Word returns "\line". Can anyone help? Thanks.
  • I'm not sure what you're trying to do, could you give an example of how you want things to look?
    in general, try
    <...suffix="
    "/>
    including the line break.
  • I want the citation to appear like this:

    title
    author
    publication
    publication-date
    URL

    The code I tried appended suffix="& # x 0 D;" to, for example:
    <text macro="title" suffix="& # x 0 D;"/>
    <text macro="container" suffix="& # x 0 D;"/>
    <text macro="access" suffix="& # x 0 D;"/>
    <text variable="URL" suffix="& # x 0 D;"/>

    Returns in Word:
    title\linecontainer\lineaccess\lineURL\line

    Instead of what I want:
    title
    container
    access
    URL
  • edited February 9, 2010
    yeah, trie instead

    <text macro="title" suffix="
    "/>
    <text macro="container" suffix="
    "/>
    <text macro="access" suffix="
    "/>
    <text variable="URL" suffix="
    "/>

    exactly like that. Works for me.

    edit: ooh wait, so does your solution... so maybe something else is going on.
  • No, breaking the tag across lines doesn't help, either.
  • edited February 10, 2010
    I have also tried "suffix="& # x 0 0 0 D;"", which also results in "\line" in MS Word.

    I don't know whether it makes a difference, but I am using MS Word 2003 SP 3.
  • OK, I'm getting closer. Now with using 'display="block"', I'm closer to what I want; however, the citation is displaying with "_" before each field that follows author.

    The code is:
    <citation>
    <option name="et-al-min" value="99"/>
    <option name="et-al-use-first" value="1"/>
    <layout delimiter=" " display="block">
    <group delimiter=" ">
    <choose>
    <if variable="author editor translator" match="any">
    <group delimiter=" ">
    <text macro="author" display="block"/>
    </group>
    </if>
    <else>
    <text variable="locator" prefix=" " display="block"/>
    <text macro="title" display="block"/>
    </else>
    </choose>
    <text macro="title" display="block"/>
    <text macro="container" display="block"/>
    <text macro="access" display="block"/>
    <text variable="URL" display="block"/>
    </group>
    </layout>
    </citation>

    Would appreciate any assistance!! Thanks.
  • edited February 15, 2010
    Like adamsmith I'm not sure why this didn't work for you before. For me, both

    the xml code and suffix="
    "

    work without a problem. Have you tried debugging your style to check it's not got other problems which are stopping your citations from displaying properly?
  • edited February 15, 2010
    the spaces need to be there so he can display the xml code in the forum, I'm sure that's the only reason they're there.

    Thomas, just to makes sure we're on the same page, if you try this in the test pane:
    chrome://zotero/content/tools/csledit.xul
    it looks OK, right? James - do you have Word? Have you tried this in Word?

    oh wait - which Zotero version are you using? and which plugin?
  • edited February 15, 2010
    the spaces need to be there so he can display the xml code in the forum
    I realised that when I tried to post them myself...and quickly edited my comment!
  • James - do you have Word? Have you tried this in Word?
    Yes, and line breaks in citations work without problem for me using Zotero 2.0 and MS Word.

    I also know that line breaks in bibliographies worked fine in Zotero 1.0 and MS Word because I wrote a style that used them.
  • I noticed that when I installed the updated CSL but did not restart Word, the formatting did not occur as I expected. I only noticed this after toggling codes on the citation field, and seeing the garbage it was putting between fields. After updating the CSL, reinstalling it, exiting and restarting Word, this is the code that formatted the citation correctly:

    <citation>
    <option name="et-al-min" value="99"/>
    <option name="et-al-use-first" value="1"/>
    <layout delimiter=" " display="block">
    <group delimiter=" " display="block">
    <choose>
    <if variable="author editor translator" match="any">
    <group delimiter=" ">
    <text macro="author"/>
    </group>
    </if>
    </choose>
    <text macro="title" display="block"/>
    <text macro="container" display="block"/>
    <text macro="access" display="block"/>
    <text variable="URL" display="block"/>
    </group>
    </layout>
    </citation>

    I realize there are other problems - particularly, the date (access) is not displaying at all - but I think perhaps it'd be best that I fumble with this myself rather than publicly embarrass myself further. :-/
Sign In or Register to comment.