public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: "krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <krulis.tomas.tk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: How to add a `\usepackage` in a Lua filter meant to support LaTeX?
Date: Fri, 20 Nov 2020 02:22:50 -0800 (PST)	[thread overview]
Message-ID: <649e3b33-6e0f-4144-8796-2175ee76f3a8n@googlegroups.com> (raw)
In-Reply-To: <6f859587-fd58-46b5-b94b-a21bebe3e6fcn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


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

I totally agree with the question author: For my personal use I have highly 
customized LaTeX template. But actually for some projects I could go with 
only a little customizations like question author: Adding package in CLI 
and use filter to modify writer to write LaTeX source that uses the 
package. For some use-cases, this option could be very helpfull, if it 
would avoid collision with `header-includes` (that is sometimes "blocked" 
as writes question author). As mentioned, other formats could benefit from 
that as well.
Regards, Tomas

Dne čtvrtek 19. listopadu 2020 v 22:08:22 UTC+1 uživatel fells...@gmail.com 
napsal:

> I can work out a solution for my own personal use.  But other people are 
> using my infrastructure.  Ideally I'd like to be able to tell them, "If you 
> want this effect, use this filter."  Asking them also to use a custom 
> template is not only a greater burden, but it's a solution that doesn't 
> compose in the same way that filters do.  You can think of the problem I'm 
> trying to solve like this: I want to extend Pandoc with a new capability.  
> The capability is going to be supported by new markup, new CSS (for the 
> HTML writer), and new LaTeX packages (for the LaTeX/PDF writer).  But I'm 
> writing more than one extension, and I want my extensions to coexist 
> peacefully with other extensions.  I can manage stuff like name-space 
> collisions for element classes.  But a custom template become 
> non-compositional.
>
> One of the many issues I looked at today mentioned the idea of extending 
> the standard template with a `filter-header-includes` variable, or even a 
> `filter-header-includes.writer` variable.  As the OP in that thread 
> observed, it's a bit clunky, but with discipline from filter authors, it 
> could work.  The key would be this: filter authors would need to rely on 
> and invariant saying that variable is not set on the command line. @jgm, 
> I'm not sure whether you considered such an extension to the default 
> templates?  (Pardon my poor memory, but I got deep into the weeds.)
>
>
> On Thursday, November 19, 2020 at 2:50:51 PM UTC-5 denis...-FfwAq0itz3ofv37vnLkPlQ@public.gmane.org 
> wrote:
>
>> I don't know how that would work with a filter, but wouldn't a custom 
>> template be an easier solution? Or what speaks against this? 
>>
>> Best, 
>> Denis 
>>
>>
>> ________________________________________ 
>> Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> im 
>> Auftrag von Norman Ramsey <fells...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 
>> Gesendet: Donnerstag, 19. November 2020 20:27:18 
>> An: pandoc-discuss 
>> Betreff: How to add a `\usepackage` in a Lua filter meant to support 
>> LaTeX? 
>>
>> I've got a Lua filter that is meant to render certain document elements 
>> in a `boxedminipage` environment. To accomplish this feat, I give the 
>> element in a suitable `div`, and a Lua filter inserts the LaTeX 
>> environment. The document itself remains universal, but the Lua filter is 
>> resolutely intended for LaTeX. 
>>
>> The filter adds a raw `\usepackage{boxedminipage2e}` to the 
>> `header-includes` of the metadata, but unfortunately when `-V 
>> header-includes=...` appears on the command line, it takes precedence and 
>> the document metadata is ignored. 
>>
>> I thought of trying to use `-M header-includes=...` instead of `-V 
>> header-includes=...`, but that comes with its own problems: using the `-M` 
>> option, the argument on the command line is escaped. It is not clear to me 
>> if there is a mechanism I can use to put raw LaTeX in that spot. 
>>
>> The issue of the command line overriding metadata has been discussed at 
>> some length on the issue tracker (
>> https://github.com/jgm/pandoc/issues/3139) and in pandoc-discuss, where 
>> a related issue is laid out in the last post (
>> https://groups.google.com/g/pandoc-discuss/c/N6WhlmSPXbY/m/UYJJBdZwAAAJ). 
>>
>> The discussion thread in pandoc-discuss is now two and a half years old, 
>> and it seemed to be in favor of a change. But as of pandoc version 
>> 2.11.1.1, no change appears to have been made, and issue #3139 remains 
>> open. 
>>
>> Is there a workaround I can add to my Lua filter that will make it work 
>> in a self-contained way even in the presence of assignments to the 
>> `header-includes` variable on the command line? And is there any thought of 
>> #3139 being resolved one way or the other? 
>>
>> -- 
>> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:
>> pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>. 
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/2e27c210-a276-4319-abd7-c81d5db7f7d7n%40googlegroups.com
>> <
>> https://groups.google.com/d/msgid/pandoc-discuss/2e27c210-a276-4319-abd7-c81d5db7f7d7n%40googlegroups.com?utm_medium=email&utm_source=footer>. 
>>
>>
>

-- 
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/649e3b33-6e0f-4144-8796-2175ee76f3a8n%40googlegroups.com.

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

  parent reply	other threads:[~2020-11-20 10:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AQHWvqoEJV35v23+VkitO4uJW9kmTKnP3L8H>
2020-11-19 19:27 ` Norman Ramsey
     [not found]   ` <2e27c210-a276-4319-abd7-c81d5db7f7d7n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-11-19 19:50     ` AW: " denis.maier-FfwAq0itz3ofv37vnLkPlQ
     [not found]       ` <e6b951c36db0463983df5a4c381693ea-FfwAq0itz3ofv37vnLkPlQ@public.gmane.org>
2020-11-19 21:08         ` Norman Ramsey
     [not found]           ` <6f859587-fd58-46b5-b94b-a21bebe3e6fcn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-11-20 10:22             ` krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [this message]
2020-11-19 20:10     ` John MacFarlane
2020-11-20 15:54     ` BPJ
2020-11-20 19:43     ` John MacFarlane
     [not found]       ` <m21rgnhkzz.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-11-20 21:04         ` Norman Ramsey

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=649e3b33-6e0f-4144-8796-2175ee76f3a8n@googlegroups.com \
    --to=krulis.tomas.tk-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=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).