-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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: fix \CSLRightInline
vertical space
#9058
Conversation
When using a CSL stylesheet with the `citation-number` attribute e.g. `nature`, when `\CSLRightInline` is only one line currently extraneous vertical space is added.
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break} | ||
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1\\[-1.7ex]}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why this change fixes the problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To determine where the additional vertical space was coming from I wrapped the \parbox{}
in an \fbox{}
. This indicated that it was from the \break
outside the \parbox
. By moving that inside the \parbox
results were consistent regardless of bibitem length, but without negative adjustment were too large. By iteration arrived at the value of -1.7ex
. I had previously been using a custom template with \break
replaced by \\[-0.7ex]
to get spacing that matched the document. Technically why, I don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just seems a bit "magic" and unprincipled...I wonder if there's a better way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about just removing the \break
? Is it needed?
It seems to work fine without it and I don't get the extra space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During my testing I had initially tried that, but when using a more complex document using article
and scrartcl
the linespacing was removed between bibitems:
but having used the above input file with article
, scrartcl
, apa6
(with the man
class option) and beamer
it works correctly, so there must be something (not obvious) in that document which is causing the issue which I will sort out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering whether, when entry spacing is set to 0, we should just use
\parskip
instead of actually using 0? In a document that has a\parskip
of 6pt (default for pandoc), the bibliography may look odd with 0 space between entries. But maybe that's too opinionated a divergence.
No. I think it would be incorrect in terms of the CSL spec. I believe the current implementation is accurate.
With entry-spacing="0"
and \setlength{\itemsep}{#2\baselineskip}}}
:
and entry-spacing="0"
and \setlength{\itemsep}{\parskip}}}
:
The spacing is approaching what it is when entry-spacing="1"
. The paragraph spacing has nothing to do with the entry spacing, which had me confused until I read the spec more carefully
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree it's more accurate this way. I just think it's a bit awkward that, with the default 6pt parskip that pandoc gives you without indent
, you have a choice between a bigger or a smaller space between bib entries, but no way to get the same...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually prefer the way it is 😃.
This is going to be the case with all documents where entry-spacing="0"
and indent: false
, regardless if using a KOMA class, the parskip
package, or the pandoc default of 6pt plus 2pt minus 1pt
. In my custom template I used to have the entry-spacing
depend on indent
. But, I was wrong, due to my ignorance from not having read the spec, assuming 0 meant zero spacing (not zero additional spacing), 1 was line spacing (actually 0)... and which clearly others do too e.g. #7296. But, I can appreciate the visual appeal:
rather than moving up to entry-spacing="1"
:
However, if you decide to implement this please don't make it the default, but rather an option, or better yet as a filter, so that at least the default is compliant with the spec. Of course, for those wanting something special, it is always possible to use header-includes
:
\usepackage{etoolbox}
\AtBeginEnvironment{CSLReferences}[\setlength{\itemsep}{ANYTHING YOU WISH}
I have completed testing the latex CSL functionality. I have tested with the KOMA, APA, and standard classes, together with beamer. All combinations of linespacing (single, onehalf and double) work correctly with entry-spacing
values of 0, 1 and 2, using bibliographies of approx 50–200 items. Thanks very much for your efforts with this, I am really happy with the results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for the extensive testing! I'll close this.
- Add a strut to avoid inconsistencies in spacing. - Remove a break at the end of CSLRightInline to avoid inconsistencies in spacing. It shouldn't be necessary because the paragraph should extend to the right margin. See #9058.
According to the CSL manual, the default entry spacing is 1. We were treating it as 0. T.P.Citeproc: always include an entry-spacing attribute in the Div if the bibliography element contains an entry-spacing attribute (previously we omitted it when it was 0). LaTeX writer: use entry spacing 1 if no entry-spacing attribute is present. Update tests. See #9058.
When using a CSL stylesheet with the
citation-number
attribute e.g.nature
, when\CSLRightInline
is only one line currently extraneous vertical space is added.