Hello,
I’ve been trying a bit the last couple of days, and I didn’t manage to get it to work what I would like to do. I’ve seen How to add horizontal line in between text lines and this is a dumbed down solution of what I have in mind.
In short, mentally thinking, I have a grid with two columns, where the first column is left aligned and the second column is right aligned. So far, so good, and not an issue. But now, I would like te see a dotted line between the texts of the first and second column.
My first thought was: let’s make it a four columns thing, where I’ll add a dotted line that’s aligned to the right for the second column and a dotted line that’s aligned to the left for the third column. Each then gets a 100% - 1.25em or something to leave some space. But this has the issue where they meet in the middle: it’s ugly, not continuing properly and sometimes it looks like the spacing is also off if you try to manually tune it.
Basically, what I want to achieve is exactly the same as the bibliography does. It shows a left aligned label on the left, then a dotted line, and a right aligned label on the right. As my content isn’t bibliography oriented and I really don’t fancy creating it like that either (unless I may be able to do it inline), I also want to control the total width and a bit more of the styling.
I cooked myself something like this, but it’s genuinely not good enough for my tastes haha. I’m wondering if I simply overlooked something trivial…
#align(right)[
#box(width: 20em)[
#grid(columns: (auto, auto), inset: (x: 0mm, y: 0.65em / 2), align: (left, right),
grid(columns: (auto, 1fr), "Secretariaat:", align(right + bottom)[#line(length: 100% - 0.65em, stroke: (paint: luma(50), dash: "dotted"))]),
grid(columns: (1fr, auto), align(left + bottom)[#line(length: 100% - 0.65em, stroke: (paint: luma(50), dash: "dotted"))], "Sample address"),
grid(columns: (auto, 1fr), "Telefoon:", align(right + bottom)[#line(length: 100% - 0.65em, stroke: (paint: luma(50), dash: "dotted"))]),
grid(columns: (1fr, auto), align(left + bottom)[#line(length: 100% - 0.65em, stroke: (paint: luma(50), dash: "dotted"))], "Sample phone number"),
grid(columns: (auto, 1fr), "E-mail:", align(right + bottom)[#line(length: 100% - 0.65em, stroke: (paint: luma(50), dash: "dotted"))]),
grid(columns: (1fr, auto), align(left + bottom)[#line(length: 100% - 0.65em, stroke: (paint: luma(50), dash: "dotted"))], "Sample e-mail address"),
grid(columns: (auto, 1fr), "Website:", align(right + bottom)[#line(length: 100% - 0.65em, stroke: (paint: luma(50), dash: "dotted"))]),
grid(columns: (1fr, auto), align(left + bottom)[#line(length: 100% - 0.65em, stroke: (paint: luma(50), dash: "dotted"))], "Sample website")
)
]
]
This results in the following, where the red rectangle is mine to show a bit where it looks funky. Additionally, this will have some weird spacing behavior as well, because it tries to keep the “left column” as large as possible, causing the “right column” to not have enough space to add the dotted line at the longest piece of text.
In Microsoft Word I used a right aligned tab stop and gave it the dotted line option. It then looks like this, which is somewhat what I am trying to reproduce here:








