public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: "kurt.pfeifle via pandoc-discuss" <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: YAML block to carry LaTeX font details -- how do I preserve '{' and ‘}‘ ?
Date: Sun, 10 Apr 2016 03:42:50 -0700 (PDT)	[thread overview]
Message-ID: <2222a182-2c72-4c59-935a-feb01e091299@googlegroups.com> (raw)
In-Reply-To: <20160410051448.GB2108-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 3585 bytes --]



On Sunday, April 10, 2016 at 7:15:02 AM UTC+2, John MacFarlane wrote:

+++ John MacFarlane [Apr 09 16 19:39 ]: 
> >See BP Johnson's suggestions (recently in this list) about 
>
> BP Jonsson, I mean! 
>
Well — and in my OP I meant to say I started to *experiment* (not to 
*experience*)…     :-)

I'm referring to the technique of defining a macro like 
>
>     \newcommand{\wrap}[1]{#1} 
>
> and using it to wrap things that you don't want pandoc 
> interpreting as Markdown. 
>
At first I did not understand at all how I should apply this advice to my 
situation… However, thanks to this tipp and some more experimentation on my 
part, I found a solution. I’ll document it here in case someone else finds 
it useful too.
What I did first (cul-de-sac, not working!) 

I created a file named *wrapmarkdown.tex* with this content:

\makeatletter
  \newcommand{\wrapmarkdown}[1]{#1}-
\makeatother

and included it as a parameter into my Pandoc command: -H wrapmarkdown.tex.

Into my YAML block I put this modification:



mainfontoptions:   \wrapmarkdown{BoldFont=WeidemannStd-Bold.otf, ItalicFont=WeidemannBookItalic.otf, BoldItalicFont=WeidemannStd-BoldItalic.otf, ItalicFeatures={Colour=AA0001}, BoldFeatures={Colour=0000

This ended up with a LaTeX output containing this code around line 17:


    \setmainfont[\wrapmarkdown{BoldFont=WeidemannStd-Bold.otf,
       ItalicFont=WeidemannBookItalic.otf, BoldItalicFont=WeidemannStd-BoldItalic.otf,
       ItalicFeatures={Colour=AA0001}, BoldFeatures={Colour=0000AA},
       BoldItalicFeatures={Colour=AA00AA}}]{WeidemannBook}

and this code around line 107:

\makeatletter
  \newcommand{\wrapmarkdown}[1]{#1} 
\makeatother

When compiling this to PDF, an error occurred:

! Undefined control sequence.
<argument> ...st ,\l__fontspec_fontopts_clist ,\wrapmarkdown
{BoldFont=WeidemannStd-Bol...

...

What I did next (final solution) 

The error message made me move the snippet from around line 107 to lines 
2-4 of my generated LaTeX file. The output PDF was created successfully 
after this modification. 

Therefore I ditched the inclusion of my *wrapmarkdown.tex* file via the -H/
--include-in-header command line parameter.

Instead I hard-coded the respective lines into a custom LaTeX template, 
right after its initial lines, and added 
--template=my-custom-latex-template.latex into the command line.
Another question… 

I assume there is no way to make -H include a code snippet at a specific 
spot in the LaTeX header? The problem with my original approach seems to 
have been that on line 17 the call to the \wrapmarkdown newcommand came 
*before* its definition on line 107… and that the only workaround was the 
one I used: to hard-code it into the LaTeX-template at an earlier line?

Would it be feasible to add a variable-based approach into the default 
Pandoc template, which could be utilized from the command line for cases 
like this?
​

-- 
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/2222a182-2c72-4c59-935a-feb01e091299%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 17313 bytes --]

  parent reply	other threads:[~2016-04-10 10:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-09 22:34 kurt.pfeifle via pandoc-discuss
     [not found] ` <6c4977e8-6dca-4d33-a44b-a72a31603e60-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-04-10  2:39   ` John MacFarlane
     [not found]     ` <20160410023930.GA96031-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
2016-04-10  5:14       ` John MacFarlane
     [not found]         ` <20160410051448.GB2108-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
2016-04-10 10:42           ` kurt.pfeifle via pandoc-discuss [this message]
     [not found]             ` <2222a182-2c72-4c59-935a-feb01e091299-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-04-24  0:57               ` Rick Dooling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2222a182-2c72-4c59-935a-feb01e091299@googlegroups.com \
    --to=pandoc-discuss-/jypxa39uh5tlh3mbocffw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).