Using "Droplet" how can I stop the space following "A" or "I" from being included in the dropcap?

If you are using “Droplet” and the paragraph begins with either “A” or “I” followed by a space, the space is included as part of the dropcap, as follows:

#set page(paper: "a7")
#set par(first-line-indent: 1em, spacing: 0.5em, justify: false)
#import "@preview/droplet:0.3.1": dropcap

// Keep original dropcap
#let orig-dropcap = dropcap

// My dropcap with my defaults
#let dropcap(body) = orig-dropcap(
  height: 2,
  gap: 1pt,
  hanging-indent: 0pt,
  body,
)

==== Heading

#dropcap[A bit #lorem(9)]

==== Heading

#dropcap[I can #lorem(9)]

==== Heading

#dropcap[Any #lorem(9)]

==== Heading

#dropcap[Into #lorem(9)]

which gives:

Does anyone know how to prevent this, please?

Many thanks

That’s a bug (or maybe it isn’t after all, see replies below)

As a workaround until I have a fix ready, you can either remove the space in the code as in

#dropcap[Abit #lorem(9)]

or – as that’s a bit ugly – give the dropcap explicitly as a separate parameter as in

#dropcap[A][bit #lorem(9)]

though you would need to adjust your customized function with one that accepts an argument sink, ideally using the with function as in

#let dropcap = orig-dropcap.with(
  height: 2,
  gap: 1pt,
  hanging-indent: 0pt
)

@Eric I also just looked into it, and based on the following sentence you wrote in the readme I thought it is a feature.

Affixes, such as punctuation, super- and subscripts, quotes, and spaces will also be detected and stay with the dropped capital.

Wouldn’t transform: it => it.trim(), be an other nice solution?

1 Like

Thank you both. I should have posted this some time ago, but I’ve been otherwise engaged. In the meantime, I’ve been rewriting paragraphs to avoid this, but that’s not a solution.

As a non-coder, I don’t follow too easily, and I’m not at my computer at the moment, but I’ll experiment when I am.

:slight_smile:
Mark

Huh, I haven’t touched that package for a while, so maybe it was intended after all. According to https://graphicdesign.stackexchange.com/questions/61177/how-to-handle-drop-caps-when-the-first-word-is-just-one-letter, it also seems to be an acceptable way to handle single-character words.

The transform method also seems very nice indeed; I certainly don’t know my packages anymore :D

3 Likes

Thank you for the solution, which works for me.

While I see what the code does, I don’t really understand the different working of #let dropcap = orig-dropcap.with() compared to #let dropcap(body) = orig-dropcap().

As for transform: it => it.trim(), I am completely in the dark with that!

Finally, while some graphic design guru(s) may consider the dropcap including the space as acceptable, I find them exceedingly ugly and to me they stand out like a sore thumb against the other non-spaced dropcaps.

I shall now (when I have time, that is) experiment to see if one could, on the basis of this code, use a decorated font for the dropcaps à la mediaeval manuscript.

:slight_smile:
Mark