-
-
Notifications
You must be signed in to change notification settings - Fork 61
Hanging indent #410
Comments
Currently reference are wrapped in
One solution would be to add the
Then we could add a CSS rule for
Other writers could also be modified to be sensitive to this class. |
As to html: sounds fine. As to LaTeX, I’m worried that as is, your proposed solution isn’t suitably configurable:
I have run a few tests wrapping all the paragraphs in a reference section of a pandoc-generated latex file in
or
… and both seem to work very well. |
Just wrapping in a We could use a special
|
Maybe setting it up so you can do
would be cleaner. |
Right. I was thinking along these lines:
ALTERNATIVE:
NOTES:
|
This can't be done. pandoc-citeproc simply modifies the pandoc AST. Variables are not part of that (they are part of writer options). pandoc-citeproc could set a metadata field, which would then populate a variable, but I prefer not to mess with metadata, since some output formats will put this in metadata blocks. Hence my thought that this should not be handled in the template, though the template might need to define a default environment. |
I suppose the latex writer could be modified to inspect the |
Sounds excellent. Just to check if I understand this correctly: So pandoc-citeproc (1) cannot set a pandoc variable itself, but (2) it could in principle set a metadata field (though you prefer not to take this route), and (3) it can write pretty much anything into the pandoc AST, which pandoc itself can use to set a pandoc variable? If so, (3) seems it could be made to work without any user intervention, which would be great. If (3) can be made to work, there’s no need of me arguing in favour of (2), but out of curiosity: Would it really pose a problem if |
Maybe it would be okay to put this in metadata, but it would mean it's included in meta tags in HTML, properties in Word, YAML markdown blocks, ... |
Again, if (3) can be expected to work just as well, we don’t really need to discuss (2). FWIW, I tried putting a few random pandoc variables ( |
This depends on whether the `hanging-indent` attribute of `<bibliography>` is true. See #410.
I've implemented this. To test, get latest pandoc master and latest pandoc-citeproc master, and change stack.yaml in pandoc so you've got
Also remove the stanza under extra-deps for pandoc-citeproc. Then |
Excellent, works like a charm for both hanging-indent styles like chicago-author-date.csl and non-hanging-indent styles like harvard-cite-them-right.csl. One thing I hadn’t considered though is that pandoc’s
with
|
I've simplified to
The thinking is that it's harmless to set |
We may want to think about adding something to the html-based templates (including e.g. revealjs), the epub default css, and the ms and context templates. This would also require changes to the writers to make sure variables are set. |
Oh, and it would be nice to make the docx writer sensitive to this, as well. |
A number of html-based templates share the same style element:
All it would seem to take to make hanging indent work is to add one line:
Would a PR for the following files be welcome?
|
Yes, sure. |
I'll do this myself as part of a refactor. |
See 381654a7043184c0b0ddf1c2e3fe5c35bfb1cd47 |
Very good that this is finally coming! When will this be available in an official release? Would be great to have this available with ConTeXt as well. What would be needed for this? |
That could be a start:
|
This will be in the next pandoc and pandoc-citeproc release (hopefully in the coming month). |
Ok. I can do this once the new version is out. But I guess we will have to change to context writer as well so that the references are wrapped in |
Put a note in your PR and I can handle that part. |
Define an start-stop-pair `cslreferences` to allow for hanging indents in the bibliography. Analogous to the cslreferences-environment in the default latex template. See here: jgm/pandoc-citeproc#410 For this to work the context writer must be adapted.
Currently, pandoc-citeproc ignores the
hanging-indent="true"
flag in.csl
style files. While it is almost trivial to obtain hanging indentation in the references section in html (via css), there is no easy way to do this if the output format is latex or pdf.(So far, I have been using this filter for tweaking the latex output by wrapping the references section in a
references
latex list environment, complemented by a suitable definition of the environment in the latex template.)It seems difficult to simplify this setup since pandoc’s latex output currently does not provide hooks of any kind in connection with the references section, e.g., a latex enviroment analogous to
<div id="refs" class="references">
in html output.So, I’d like to suggest, as a minimum, to start wrapping the references section (excluding its header) in a latex environment, e.g.,
\begin{references}
…\end{references}
(or possibly, for maximal clarity,\begin{pandocreferences}
…\end{pandocreferences}
).Of course this would have to be defined in the latex template. As a minimum, this could be set up to do nothing:
… and users would be able to redefine this as they see fit.
A further step could be to provide a suitable definition for hanging indentation in the template. This would make hanging indentation the default, but since a large majority of CSL styles calls for hanging indentation anyway, pandoc’s latex output would actually be correct more often than it is currently.
One option would be to add, in the template,
\usepackage{hanging}
, and define\newenvironment{references}{\hangparas{2em}{1}}{\endhangparas}
. Of course, one could avoid loading an additional package by providing a functionally equivalent definition in a few lines of latex code.A final step would be to actually honour CSL’s
hanging-indent
flag by having pandoc-citeproc read this from the.csl
file, setting a pandoc variable (which could be calledhanging-indent
as well), and adding a suitable if-then-else construct to the latex template.The text was updated successfully, but these errors were encountered: