This project is read-only.
1
Vote

Drop caps

description

Daan

I wanted to use drop caps in a paragraph so inserted the following snippet:
package: lettrine

~ Snippet
\lettrine[lines=2, findent=0pt, nindent=0pt]{M}{adoko} is a fast markdown processor for writing professional articles
with a focus on simplicity and plain text readability. This is another sentence that is longer than three lines so I have to keep going.
~
This works but the font is different to the rest of the document. How can I fix this?

Many Thanks

Paul

file attachments

comments

daan wrote Mar 17 at 11:25 PM

Hi Paul.

Right -- you are setting a whole paragraph in LaTeX (as a snippet) and then including that as an image into the HTML; that is far from ideal. It is much better to use Markdown (and CSS styles) so that the output is nice in both HTML and PDF.

Now, having said that, it turns out to be rather involved to get good dropcaps in HTML ... (and in LaTeX too without a package like lettrine). I should really create an extra template for dropcaps to make this more easy in Madoko. For now, you may want to do the following. First create these styles at the metadata section of your document:
.dropcap2 {
  font-size: 250%;
  display: block;
  float: left;
  height: 2ex;
  margin-top: -0.4ex;
  padding-right: 0.1ex;
}

@if tex {
  .dropcap2 { 
    margin-top: -2.5ex; 
    tex-wrap-lines: 2;  
    tex-wrap-width: 1.1em;
    tex-wrap-placement: l;
  }
}

p.dropcap {
  replace: "/^[a-zA-Z]/[\0]{.dropcap2}/";
  .noindent;
}
The .dropcap2 style is really for the first letter and makes it 2 lines high. The style p.dropcap is meant to be applied to a paragraph and makes it first letter a dropcap (by applying the dropcap2 style to it.):
Madoko is a fast markdown processor for writing professional
articles with a focus on simplicity and plain text readability. is a fast
markdown processor for writing professional articles with a focus on
simplicity and plain text readability.
{.dropcap}
It'll look like this in html:

in html

and in PDF like this

pdf



I hope this helps. Let me know how it works for you -- I plan to create a template to include these rules more easily so any feedback is welcome :-)

pdoak wrote Mar 27 at 6:58 PM

Thanks Daan