Sematre / typst-letter-pro

DIN 5008 letter template for Typst
https://typst.app/universe/package/letter-pro/
MIT License
103 stars 5 forks source link

More Options for Text Alignement in Sender Box #10

Open scavi-github opened 3 months ago

scavi-github commented 3 months ago

Hi, this is a very nice template!

It would be really cool to have more options for text alignment in the sender box (but still have the box on the right-hand side of the page), e.g. to have the text left-aligned, or even better, to have right and left alignment like in a two-column table.

So, using the example from the README, to change the sender box from this:

alt

to something like this:

neu

Sematre commented 3 months ago

Seems like a useful addition, but how would you define the API?

If this is your first example:

#show: letter-simple.with(
  sender: (
    name: "Anja Ahlsen",
    address: "Deutschherrenufer 28, 60528 Frankfurt",
    extra: [
      Telefon: #link("tel:+4915228817386")[+49 152 28817386]\
      E-Mail: #link("mailto:aahlsen@example.com")[aahlsen\@example.com]\
    ],
  ),

  // etc.
)

How would you like your second example to be implemented?

There's an example:

#show: letter-simple.with(
  sender: (
    name: "Anja Ahlsen",
    address: "Deutschherrenufer 28, 60528 Frankfurt",
    extra: (
      ([Telefon], link("tel:+4915228817386")[+49 152 28817386]),
      ([E-Mail], link("mailto:aahlsen@example.com")[aahlsen\@example.com]),
    ),
  ),

  // etc.
)
scavi-github commented 3 months ago

How about adding an extra option, e.g. textalign, to sender? If unspecified, its default value would be right, but one could set it to left, or, for my second example, it could take an array (right, left).

Then there is a choice to either...

For the first version, the syntax could look like this:

#show: letter-simple.with(
  sender: (
    textalign: (right, left),
    name: "Anja Ahlsen",
    address: "Deutschherrenufer 28, 60528 Frankfurt",
    extra: (
      ([Telefon], link("tel:+4915228817386")[+49 152 28817386]),
      ([E-Mail], link("mailto:aahlsen@example.com")[aahlsen\@example.com]),
    ),
  ),

  // etc.
)

By the way, the change in text size I made in my example picture should in my opinion not be caused by any of this and can always be put in by hand, e.g. by manually writing text(0.7em)[Telefon:] instead of [Telefon:].