I don't know. Maybe I'm a simpleton but I would just edit the latex templates. I have lots of them. Then you keep your source file clean. Rick On Sunday, April 10, 2016 at 5:42:50 AM UTC-5, kurt.p...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org wrote: > > 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. > ...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/b9af327d-6e18-4625-b3de-dbf8702e4d6c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.