csl how to insert a line break in bibliography

5.2k Views Asked by At

I am close to giving up now: I am desperately trying to accomplish a supposedly simple thing: I manage the references for my work with Mendeley. I want to format the bibliography so that I have:

[author]
      [title] etc.

means, after the element author I would like to have a simple line break. However, this seems to be a major problem. I came across these ways:

However none of the worked at all. I can't believe that it is that hard. I tried to surround the author by a <group> with delimiter="&#10;" as well, but this had not effect.

Can anyone help me or point me a direction or is this not possible at all? Can't believe that this is so hard...

Thanks a lot!

Peter

3

There are 3 best solutions below

0
On

At least as of 2018 (version 0.14.18) there is a supported way to do this.

You can define writer-specific raw content in a prefix, suffix, delimiter, or term by wrapping it in

{{<writer-name>}}<raw-content>{{/writer-name}}

For example, if you have a text macro "author" for listing authors and you want a newline after this for the latex and HTML writers with a ". " in other cases you can write:

<text macro="author" suffix=".{{latex}}\\{{/latex}}{{html}}&#10;{{/html}} "

Reference: "Raw Content" section in https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md

0
On

Using the escaped HTML code for a line feed (&#10;), as described in your first link, works for me.

With the modified version of APA at https://gist.github.com/rmzelle/b9bc934521ff7c5b4fb7, which uses <text macro="author" suffix="&#10;"/> (and a little cleanup, like removing the hanging-indent and delimiter after the author macro), I get references like:

Alberty, R. A.
(2006). Thermodynamics and kinetics of the glyoxylate cycle. Biochemistry, 45(51), 15838–15843. doi:10.1021/bi061829e

(as tested with the Zotero reference test pane)

0
On

I'm using pandoc-citeproc to generate HTML. The above trick doesn't work, because pandoc doesn't unescape correctly the characters: https://github.com/jgm/pandoc-citeproc/issues/120

Finally I resorted to CSS to accomplish the trick:

CSL:

<text macro="title" font-weight="bold"/>

CSS:

.citation strong {
   display: block;
}

This displays the title on its own line.