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 pairDelim YAML metadata option #126

Closed
samueldodson opened this issue Jul 13, 2017 · 5 comments
Closed

Add pairDelim YAML metadata option #126

samueldodson opened this issue Jul 13, 2017 · 5 comments

Comments

@samueldodson
Copy link

Hi @lierdakil,

Is it possible to set my own delimiter for pairs of references? For example, I would like [@fig:one; @fig:two] to output as "figs. 1 and 2" rather than "figs. 1, 2". Perhaps a pairDelim YAML metadata option could be added to pandoc-crossref (e.g., pairDelim: "and")?

Thanks.

@samueldodson samueldodson changed the title Add pairDelim YAML metadata Add pairDelim YAML metadata option Jul 13, 2017
@lierdakil
Copy link
Owner

Possible. Need to discuss particularities though.

For one, imagine you reference a bunch of stuff (figures, for instance) that happen to form two succession sequences, f.ex. 1,2,3 and 6,7,8. At the moment, this will be rendered as 'figs. 1-3, 6-8'. Should pairDelim be applied here, to produce 'figs. 1-3 and 6-8', or should it be reserved specifically for the case of exactly two references?

If we don't limit it to the case of exactly two references, we run into another question. When exactly should this pairDelim be applied? Pairs of successive and non-successive references are handled slightly differently, and successive pairs are rendered earlier than non-successive ones. For example, 'figs. 1, 2' and 'figs. 1, 3' are slightly different, despite similar end result. Hence, when we have multiple pairs of successive references, we can have something like 'figs. 1 and 2, 4 and 5, 7 and 8' or somesuch. Moreover, if we apply pairDelim in both cases, we can get this horribleness: 'figs. 1 and 2 and 4 and 5'. This requires some careful consideration.

Let me know what you think.

@samueldodson
Copy link
Author

What if we added a lastDelim metadata option rather than pairDelim? The value of lastDelim would be added before the last reference or range of references. For example,

  • figs. 1 3 => figs 1 and 3
  • figs. 1 2 3 6 8 => figs 1–3, 6 and 8.
  • figs. 1 2 3 6 7 8 => figs 1–3 and 6–8.

lastDelim would not be applied when there is only one reference or one range of references. For example,

  • fig. 1 => fig. 1
  • figs. 1 2 3 => figs. 1–3

@lierdakil
Copy link
Owner

Okay, I figured out a relatively reasonable way to make this work. 2926e3f pairDelim is used for a pair of references or a pair of ranges, or any combination thereof (f.ex. with pairDelim: " and ", we could have fig. 2 and 4-6), and lastDelim is used in other cases. refDelim is there in case you want to override default comma delimiter.

fig. 2 and 4-6 is a weird corner case though, as would be fig. 2, 4 and 6-9 in case of lastDelim. Not so sure about that.

@samueldodson
Copy link
Author

Thanks for adding these metadata options.

Would you please explain why "fig. 2 and 4–6" and "fig. 2, 4, and 6–9" are corner cases for pairDelim and lastDelim, respectively?

@lierdakil
Copy link
Owner

lierdakil commented Jul 18, 2017

It's just somewhat counter-intuitive, IMO. Generally you wouldn't expect a range after "and" if there weren't any ranges before "and". So I was wondering if I should handle this case differently.

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

2 participants