]> Shamusworld >> Repos - ardour-manual/blob - source/css/pdf.css
Minor PDF tweaks: indent the TOC
[ardour-manual] / source / css / pdf.css
1 /* this stylesheet is used when generating a PDF */
2 /* define a page */
3 @page {
4    size: A4;
5    margin: 1.5cm 1.5cm 1.5cm 1.5cm;
6 }
7
8 @font-face {
9     font-family: 'lora';
10     src: url('../css/Lora-Regular.ttf')  format('truetype');
11     font-weight: normal;
12     font-style: normal;
13 }
14
15 body {
16         font-family: 'lora';
17         counter-reset: partnum chapternum subchapternum subsubchapternum figurenum; /* resets all counters */
18         font-size: 10pt;
19         line-height: 1.25em;
20         text-align: justify;
21         color:#212a30;
22 }
23
24 img {
25         max-width: 100%;
26 }
27
28 div.frontcover {
29         page-break-after: always;
30         margin: auto;
31         width: 80%;
32         font-size: 3em;
33         text-align: center;
34 }
35
36 .frontcover #generationdate {
37         font-size: .25em;
38         text-align: right;
39         bottom: 3cm;
40 }
41
42 /* styles for the right hand spread
43         Bottom left we display the title of the book, bottom right the page using a CSS
44   counter, top right the content of the current chapter
45 */
46 @page :right {
47    @bottom-left {
48        margin: 10pt 0 30pt 0;
49            content: "The Ardour Manual";
50        font-size: 7pt;
51        color: #333;
52    }
53    @bottom-right {
54        margin: 10pt 0 30pt 0;
55        content: counter(page);
56        font-size: 7pt;
57    }
58    @top-right {
59            content: string(doctitle);
60            margin: 30pt 0 10pt 0;
61            font-size: 7pt;
62            color: #333;
63    }
64 }
65
66 /* styles for the left hand spread
67         Bottom right book title, bottom left current page
68 */
69 @page :left {
70    @bottom-right {
71        margin: 10pt 0 30pt 0;
72            content: "The Ardour Manual";
73        font-size: 7pt;
74        color: #333;
75    }
76    @bottom-left {
77        margin: 10pt 0 30pt 0;
78        content: counter(page);
79        font-size: 7pt;
80    }
81 }
82
83 /* first page */
84 @page :first {
85   @bottom-right {
86     content: normal;
87     margin: 0;
88   }
89
90   @bottom-left {
91     content: normal;
92     margin: 0;
93   }
94 }
95
96 h1, h2 {
97   string-set: doctitle content(); /* get the title of the current chapter */
98   page-break-before: always;
99 }
100
101 #toc::before { /* the ToC should not count...*/
102   content: none;
103   counter-reset: partnum;
104 }
105
106 h1::before { /* parts */
107         counter-increment: partnum;
108         content: "Part " counter(partnum) " - ";
109 }
110
111 h2::before {    /* chapter */
112         counter-increment: chapternum;
113         content: "Chapter " counter(chapternum) " - ";
114 }
115
116 h3::before {    /* subchapter */
117   counter-increment: subchapternum;
118   content: counter(chapternum) "." counter(subchapternum) " - " ;
119 }
120
121 h4::before {    /* subsubchapter */
122   counter-increment: subsubchapternum;
123   content: counter(chapternum) "." counter(subchapternum) "." counter(subsubchapternum) " - " ;
124 }
125
126 figcaption::before {
127         counter-increment: figurenum;
128         content: "Fig. " counter(chapternum) "." counter(figurenum) " - ";
129 }
130
131 h1 { font-size: 2.5em; }
132 h2 { font-size: 2em; counter-reset: subchapternum subsubchapternum figurenum; }
133 h3 { font-size: 1.75em; counter-reset: subsubchapternum; }
134 h4 { font-size: 1.4em; }
135 h5 { font-size: 1.2em; }
136 h6 { font-size: 1.1em; }
137
138 h1,h2,h3,h4,h5 {
139         font-weight: bold;
140         page-break-after: avoid;
141         page-break-inside: avoid;
142         line-height: 1.25em;
143         color: #e4214e;
144 }
145
146 h1+p, h2+p, h3+p {
147         page-break-before: avoid;
148 }
149
150 table {
151         clear: both;
152 }
153
154 figure {
155         page-break-inside: avoid;
156 }
157
158 td, th {
159         vertical-align: top;
160 }
161
162 ul.toc {
163         white-space: nowrap;
164         list-style: none;
165 }
166
167 /* create page numbers using target-counter in the TOC */
168 ul.toc a::after {
169   content: target-counter(attr(href), page);
170   float: right;
171 }
172
173 ul.toc li {
174         line-height: 2;
175 }
176
177 ul.toc li a {
178         text-decoration: none;
179 }
180
181 ol {
182         list-style-position: inside;
183 }
184
185 a {
186         font-weight: bold;
187         text-decoration: none;
188         color: inherit;
189 }
190
191 /* add page number to cross references */
192 a[href^="#"]::after {
193   content: " (p. " target-counter(attr(href, url), page) ")";
194 }
195 a[href^="http"]::after {
196         content: " (" attr(href) ")";
197 }