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

LaTeX Template: add \linebreak to \CSLBlock #7363

Closed
denismaier opened this issue Jun 7, 2021 · 11 comments
Closed

LaTeX Template: add \linebreak to \CSLBlock #7363

denismaier opened this issue Jun 7, 2021 · 11 comments

Comments

@denismaier
Copy link
Contributor

Currently \CSLBlock adds a break after the command, but we may also want to have the entire block on its own line. I suggest we add a something along the lines of \newcommand{\CSLBlock}[1]{\linebreak#1\hfill\break}

@jgm
Copy link
Owner

jgm commented Jun 8, 2021

---
references:
- type: article-journal
  id: WatsonCrick1953
  author:
  - family: Watson
    given: J. D.
  - family: Crick
    given: F. H. C.
  issued:
    date-parts:
    - - 1953
      - 4
      - 25
  title: 'Molecular structure of nucleic acids: a structure for
    deoxyribose nucleic acid'
  title-short: Molecular structure of nucleic acids
  container-title: Nature
  volume: 171
  issue: 4356
  page: 737-738
  DOI: 10.1038/171737a0
  URL: https://www.nature.com/articles/171737a0
  language: en-GB
  note: Note this!
nocite: |
  @*
...

Test with apa-annotated-bibliography.csl

@jgm
Copy link
Owner

jgm commented Jun 8, 2021

With the change

-\newcommand{\CSLBlock}[1]{#1\hfill\break}
+\newcommand{\CSLBlock}[1]{\linebreak #1\hfill\break}

I get
Screen Shot 2021-06-08 at 5 54 23 AM

Any advice?

@denismaier
Copy link
Contributor Author

denismaier commented Jun 8, 2021

\linebreak is probably wrong. Perhaps better \\ or \hfill\break just like at the end. But we need to check what happens if we have two of these in a row.

@jgm
Copy link
Owner

jgm commented Jun 9, 2021

I'm thinking \par will give good results.
But... the docs say

“block” - block stretching from margin to margin.

How does this interact with hanging-indent? IN a hanging-indent style, do we have a non-hanging annotation?

@denismaier
Copy link
Contributor Author

denismaier commented Jun 9, 2021

I'm thinking \par will give good results.
But... the docs say

“block” - block stretching from margin to margin.

My understanding of this is that the "block" covers the whole textarea, not that the content itself should be stretched to fill the available space. See this example from Word/Zotero:

grafik

How does this interact with hanging-indent? IN a hanging-indent style, do we have a non-hanging annotation?

See above. I don't think a non-hanging annnotation would be wanted. I guess that's why whe have these hard line breaks in the Zotero/Word example from above.

cc @bwiernik What do you think about this?

@bwiernik
Copy link

bwiernik commented Jun 9, 2021

@adam3smith or @rmzelle might be a better source here. I'll admit that I find the display attribute confusing. It's supposed to follow the logic of the CSS display attribute https://www.w3schools.com/CSSref/pr_class_display.asp

Following citeproc-js's behavior, I wrote apa-annotated-bibliography.csl expecting that a display="block" element would inherit the hanging indentation from the block above (that is, it's separated by a soft line break instead of a paragraph break). https://github.com/citation-style-language/styles/blob/3a2ff5f0370ab63ba962385bbc5a90de9badf9e8/apa-annotated-bibliography.csl#L1914

@bwiernik
Copy link

bwiernik commented Jun 9, 2021

Also perhaps @fbennett ?

@adam3smith
Copy link

I also find display confusing. Note that citeproc-js's behavior is frequently inconsistent between HTML and RTF. So for example a hanging indent style with the abstract in a display="block" element appears in HTML like this (in contrast to the Word/RTF example above):
image

I don't know if this makes a ton of sense, but I don't think this is an unreasonable interpretation of the spec? For annotated bibliographies, the Spec specifically has display="indent" (some weird behavior there with hanging-indent, though, and also inconsistent between RTF and HTML with citeproc-js.)
Sorry this isn't terribly helpful -- might be a candidate for clarification & more formalization in 1.1?

@bwiernik
Copy link

bwiernik commented Jun 9, 2021

Yes, this sounds like a good thing for clarification in CSL 1.1.

@jpcirrus
Copy link
Contributor

jpcirrus commented Sep 4, 2023

Since the change to using \bibitem in the bibliography in 353177f, changing \newcommand{\CSLBlock}[1]{#1\hfill\break}, which outputs:

image

to \newcommand*{\CSLBlock}[1]{\\#1}, outputs:

image

using:

---
csl: apa-annotated-bibliography
references:
- type: article-journal
  id: WatsonCrick1953
  author:
  - family: Watson
    given: J. D.
  - family: Crick
    given: F. H. C.
  issued:
    date-parts:
    - - 1953
      - 4
      - 25
  title: 'Molecular structure of nucleic acids: a structure for
    deoxyribose nucleic acid'
  title-short: Molecular structure of nucleic acids
  container-title: Nature
  volume: 171
  issue: 4356
  page: 737-738
  DOI: 10.1038/171737a0
  URL: https://www.nature.com/articles/171737a0
  language: en-GB
  note: Note this!
- id: francois2014
  type: article-journal
  title: >-
    ‘Exercise snacks’ before meals: a novel strategy to improve glycaemic
    control in individuals with insulin resistance
  container-title: Diabetologia
  page: 1437-1445
  volume: '57'
  issue: '7'
  DOI: 10.1007/s00125-014-3244-6
  author:
    - family: Williams
      given: Michael J. A.
    - family: Francois
      given: Monique E.
    - family: Baldi
      given: James C.
    - family: Manning
      given: Patrick J.
    - family: Lucas
      given: Samuel J. E.
    - family: Hawley
      given: John A.
    - family: Cotter
      given: James D.
  issued:
    date-parts:
      - - 2014
nocite: |
  @*
...

@jgm
Copy link
Owner

jgm commented Sep 4, 2023

\newcommand*{\CSLBlock}[1]{\\#1} won't work when the block is the first thing in the entry ("No line to end").
But this works I think:

-\newcommand{\CSLBlock}[1]{#1\hfill\break}
+\newcommand{\CSLBlock}[1]{\hfill\break#1\hfill\break}

@jgm jgm closed this as completed in 4b1fc4d Sep 4, 2023
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

6 participants