Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CSL "display" attribute (and for some bibliographic options) #335

Closed
arossato opened this issue Oct 31, 2011 · 18 comments
Closed

Comments

@arossato
Copy link

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?

@jgm
Copy link
Owner

jgm commented Nov 6, 2011

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!

@pvorb
Copy link
Contributor

pvorb commented Oct 23, 2013

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?

@jgm
Copy link
Owner

jgm commented Oct 23, 2013

+++ 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.

@pvorb
Copy link
Contributor

pvorb commented Oct 24, 2013

:-(

@aswolf
Copy link

aswolf commented Oct 28, 2014

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.

@jgm
Copy link
Owner

jgm commented Oct 28, 2014

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.

@aswolf
Copy link

aswolf commented Oct 28, 2014

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 notifications@github.com
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
#335 (comment).

@tolot27
Copy link
Contributor

tolot27 commented Mar 25, 2015

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).

@katrinleinweber
Copy link
Contributor

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

@pedmiston
Copy link

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

@per-review
Copy link

per-review commented Jun 12, 2018

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.

@tarleb
Copy link
Collaborator

tarleb commented May 12, 2021

I believe that support for this has been added with the switch from external pandoc-citeproc filter to the new citeproc library.

@tarleb tarleb closed this as completed May 12, 2021
@rnhmjoj
Copy link

rnhmjoj commented May 16, 2021

Support is better with --citeproc but not full, yet.
It seems hanging-indent and second-field-align have been implemented, however entry-spacing and line-spacing still have no effect.
I tested with pandoc 1.23.

@tarleb
Copy link
Collaborator

tarleb commented May 16, 2021

Thanks @rnhmjoj, please open a new issue so we can keep track.

@jgm
Copy link
Owner

jgm commented May 16, 2021

pandoc 1.23? you mean 2.13 I suspect?
entry-spacing and line-spacing should work -- though not in every output format. What format are you targeting? (They are implemented for ms, latex/pdf, and HTML.)

@rnhmjoj
Copy link

rnhmjoj commented May 16, 2021

pandoc 1.23? you mean 2.13 I suspect?

Oh, yes, sorry.

What format are you targeting? (They are implemented for ms, latex/pdf, and HTML.)

Latex.

Ok, I was wrong: entry-spacing is working. However, I've been trying entry-spacing="0", which is not having the intended effect (at least in my mind): it still leaves an empty line between entries. I have to manually set \setlength{\parskip}{0pt} at the start of the bibliography.

---
title: Issue \#335 reproducer
citation-style: https://www.zotero.org/styles/elsevier-with-titles
reference-section-title: References
references:
  - id: trapani15
    type: article-journal
    author:
      family: Trapani
      given: Lorenzo
    title: Testing for (in)finite moments
    container-title: Journal of Econometrics
    issued:
      - year: 2015
  - id: silver86
    type: book
    author:
      family: Silverman
      given: Bernard W.
    title: Density Estimation for Statistics and Data Analysis
    issued:
      - year: 1986
  - id: robertson74
    type: article-journal
    author:
    - family: Robertson
      given: Tim
    - family: Cryer
      given: Jonathan D
    issued:
      - year: 1974
    title: An iterative procedure for estimating the mode
    container-title: Journal of the American Statistical Association
    volume: 69
    issue: 348
...

# Testing

This is a test[@trapani15] for CSL[@silver86] display options[@robertson74].

# Compiling

Run this to compile: `pandoc --citeproc test.md -o test.pdf`

@jgm
Copy link
Owner

jgm commented May 17, 2021

OK. Can you submit a new issue on this?

@rnhmjoj
Copy link

rnhmjoj commented May 17, 2021

Done: #7296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests