public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: J <lixichen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: How to use color in equations when converting to MS Word ?
Date: Mon, 23 Jul 2018 10:54:48 -0700	[thread overview]
Message-ID: <yh480kr2jtx2fr.fsf@johnmacfarlane.net> (raw)
In-Reply-To: <6827ba93-b05a-494a-ac78-a12a06f62e46-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


No, the warning is actually emitted by the writer.
The parser just stores the raw tex math; it gets
converted to the target format by the writer.

The filter would be quite easy, something like

function Math(el)
    el.text = el.text:gsub("\\color{%w+}", "")
    return el
end


J <lixichen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Dear John, many thanks for your help ! You mentioned that "the filter is 
> applied after parsing", but the error "[WARNING] Could not convert TeX 
> math..." seems to be in the parsing ? Would you be kind enough to show an 
> example, or to suggest which part of https://pandoc.org/lua-filters.html is 
> most relevant ? 
>
> On Monday, July 23, 2018 at 1:58:48 PM UTC+8, John MacFarlane wrote:
>>
>> John MacFarlane <j...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org <javascript:>> writes: 
>>
>> > One approach would be to use a lua filter, which 
>> > would allow you to insert content into a document 
>> > only if the format is docx. 
>>
>> Sorry, that wouldn't actually help, since the filter 
>> is applied after parsing. 
>>
>> But instead of redefining the macros, you could use 
>> a lua filter to intercept all math elements and 
>> remove the color commands.  The filter could be 
>> told to do this only for certain formats (e.g. 
>> only for non-latex formats). 
>>
>>
>>
>
> -- 
> 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/6827ba93-b05a-494a-ac78-a12a06f62e46%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


  parent reply	other threads:[~2018-07-23 17:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-21  4:48 J
     [not found] ` <aa5ab201-d3a6-44e2-807d-3f92a97f7a8b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-07-21 19:09   ` John MacFarlane
     [not found]     ` <m28t64h0da.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-07-22  3:18       ` J
     [not found]         ` <ce8072fa-b82f-468b-8d62-781ce71bd8e0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-07-22  5:03           ` John MacFarlane
     [not found]             ` <m24lgrhnfd.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-07-23  2:42               ` J
     [not found]                 ` <eed0bcd1-9e02-4945-aa91-28d1464d34c3-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-07-23  5:55                   ` John MacFarlane
     [not found]                     ` <m2a7qi5wdi.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-07-23  5:58                       ` John MacFarlane
     [not found]                         ` <m27elm5w8m.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-07-23  6:32                           ` J
     [not found]                             ` <6827ba93-b05a-494a-ac78-a12a06f62e46-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-07-23 17:54                               ` John MacFarlane [this message]
     [not found]                                 ` <yh480kr2jtx2fr.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-07-23 17:56                                   ` John MacFarlane
     [not found]                                     ` <yh480ko9exx2d5.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-07-24  4:56                                       ` J

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=yh480kr2jtx2fr.fsf@johnmacfarlane.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=lixichen-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).