mlhetland / pseudo.sty

Straightforward pseudocode.
MIT License
13 stars 2 forks source link

Permit spacing in \\ command #6

Closed mlhetland closed 2 years ago

mlhetland commented 2 years ago

Currently, using something like \\[1ex] inside pseudo produces the following error:

Unknown key `pseudo/package/unknown` ignored

A default key should be defined, here, which produces the proper spacing, like in a normal \\ command.

The spacing could be created by providing the argument to \tabularnewline in \@@_eol_tail.

In array.sty, we find the following definitions (inside \@array):

\let\\\@arraycr \let\tabularnewline\\

So using \tabularnewline should invoke the correct command. However, supplying extra space to \tabularnewline, while increasing the row height, does not modify the \@arstrutbox (which only enforces the minimum row height), and thus does not affect the default indent-mark. Normal vertical lines in tabulars grow with the row height, however; the default indent-mark should probably rather use the same mechanism as those lines for determining its height. Those, however, use built-in TeX mechanisms, without actually specifying the height/depth of the \vrules. Maybe we could just do the same? Without arguments, \vrule has a width of 0.4 pt, and a height and depth to fill the smallest box that contains it, and adding a \vrule to the text works just fine; however, it seems to not expand when used as part of the indentation command; something is restricting its height, presumably.

Note: Using \@arstrutbox for the indent mark also means that a positive \extrarowheight will cause a break in the vertical line.

~One option would be to add height to the next indent-mark to compensate (and for the vertical lines to join up); given the use of \smash, this would not affect row height. This would not, of course, help with the last line – though that might be okay, since the indent marker would end at an appropriate position relative to the text itself.~

Perhaps look at how, e.g., arydshln draws its vertical lines.

mlhetland commented 2 years ago

D'oh: Of course \vrule won't expand vertically – I'm enclosing it in a \smash! #facepalm

The \hbox_overlap_right:n also messes with the \vrule, so I'll need to make that (and the \smash, if I use it) optional. Maybe I could have a raw-indent-mark in addition to indent-mark, or something; and the default setup could deal with the overlap using a negative horizontal space?

Anyway: Without the smash-ing and rlap-ing, using \vrule works just fine. (Adding top/bottom markers to the vertical lines – a possible later feature – might be challenging when we don't know the actual height, but …)