Open jopetty opened 3 years ago
This is one of the trickier formatting problems I’ve come across in working on Quadwriter. Quadwriter doesn’t have a concept of “right-aligned tab stop”, which is how you would handle this in a word processor.
The way I went about it was to sequence the duration and title as sequential paragraphs, and then apply a negative space-after
attribute to the duration, thereby hoisting the title to be vertically aligned with the duration. (You would also want to apply a generous inset-right
to the title so that it doesn’t wrap all the way to the right edge, so its text doesn’t collide with the duration, which should have a predictable width).
In other words, you convert it from a problem of inserting horizontal space (= hard) to one of subtracting vertical space (= easy)
More precisely:space-after
should be the negative of line-height
. Here is the relevant fragment of my markup, which should give you enough to go on:
(define line-ht "1.3em")
`(q
(q ((font-size "1.4em")(line-height ,line-ht))
(para-break)
(duration ((keep-with-next "true")
(space-after ,(string-append "-" line-ht))
(line-align "right"))
(q ,duration))
(para-break)
(q ((space-after "0")
(inset-right "3em")
(keep-with-next "true"))
(q ,title))))
How can one specify the anchor points of a quad while in #lang quadwriter
The low-level Quad layout functions are not exposed in Quadwriter markup, except for anchor-from-parent
and anchor-to
. Quadwriter is a demo app that’s meant to demonstrate a higher-level interface (and convince myself that it is possible).
To learn how
quad
andquadwriter
work, I tried building a version of the Practical Typography "after" résumé as aquadwriter
document. In order to achieve the "left-aligned location, right-aligned date on the same line" layout, I tried using theanchor-from-parent
andanchor-to
attributes on a Q-expression, to no avail:It seems that both the "place" and "date" quads are still using the
'baseline-in
-to-'baseline-out
anchors:Am I going about this in the correct way? How can one specify the anchor points of a quad while in
#lang quadwriter
, instead of using the lower-levelquad
commands like(quad->pict (position (attach-to parent 'e child 'w)))
?