-
-
Notifications
You must be signed in to change notification settings - Fork 97
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Setting vertical marks #318
Comments
Off the top of my head, I would try putting the text into a vbox; have a look at the simple table package. (Yeah, doing layout with tables feels as bad here as it does in HTML, but it's worth a look.) Or you could try doing what |
I've tried a couple stabs at this and fallen pretty flat every time. My current hack is to look through the paragraph and count the number of penalties. If it's less than 5 I stuff a couple more in. This works for this particular use but it probably doesn't generalize very well making this a hard problem for users to solve: if publisher then
SILE.call("skip", { height = "5.4em" })
SILE.settings.temporarily(function ()
SILE.call("img", { src = qrimg, height = "5.8em" })
SILE.call("skip", { height = "-6.3em" })
SILE.settings.set("document.lskip", SILE.nodefactory.newGlue({ width = imgUnit * 6.5 }))
if SILE.Commands["meta:identifiers"] then SILE.call("meta:identifiers") end
SILE.call("font", { weight = 600, style = "Bold" }, { "Sürüm: " })
SILE.call("font", { family = "Hack", size = "0.8em" }, SILE.Commands["meta:surum"])
SILE.call("break")
SILE.call("font", { weight = 600, style = "Bold" }, { "URL: " })
SILE.call("font", { family = "Hack", size = "0.8em" }, SILE.Commands["meta:url"])
-- Hack around not being able to output a vbox with an indent
-- See https://github.com/simoncozens/sile/issues/318
local lines = 1
for i = 1, #SILE.typesetter.state.nodes do
lines = lines + (SILE.typesetter.state.nodes[i]:isPenalty() and 1 or 0)
end
for i = lines, 5 do
SILE.call("hbox")
SILE.call("break")
end
SILE.call("par")
end)
end The key here is that I don't know how many lines |
There would be so many ways to achieve this, with probably variants depending on how one wants to handle all the decisions left undefined in the initial question (e.g. maximum width of the text content, maximum height of the image, edge cases when these get incompatible with each other vs. the available page width, etc. -- and, why not, even min-max both blocks). Considering the simplest case, though... Let me give it a try, to back my old claim elsewhere it was all doable with the appropriate tools... LGTM 😺 Here are the steps:
Where
Does it answer the question? |
The suggested answer currently only works well with the boxed paragraph doesn't contain migrating contents (footnotes). "Stealing" content from the typesetter queue is bad otherwise. As an aside addition, indirectly related to the original example: instead of an image for the QR code, one may be interested in giving a try to qrcode.sile :) |
A new version (with the latest "parbox.sile" module at this date), better for two reasons at least:
Comments welcome, especially on how to properly handle the "DOH" commented sections in such examples. (It works, but is rather long-winded... Of course, moving the Lua bit in some package or dedicated class would avoid it all.) |
Fixing #1510 should address most of this. The deprecation warnings thrown in this context are bogus because the context for their registration is known. I was trying to get unscoped registrations out out of packages, not out of documents! As an alternative you can use a |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
How should something like this be typeset:
This layout is correct (and generated by SILE) but the code for it is too brittle to put in an automatic template. I can massage it given specific content, but with the content being an unknown I'm having a hard time coming up with a template.
Currently I'm dropping the image with a fixed height, then skipping back negative a little more than that height, then adding lskip, then typesetting the 5 lines of data, then turning off the lskip and going back to normal.
The trouble is I don't actually know ahead of time how much content there will be. For some instances there might only be three lines of content. Given my current code this would cause the next block to be typeset overlapping the barcode.
I tried using
SILE.typesetter.frame.state.cursorY
, but this value does not get updated in between elements like I would need it to be to do math and figure out how much I moved relative to where the image was output. It updates if I callSILE.typesetter:chuck()
, but of course that screws up the page layout, notably the\vfill
at the top of the page that puts this whole thing at the bottom of the page gets eaten.The nearest thing I found in the docs was the "sidenotes" example using the cursor position, but like I said this doesn't seem to update when I need it to.
What's the best tool for the job here?
The text was updated successfully, but these errors were encountered: