Pandoc: Add support for CSL "display" attribute (and for some bibliographic options)

Created on 31 Oct 2011  Â·  11Comments  Â·  Source: jgm/pandoc

There are a couple of CSL that possibly require some support in the Pandoc types:

One possible solution would be to use an Unsupported block (see issue #187). Any idea?

high enhancement

Most helpful comment

For what it's worth, here's a hack to format the bibliography with hanging indents in LaTeX output. Put this where you want the bibliography to be:

# Your reference section title

\begingroup
\noindent
\vspace{-1em}
\setlength{\parindent}{-1.5em}
\setlength{\leftskip}{1.5em}
\setlength{\parskip}{0pt}

<div id="refs"></div>

\endgroup

This comes fairly close to how biblatex formats e.g. its authoryear style, with no extra spacing between the entries:

Hogue, C.W.V. (2001) ‘Structure databases’, in Baxevanis, A. D. and Ouellette,
    B. F. F. (eds.) Bioinformatics. Life Sciences Series. 2nd edn. New York,
    NY: Wiley-Interscience, pp. 83109.
Sambrook, J. and Russell, D.W. (2001) Molecular cloning: a laboratory manual.
    3rd edn. Cold Spring Harbor, NY: CSHL Press.

You should leave the value of reference-section-title empty and create a header manually (although it seems that reference-section-title is ignored in the example above). Otherwise the header will also be formatted according the preferences set after \begingroup – with undesired results.

All 11 comments

These changes would require a major version bump in pandoc, and the new features could be difficult to implement uniformly across output formats. So, I want to put the idea on the back burner for now -- in other words, don't wait for this issue before releasing new versions of citeproc-hs!

I am trying to use a CSL that has numbers in the bibliography and the entries are aligned with the margin, but I don't see a margin in the resulting PDF.

Are these CSL options (such as display, hanging-indent and second-field-align) still unsupported?

+++ Paul Vorbach [Oct 23 13 03:12 ]:

I am trying to use a CSL that has numbers in the bibliography and the entries are aligned with the margin, but I don't see a margin in the resulting PDF.

Are these CSL options (such as display, hanging-indent and second-field-align) still unsupported?

Yes.

:-(

I am also trying to get some more fine-tuned formatting. One possible workaround is to allow line break characters within a custom csl file.

In this forum:
https://forums.zotero.org/discussion/4889/how-to-add-a-line-break-after-text-element/
They discuss the workaround of inserting "& # 1 0 ;" as a prefix to you text element within the csl file, in order to force a line break. It's not elegant, but it appears to get the job done usually... BUT not in pandoc. If you try to run pandoc using a custom csl with that code as a prefix on any text elements, it gives the following error:

pandoc-citeproc: error while reading the XML file: XMLParseError "not well-formed (invalid token)" (XMLParseLocation {xmlLineNumber = 40, xmlColumnNumber = 46, xmlByteIndex = 1379, xmlByteCount = 0})
pandoc: Error running filter pandoc-citeproc

Am I missing something? I am happy to prepare a minimal working example if needed.

You need to remove the blanks in & # 1 0; -- it appears they put the blanks in due to limitations in the forum software, which would otherwise print it as a newline.

Unfortunately, I already tried this. Without the spaces, using
in the csl document, the pandoc
command runs, but the newline is totally ignored. The output is identical
to:

On Tue, Oct 28, 2014 at 1:36 PM, John MacFarlane [email protected]
wrote:

You need to remove the blanks in & # 1 0; -- it appears they put the
blanks in due to limitations in the forum software, which would otherwise
print it as a newline.

—
Reply to this email directly or view it on GitHub
https://github.com/jgm/pandoc/issues/335#issuecomment-60797736.

Any progress on that? Just allowing control characters such as tabstop ( ) would be a quick workaround for many non-ascii/utf output formats (docx, odt).

+1 Gaining some control over whitespace via CSL attributes would be very helpful :-)

+1 as it would allow for rendering annotated bibliographies correctly.

For what it's worth, here's a hack to format the bibliography with hanging indents in LaTeX output. Put this where you want the bibliography to be:

# Your reference section title

\begingroup
\noindent
\vspace{-1em}
\setlength{\parindent}{-1.5em}
\setlength{\leftskip}{1.5em}
\setlength{\parskip}{0pt}

<div id="refs"></div>

\endgroup

This comes fairly close to how biblatex formats e.g. its authoryear style, with no extra spacing between the entries:

Hogue, C.W.V. (2001) ‘Structure databases’, in Baxevanis, A. D. and Ouellette,
    B. F. F. (eds.) Bioinformatics. Life Sciences Series. 2nd edn. New York,
    NY: Wiley-Interscience, pp. 83109.
Sambrook, J. and Russell, D.W. (2001) Molecular cloning: a laboratory manual.
    3rd edn. Cold Spring Harbor, NY: CSHL Press.

You should leave the value of reference-section-title empty and create a header manually (although it seems that reference-section-title is ignored in the example above). Otherwise the header will also be formatted according the preferences set after \begingroup – with undesired results.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cnblogs-dudu picture cnblogs-dudu  Â·  5Comments

velimir picture velimir  Â·  4Comments

XiaTeng1993 picture XiaTeng1993  Â·  3Comments

chrissound picture chrissound  Â·  4Comments

transientsolutions picture transientsolutions  Â·  3Comments