jez / tufte-pandoc-css

Starter files for using Pandoc Markdown with Tufte CSS
https://jez.io/tufte-pandoc-css/
313 stars 30 forks source link

No css for bibliography? #5

Closed postylem closed 3 years ago

postylem commented 3 years ago

I was compiling HTML from markdown using pandoc with the --citeproc option, and I noticed that the bibliography looked bad (basically because there's no hanging indent).

Here is an example with tufte-pandoc-css Screen Shot 2021-06-24 at 16 24 52

Compare to the following (with the default css), it's clear that the lack of hanging indent makes it pretty unreadable.

Screen Shot 2021-06-24 at 16 25 09

This seems to be caused by the fact that no classes such as div.csl-entry are defined in tufte-css, or in the additional css files in this repo. I hacked together a quick fix by copying things from the default css. This is what I added:

div.csl-bib-body {
  /* font-size: 1.4rem; */
  /* line-height: 2rem; */
  width: 55%;
}
div.csl-entry {
  clear: both;
  margin-top: .25em;
}
.hanging div.csl-entry {
  margin-left:2em;
  text-indent:-2em;
}
div.csl-left-margin {
  min-width:2em;
  float:left;
}
div.csl-right-inline {
  margin-left:2em;
  padding-left:1em;
}
div.csl-indent {
  margin-left: 2em;
}
div.hanging-indent{
  margin-left: 1.5em;
  text-indent: -1.5em;
}

@media (max-width: 760px) {
  div.csl-bib-body {
    width: 100%;
  }
}

to get the following Screen Shot 2021-06-24 at 17 21 57

This is better. But, a more comprehensive fix would be needed to make this work with arbitrary CSLs, I think (I'm just using the default Chicago author-year CSL, ones that make numbered references (e.g. Springer, or IEEE) would need additional attention.) Am I missing something, and is this fix not needed? Is fixing this something within the scope of this project?

(Also, This repo is great. Thanks for putting it up!)

jez commented 3 years ago

Sorry I’ve never used pandoc with citations. Feel free to contribute whatever styles you think you need!

postylem commented 3 years ago

Ok. I just made a pull request here https://github.com/jez/tufte-pandoc-css/pull/6#issue-677603271 with this addition. It doesn't provide complete support (I've only tested it with the default chicago-author-date style), but it should work for people who just use the default settings which is better than nothing :).