├── .github └── workflows │ └── build_example.yaml ├── LICENSE ├── README.md ├── assets └── banner.png ├── bib.bib ├── example.pdf ├── example.typ └── haobook ├── lib.typ ├── pages.typ ├── styles.typ └── tools.typ /.github/workflows/build_example.yaml: -------------------------------------------------------------------------------- 1 | name: Build example.pdf 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | 9 | jobs: 10 | update-example: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Checkout repository 15 | uses: actions/checkout@v4 16 | 17 | - name: Setup Typst 18 | uses: typst-community/setup-typst@v2 19 | with: 20 | version: "latest" 21 | 22 | - name: Build example.pdf 23 | run: | 24 | typst c example.typ example.pdf 25 | 26 | - name: Commit and push changes 27 | run: | 28 | git config --local user.email "github-actions[bot]@users.noreply.github.com" 29 | git config --local user.name "github-actions[bot]" 30 | git add . -f 31 | git commit -m "Update example.pdf" || echo "No changes to commit" 32 | git push 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HaoBook 2 | 3 | A beautiful Typst book template inspired by [kaobook](https://github.com/fmarotta/kaobook), featuring margin notes, side figures, and elegant typography. 4 | 5 | ## Example and Usage 6 | 7 | See [example.pdf](https://github.com/ParaN3xus/haobook/blob/main/example.pdf) for detailed usage examples and template features. 8 | 9 | ## Features 10 | 11 | - Elegant typography with margin notes and side figures 12 | - Book mode with alternating margin positions 13 | 14 | ## License 15 | This project is open-source under the [Mozilla Public License 2.0 (MPL-2.0)](https://github.com/ParaN3xus/haobook/blob/main/LICENSE). -------------------------------------------------------------------------------- /assets/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParaN3xus/haobook/96db3c1dfb7edff38e23f88c23a7e7b5dcaf4b81/assets/banner.png -------------------------------------------------------------------------------- /bib.bib: -------------------------------------------------------------------------------- 1 | @mastersthesis{maedje2022typst, 2 | author = {M{\"a}dje, Laurenz}, 3 | title = {Typst: A Programmable Markup Language for Typesetting}, 4 | school = {Technical University of Berlin}, 5 | year = {2022}, 6 | month = {9}, 7 | day = {8}, 8 | address = {Berlin, Germany}, 9 | note = {Faculty IV - Electrical Engineering and Computer Science}, 10 | email = {maedje@campus.tu-berlin.de}, 11 | supervisor = {Prof. Dr. Odej Kao and Prof. Dr. Sabine Glesner} 12 | } 13 | -------------------------------------------------------------------------------- /example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ParaN3xus/haobook/96db3c1dfb7edff38e23f88c23a7e7b5dcaf4b81/example.pdf -------------------------------------------------------------------------------- /example.typ: -------------------------------------------------------------------------------- 1 | #import "haobook/lib.typ": * 2 | #import "@preview/zebraw:0.5.0": * 3 | #show: zebraw.with(..zebraw-themes.zebra) 4 | 5 | #let ( 6 | body-styles, 7 | normal-page, 8 | img-heading, 9 | side-figure, 10 | ) = template(book: false) 11 | 12 | #cover( 13 | title: [ 14 | Example and Documentation \ 15 | of the HaoBook Template 16 | ], 17 | author: "ParaN3xus", 18 | date: datetime(year: 2025, month: 4, day: 6), 19 | ) 20 | 21 | #epigraph[ 22 | By `epigraph`, you can add a quote or a saying at the beginning of the book. 23 | ] 24 | 25 | #preface[ 26 | #let l-marginalia = link("https://github.com/nleanba/typst-marginalia")[marginalia] 27 | #let l-yexiang1992 = link("https://github.com/yexiang1992")[\@yexiang1992] 28 | 29 | This is a preface. You can add some information about the book here by calling `preface`. 30 | 31 | The template is heavily inspired by the LaTeX book template #link("https://github.com/fmarotta/kaobook")[kaobook], and was sponsored by #l-yexiang1992. Without the developers of kaobook and the support of #l-yexiang1992, this template would not have been possible. 32 | 33 | During the development of this template, I have also referenced the implementations of #link("https://github.com/samuelireson/project-iii-typst")[project-iii-typst] and #link("https://github.com/nogula/tufte-memo")[tufte-memo]. They are all excellent templates that you might want to explore if interested. The key feature of this template—sidenotes—is implemented using #l-marginalia by #link("https://github.com/nleanba")[\@nleanba]. I must emphasize that #l-marginalia's implementation is truly outstanding. If you simply want to add sidenotes to your document, I recommend using #l-marginalia directly, as it offers more power and customization options than this template. 34 | 35 | This document serves both as a test document and a tutorial for the template. You can find the source code in the `example.typ` file. The template is designed to be user-friendly and customizable, allowing you to adapt it to your specific requirements. 36 | #align(right)[_ParaN3xus_] 37 | ] 38 | 39 | #contents 40 | 41 | #show: body-styles 42 | 43 | #part[Specifications] 44 | = Features 45 | In this chapter, I will show you all the features of the template. 46 | 47 | == Front Matter 48 | As you can see, the template provides all those front matter pages before this page. You can use them to add a cover page, an epigraph, a preface, and a table of contents to your document. 49 | 50 | == Margin-related Features 51 | === Automatically 52 | ==== Margin position 53 | You may want to publish your book in a way that the margin notes are on the left side of the page for odd pages and on the right side for even pages. This template provides you with this feature. You can enable it by using the `book: true` parameter when calling the `template` function. 54 | 55 | ==== Chapter outline 56 | You may have noticed that the chapter outline is automatically generated. 57 | 58 | ==== References 59 | When I'm referencing something great@maedje2022typst, a detailed reference will be shown in the margin. 60 | 61 | ==== Figures 62 | When I'm adding a figure, the caption will be shown in the margin. 63 | 64 | #figure( 65 | rect( 66 | width: 100%, 67 | height: 1cm, 68 | fill: gradient.linear(..color.map.rainbow), 69 | ), 70 | caption: [A rainbow], 71 | ) 72 | 73 | === Manually 74 | ==== Side Notes 75 | You can use `side-note` and `margin-note`#margin-note[A margin note.] to add notes to the document. Just like what#side-note[A side note.] was shown on the right side. 76 | 77 | ==== Side Figures 78 | You can use `side-figure` to add a figure like @fig-circle to the document. 79 | 80 | You might wonder why you can't simply use `figure` inside `margin-note`. This would cause conflicts with the figure caption styles shown in @sect-feat-figures, so you need to use `side-figure` instead. 81 | #side-figure( 82 | figure( 83 | circle(), 84 | caption: "A circle", 85 | ), 86 | label: , 87 | dy: -4em, 88 | ) 89 | 90 | ==== Wide Block 91 | You can use `wideblock` to add a block that spans the whole page. This is useful for adding text or figures that need to extend across the entire page width. 92 | 93 | #wideblock( 94 | figure( 95 | rect( 96 | width: 100%, 97 | height: 1cm, 98 | fill: gradient.linear(..color.map.rainbow), 99 | ), 100 | caption: [A wide rainbow], 101 | ), 102 | ) 103 | 104 | == General Styles 105 | You've already seen the general styles of the template, including heading styles, page headers, etc. 106 | 107 | You may have also noticed that figure numbering#side-note[Actually the counters affected are: 108 | - `figure.where(kind: image)` 109 | - `figure.where(kind: table)` 110 | - `figure.where(kind: raw)` 111 | - `math.equation`. 112 | ] follows the format `chapno`-`figno`. This is already implemented in the template, so there's no need to use `i-figured`. 113 | 114 | // = Usage of the Template 115 | #img-heading( 116 | [Usage of the Template], 117 | read("assets/banner.png", encoding: none), 118 | label: , 119 | ) 120 | The template is designed to be easy to use. You can use it to create a book or a report with a beautiful layout. 121 | 122 | In this chapter, I will show you how to initialize the template and use a variety of utility functions provided. 123 | 124 | == Importing the Template 125 | To use the template, you need to import the `lib.typ` file and call the `template` function. 126 | 127 | ```typ 128 | #import "haobook/lib.typ": * 129 | 130 | // Pass book: true parameter to use book mode 131 | #let (body-styles, normal-page, img-heading, side-figure) = template(book: true) 132 | ``` 133 | 134 | When calling the `template` function, you can pass a parameter `book` to specify whether you are creating a book with alternating margin notes position or a report with consistent margin position. The default value is `false`. 135 | 136 | In addition to the four functions returned by `template`, functions independent of book mode are also imported. All of these functions are: 137 | - Styles: 138 | - `front-matter-style(body)`: Style for front matter pages. 139 | - `appendix-style(body)`: Style for appendix pages. 140 | - `body-styles(body)`: Style for body pages. 141 | - Pages#side-note[Some of them like `contents` and `normal-page` are not necessarily limited to one page.]: 142 | - `cover(title: "The Title", author: "The Author", date: datetime.today())`: Add a cover page to the document. 143 | - `epigraph(body)`: Add an epigraph to the document. 144 | - `preface(body)`: Add a preface to the document. 145 | - `contents`: Add a table of contents to the document. 146 | - `bib(body)`: Add a bibliography to the document. 147 | - `part(body)`: Add a part page to the document. 148 | - `normal-page(body)`: Add normal pages without side notes to the document. 149 | - Tools: 150 | - `side-note(body, dy: 0em)`: Add a side note#side-note[`side-note` has numbering.] to the document. 151 | - `margin-note(body, dy: 0em)`: Add a margin note#margin-note[`margin-note` doesn't have numbering.] to the document. 152 | - `side-figure(figure, label: none, dy: 0em)`: Add a side figure to the document. 153 | - `wideblock(body)`: Add a wide block to the document. 154 | - `img-heading(body, img, label: none)`: Add a heading of level 1 with a banner image to the document. 155 | 156 | == Suggested Document Structure 157 | Overall, your document should be structured like this: 158 | 159 | ```typ 160 | #import "haobook/lib.typ": * 161 | #let (body-styles, normal-page, img-heading, side-figure) = template(book: true) 162 | 163 | // frontmatter 164 | #cover( 165 | // title: "The Title", 166 | // author: "The Author", 167 | // date: datetime.today(), 168 | ) 169 | #epigraph[ 170 | // Add an epigraph to the document. 171 | ] 172 | #preface[ 173 | // Add a preface to the document. 174 | ] 175 | #contents 176 | 177 | // body 178 | #show: body-styles 179 | 180 | ... 181 | 182 | // appendix 183 | #part[Appendix] 184 | #show: appendix-style 185 | 186 | ... 187 | ``` 188 | 189 | For the body of the document, the template provides you with at least three hierarchical levels of structure: 190 | - `part`#side-note[A part is optional. You can create a level 1 heading without any part just like @chapter-usage.]: The `part` will create a single page with a title. You can use it to create a new chapter or a new part in your document. 191 | - `= Heading` or `img-heading`: The level 1 heading will create a chapter starting from a new page#side-note[With a chapter outline just like the one at the beginning of this chapter]. Specifically, the `img-heading` will create a heading with an image banner. 192 | - `== Section`: The level 2 heading will create a section. 193 | - `...`: You can use more `=` to create deeper levels of headings. The template won't style them for you. 194 | 195 | For the appendix, it's almost the same as the body. But their heading numbering is `"A.1"`. 196 | 197 | == Usage of Some Functions 198 | In this chapter, I will show you how to use some functions, mainly tool functions, as well as some page functions. 199 | === Side Note 200 | Two types of notes are provided in the template: 201 | - `side-note`: The `side-note` will create a side note with numbering#side-note[Like this]. Its numbering will be reset for each page. 202 | - `margin-note`: The `margin-note` will create a margin note without numbering#margin-note[Like this]. And thus, there won't be any mark in the main text. 203 | 204 | For both types of notes, you can use the `dy` parameter to specify the vertical position of the note. The default value is `0em`, which means the note will be placed at the same vertical position as the main text. You can use a negative value to move the note up, or a positive value to move it down. 205 | 206 | === Side Figure 207 | The `side-figure` will create a side figure with a caption. You can use it to create a figure with a caption on the side of the page. The caption will be numbered according to the chapter. 208 | 209 | Here is an example of how to use the `side-figure`: 210 | ```typ 211 | #side-figure( 212 | figure( 213 | rect(), 214 | caption: "A rectangle", 215 | ), 216 | label: , 217 | ) 218 | ``` 219 | #side-figure( 220 | figure( 221 | rect(), 222 | caption: "A rectangle", 223 | ), 224 | label: , 225 | ) 226 | 227 | As you can see, the `side-figure` will create a figure with a caption on the side of the page, just like @fig-rect. 228 | 229 | You can also use the `dy` parameter to specify the vertical position of the figure. 230 | 231 | === Wide Block 232 | Sometimes, you may want to create a wide block of content that spans the whole page. You can use the `wideblock` function to do this: 233 | ```typ 234 | #wideblock( 235 | figure( 236 | rect( 237 | width: 100%, 238 | height: 1cm, 239 | fill: gradient.linear(..color.map.rainbow), 240 | ), 241 | caption: [Another wide rainbow], 242 | ), 243 | ) 244 | ``` 245 | #wideblock( 246 | figure( 247 | rect( 248 | width: 100%, 249 | height: 1cm, 250 | fill: gradient.linear(..color.map.rainbow), 251 | ), 252 | caption: [Another wide rainbow], 253 | ), 254 | ) 255 | 256 | === Image Heading 257 | The `img-heading` function will create a level 1 heading with an image banner. 258 | 259 | Actually, it's more like an example of alternative styles for level 1 headings. If you don't like it, you can modify it to your own style. 260 | 261 | 262 | ```typ 263 | #img-heading( 264 | [Usage of the Template], 265 | read("assets/banner.png", encoding: none), 266 | label: , 267 | ) 268 | ``` 269 | The effect is shown in @chapter-usage. 270 | 271 | Note that you should use the `label` parameter to specify the label of the heading, and you have to use the `read` function to read the image file, otherwise the root of the path will be inside the template folder#side-note[Which is not what we want]. 272 | 273 | 274 | === Bibliography 275 | ```typ 276 | #bib(read("bib.bib")) 277 | ``` 278 | The `bib` function will create a bibliography page with the references in the `bib.bib` file. 279 | 280 | Note that you should use the `read` function to read the `bib.bib` file, for the same reason as explained for `img-heading`. 281 | 282 | === Normal Page 283 | The `normal-page` function#side-note[It's just a wrapper of `set page(...)`] will create a normal page without any side notes. You can use it to create a page with only the main text. 284 | 285 | Actually it creates normal "pages" since if you pass too much content to it, it will create multiple pages. 286 | 287 | = Compatibility 288 | == Margin Notes Packages 289 | The template is based on the `marginalia` package, so it should be compatible with the `marginalia` package. 290 | 291 | Regarding `marge`, `drafting`, or other margin-related packages, I'm not certain about their compatibility. However, it's generally not recommended to use them together with the `marginalia` package. 292 | 293 | == i-figured 294 | Don't use i-figured with this template. It will cause conflicts with the numbering styles. 295 | 296 | If you want to customize the numbering styles, you can examine `chapter-fig-eq-no` and its usage inside `body-styles` in `haobook/styles.typ`. 297 | 298 | == Theorems 299 | === theorion 300 | After a simple test#side-note[A simple "define and reference" test.], I believe the #link("https://github.com/OrangeX4/typst-theorion")[theorion] package is compatible with this template. 301 | 302 | It's an excellent package for creating theorems and proofs. You can use it to create theorems, lemmas, corollaries, propositions, definitions, examples, remarks, and proofs. 303 | 304 | It's recommended to use `#set-inherited-levels(1)` to make its numbering consistent with the template. 305 | 306 | === ctheorems 307 | After a simple test, I believe the #link("https://github.com/sahasatvik/typst-theorems")[ctheorems] package is compatible with this template. 308 | 309 | It's recommended to set `base_level: 1` when defining thmboxes to make its numbering consistent with the template. Also, to ensure the style of `ref`#side-note[The default style of ctheorems `ref` is affected by the show rule of `link`, so it will be blue and underlined without action.] to theorems is consistent with the template, you are recommended to use the following `show` rule: 310 | 311 | 312 | ```typ 313 | #show ref: it => { 314 | if it.element == none or it.element.func() != figure or it.element.kind != "thmenv" { 315 | return it 316 | } 317 | 318 | show link: set text(black) 319 | show underline: x => x.body 320 | it 321 | } 322 | ``` 323 | 324 | === thmbox 325 | After a simple test, I believe the #link("https://github.com/s15n/typst-thmbox")[thmbox] package is compatible with this template. 326 | 327 | It's recommended to set fonts for thmboxes to make them consistent with the template: 328 | 329 | ```typ 330 | #import "@preview/thmbox:0.2.0": * 331 | 332 | #let (thmbox, proof, theorem, proposition, lemma, corollary, definition, example, remark, note, exercise, algorithm, claim, axiom) = (thmbox, proof, theorem, proposition, lemma, corollary, definition, example, remark, note, exercise, algorithm, claim, axiom).map(x => x.with( 333 | title-fonts: "Libertinus Serif", 334 | sans-fonts: "Libertinus Serif", 335 | )) 336 | #show: thmbox-init() 337 | ``` 338 | 339 | === lemmify 340 | It works fine, but due to its own bug#side-note[I'm not entirely sure, but once I've set some heading numbering, the `max-reset-level` parameter stopped working.], the numbering is not consistent with the template. 341 | 342 | === frame-it 343 | It's completely#side-note[The theorem body simply disappears.] incompatible with this template. It causes conflicts with the figure caption styles. 344 | 345 | === great-theorems 346 | It's completely incompatible with this template. It causes conflicts with the heading numbering#side-note[Actually the conflicting part is inside `rich-counters`, so that may be another incompatible package.] styles. 347 | 348 | #part[Appendix] 349 | 350 | #show: appendix-style 351 | 352 | #bib(read("bib.bib")) 353 | 354 | = Notes 355 | I hate writing notes. 356 | 357 | 358 | -------------------------------------------------------------------------------- /haobook/lib.typ: -------------------------------------------------------------------------------- 1 | #import "pages.typ": cover, epigraph, preface, contents, bib, normal-page 2 | #import "styles.typ": body-styles, front-matter-style, appendix-style 3 | #import "tools.typ": part, side-note, margin-note, side-figure, wideblock, img-heading 4 | 5 | #let template(book: false) = { 6 | ( 7 | body-styles.with(book: book), 8 | normal-page.with(book: book), 9 | img-heading.with(book: book), 10 | side-figure.with(book: book), 11 | ) 12 | } 13 | -------------------------------------------------------------------------------- /haobook/pages.typ: -------------------------------------------------------------------------------- 1 | #import "styles.typ": * 2 | #import "tools.typ": label-part 3 | 4 | #let normal-page(body, book: false) = { 5 | set page(margin: (y: 2.5cm, outside: 2.5cm, inside: 2.5cm)) if book 6 | set page(margin: (y: 2.5cm, left: 2.5cm, right: 2.5cm)) if not book 7 | body 8 | } 9 | 10 | #let cover( 11 | title: "The Title", 12 | author: "The Author", 13 | date: datetime.today(), 14 | ) = { 15 | page({ 16 | align( 17 | center + horizon, 18 | { 19 | text(3em, weight: "bold", title) 20 | v(1em) 21 | text(1.5em, "by " + author) 22 | v(1em) 23 | text(1.5em, date.display()) 24 | }, 25 | ) 26 | }) 27 | } 28 | 29 | #let epigraph( 30 | body, 31 | ) = { 32 | page({ 33 | align( 34 | center + horizon, 35 | text(1.5em, body), 36 | ) 37 | }) 38 | } 39 | 40 | #let preface(body) = { 41 | show: front-matter-style 42 | heading(level: 1, [Preface]) 43 | body 44 | pagebreak() 45 | } 46 | 47 | #let contents = { 48 | show: front-matter-style 49 | show: contents-style 50 | outline(target: selector(heading).or(label-part), depth: 3) 51 | } 52 | 53 | #let bib(bib) = { 54 | heading(level: 1, [Bibliography]) 55 | bibliography(bytes(bib), title: none) 56 | pagebreak(weak: true) 57 | } 58 | -------------------------------------------------------------------------------- /haobook/styles.typ: -------------------------------------------------------------------------------- 1 | #import "@preview/marginalia:0.1.3" as marginalia: note 2 | #import "@preview/numbly:0.1.0": numbly 3 | #import "tools.typ": * 4 | 5 | 6 | #let chapter-fig-eq-no( 7 | config: ( 8 | (figure.where(kind: image), figure, "1-1"), 9 | (figure.where(kind: table), figure, "1-1"), 10 | (figure.where(kind: raw), figure, "1-1"), 11 | (math.equation, math.equation, "(1-1)"), 12 | ), 13 | unnumbered-label: "-", 14 | body, 15 | ) = { 16 | show heading.where(level: 1): it => { 17 | config.map(x => counter(x.first())).map(x => x.update(0)).join() 18 | it 19 | } 20 | let h1-counter = counter(heading.where(level: 1)) 21 | 22 | show: x => config.fold( 23 | x, 24 | (it, config) => { 25 | let (k, f, n) = config 26 | 27 | show k: set f( 28 | numbering: _ => { 29 | numbering(n, ..(h1-counter.get(), counter(k).get()).flatten()) 30 | }, 31 | ) 32 | 33 | show selector(k).and(selector(label(unnumbered-label))): set f(numbering: _ => counter(k).update(x => x - 1)) 34 | it 35 | }, 36 | ) 37 | body 38 | } 39 | 40 | #let common-style(body) = { 41 | show link: set text(blue.lighten(10%)) 42 | show link: underline 43 | body 44 | } 45 | 46 | 47 | #let front-matter-style(body) = { 48 | set page(margin: 2.5cm) 49 | set par(justify: true) 50 | show: common-style 51 | show heading.where(level: 1): x => { 52 | set text(22pt) 53 | x 54 | v(28pt) 55 | } 56 | 57 | body 58 | } 59 | 60 | #let appendix-style(body) = { 61 | counter(heading).update(0) 62 | set heading( 63 | numbering: numbly( 64 | "{1:A}", 65 | "{1:A}.{2}", 66 | ), 67 | ) 68 | body 69 | } 70 | 71 | #let contents-style(body) = { 72 | // cancel link style 73 | show link: set text(black) 74 | show underline: it => it.body 75 | 76 | let indent = 0.7cm 77 | set outline( 78 | indent: indent, 79 | title: { 80 | heading( 81 | outlined: true, 82 | level: 1, 83 | [ 84 | Contents 85 | #v(-0.9cm) 86 | ], 87 | ) 88 | }, 89 | ) 90 | set outline.entry(fill: repeat(".", gap: 0.2cm)) 91 | show outline.entry: x => { 92 | if x.element.func() == figure { 93 | // parts 94 | link( 95 | x.element.location(), 96 | { 97 | set text(1.3em) 98 | v(0.4cm) 99 | smallcaps(strong(x.body())) 100 | h(1fr) 101 | strong(x.page()) 102 | v(0cm) 103 | }, 104 | ) 105 | } else if x.level == 1 { 106 | // level 1 headings 107 | link( 108 | x.element.location(), 109 | { 110 | strong({ 111 | let prefix = x.prefix() 112 | if prefix != none { 113 | box(width: indent, prefix) 114 | } 115 | x.body() 116 | }) 117 | h(1fr) 118 | strong(x.page()) 119 | }, 120 | ) 121 | v(0cm) 122 | } else { 123 | x 124 | } 125 | } 126 | body 127 | } 128 | 129 | #let figure-styles(x) = { 130 | // figure caption by side 131 | // skip side figure 132 | if x.body.func() == func-seq and x.body.children.len() > 0 and x.body.children.first() == no-side-caption-tag { 133 | return x 134 | } 135 | 136 | if x.caption != none { 137 | context { 138 | show figure.caption: none 139 | x 140 | margin-note( 141 | bold-figure-caption(x.caption, x.location()), 142 | dy: -measure(x.body).height - 0.65em, 143 | ) 144 | v(-par.spacing) 145 | } 146 | } else { 147 | x 148 | } 149 | } 150 | 151 | #let ref-styles(x) = { 152 | // ref bib styles 153 | // if is bib 154 | if x.element == none { 155 | x 156 | margin-note( 157 | cite( 158 | x.target, 159 | form: "full", 160 | ), 161 | ) 162 | } else { 163 | x 164 | } 165 | } 166 | 167 | #let heading-styles(book: false, x) = { 168 | if x.body.func() == func-seq and x.body.children.at(0) == no-style-heading { 169 | // prevent conflicting with img heading 170 | return x 171 | } 172 | if x.level == 1 { 173 | if type(page.margin) != dictionary { 174 | return x 175 | } 176 | { 177 | set page(header: none) 178 | if book { 179 | pagebreak(to: "odd") 180 | } 181 | } 182 | place( 183 | top, 184 | dy: -page.margin.top, 185 | dx: -book-func(book, _ => page.margin.left, _ => page.margin.inside, _ => 0), 186 | { 187 | let bottom-pad = 6pt 188 | block( 189 | width: page.width, 190 | align( 191 | right, 192 | grid( 193 | columns: ( 194 | auto, 195 | 10pt, 196 | 0pt, 197 | 8pt, 198 | book-func(book, _ => page.margin.right, _ => page.margin.outside, _ => 0) - 17pt, 199 | ), 200 | align: (right + bottom, center, center, center, left + bottom), 201 | pad( 202 | text(26pt, x.body), 203 | bottom: bottom-pad, 204 | ), 205 | [], 206 | line(angle: 90deg, length: 4cm), 207 | [], 208 | pad( 209 | text(74pt, counter(heading).display(heading.numbering)), 210 | bottom: bottom-pad, 211 | ), 212 | ), 213 | ), 214 | ) 215 | }, 216 | ) 217 | v(3.5cm) 218 | context chapter-outline() 219 | } else if x.level == 2 { 220 | v(1cm, weak: true) 221 | set text(14pt) 222 | x 223 | v(0.7cm, weak: true) 224 | } else { 225 | x 226 | } 227 | } 228 | 229 | #let body-styles(book: false, body) = { 230 | let config = ( 231 | outer: (far: 2.5cm, width: 5cm, sep: 0.6cm), 232 | book: book, 233 | ) 234 | marginalia.configure(..config) 235 | 236 | set page(..marginalia.page-setup(..config)) 237 | set page(footer: side-note-counter.update(0)) 238 | set par(justify: true) 239 | 240 | // heading numbering 241 | set heading( 242 | numbering: numbly( 243 | "{1}", 244 | "{1}.{2}", 245 | ), 246 | ) 247 | 248 | show: common-style 249 | set text(body-font-size) 250 | 251 | // heading style 252 | show heading: heading-styles.with(book: book) 253 | 254 | // page header 255 | set page(header: page-header(book)) 256 | 257 | show figure: figure-styles 258 | 259 | show ref: ref-styles 260 | 261 | show: chapter-fig-eq-no 262 | body 263 | } 264 | -------------------------------------------------------------------------------- /haobook/tools.typ: -------------------------------------------------------------------------------- 1 | #import "@preview/marginalia:0.1.3" as marginalia: note, wideblock 2 | 3 | #let label-part = 4 | #let side-note-counter = counter("side-note") 5 | #let no-side-caption-tag = metadata("no-side-caption") 6 | #let no-style-heading = metadata("no-style-heading") 7 | #let body-font-size = 10pt 8 | 9 | 10 | #let func-seq = [].func() 11 | 12 | 13 | #let bold-figure-caption(fig-cap, loc) = context { 14 | strong({ 15 | fig-cap.supplement 16 | " " 17 | numbering(fig-cap.numbering, ..fig-cap.counter.at(loc)) 18 | fig-cap.separator 19 | }) 20 | fig-cap.body 21 | } 22 | 23 | #let book-func(book, non-book-f, book-odd-f, book-even-f) = if book { 24 | if calc.odd(here().page()) { 25 | book-odd-f(0) 26 | } else { 27 | book-even-f(0) 28 | } 29 | } else { 30 | non-book-f(0) 31 | } 32 | 33 | 34 | #let book-value(book, non-book-v, book-odd-v, book-even-v) = if book { 35 | if calc.odd(here().page()) { 36 | book-odd-v 37 | } else { 38 | book-even-v 39 | } 40 | } else { 41 | non-book-v 42 | } 43 | 44 | #let rev-or-not(book) = book-value(book, x => x, x => x, x => x.rev()) 45 | 46 | #let part(title) = page( 47 | margin: auto, 48 | header: none, 49 | { 50 | show figure.caption: none 51 | align( 52 | center + horizon, 53 | [ 54 | #figure( 55 | no-side-caption-tag + text(32pt, strong(smallcaps(title))), 56 | kind: "part", 57 | supplement: h(-0.3em), 58 | numbering: _ => none, 59 | caption: title, 60 | ) #label-part 61 | ], 62 | ) 63 | }, 64 | ) 65 | 66 | #let side-note(body, dy: 0em) = { 67 | side-note-counter.step() 68 | 69 | context { 70 | let in-text-loc = here() 71 | 72 | context super(side-note-counter.display()) 73 | note( 74 | dy: dy, 75 | numbered: false, 76 | { 77 | show link: set text(black) 78 | show underline: it => it.body 79 | 80 | link( 81 | in-text-loc, 82 | context side-note-counter.display("1:"), 83 | ) 84 | h(0.3em) 85 | body 86 | }, 87 | ) 88 | } 89 | } 90 | 91 | #let margin-note( 92 | body, 93 | dy: 0em, 94 | ) = note( 95 | dy: dy, 96 | numbered: false, 97 | body, 98 | ) 99 | 100 | #let side-figure( 101 | body, 102 | book: false, 103 | label: none, 104 | dy: 0em, 105 | ) = { 106 | margin-note( 107 | { 108 | show figure.caption: x => context align( 109 | if book { 110 | if calc.odd(here().page()) { 111 | left 112 | } else { 113 | right 114 | } 115 | } else { 116 | left 117 | }, 118 | { 119 | context strong(x.supplement + " " + x.counter.display(x.numbering) + x.separator) 120 | x.body 121 | }, 122 | ) 123 | show figure: set block(width: 100%) 124 | 125 | let fields = body.fields() 126 | _ = fields.remove("body") 127 | 128 | body = figure(no-side-caption-tag + body.body, ..fields) 129 | [#body #label] 130 | }, 131 | dy: dy, 132 | ) 133 | } 134 | 135 | #let page-header(book) = context { 136 | let h1s = query(selector(heading.where(level: 1)).after(here())) 137 | if h1s.len() != 0 and h1s.first().location().page() == here().page() { 138 | // there's a level 1 heading on this page, don't show pago no header 139 | return 140 | } 141 | 142 | h1s = query(selector(heading.where(level: 1)).before(here())) 143 | if h1s.len() == 0 { 144 | // there's no previous level 1 heading, nothing to show in the header 145 | return 146 | } 147 | 148 | let clothest-h1 = h1s.last() 149 | let pad-b = 3pt 150 | 151 | if type(page.margin) != dictionary { 152 | // normal page 153 | return 154 | } 155 | 156 | move( 157 | dx: -book-func(book, _ => page.margin.left, _ => page.margin.inside, _ => page.margin.outside), 158 | { 159 | let rev-or-not = rev-or-not(book) 160 | block( 161 | width: page.width, 162 | grid( 163 | columns: rev-or-not((1fr, 0.3cm, 0pt, 0.3cm, 3cm)), 164 | align: (right, center, center, center, left), 165 | ..rev-or-not(( 166 | // chapter title 167 | pad( 168 | rev-or-not(( 169 | text( 170 | style: "italic", 171 | clothest-h1.body, 172 | ), 173 | h(0.3em), 174 | numbering("1", ..counter(heading).at(clothest-h1.location())), 175 | )).join(), 176 | bottom: pad-b, 177 | ), 178 | [], 179 | // line 180 | line( 181 | angle: 90deg, 182 | stroke: 0.5pt, 183 | length: page.margin.top, 184 | ), 185 | [], 186 | // page no 187 | pad(str(here().page()), bottom: pad-b), 188 | )) 189 | ), 190 | ) 191 | }, 192 | ) 193 | } 194 | 195 | #let chapter-outline() = place({ 196 | v(0.3cm) 197 | note( 198 | numbered: false, 199 | { 200 | set outline.entry(fill: repeat(".", gap: 0.1cm)) 201 | show outline.entry: x => { 202 | set text(body-font-size) 203 | strong(x) 204 | h(0em) 205 | } 206 | outline( 207 | title: none, 208 | indent: 0em, 209 | target: { 210 | let s = selector(heading.where(level: 2)).after(here()) 211 | 212 | let next-heading = query(heading.where(level: 1).after(here())) 213 | if next-heading.len() > 1 { 214 | s = s.before(next-heading.at(0).location()) 215 | } 216 | s 217 | }, 218 | ) 219 | }, 220 | ) 221 | }) 222 | 223 | #let img-heading(body, img, book: false, label: none) = { 224 | body = heading(level: 1, no-style-heading + body) 225 | if label != none { 226 | body = [#body #label] 227 | } 228 | 229 | context { 230 | if type(page.margin) != dictionary { 231 | return x 232 | } 233 | { 234 | set page(header: none) 235 | if book { 236 | pagebreak(to: "odd") 237 | } 238 | } 239 | let img-h = 9cm 240 | 241 | place( 242 | top, 243 | dy: -page.margin.top, 244 | dx: -book-func(book, _ => page.margin.left, _ => page.margin.inside, _ => page.margin.outside), 245 | block( 246 | width: page.width, 247 | { 248 | image( 249 | img, 250 | width: 100%, 251 | height: img-h, 252 | fit: "cover", 253 | ) 254 | place( 255 | bottom, 256 | { 257 | block( 258 | fill: luma(81.57%, 91.4%).transparentize(10%), 259 | stroke: 0pt, 260 | height: 1.5cm, 261 | inset: ( 262 | left: book-func(book, _ => page.margin.left, _ => page.margin.inside, _ => page.margin.inside), 263 | ), 264 | width: 100%, 265 | align( 266 | left + horizon, 267 | text(14pt, body), 268 | ), 269 | ) 270 | }, 271 | ) 272 | }, 273 | ), 274 | ) 275 | 276 | v(img-h - 0.7cm) 277 | context chapter-outline() 278 | } 279 | } 280 | --------------------------------------------------------------------------------