Skip to content

Instantly share code, notes, and snippets.

@rjcragg
Created May 5, 2015 18:21
Show Gist options
  • Save rjcragg/7dfe6fc2d400e4809161 to your computer and use it in GitHub Desktop.
Save rjcragg/7dfe6fc2d400e4809161 to your computer and use it in GitHub Desktop.
<style type="text/css">
body {
background:#fff;
color:#000;
font-family: Didot;
font-size:14px;
line-height:170%;
text-align: justify;
counter-reset: chapter; // FDM 130718 - Essential declaration of 'chapter' for nested counters H1 to H6 to work
}
table { border: solid black; border-width: 2px 0px; empty-cells: hide; border-spacing: 0px; padding: 2px; margin: 20px auto;}
table caption { margin: 5px; text-align: center; caption-side: bottom;}
thead th { border: solid gray; border-width: 0 0 2px 0; padding: 5px;}
thead > tr:last-child > th { border-style: none; }
tbody > tr:first-child > td { border: solid gray; border-width: 1px 0 0 0;}
tbody > tr:first-child > th { border: solid gray; border-width: 1px 0 0 0;}
thead + tbody > tr:first-child > td { border: solid black; border-width: 1px 0 0 0;}
thead + tbody > tr:first-child > th { border: solid black; border-width: 1px 0 0 0;}
del.critic {background:#fae6e6;}
ins.critic {background:#ecfce6}
a.footnote, a.citation {font-size: 0.83em; vertical-align: super;}
H1:before {
content: counter(chapter) ". ";
counter-increment: chapter;
}
H1 {
counter-reset: SectionH2;
}
H2:before {
content: counter(chapter) "." counter(SectionH2) " ";
counter-increment: SectionH2;
}
H2 {
counter-reset: SectionH3;
}
H3:before {
content: counter(chapter) "." counter(SectionH2) "." counter(SectionH3) " ";
counter-increment: SectionH3;
}
H3 {
counter-reset: SectionH4;
}
H4:before {
content: counter(chapter) "." counter(SectionH2) "." counter(SectionH3) "." counter(SectionH4) " ";
counter-increment: SectionH4;
}
H4 {
counter-reset: SectionH5;
}
H5:before {
content: counter(chapter) "." counter(SectionH2) "." counter(SectionH3) "." counter(SectionH4) "." counter(SectionH5) " ";
counter-increment: SectionH5;
}
H5 {
counter-reset: SectionH6;
}
H6:before {
content: counter(chapter) "." counter(SectionH2) "." counter(SectionH3) "." counter(SectionH4) "." counter(SectionH5) "." counter(SectionH6) " ";
counter-increment: SectionH6;
}
H1 { page-break-after: always; }
H1:not(:first-of-type) { page-break-before: always; }
H2:not(:first-of-type) {page-break-before: always; page-break-after: avoid;}
H3, H4, H5, H6 { page-break-after: avoid; }
h3+p,h4+p,h5+p,h6+p { page-break-before: avoid; }
caption:before, figcaption:before {counter-increment: FigureNo; content: counter(ChapterNo) "-" counter(FigureNo) ": "}
@page :left { @bottom-left { content: counter(page) " " string(BookTitle); } }
@page :right { @bottom-right { content: string(Chapter) " " counter(page); } }
head > title { string-set: BookTitle self; }
H2 { string-set: Chapter self before; }
@page {size: 5.5in 8.5in;}
@page chapters:left {margin: 0.75in 0.75in 1.125in 0.62in; padding-left: 0.5in;}
@page chapters:right {margin: 0.75in 0.62in 1.125in 0.75in; padding-right: 0.5in;}
</style>
@rjcragg
Copy link
Author

rjcragg commented May 5, 2015

Created by francois
http://support.multimarkdown.com/users/2646226

Works well in StackEdit.io if you add the <style> to the template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment