public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* How to use color in equations when converting to MS Word ?
@ 2018-07-21  4:48 J
       [not found] ` <aa5ab201-d3a6-44e2-807d-3f92a97f7a8b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: J @ 2018-07-21  4:48 UTC (permalink / raw)
  To: pandoc-discuss


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

$ 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-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/aa5ab201-d3a6-44e2-807d-3f92a97f7a8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

[-- Attachment #2: MWE1.md --]
[-- Type: text/x-markdown, Size: 146 bytes --]

---
header-includes:
    - \usepackage{xcolor}
---
$\mathrm{\underline{\begingroup\color{magenta}AB\endgroup},\underline{\textcolor{green}{CD}}}$

[-- Attachment #3: MWE1.pdf --]
[-- Type: application/pdf, Size: 3949 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use color in equations when converting to MS Word ?
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: John MacFarlane @ 2018-07-21 19:09 UTC (permalink / raw)
  To: J, pandoc-discuss


Sorry, the texmath package (which we use for
conversions) doesn't support xcolor.

J <lixichen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-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/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}}}$


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use color in equations when converting to MS Word ?
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: J @ 2018-07-22  3:18 UTC (permalink / raw)
  To: pandoc-discuss


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

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-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/ce8072fa-b82f-468b-8d62-781ce71bd8e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use color in equations when converting to MS Word ?
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: John MacFarlane @ 2018-07-22  5:03 UTC (permalink / raw)
  To: J, pandoc-discuss


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 <lixichen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-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/ce8072fa-b82f-468b-8d62-781ce71bd8e0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use color in equations when converting to MS Word ?
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: J @ 2018-07-23  2:42 UTC (permalink / raw)
  To: pandoc-discuss


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

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.

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use color in equations when converting to MS Word ?
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: John MacFarlane @ 2018-07-23  5:55 UTC (permalink / raw)
  To: J, pandoc-discuss


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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use color in equations when converting to MS Word ?
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: John MacFarlane @ 2018-07-23  5:58 UTC (permalink / raw)
  To: J, pandoc-discuss

John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> 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).



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use color in equations when converting to MS Word ?
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: J @ 2018-07-23  6:32 UTC (permalink / raw)
  To: pandoc-discuss


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

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.

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use color in equations when converting to MS Word ?
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: John MacFarlane @ 2018-07-23 17:54 UTC (permalink / raw)
  To: J, pandoc-discuss


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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use color in equations when converting to MS Word ?
       [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>
  0 siblings, 1 reply; 11+ messages in thread
From: John MacFarlane @ 2018-07-23 17:56 UTC (permalink / raw)
  To: J, pandoc-discuss


Sorry, to make it work only if the output format is
not latex, you want:

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

John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:

> 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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use color in equations when converting to MS Word ?
       [not found]                                     ` <yh480ko9exx2d5.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2018-07-24  4:56                                       ` J
  0 siblings, 0 replies; 11+ messages in thread
From: J @ 2018-07-24  4:56 UTC (permalink / raw)
  To: pandoc-discuss


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

Dear John, many thanks for your efforts to help !

On Tuesday, July 24, 2018 at 1:56:37 AM UTC+8, John MacFarlane wrote:
>
>
> Sorry, to make it work only if the output format is 
> not latex, you want: 
>
> function Math(el) 
>     if FORMAT ~= "latex" then 
>       el.text = el.text:gsub("\\color{%w+}", "") 
>       return el 
>     end 
> end 
>
> John MacFarlane <j...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org <javascript:>> writes: 
>
> > 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 <lixi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> 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-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/6827ba93-b05a-494a-ac78-a12a06f62e46%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/2b08cab7-9405-49b1-9ce0-2359e996954f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-07-24  4:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-21  4:48 How to use color in equations when converting to MS Word ? 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
     [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

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).