"soft return"/line feed/cr vs display="block"

Old programmer here, but new to Zotero/CSL. Sorry to take up bandwidth, but have been combing the forum for days trying to answer my own question about inserting a "soft return" or line feed (aka "line break", "newline", or "carriage return", et al) into a citation or bibliographic entry. Have seen documented a flurry of interests YEARS ago, but have seen nothing recent, and more importantly, nothing that works for me.

I want to add annotations (via the Extra field) to my citation; I am editing an already defined style (in this case, latest version of Chicago), which will ultimately end up in Word (2016). I want to have a "soft return" -- in Microsoft Word parlance (shift+enter) -- between the citation entry and the annotation; I do not want extra space, as one would have between paragraphs.

If I say:

I will get the annotation tacked onto the end of my citation, wherever on the line that occurs.

If I say:

I will get the annotated [Remarks:....] on a new line BUT with a bunch of whitespace after it. The whitespace is not affected by Word paragraph formats which dictate 0 spacing after paragraphs.

I understand the handoff between the Zotero styles and the Word format controls. Ideally, I'd rather be telling Word how to handle white space than changing a Zotero style.

There are a few kludgey ways around this, like post-processing the Word file, for example. But I'd rather not; I'm trying to set up for a large project, involving a few hundred files & anticipating many annotated citations per file.

So, can one insert a "soft return" into a citation or bibliography? And if so, how? (And please note, if "&#10" is involved, you are going to have to hold my hand for a moment & give me a firm example, because I've tried this, multiple ways, to no avail.)

Thanks in advance....



  • edited October 18, 2017
    You should use display=block for this (this is what that is for). See the APA Annotated Bibliography Style (https://github.com/citation-style-language/styles/blob/master/apa-annotated-bibliography.csl) for an example. Does that work for you? If not, can you paste your code to a secret gist at gist.github.com and post a link here?
  • Sigh. I see now why so many of the threads I've been reading suggest posting the code somewhere else & linking. Since my code snippets don't appear in the post, it's not apparent to anyone what I've tried. Doh! I should have realized that! Yes, I can paste the code, but that seems hardly worth the effort, as I'm really only changing one line in a supported style -- and this topic has already been batted around YEARS ago. I was just hoping something new had happened in the meantime that I had missed.

    To display=block or not, yes, that is the question.

    I don't like display=block because it seems there is no control over the whitespace. Once display=block is employed, that whitespace is there (seems to be varying amounts depending on the text being displayed) -- and Word paragraph settings don't appear to affect that whitespace.

    I just want my little added bit of text to start on a new line, but I don't want to tart it up with a lot of trailing whitespace.

    Am I missing something here?

    Seems like display=block is the hardest of hard returns, not the soft one that I'm looking for. But if the code won't support a soft return, then perhaps I need to rethink my approach.

    Zotero is such a nifty tool, I was really hoping to do some cool customizations, but I may need to scale my expectations back just a tad. ;)
  • display=block doesn’t itself create any whitespace, so it is likely coming from some other part of the style, which is why I was asking you to paste the code somewhere.

    (FYI, you can wrap code in <code> tags on the forums, but it is much easier to read entire styles if you post them as a link to a gist.)
  • Thanks for that information about display=block not creating whitespace, that's certainly what I initially expected; however, my real life experience does not match this expectation. I've been combing through the style & just don't see what's causing my results, but I'm new at CSL, so maybe I'm missing something.

    What I'm trying to do is take the Chicago Manual of Style 17th edition (full note) style and tweak it a bit to add some additional information which I've entered into the "Extra" field (is that the correct terminology?) in Zotero. I figured out that this info is stored in the variable "note" & I want to output that at the end of the citation, but on a new line with no white space.

    I do that in the last line of the layout section. I also made a minor change to the layout to remove the suffix "." and instead output that before the note variable is output (to put the period at the end of the citation where it belongs, not after the following remarks). The style is here: https://gist.github.com/clcabler/226f6c656be034928455411c9412a3a5

    If I have display=block in the text line, I get something in Word that looks like the output shown here: https://gist.github.com/clcabler/2bbb72561f148917bd336bff380ddf3e
    The first citation does not have data in the Extra field, so nothing output, and the 0 spacing after the paragraph is preserved. The next 2 citations (lines 2-7) both have data in the Extra field; this is correctly output on the next line following the citation BUT an extra line is inserted. This line cannot be deleted in Word without deleting the citation; its size/spacing cannot be managed through the paragraph formatting controls.

    In the style I supply, I have commented out the line where I output the note variable without display=block. When I use that line instead, I get something in Word that looks like the output shown here: https://gist.github.com/clcabler/ec606e4381df8b9727af56436d51a020
    Here, no extra blank lines are created in the Word document. Of course, the remarks are tacked onto the end citation, instead of going onto a new line.

    Thanks for offering to look through the style. I've gotten pretty frustrated -- I'm so close to having the look I want!


  • edited October 19, 2017
    And just to confirm, you want the annotations to appear in the footnotes, not in the bibliography? What version of Word are you using (Operating system, specific version such as 15.39)?
  • Yes, I know annotations in the notes is a funky idea, but that's the current plan as there may not be a standard bibliography -- sort of like some wikipedia entries (yeah, I know, where there are no firm standards).

    Word: Microsoft Office Professional Plus 2016, version 1708, running on Windows 10, version 1703

    Would it make a difference for the annotations to appear in the bib? I guess it just depends on what code is causing the undesired side effect. Guess I should try & see. And it could be something on the Word side of things -- wouldn't be the first time a Microsoft product has bitten me with unexpected behavior. OTOH the extra lines show up in the display panel of the Zotero Style Editor also.


  • Also, I'm sensing some special sauce going on with the "Extra" field. Could this be a source of unexpected behavior? I see a thread from earlier this year (https://forums.zotero.org/discussion/64859/ebook-citations#latest) where you explained how to use Extra to designate e-book formats.

    I figured that trying to use Extra for the medium field would negate being able to use Extra as my annotation field, but when I tried it I was surprised to find out that I could do both, simultaneously!

    What else can Extra do? Iron shirts & tie ties? ;) Seriously, is there a mapping of the fields within fields somewhere?

    Sorry to pull this thread somewhat off-topic, but wondering if storing my annotations in a different field would have a different effect on the output.
  • Okay, I see that display="block" isn't behaving the way that I expected.

    @adamsmith Is it correct for display="block" to insert a soft return both before and after the text element? That would seem to produce undesired output in a lot of circumstances. Shouldn't the correct behavior be to only insert a soft return before?

    Relatedly, none of the XML line end entities work anymore in CSL styles (though they did previously [years ago]). Is that also expected?
  • @adamsmith @fbennett Is a soft return both before and after display="block" the expected behavior?

  • Interesting to bring a discussion 7 years ago alive.

    I confirm that the display="block" produces 2 linebreaks, i.e. one at the beginning and one the end.

    For example, in the bibliography block, the <text macro="fullref" display="block" /> (where the macro="fullref" is a full bibliography item) results in 2 blank lines, i.e. 3 linebreaks, between items.

    In the citation block for a footnote style, the <text macro="fullref" display="block" /> produces a line break after the citation number label (i.e. before the macro="fullref"), and 1 blank line (i.e. 2 linebreaks) between items.

    The above is found when I want to insert a linebreak (soft return) between footnote citation items, instead of using semicolon by <layout suffix="" delimiter="; ">. But as @bwiernik said, "none of the XML line end entities works". <layout suffix="" delimiter="&#10;&#13;"> does not produce a linebreak at all.

    So, as a suggestion or bug report to the Zotero development, it is useful to activate: delimiter="&#10;&#13;", and it is also reasonable to add only 1 linebreak at the end of the part with display="block".

    Would be nice to see the change. Cheers!
Sign In or Register to comment.