What is the best method to introduce horizontal space in text in a Pandoc document? Preferably something that would work for both HTML and PDF output? I need this for some poetry that has indented lines, ala the 2nd and 3rd lines: hickory dickory dock the most ran up the clock the clock struck one the mouse ran down c -- Chris Lott <chris at chrislott.org>
My short answer is CSS. I haven't used Pandoc, so the example below may need modification for use in that environment. Poetry can straddle the line between semantic structure (HTML) and presentation (CSS), particularly when it attaches semantic meaning to indentations and the like, but let's keep things simple. Below I've added <br /> elements for the basic structural breaks, and then, for styling, wrapped certain lines within <span> elements with IDs: The CSS: #ranup, #struck { display: block } #ranup { margin-left: 1.5em } #struck { margin-left: 3em } The HTML: hickory dickory dock<br /> <span id="ranup">the mouse ran up the clock</span><br /> <span id="struck">the clock struck one</span><br /> the mouse ran down - TH On Oct 30, 2012, at 11:57 AM, Chris Lott wrote:> What is the best method to introduce horizontal space in text in a > Pandoc document? Preferably something that would work for both HTML > and PDF output? > > I need this for some poetry that has indented lines, ala the 2nd and 3rd lines: > > hickory dickory dock > the most ran up the clock > the clock struck one > the mouse ran down > > c > -- > Chris Lott <chris at chrislott.org>
On Tue, Oct 30, 2012 at 11:57 AM, Chris Lott <chris at chrislott.org> wrote:> What is the best method to introduce horizontal space in text in a > Pandoc document? Preferably something that would work for both HTML > and PDF output?Well, there are a few different things you could try: The easiest would be to put the entire poem in a code block. Of course, that may not be as pretty (with a monospaced font) and you lose inline markdown (emphasis, links, etc). http://johnmacfarlane.net/babelmark2/?normalize=1&text=++++hickory+dickory+dock%0A++++++++the+mouse+ran+up+the+clock%0A+++++++++++++the+clock+struck+one%0A++++the+mouse+ran+down A second option would be to use html entities for non-braking spaces (` `). You only need to make every other space non-breaking. And don't forget to end each line with two spaces to force the line breaks. Like this: hickory dickory dock the mouse ran up the clock the clock struck one the mouse ran down http://johnmacfarlane.net/babelmark2/?normalize=1&text=hickory+dickory+dock++%0A+%26nbsp%3B+%26nbsp%3B+%26nbsp%3B+the+mouse+ran+up+the+clock++%0A+%26nbsp%3B+%26nbsp%3B+%26nbsp%3B+%26nbsp%3B+%26nbsp%3B+%26nbsp%3B+%26nbsp%3B+%26nbsp%3B+the+clock+struck+one++%0Athe+mouse+ran+down Of course, that doesn't look so nice in markdown, but works great in HTML. The HTML spec actually suggests that poetry could be wrapped in a `<pre>` tag (but without the inner `<code>` tags of the code block). So, you could use raw html like this: <pre> hickory dickory dock the mouse ran up the clock the clock struck one the mouse ran down </pre> http://johnmacfarlane.net/babelmark2/?normalize=1&text=%3Cpre%3E%0Ahickory+dickory+dock%0A++++the+mouse+ran+up+the+clock%0A+++++++++the+clock+struck+one%0Athe+mouse+ran+down%0A%3C%2Fpre%3E I'm not sure if Pandoc will parse inline markdown in there or not (some parers might if you set markdown=1 on the pre tag). And I'm not sure how any of the above will translate to PDF. But that should get you started. -- ---- \X/ /-\ `/ |_ /-\ |\| Waylan Limberg
On Oct 30, 2012, at 11:23 AM, Koralatov <lists at koralatov.com> wrote:> On Tue, Oct 30, 2012 at 15:57, Chris Lott wrote: > >> What is the best method to introduce horizontal space in text in a >> Pandoc document? Preferably something that would work for both HTML and >> PDF output? >> I need this for some poetry that has indented lines, ala the 2nd and 3rd >> lines: >> hickory dickory dock >> the most ran up the clock >> the clock struck one >> the mouse ran down > > The other suggestions are all better than the one I?m about to make, so > consider yourself forewarned. > > I?m personally do it using code spaces, like so: > > hickory dickory dock ` `the most ran up the clock ` `the clock struck one the mouse ran down > The spaces contained inside the code will be printed as they are, and it > shouldn?t interfere with later Markdown syntax because they?re terminated > already. It?s a pretty ugly, low-tech solution though.If you are controlling the output HTML & PDF, this ?won?t? be a problem, but many stylesheets (such as my own) style such incline `<code>` elements to have a slightly colored background. It is definitely an ugly solution in that it does not produce portable or semantic output. AJH -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4887 bytes Desc: not available Url : <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20121030/5d4b7ba5/attachment.bin>
If you don't use emphasis or other inline formatting, it's easiest to put this in a special fenced code block ~~~ {.poetry} hickory dickory dock the mouse ran up the clock the clock struck one the mouse ran down ~~~ And then use a CSS rule like pre.poetry code { font-family: serif; } Alternatively you can do this: hickory dickory dock\ \ \ \ \ the mouse ran up the clock\ \ \ \ \ \ \ \ \ the clock struck one\ the mouse ran down John +++ Chris Lott [Oct 30 12 07:57 ]:> What is the best method to introduce horizontal space in text in a > Pandoc document? Preferably something that would work for both HTML > and PDF output? > > I need this for some poetry that has indented lines, ala the 2nd and 3rd lines: > > hickory dickory dock > the most ran up the clock > the clock struck one > the mouse ran down > > c > -- > Chris Lott <chris at chrislott.org> > _______________________________________________ > Markdown-Discuss mailing list > Markdown-Discuss at six.pairlist.net > http://six.pairlist.net/mailman/listinfo/markdown-discuss