public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* tex newlines in yaml metadata?
@ 2013-10-23 22:30 Carl Boettiger
       [not found] ` <CAN_1p9xLfGuZstX54D23T9W0-7gQyVRz6MhxVLy81o1r3xcrBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Carl Boettiger @ 2013-10-23 22:30 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1701 bytes --]

Hi list,

I have a latex template for yaml with a section to insert the variable
"addressee"

    $if(addressee)$
    \begin{letter}{$addressee$}
    $endif$

and then in my markdown file, I add the yaml metadata:


---
adressee: |
               Carl Boettiger
               UC Santa Cruz
               http://carlboettiger.info/
---


Where I've used the yaml block literal "|" to preserve the newlines in the
address.  Unfortunately, tex doesn't care about these newlines, since it
uses a double escape for a newline, and the address comes out as a single
line.  This presents a problem.  I try various permutations of this with
things like:

---
adressee: Carl Boettiger \\ UC Santa Cruz \\ http://carlboettiger.info/
---


but any explicit use of `\\` ends up being printed as a `\` in the tex
output pdf rather than as a newline.  How can I get newlines to work here?
 E.g. what formatting do I need to get newlines (e.g. verbatim `\\`) to
appear when pandoc parses this yaml and writes the addressee variable into
the text?

Thanks!

Carl


-- 
Carl Boettiger
UC Santa Cruz
http://carlboettiger.info/

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAN_1p9xLfGuZstX54D23T9W0-7gQyVRz6MhxVLy81o1r3xcrBg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

[-- Attachment #2: Type: text/html, Size: 2942 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: tex newlines in yaml metadata?
       [not found] ` <CAN_1p9xLfGuZstX54D23T9W0-7gQyVRz6MhxVLy81o1r3xcrBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-10-23 23:13   ` John MacFarlane
  0 siblings, 0 replies; 2+ messages in thread
From: John MacFarlane @ 2013-10-23 23:13 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

This is parsed as markdown.  So \\ is just an escaped \.
If you want a hard line break, use two spaces at the end of
the line, or \ followed by a newline.  Or, use a line block:

addressee: |
  | Carl B
  | UCSC

+++ Carl Boettiger [Oct 23 13 15:30 ]:
>    Hi list,
>    I have a latex template for yaml with a section to insert the variable
>    "addressee"
>    $if(addressee)$
>    \begin{letter}{$addressee$}
>    $endif$
>    and then in my markdown file, I add the yaml metadata:
> 
>    ---
> 
>    adressee: |
> 
>    Carl Boettiger
> 
>    UC Santa Cruz
> 
>    [1]http://carlboettiger.info/
> 
>    ---
> 
>    Where I've used the yaml block literal "|" to preserve the newlines in
>    the address. Unfortunately, tex doesn't care about these newlines,
>    since it uses a double escape for a newline, and the address comes out
>    as a single line. This presents a problem. I try various permutations
>    of this with things like:
> 
>    ---
> 
>    adressee: Carl Boettiger \\ UC Santa Cruz
>    \\[2]http://carlboettiger.info/
> 
>    ---
> 
>    but any explicit use of `\\` ends up being printed as a `\` in the tex
>    output pdf rather than as a newline. How can I get newlines to work
>    here? E.g. what formatting do I need to get newlines (e.g. verbatim
>    `\\`) to appear when pandoc parses this yaml and writes the addressee
>    variable into the text?
>    Thanks!
>    Carl
> 
>    --
>    Carl Boettiger
>    UC Santa Cruz
>    [3]http://carlboettiger.info/
> 
>    --
>    You received this message because you are subscribed to the Google
>    Groups "pandoc-discuss" group.
>    To unsubscribe from this group and stop receiving emails from it, send
>    an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>    To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>    To view this discussion on the web visit
>    [4]https://groups.google.com/d/msgid/pandoc-discuss/CAN_1p9xLfGuZstX54D
>    23T9W0-7gQyVRz6MhxVLy81o1r3xcrBg%40mail.gmail.com.
>    For more options, visit [5]https://groups.google.com/groups/opt_out.
> 
> References
> 
>    1. http://carlboettiger.info/
>    2. http://carlboettiger.info/
>    3. http://carlboettiger.info/
>    4. https://groups.google.com/d/msgid/pandoc-discuss/CAN_1p9xLfGuZstX54D23T9W0-7gQyVRz6MhxVLy81o1r3xcrBg%40mail.gmail.com
>    5. https://groups.google.com/groups/opt_out


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-23 23:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-23 22:30 tex newlines in yaml metadata? Carl Boettiger
     [not found] ` <CAN_1p9xLfGuZstX54D23T9W0-7gQyVRz6MhxVLy81o1r3xcrBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-10-23 23:13   ` John MacFarlane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).