Skip to content
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

help please? want to have a box with a rule on one side #544

Closed
Eli-the-Bearded opened this issue Dec 2, 2018 · 7 comments
Closed

help please? want to have a box with a rule on one side #544

Eli-the-Bearded opened this issue Dec 2, 2018 · 7 comments
Labels
duplicate Rejected as duplicate enhancement Software improvement or feature request

Comments

@Eli-the-Bearded
Copy link

Consider packages/linebox.lua:

SILE.registerCommand("linebox", function (options, content)
  local box = SILE.Commands["hbox"]({}, content)
  local backgroundColor = SILE.colorparser(options.color)
  SILE.outputter:pushColor(backgroundColor)
  SILE.outputter.rule(cursorX, cursorY, 0.5, box.height)
  SILE.outputter:popColor()

  table.insert(SILE.typesetter.state.nodes, box)
end, "Place the output within a box that has a left rule")

The SILE.outputter.rule(cursorX, cursorY, 0.5, box.height) bit was cribbed from libtexpdf-output.lua. And when I try to use this, I get an error that boils down to cursorY is undefined, which upon inspection I see is a variable declared elsewhere in libtexpdf-output.lua. Fooey.

I can't seem to find any examples of working out the size of box so you can draw near it.

(The end goal is to have email style quoting, because I'm trying to include email in a document.)

@alerque alerque added the enhancement Software improvement or feature request label Dec 5, 2018
@alerque
Copy link
Member

alerque commented Dec 5, 2018

The code you cribbed was from a very different context, and the position in the output pipeline gives it a leg up as far as what has been set in stone about the layout at the time it runs. That's not to say that such frames are not possible, they are, but it will require a little more math than this.

This is certainly something we need to work on. One of the hardest bits will be handling boxes that split over frames or pages.

@Omikhleia
Copy link
Member

I don't get the issue.

  • An hbox normally doesnt split over frames or pages, does it?
  • Adding rules to an hbox can be done in its outputYourself().

Is this issue still valid or can we have a MVE of the kind of problem to solve? Otherwise, close/reject it.

@Eli-the-Bearded
Copy link
Author

FWIW, I've long ago given up on this. I ended up using a much different formatting method. I'm okay with this being closed.

@alerque
Copy link
Member

alerque commented Dec 16, 2021

Isn't this a feature request for something roughly equivalent to LaTeX's \framebox (or the myriad of alternatives)?

@Omikhleia
Copy link
Member

@alerque

Isn't this a feature request for something roughly equivalent to LaTeX's \framebox (or the myriad of alternatives)?

If it is the case, then:

luarocks install --server=https://luarocks.org/dev ptable.sile

And one gets a packages.framebox with a \framebox command = Problem solved.

It wouldn't cover the case for long text blocks that get split over several pages, though. But this is not what the original code above implied initially (using an \hbox)...

And a more general use case for such vertical lines that might span over pages be what #1524 intended. It is, on its own, an interesting topic per se, but not particularly relevant to this issue. It would need more considerations then, whether as further work on #1524 or, possibly better, on a dedicated 3rd-party package... Out of curiosity I also possibly wonder whether something in the direction considered in #1334 could be used for the simplest case (after all, it tracks positions) - though I am pretty sure it's not sufficient for the more complex cases mentioned in #1524, with possibly several vertical lines (for each indentation level of the formatted program/algorithm).

To make that long story shorter: I don't think we need to keep this very issue open.

@Omikhleia
Copy link
Member

Additionally, #529 is also very similar (at least by it's topic name, erm). Another reason why we wouldn't need to keep this very issue opened.

@ctrlcctrlv
Copy link
Member

Closed as dupe of #529.

@ctrlcctrlv ctrlcctrlv closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2023
@ctrlcctrlv ctrlcctrlv added the duplicate Rejected as duplicate label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Rejected as duplicate enhancement Software improvement or feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants