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

Command \center now has an option to center its content vertically #1898

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jodros
Copy link
Contributor

@jodros jodros commented Oct 21, 2023

I found this command was lacking an option to do the centering vertically (like asked here #475).

…sile-typesetter#1894)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@jodros
Copy link
Contributor Author

jodros commented Oct 21, 2023

I'm unsure whether I should write the following after the settings:temporarily block

if SU.boolean(options.vertical) and then
      SILE.call("eject")
end

if #SILE.typesetter.state.nodes ~= 0 then
SU.warn("\\center environment started after other nodes in a paragraph, may not center as expected")
end
if SU.boolean(options.vertical) then
SILE.call("hbox")
SILE.call("vfill")
Copy link
Member

@Omikhleia Omikhleia Oct 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A vfill won't push the content middle of the page, unless if it is a final page automatically vfill'ed (such as the final page of your example) or explicitly \eject'ed. Then another vfill is currently automatically added at the end of the page, resulting in centering.

Personally:

  • I don't think that horizontal centering and vertical centering should be the same command
  • I don' think the vfill added on final pages or via eject is actually good :)

EDIT: Oh, and by the way, the empty hbox is no innocuous. It introduces an empty line. With the default typesetter, this is nearly innocuous, as it has a height of 0. With any other linespacing strategy (from the eponymous package, broken, IMHO) or grid, it becomes messy.

Copy link
Member

@alerque alerque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @Omikhleia is right here, writing direction (linewise) centering and advance direction (framewise) are very different operations and don't belong in the same command. In fact any sort of advance direction centering (absolute to page?, relative to frame), fill available remaining space?) is so complicated and the interactions with line spacing, start-of-frame and end-of-frame queues, and so forth is so complicated that this should go in a dedicated package and even if all possible modes are not implemented at first, some thought should be given to the command names(s) so that the rest of the scenarios can be implemented without stepping all over existing documents.

I don think that some centering handlers are sufficiently basic enough and used as building blocks for other commands that this is something the core distribution should provide, so adding a package in this repo is probably warranted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants