Omikhleia / ptable.sile

Paragraph boxes, framed boxes and table packages for the SILE typesetting system
MIT License
10 stars 2 forks source link

add noindent parameter to all boxes #7

Closed nphyx closed 1 year ago

nphyx commented 1 year ago

When SILE indentation is enabled all boxes are indented by 20pt from frame left. Calling \noindent before \framebox doesn't solve this; the only way I have managed to fix it is to call \neverindent, which is undesirable if you want indentation elsewhere.

This adds a new parameter noindent to all box types, which shifts the boxes left by 20pt when true.

It seems to have to be hard-coded to 20pt - getting current.parindent doesn't seem to work. Would be nice to figure out why, but I'm at a loss.

I'm not sure if this is useful or desirable in general, but it was driving me nuts for a day or two before I tracked it down. Please let me know if there's a better way to deal with this.

Omikhleia commented 1 year ago

Greetings,

It seems to have to be hard-coded to 20pt - getting current.parindent doesn't seem to work. Would be nice to figure out why, but I'm at a loss.

The 20pt is the (default) value of document.parindent. So it cannot be hard-coded, this setting may be changed; for instance personally, I set it to "1.25em" in my own book classes, and sometimes I temporarily set it to a different value in blockquote-like environments, etc.).

The problem here is that you are hitting a bug (or at least a very weird behavior) of SILE itself, with respect to the measured width of horizontal boxes at the beginning of a paragraph. You would have the same issue with, say, the standard rules packages and its \underline command (or the deprecated \boxaround as well); or the rotate package, etc.

So I am afraid adding an "ad hoc" option to the boxes proposed by this package cannot be a general solution.

I was pretty sure I already had seen that kind of problem discussed on the SILE issue tracker, but just looking (fairly) quickly, I could not find it back. I would suggest to report to SILE, therefore. For what matters, here is an example showing that same issue with standard packages:

\begin{document}
\use[module=packages.rules]
\use[module=packages.rotate]

\noindent{}Lorem...

Lorem (paragraph indented)

\underline{ipsum}

\rotate[angle=5]{dolor}

\boxaround{toto}% deprecated command, but just to show it there too

\end{document}

image

As for the PR here, therefore, I'll likely label it as "invalid" -- FWIW, opening an issue (first) is the preferred way to go, so as to track relevant exchanges (or if it gets fixed in SILE, check if it solves here it too -- I'd probably have to update my current "hboxer" compatibility shim, for instance, if that happens).

Omikhleia commented 1 year ago

EDIT: I just edited my previous answer to improve a bit the reproduction scenario with rules/rotate. @nphyx would you like to report it to SILE? Not that I cannot do it myself, but I'm real busy these days, running too many horses.

Omikhleia commented 1 year ago

@nphyx would you like to report it to SILE? Not that I cannot do it myself, but I'm real busy these days, running too many horses.

Oh well, I just did it, opening our own #8 and raising on issue to SILE from there. Thanks for catching this issue. Let's hope it get addressed :smile:

nphyx commented 1 year ago

Thank you for the info! I will go ahead and keep the ad-hoc solution locally in the meanwhile. Hopefully it gets fixed soon :crossed_fingers:

RE: opening an issue, I was in a hurry for a fix and figured I'd share it just in case it was helpful :) But in general yeah, I'd have opened an issue.