public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Gwern Branwen <gwern-v26ZT+9V8bxeoWH0uzbU5w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Colored equations? (particularly compiling to HTML)
Date: Sat, 5 Sep 2020 23:16:57 -0400	[thread overview]
Message-ID: <CAMwO0gzotcqk5J0uHvp3YZqmfhmistbkbv7Mv-QLq5vqdbD7LQ@mail.gmail.com> (raw)
In-Reply-To: <CAMwO0gyY9o7hurpkaWaOQws5xNN1gV9kjHV9RsEp3h_K8fDWJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Wed, Mar 18, 2020 at 11:27 PM Gwern Branwen <gwern-v26ZT+9V8bxeoWH0uzbU5w@public.gmane.org> wrote:
> In an earlier discussion of Pandoc->Docx (
> https://groups.google.com/d/msgid/pandoc-discuss/aa5ab201-d3a6-44e2-807d-3f92a97f7a8b%40googlegroups.com
> ), John says that the texmath package doesn't support the necessary
> TeX color library, so you can't simply write out color annotations in
> native TeX expressions with $/$$.
> People writing Latex->PDF presumably can just use that color library directly.

So to follow this up more, the weakest link seems to be Texmath.

On the server-side end, the Latex 'xcolor' package is imported by
default by Pandoc, so anyone writing Markdown->PDF can just use colors
directly without even modifying the imports or anything:

https://bookdown.org/yihui/rmarkdown-cookbook/font-color.html

> For PDF, we can use the LaTeX command \textcolor{}{}. This requires the LaTeX package xcolor, which is included in Pandoc’s default LaTeX template.

Which is also confirmed by https://pandoc.org/MANUAL.html#creating-a-pdf

And on the other hand, on the client-side end, Mathjax also supports
color in equations:
https://docs.mathjax.org/en/latest/input/tex/extensions/color.html

> This extension is loaded automatically when the autoload extension is used. ...The color extension defines the \color macro as in the LaTeX color package, along with \colorbox, \fcolorbox, and \definecolor. It declares the standard set of colors (Apricot, Aquamarine, Bittersweet, and so on), and provides the RGB, rgb, and grey-scale color spaces in addition to named colors...in version 3 (and in LaTeX itself), you would do
>
> `{\color{red} x} + {\color{blue} y}`

So we have the situation that if you write Latex directly for Mathjax
in your final HTML, it works fine (example:
https://adereth.github.io/blog/2013/11/29/colorful-equations/ ), and
if you write Latex directly in your Markdown, it works fine by default
(for PDFs), but then it doesn't work at all* if you write Markdown for
HTML?

* I thought initially https://github.com/chdemko/pandoc-latex-color
might work but the README is confusing and it seems to be for the
special-case of colorizing body text, not equations, and for
Markdown->PDF only. There don't seem to be any other relevant filters
for color. So I suppose you would have to go the full-blown 'render
arbitrary LaTeX as SVG/PNG and inline' filter route in order to do
Markdown->HTML colorized equations?

-- 
gwern
https://www.gwern.net

-- 
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/CAMwO0gzotcqk5J0uHvp3YZqmfhmistbkbv7Mv-QLq5vqdbD7LQ%40mail.gmail.com.


  parent reply	other threads:[~2020-09-06  3:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19  3:27 Gwern Branwen
     [not found] ` <CAMwO0gyY9o7hurpkaWaOQws5xNN1gV9kjHV9RsEp3h_K8fDWJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-09-06  3:16   ` Gwern Branwen [this message]
     [not found]     ` <CAMwO0gzotcqk5J0uHvp3YZqmfhmistbkbv7Mv-QLq5vqdbD7LQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-09-07 18:04       ` John MacFarlane
     [not found]         ` <m28sdlv4ys.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-09-07 23:48           ` Gwern Branwen
     [not found]             ` <CAMwO0gx3i0E-C4c35sX+Xcwwu+t5+TrRcOnQ3OSnNqsx6eYMFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-11-18 23:33               ` Advanced equation typesetting, "Nota" " Gwern Branwen

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=CAMwO0gzotcqk5J0uHvp3YZqmfhmistbkbv7Mv-QLq5vqdbD7LQ@mail.gmail.com \
    --to=gwern-v26zt+9v8bxeowh0uzbu5w@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).