[quad] positioning a block a text #31

Closed
opened 4 years ago by sorawee · 11 comments
sorawee commented 4 years ago (Migrated from github.com)

Let me use this space for asking a quad question again.

I wonder how I can typeset a letter like this. Specifically, the letter heading has multiple lines. These lines all start at the same position (about 60% of the page width). How could I do that in quad? If this were LaTeX, I would use minipage or parbox, which would be equivalent to the quad structure in quad (as you mentioned at https://github.com/mbutterick/quad/issues/57#issuecomment-589906441). But as I understand, a quad cannot be directly manipulated (like changing its position) in quadwriter, correct?

Let me use this space for asking a quad question again. I wonder how I can typeset a letter like [this](https://upload.wikimedia.org/wikipedia/commons/f/f7/Einstein_Szilard_p1.jpg). Specifically, the letter heading has multiple lines. These lines all start at the same position (about 60% of the page width). How could I do that in quad? If this were LaTeX, I would use `minipage` or `parbox`, which would be equivalent to the `quad` structure in quad (as you mentioned at https://github.com/mbutterick/quad/issues/57#issuecomment-589906441). But as I understand, a `quad` cannot be directly manipulated (like changing its position) in quadwriter, correct?
ergl commented 4 years ago (Migrated from github.com)

My first idea would be to use a combination of inset-left and friends to manually position the header. I see there are options like anchor-from-parent, anchor-to, etc; but I haven't used them, so I don't know how they work.

Below is a sample of how I would go about replicating the letter you mention:

#lang quadwriter

'(q [(footer-display "false") (page-margin-left "2cm")]
    (q [(inset-left "12cm")]
        "Albert Einstein"
        '(line-break)
        "Old Grove Rd."
        '(line-break)
        "Nassau Point"
        '(line-break)
        "Peconic, Long Island"
        '(para-break)
        "August, 2nd, 1939")
    '(para-break)
    (q 
        "F.D. Roosevelt,"
        '(line-break)
        "President of the United States,"
        '(line-break)
        "White House"
        '(line-break)
        "Washington, D.C.")

    '(para-break)
    (q [(inset-top "1cm")] "Sir:")
    '(para-break)
    (q [(hyphenate "true") (line-wrap "kp")]
       (q [(first-line-indent "40")]
        "Some recent work by E. Fermi and L. Szilard, which has been communicated to me in manuscript, ...")))

And this is how it looks:

quad-letter

My first idea would be to use a combination of `inset-left` and friends to manually position the header. I see there are options like `anchor-from-parent`, `anchor-to`, etc; but I haven't used them, so I don't know how they work. Below is a sample of how I would go about replicating the letter you mention: ``` #lang quadwriter '(q [(footer-display "false") (page-margin-left "2cm")] (q [(inset-left "12cm")] "Albert Einstein" '(line-break) "Old Grove Rd." '(line-break) "Nassau Point" '(line-break) "Peconic, Long Island" '(para-break) "August, 2nd, 1939") '(para-break) (q "F.D. Roosevelt," '(line-break) "President of the United States," '(line-break) "White House" '(line-break) "Washington, D.C.") '(para-break) (q [(inset-top "1cm")] "Sir:") '(para-break) (q [(hyphenate "true") (line-wrap "kp")] (q [(first-line-indent "40")] "Some recent work by E. Fermi and L. Szilard, which has been communicated to me in manuscript, ..."))) ``` And this is how it looks: ![quad-letter](https://user-images.githubusercontent.com/3091816/75438597-80231b80-5958-11ea-8187-9e05ba675cb8.png)
sorawee commented 4 years ago (Migrated from github.com)

Thanks. That is very helpful.

If you don't mind, here's my next question. I also would like to be able to do this but the above solution doesn't seem suffice.

Let's ignore the images. The core issue is that in the above solution, the block with inset-left must have nothing on the left. That is, it must be on a new line. However, in the above example, there's a phrase "Home is" on the same line as the block with inset-left (which contains checkboxes). The solution above would fail: the checkbox would starts right after "Home is" without any inset. Do you have any workaround or solution for this?

Thanks. That is very helpful. If you don't mind, here's my next question. I also would like to be able to do this but the above solution doesn't seem suffice. ![](http://1.bp.blogspot.com/-4gwC0ZTnYpw/U7_v_AkMt_I/AAAAAAAAADM/eRB8z9amxBg/s1600/postcard6.png) Let's ignore the images. The core issue is that in the above solution, the block with `inset-left` must have nothing on the left. That is, it must be on a new line. However, in the above example, there's a phrase "Home is" on the same line as the block with `inset-left` (which contains checkboxes). The solution above would fail: the checkbox would starts right after "Home is" without any inset. Do you have any workaround or solution for this?
sorawee commented 4 years ago (Migrated from github.com)

@ergl: btw, if I understand correctly, you should not write ' in '(para-break). Racket would expand it into (quote (para-break)) which is incorrect. It just happens that quad ignores bogus tag name, so the result looks valid.

@ergl: btw, if I understand correctly, you should not write `'` in `'(para-break)`. Racket would expand it into `(quote (para-break))` which is incorrect. It just happens that quad ignores bogus tag name, so the result looks valid.
ergl commented 4 years ago (Migrated from github.com)

You're right, I got confused, the ' in both '(para-break) and '(line-break) should be removed.

You're right, I got confused, the `'` in both `'(para-break)` and `'(line-break)` should be removed.
ergl commented 4 years ago (Migrated from github.com)

As for your other problem, you're right that using inset-left is not sufficient. I'd use the column-count attribute for that. Sadly, it's only a section-level attribute, so you can not have different parts in a page with different columns.

Right now I don't if it's possible to emulate that layout with quad. Hopefully Matthew or others can chime in with ideas.

As for your other problem, you're right that using `inset-left` is not sufficient. I'd use the `column-count` attribute for that. Sadly, it's only a section-level attribute, so you can not have different parts in a page with different columns. Right now I don't if it's possible to emulate that layout with quad. Hopefully Matthew or others can chime in with ideas.
mbutterick commented 4 years ago (Migrated from github.com)

@sorawee Despite the soothing presence of Comic Sans, that’s actually a complicated layout. In general placing things side-by-side is difficult. I am currently working on a #lang résumé based on quadwriter with a similar problem. What I did is use a negative space-after value on the first line, equal to the height of the line, to move the remaining lines upward vertically. So I make this, using inset-left:

First line
                     Second line
                     Third line

And then with the negative space-after on the first line, I make it look like this:

First line           Second line
                     Third line
@sorawee Despite the soothing presence of Comic Sans, that’s actually a complicated layout. In general placing things side-by-side is difficult. I am currently working on a `#lang résumé` based on `quadwriter` with a similar problem. What I did is use a negative `space-after` value on the first line, equal to the height of the line, to move the remaining lines upward vertically. So I make this, using `inset-left`: ``` First line Second line Third line ``` And then with the negative `space-after` on the first line, I make it look like this: ``` First line Second line Third line ```
ergl commented 4 years ago (Migrated from github.com)

Is there any particular limitation as to why column-count can only be used at the page level? I'm sure there are more complicated layouts that maybe could be solved by scoping columns to parts of a page.

Is there any particular limitation as to why `column-count` can only be used at the page level? I'm sure there are more complicated layouts that maybe could be solved by scoping columns to parts of a page.
mbutterick commented 4 years ago (Migrated from github.com)

No reason for that limitation (other than making my life simpler, for a week). I’ve been coming around to the idea that it would be useful to allow section breaks to happen within a page.

No reason for that limitation (other than making my life simpler, for a week). I’ve been [coming around](https://github.com/mbutterick/quad/issues/40#issuecomment-589463702) to the idea that it would be useful to allow section breaks to happen within a page.
mbutterick commented 4 years ago (Migrated from github.com)

(Or more likely, create a new break level that represents an arbitrary vertical territory in the document, and allow column-count to apply at that lower level. It is useful to have a section consistently denote a set of whole pages.)

(Or more likely, create a new break level that represents an arbitrary vertical territory in the document, and allow `column-count` to apply at that lower level. It is useful to have a `section` consistently denote a set of whole pages.)
otherjoel commented 4 years ago (Migrated from github.com)

Isn't table layout what we really want?

Isn't table layout what we really want?
mbutterick commented 4 years ago (Migrated from github.com)

Right now I’m just trying to reach the typesetting capability of the 1960s. You’re way out in the ’90s.

Right now I’m just trying to reach the typesetting capability of the 1960s. You’re way out in the ’90s.
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen-users#31
Loading…
There is no content yet.