-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow usage of inside/outside #3
Comments
I am not yet inclined to support this by default since it would greatly increase some of the complexity, but does this work for you? #import "@preview/drafting:0.1.1": *
#import "utils.typ": *
#let (in-margin, out-margin) = (3in, 0.8in)
#let my-note(..args) = {
locate(loc => {
let (l, r) = (out-margin, in-margin)
if calc.odd(counter(page).at(loc).last()) {
(l, r) = (r, l)
}
margin-note(margin-left: l, margin-right: r, ..args)
})
}
#set page(
margin: (inside: in-margin, outside: out-margin),
paper: "us-letter",
height: auto,
)
#set-page-properties()
#lorem(50)
#my-note[A right note]
#my-note(side: left)[A left note]
#lorem(50)
#pagebreak()
#lorem(50)
#my-note[A right note]
#my-note(side: left)[A left note]
#lorem(50) |
Thank you! That works. I modified the function to automatically do what I want:
Would be nice if something like this could be included in the package, but of course it is your decision if the use case fits your conception. |
The reason I'm hesitant is it almost doubles the number of parameters the user must pass to |
I am inspired by your solution to set the default |
That would already help tremendously and actually be as well of a solution! :) 👍 |
It was not working for me, so I sent a PR with the page oddity check. |
I came across this when I ran into compiler warnings trying to solve the same issue (switching left/right with different margins depending on odd/even pages). I had found a similar solution and it seemed to work (visually, it produced the desired output), but it throws a warning, that the layout did not converge within 5 attempts. So I tried this solution, which is very similar to mine, and I am getting the very same warning. Has anyone experienced this as well? |
@mareikep thanks for reporting, are you able to share the full source code for your document that generates warnings? It will be much easier for me to identify the cause in that case. Generally, the only time compiler warnings are unavoidable is when you have >= 4 overlapping notes |
Sure, I decided to just create a link to share the source in the Typst app, so it's easiest to reproduce. Hope, you have some fresh ideas :) |
@mareikep the problem is you have |
Thanks for the hint, unfortunately the drafting package does not pass the |
Typst now allows defining margins for inside/outside for bound documents. Would be nice if I could use this package like this, too.
Also, making it possible to define different text alignments depending on if the outside margin is on a left or a right side of a page.
Thanks for this very useful package!
The text was updated successfully, but these errors were encountered: