Thanks, It works. I have spent much much time on it. I should ask in this group earlier. 

在2021年7月11日星期日 UTC+8 上午2:38:07<Bastien Dumont> 写道:
I got it. The filter you're using performs a search on the "style" attribute's value even if there is none. The error happens when citeproc is called because citeproc creates spans with no "style" attribute.

Simply replace l. 2 with the following:

if el.attributes.style and string.find(el.attributes.style, "color") then

Le Saturday 10 July 2021 à 10:31:53AM, dualer a écrit :
> Sorry, I forgot something. I have added `-C --bibliography=Library.bib`
> to the cmd code. 
>
> 在2021年7月11日星期日 UTC+8 上午12:36:49<dualer> 写道:
>
> Hi everyone! I have a naive question: When I transform .md to .pdf,
> how to keep the font color unchange? I have
> see (https://stackoverflow.com/questions/62831191/using-span-for-font-color-in-pandoc-markdown-for-both-html-and-pdf),
> but the code don't work when meeting following markdown code: 
>
> <span style="color: red;">@red text</span>
>
> The key point above is `@`, and it interrupts `lua filter` to work,
> but I need it when I add some references, e.g. [@XX]. So how to solve
> it?
>
> --
> 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 (mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org).
> To view this discussion on the web visit
> (https://groups.google.com/d/msgid/pandoc-discuss/de189b39-1ca1-4d72-92de-a9d39d41d421n%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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/b60be6af-b18f-485d-87ca-2ada3ec6f8cen%40googlegroups.com.