Skip to content

Commit

Permalink
marginalia:0.1.2 (#1666)
Browse files Browse the repository at this point in the history
  • Loading branch information
nleanba authored Feb 5, 2025
1 parent dc189ac commit cd71d17
Show file tree
Hide file tree
Showing 4 changed files with 709 additions and 0 deletions.
78 changes: 78 additions & 0 deletions packages/preview/marginalia/0.1.2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Marginalia

## Setup

Put something akin to the following at the start of your `.typ` file:

```typ
#import "@preview/marginalia:0.1.2" as marginalia: note, wideblock
#let config = (
// inner: ( far: 5mm, width: 15mm, sep: 5mm ),
// outer: ( far: 5mm, width: 15mm, sep: 5mm ),
// top: 2.5cm,
// bottom: 2.5cm,
// book: false,
// clearance: 8pt,
// flush-numbers: false,
// numbering: /* numbering-function */,
)
#marginalia.configure(..config)
#set page(
// setup margins:
..marginalia.page-setup(..config),
/* other page setup */
)
```

If `book` is `false`, `inner` and `outer` correspond to the left and right
margins respectively. If book is true, the margins swap sides on even and odd
pages. Notes are placed in the outside margin by default.

Where you can then customize `config` to your preferences. Shown here (as
comments) are the default values taken if the corresponding keys are unset.
[Please refer to the PDF documentation for more details on the configuration and the provided commands.](https://github.com/nleanba/typst-marginalia/blob/v0.1.2/Marginalia.pdf)

## Margin-Notes

Provided via the `#note[...]` command.

- `#note(reverse: true)[...]` to put it on the inside margin.
- `#note(numbered: false)[...]` to remove the marker.

Note: it is recommended to reset the counter for the markers regularly, e.g. by
putting `marginalia.notecounter.update(0)` into the code for your header.

## Wide Blocks

Provided via the `#wideblock[...]` command.

- `#wideblock(reverse: true)[...]` to extend into the inside margin instead.
- `#wideblock(double: true)[...]` to extend into both margins.

Note: `reverse` and `double` are mutually exclusive.

Note: Wideblocks do not handle pagebreaks in `book: true` documents well.

## Figures

You can use figures as normal, also within wideblocks.
To get captions on the side, use
```typ
#set figure(gap: 0pt)
#set figure.caption(position: top)
#show figure.caption.where(position: top): note.with(numbered: false, dy: 1em)
```

For small figures, the package also provides a `notefigure` command which places the figure in the margin.
```typ
#marginalia.notefigure(
rect(width: 100%),
label: <aaa>,
caption: [A notefigure.],
)
```

-------


[![first page of the documentation](https://github.com/nleanba/typst-marginalia/raw/refs/tags/v0.1.2/preview.svg)](https://github.com/nleanba/typst-marginalia/blob/v0.1.2/Marginalia.pdf)
24 changes: 24 additions & 0 deletions packages/preview/marginalia/0.1.2/UNLICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>
Loading

0 comments on commit cd71d17

Please sign in to comment.