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: Sun, 22 Jul 2018 22:55:37 -0700	[thread overview]
Message-ID: <m2a7qi5wdi.fsf@johnmacfarlane.net> (raw)
In-Reply-To: <eed0bcd1-9e02-4945-aa91-28d1464d34c3-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


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.

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

> Dear John, many thanks for your suggestion ! I would like to have a same 
> markdown file for PDF and .docx. Could you help to suggest how to only 
> redefine the color macros to no-ops for generating .docx ?
>
> On Sunday, July 22, 2018 at 1:03:51 PM UTC+8, John MacFarlane wrote:
>>
>>
>> You can redefine the color macros to no-ops; (recent) pandoc 
>> should be able to expand the macros prior to passing 
>> the tex to texmath.  e.g., 
>>
>>     \renewcommand{\color}[1]{#1} 
>>
>> Try that. 
>>
>> J <lixi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> writes: 
>>
>> > Dear John, many thanks for your comment ! Is it possible to just ignore 
>> the 
>> > color instructions and produce a monochrome one ? I mean, a monochrome 
>> one 
>> > is much useful than raw latex code. 
>> > 
>> > On Sunday, July 22, 2018 at 3:09:37 AM UTC+8, John MacFarlane wrote: 
>> >> 
>> >> 
>> >> Sorry, the texmath package (which we use for 
>> >> conversions) doesn't support xcolor. 
>> >> 
>> >> J <lixi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> writes: 
>> >> 
>> >> > $ pandoc MWE1.md --mathml --filter=pandoc-crossref 
>> >> --filter=pandoc-citeproc 
>> >> > -s -o MWE1.docx 
>> >> > [WARNING] Could not convert TeX math 
>> >> > 
>> >> 
>> '\mathrm{\underline{\begingroup\color{magenta}AB\endgroup},\underline{\textcolor{green}{CD}}}', 
>>
>> >> 
>> >> > rendering as TeX: 
>> >> >   derline{\begingroup\color{magenta}AB\end 
>> >> >                      ^ 
>> >> >   unexpected "\\" 
>> >> >   expecting "%", "\\label", "\\nonumber" or whitespace 
>> >> > $ 
>> >> > $ pandoc MWE1.md --mathml --filter=pandoc-crossref 
>> >> --filter=pandoc-citeproc 
>> >> > -s -o MWE1.pdf --pdf-engine=xelatex 
>> >> > $ 
>> >> > 
>> >> > 
>> >> > Could you help to comment how to use color in equations when 
>> converting 
>> >> to 
>> >> > MS Word file ? The MWE1.md attached can be converted to PDF but not 
>> to 
>> >> > .docx. Many thanks ! 
>> >> > 
>> >> > -- 
>> >> > 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 <javascript:>. 
>> >> > To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
>> >> <javascript:>. 
>> >> > To view this discussion on the web visit 
>> >> 
>> https://groups.google.com/d/msgid/pandoc-discuss/aa5ab201-d3a6-44e2-807d-3f92a97f7a8b%40googlegroups.com. 
>>
>> >> 
>> >> > For more options, visit https://groups.google.com/d/optout. 
>> >> > --- 
>> >> > header-includes: 
>> >> >     - \usepackage{xcolor} 
>> >> > --- 
>> >> > 
>> >> 
>> $\mathrm{\underline{\begingroup\color{magenta}AB\endgroup},\underline{\textcolor{green}{CD}}}$ 
>>
>> >> 
>> >> 
>> > 
>> > -- 
>> > 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 <javascript:>. 
>> > To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
>> <javascript:>. 
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/ce8072fa-b82f-468b-8d62-781ce71bd8e0%40googlegroups.com. 
>>
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>
> -- 
> 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/eed0bcd1-9e02-4945-aa91-28d1464d34c3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


  parent reply	other threads:[~2018-07-23  5:55 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 [this message]
     [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
     [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=m2a7qi5wdi.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).