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

pandoc 3.1.7 with link-citations: true doesn't break lines in citations #9050

Closed
jpcirrus opened this issue Sep 1, 2023 · 9 comments
Closed
Labels

Comments

@jpcirrus
Copy link
Contributor

jpcirrus commented Sep 1, 2023

In pandoc 3.1.7 with the citeproc filter and output to pdf, if link-citations: true then the citations don't break at the right margin, which they do when link-citations: false, and did previously. This is due to \protect\hyperlink{ref-}{text} being replaced by \citeproc{ref-}{text} in the resolution of #9031 by 353177f.

This can be seen with this input file (test-citations.md):

---
link-citations: true
references:
- id: moore2000
  type: article-journal
  title: Diabetes
  container-title: Diabetes
  page: 1-2
  volume: 50
  issue: 2
  author:
    - family: Moore
      given: M.Peter
    - family: Lunt
      given: Helen
  issued:
    date-parts:
      - - 2000
...

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do [@moore2000]
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt...

and compiling with:

pandoc -o test-citations.pdf --citeproc test-citations.md

With link-citations: true:

image

and with link-citations: false:

image
@jpcirrus jpcirrus added the bug label Sep 1, 2023
@jgm
Copy link
Owner

jgm commented Sep 2, 2023

@u-fischer is there a way to fix this?

@jgm
Copy link
Owner

jgm commented Sep 2, 2023

This https://tex.stackexchange.com/questions/2773/how-do-i-make-latex-push-long-citations-to-a-new-line suggests that we need

\usepackage[breaklinks=true]{hyperref}
\usepackage{breakcites}

@jgm
Copy link
Owner

jgm commented Sep 2, 2023

I can confirm that this works. But I don't know how common a package breakcites is.
The code is so short we could even include it verbatim in the template (though this would be ugly).

@u-fischer
Copy link

sorry can't test now, but something like \let\@cite@ofmt\relax or \let\@cite@ofmt\@firstofone should be enough. There is no need to pass to hyperref breaklinks=true. There are no current driver where this is relevant anymore.

@jpcirrus
Copy link
Contributor Author

jpcirrus commented Sep 2, 2023

@jgm, just to let you know that 353177f causes an issue with beamer, as enumitem clobbers beamer lists. I will open an issue tomorrow.

@jgm
Copy link
Owner

jgm commented Sep 3, 2023

Sorry to hear about the beamer/enumitem incompatibility. Perhaps we can work around that by using lower-level commands to adjust the list instead? What we need to control:

  • hanging indent
  • spacing between bibliography items
  • control over list label

@cagix
Copy link
Contributor

cagix commented Sep 3, 2023

@jgm, just to let you know that 353177f causes an issue with beamer, as enumitem clobbers beamer lists. I will open an issue tomorrow.

the mentioned related issue is #9053 (just for future reference).

@jgm jgm closed this as completed in c017bbe Sep 3, 2023
@jgm
Copy link
Owner

jgm commented Sep 3, 2023

@u-fischer I went with

\let\@cite@ofmt\@firstofone

and this seems to work (though I don't know the difference between it and the other option).

@u-fischer
Copy link

(though I don't know the difference between it and the other option).

The grouping will be slightly different, in one case \@cite@ofmt{#1} -> \relax{#1}, in the other \@cite@ofmt{#1} -> #1.

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

No branches or pull requests

4 participants