From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/14753 Path: news.gmane.org!not-for-mail From: "kurt.pfeifle via pandoc-discuss" Newsgroups: gmane.text.pandoc Subject: =?UTF-8?Q?Re:_YAML_block_to_carry_LaTeX_font_det?= =?UTF-8?Q?ails_--_how_do_I_preserve_'{'_and_=E2=80=98}=E2=80=98_=3F?= Date: Sun, 10 Apr 2016 03:42:50 -0700 (PDT) Message-ID: <2222a182-2c72-4c59-935a-feb01e091299@googlegroups.com> References: <6c4977e8-6dca-4d33-a44b-a72a31603e60@googlegroups.com> <20160410023930.GA96031@MacBook-Air-2.local> <20160410051448.GB2108@MacBook-Air-2.local> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2013_1904731973.1460284970538" X-Trace: ger.gmane.org 1460284975 11894 80.91.229.3 (10 Apr 2016 10:42:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Apr 2016 10:42:55 +0000 (UTC) To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDO5LOXQ2AARBK64VC4AKGQECTBNBGY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Apr 10 12:42:55 2016 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-qk0-f187.google.com ([209.85.220.187]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1apCpQ-0008Uc-Tr for gtp-pandoc-discuss@m.gmane.org; Sun, 10 Apr 2016 12:42:53 +0200 Original-Received: by mail-qk0-f187.google.com with SMTP id z64sf46559422qkb.1 for ; Sun, 10 Apr 2016 03:42:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=c1ZnxJZMpvvWIlFUJ8pKP0WmHEDQ+ar7F4pXxVW1kOA=; b=cpWkI2NXoeZlyvV1zumFryEfaXpCWpDz3BaFa1y9gLqCS1ZM6ZZ0M3qjS5qaKwWVoG 62HoIO0GPt7gU3ejnyQhPXRx6Nru2KU8kqu1FSBwCKDYk3HL6JeB2Xljqnkm6LOvBX0j I0sLJebZnEMWQBE+jV9z6u3oYQv2uK19RZDeM7A6XLYDr298rnvfAbOGAw6Jj4yuMkfz tRBGyVwWUPFvb5uBk1tUS5uFRKsa4qkJ/5FbdSneU6UBbCXhldRjbBAipkEVUaYdGhCA ooSs8u2mW246kGVzzkasZteB6KyCAKX/aoaAVd+aDTBYbID8XtIP2GEsUXLdC/Dx3/uM 51eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:message-id:in-reply-to:references :subject:mime-version:x-original-sender:reply-to:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=c1ZnxJZMpvvWIlFUJ8pKP0WmHEDQ+ar7F4pXxVW1kOA=; b=V0VYnAO4MZsd5wUXkpbmBlH6fXGoscURlDE0cfuEtYF6UKWYG7BxmMs9Ep1ukONAYA 3Vs+1+CEv9YthKLa8w3ay9f/oCMO6QaWW0Pra3ec99uBP3v0Mxd95gyJ9fAh3EHJbeer uszjkEERjlYfFFSknk/2tik8hfH1yMAEHodvWRnvk3IWXsh5LI8UyM9+VY8JthPijuAA T5s7cFgpYiFfVLGDv7+278UTmS2hBNZnACDce5v0tse8VK10gVAawzKwN1XH0xhOVS6b vcehYMjdsgiBCSCf4uoURN2UE2tUwgX6aztxE1D1/XGxM2aloGcPIvXVuTXWtEODUg7x Oj7Q== X-Gm-Message-State: AD7BkJJYlTGkh1SeIYzczH4oletP819UYIaauxK4wnOzbGkcJEZLf5nWNrr2OQZVnEYW8w== X-Received: by 10.182.129.227 with SMTP id nz3mr118410obb.2.1460284971886; Sun, 10 Apr 2016 03:42:51 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.182.50.195 with SMTP id e3ls692618obo.56.gmail; Sun, 10 Apr 2016 03:42:51 -0700 (PDT) X-Received: by 10.157.3.235 with SMTP id f98mr28843otf.9.1460284971060; Sun, 10 Apr 2016 03:42:51 -0700 (PDT) In-Reply-To: <20160410051448.GB2108-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org> X-Original-Sender: kurt.pfeifle-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Spam-Checked-In-Group: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Original-From: kurt.pfeifle-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org Xref: news.gmane.org gmane.text.pandoc:14753 Archived-At: ------=_Part_2013_1904731973.1460284970538 Content-Type: multipart/alternative; boundary="----=_Part_2014_2122891191.1460284970538" ------=_Part_2014_2122891191.1460284970538 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sunday, April 10, 2016 at 7:15:02 AM UTC+2, John MacFarlane wrote: +++ John MacFarlane [Apr 09 16 19:39 ]:=20 > >See BP Johnson's suggestions (recently in this list) about=20 > > BP Jonsson, I mean!=20 > Well =E2=80=94 and in my OP I meant to say I started to *experiment* (not t= o=20 *experience*)=E2=80=A6 :-) I'm referring to the technique of defining a macro like=20 > > \newcommand{\wrap}[1]{#1}=20 > > and using it to wrap things that you don't want pandoc=20 > interpreting as Markdown.=20 > At first I did not understand at all how I should apply this advice to my= =20 situation=E2=80=A6 However, thanks to this tipp and some more experimentati= on on my=20 part, I found a solution. I=E2=80=99ll document it here in case someone els= e finds=20 it useful too. What I did first (cul-de-sac, not working!)=20 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=3DWeidemannStd-Bold.otf, ItalicFo= nt=3DWeidemannBookItalic.otf, BoldItalicFont=3DWeidemannStd-BoldItalic.otf,= ItalicFeatures=3D{Colour=3DAA0001}, BoldFeatures=3D{Colour=3D0000 This ended up with a LaTeX output containing this code around line 17: \setmainfont[\wrapmarkdown{BoldFont=3DWeidemannStd-Bold.otf, ItalicFont=3DWeidemannBookItalic.otf, BoldItalicFont=3DWeidemannStd-= BoldItalic.otf, ItalicFeatures=3D{Colour=3DAA0001}, BoldFeatures=3D{Colour=3D0000AA}= , BoldItalicFeatures=3D{Colour=3DAA00AA}}]{WeidemannBook} and this code around line 107: \makeatletter \newcommand{\wrapmarkdown}[1]{#1}=20 \makeatother When compiling this to PDF, an error occurred: ! Undefined control sequence. ...st ,\l__fontspec_fontopts_clist ,\wrapmarkdown {BoldFont=3DWeidemannStd-Bol... ... What I did next (final solution)=20 The error message made me move the snippet from around line 107 to lines=20 2-4 of my generated LaTeX file. The output PDF was created successfully=20 after this modification.=20 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,=20 right after its initial lines, and added=20 --template=3Dmy-custom-latex-template.latex into the command line. Another question=E2=80=A6=20 I assume there is no way to make -H include a code snippet at a specific=20 spot in the LaTeX header? The problem with my original approach seems to=20 have been that on line 17 the call to the \wrapmarkdown newcommand came=20 *before* its definition on line 107=E2=80=A6 and that the only workaround w= as the=20 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=20 Pandoc template, which could be utilized from the command line for cases=20 like this? =E2=80=8B --=20 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 e= mail 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. ------=_Part_2014_2122891191.1460284970538 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

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

+++ John MacFa= rlane [Apr 09 16 19:39 ]:
>See BP Johnson's suggestions (recently in this list) about

BP Jonsson, I mean!

Well =E2=80=94 and in my OP I me= ant to say I started to experiment (not to experience)=E2= =80=A6 =C2=A0 =C2=A0 :-)

I'm referr= ing to the technique of defining a macro like

=C2=A0 =C2=A0 \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=E2=80=A6 However, thank= s to this tipp and some more experimentation on my part, I found a solution= . I=E2=80=99ll document it here in case someone else finds it useful too.

What I did first (cul-de-sa= c, not working!)

I created a file named wrapm= arkdown.tex with this content:

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

and included it as a parameter i= nto my Pandoc command: -H wrapmark= down.tex.

Into my YAML block I put this mo= dification:



mainfontoptions:   \wrapmarkdown{BoldFont=3DWeidemannStd-Bold.otf, ItalicFo=
nt=3DWeidemannBookItalic.otf, BoldItalicFont=3DWeidemannStd-BoldItalic.otf,=
 ItalicFeatures=3D{Colour=3DAA0001}, BoldFeatures=3D{Colour=3D0000

This ended up with a LaTeX outpu= t containing this code around line 17:


    \setmainfont[\wrapmarkdown{BoldFont=3DWeidemannStd-Bold.otf,
       ItalicFont=3DWeidemannBookItalic.otf, BoldItalicFont=3DWeidemannStd-=
BoldItalic.otf,
       ItalicFeatures=3D{Colour=3DAA0001}, BoldFeatures=3D{Colour=3D0000AA}=
,
       BoldItalicFeatures=3D{Colour=3DAA00AA}}]{WeidemannBook}

and this code around line 107:

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

When compiling this to PDF, an e= rror occurred:

! Undefined control se=
quence.
<argument> ...st ,\l__fontspec_fontopts_clist ,\wrapmarkdown
{BoldFont=3DWeidemannStd-Bol...

...

What I did next (final s= olution)

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

Therefore I ditched the inclusio= n of my wrapmarkdown.tex file via the -H/--include-i= n-header command line parameter.

Instead I hard-coded the respect= ive lines into a custom LaTeX template, right after its initial lines, and = added --template=3Dmy-custom-latex= -template.latex into the command line.

Another question=E2=80=A6

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 approa= ch seems to have been that on line 17 the call to the \wrapmarkdown newcommand came before it= s definition on line 107=E2=80=A6 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 va= riable-based approach into the default Pandoc template, which could be util= ized from the command line for cases like this?

=E2=80=8B<= /div>

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@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.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_2014_2122891191.1460284970538-- ------=_Part_2013_1904731973.1460284970538--