From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/25117 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "R. Wils" Newsgroups: gmane.text.pandoc Subject: Re: Colored text in PDF Date: Tue, 5 May 2020 10:36:32 -0700 (PDT) Message-ID: References: <5f7aae6a-8087-439d-874b-dcf547dd10b1@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_745_980554949.1588700192347" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="44328"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCUYVKWP6AMBBIOIY32QKGQEZGT2BQA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue May 05 19:36:36 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f60.google.com ([209.85.161.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jW1Ui-000BQg-F5 for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 05 May 2020 19:36:36 +0200 Original-Received: by mail-oo1-f60.google.com with SMTP id j4sf2199678oot.10 for ; Tue, 05 May 2020 10:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=YWMd9uYF2UrNCis5FDZ3npOYEnaCB9lOQmqkPwzIxYU=; b=sBMgUCnGLCZmHwtla03JuYJFYoZ6EXXiN++2JjZIGC2vJLnqWIDrI8qXSawh02a+z+ 3ByVnzE0zI7e3Z1dMuMpgPGMeG5k1Yk0nlImiJ3vNELu/RQw2C8+40rmR9Ne1PQAl297 Wmo2DqvxUsKfG6ZnmtoZuJ+PeUeOtFYY5DPlgzwY6bKHzoJVlY9v9Ls+9uONer9coExx OUxEAQUdGTpog/vHS3nwSVjMeEHWk6ylIRhlCANHv17ehyVSi3MRhgXjKGXQgerWaq9H EhmjVfhunApCiP8f5fGdZKyjACKk8IsSziqUjsvs4XYixjhgVxFb89xYutqfK7BG0Ips ljSQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=YWMd9uYF2UrNCis5FDZ3npOYEnaCB9lOQmqkPwzIxYU=; b=b+2g+jbDjxcQCgK9anIVjjrt0G7qoZJp0XsEwIegmZud37dRWVhGS/bKKnVcmOJpnn gezVw+D2B27UgMcfPsJUBSU3F/cI5sVm8Mo3sE3b5mBpW5k/0byxt4WFbBD34eX4kDsp 2+Y67538og6th+P0Dl6rw47m/GEAXuVEollYZYTsBTeOWmhvJFjaPs3BlKAhce3LWcqC Ltst8AxfC1UKfBHbvautQVAbfzH2qbEyDLf3a6nE7S7PV1/CM65vIGBrcZ84MiIRZRwk Ff48pfoS5+ekazDwuBnQVAJx2jwj3WgFCUFQrtYuKYtkEekd2tfDFl7n3sRDfBMN8BK2 axzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=YWMd9uYF2UrNCis5FDZ3npOYEnaCB9lOQmqkPwzIxYU=; b=DhbEFn1RU9HGsy2myWQWpm1smnybOLurd/InAAvTJJYC/eMGreXZu7B0/KevD5bT55 jMNMRV0sCwq63AttJ3mWcySLDfa04vicmf08jajLEeGgWPK3PHDaAyWMYr4LqSY/Ssbq ZQHuekilITqbHTKslVWkRkbVvNiCXXl//xHBVRwauR2LKw8N7SwTydtdqx/74efw5XI8 6657dTHP4MMcvpiBQlD3Pi1fodv/lQ1afhKr+UK2k5fn7h2XCaw8uOFUYW8Zz/CO9Nl0 pkId+L7OuCRZQPwyJezbDCos3Z2+rriCpx8hxspejGUlxYMoSKWisqQpBsvfNWZ91pNh 4dxA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AGi0PubOo6a1m1Q7zUcLLQsKUOvJaW7Qgjwy5/z6UuO11bOWHlnQnew9 xWlYaAd8Xhl1V8B4ZpilSt0= X-Google-Smtp-Source: APiQypJka3qnp2TN7gcGgRL6CrmBrARZQokNWZGoo8J9Pi+o9SFLooe72iZypIlPwGTTdGmVzwcM7A== X-Received: by 2002:a05:6830:1da1:: with SMTP id z1mr3144518oti.101.1588700195418; Tue, 05 May 2020 10:36:35 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:ad16:: with SMTP id w22ls718408oie.8.gmail; Tue, 05 May 2020 10:36:33 -0700 (PDT) X-Received: by 2002:aca:edcb:: with SMTP id l194mr3340907oih.159.1588700192938; Tue, 05 May 2020 10:36:32 -0700 (PDT) In-Reply-To: X-Original-Sender: raiwil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:25117 Archived-At: ------=_Part_745_980554949.1588700192347 Content-Type: multipart/alternative; boundary="----=_Part_746_446134980.1588700192347" ------=_Part_746_446134980.1588700192347 Content-Type: text/plain; charset="UTF-8" Thank you very much for your reply. Pandoc is so nice but also very difficult to understand. I've never seen the lua language before. I'm quit familiar with Python and Html but I've never seen lua code before. I've read the pages: - lua-filters.html Created a file: my_luafilter.lua with your function inside function Span(el) if el.attributes.color then return { pandoc.rawInline("latex", "\\textcolor{" .. el.attributes.color .. "}"), el } end end And in my pandoc.markdown file I added this: test And added this filter to my pandoc command: --lua-filter=d:\\my_luafilter.lua Nothing happened. What did I wrong? Sorry to ask you all these questions I just need *colored text* and *underscore* for a markdown document I created and which I want to convert to PDF format. I'll learn every day a bit more about lua and lua filters. On Tuesday, May 5, 2020 at 6:15:06 PM UTC+2, John MacFarlane wrote: > > > Cleanest way is to use a Span with an attribute, plus a > lua filter that reacts to Spans with that attribute by > adding some LaTeX color commands. > > See the lua filter documentation and feel free to ask > if you have questions. > > Something like this (untested) > > function Span(el) > if el.attributes.color then > return { pandoc.rawInline("latex", "\\textcolor{" .. > el.attributes.color .. "}"), el } > end > end > > "R. Wils" > writes: > > > Does anyone know how to color text in a PDF > > (converting from a pandoc.markdown text file)? > > > > I tried to use a span and div tag without success. > > > > (Sorry I'm a new pandoc user) > > > > -- > > 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/5f7aae6a-8087-439d-874b-dcf547dd10b1%40googlegroups.com. > > -- 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/d38ce0bc-44cc-4e70-9914-728835ead837%40googlegroups.com. ------=_Part_746_446134980.1588700192347 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you very much for your reply.

Pandoc is so nice but also very difficult to understand.
= I've never seen the lua language before. I'm quit familiar with Pyt= hon and Html but I've never seen lua code before.

<= div>I've read the pages:
- lua-filters.html
Created= a file: my_luafilter.lua

with your function insid= e

function Span(el)
=C2=A0 if el.attributes.color then
=C2=A0 =C2=A0 return { pandoc.rawInline("latex", "\\text= color{" ..
=C2=A0 el.attributes.color .. "}"), el }
=C2=A0 end
end

And in my pandoc.markdown file I adde= d this:

<span style=3D"color:red">= test</span>

And added this filter to my pand= oc command:
--lua-filter=3Dd:\\my_luafilter.lua
Nothing happened.
What did I wrong?

Sorry to ask you all these questions
I just need color= ed text and underscore for a markdown document I created and whi= ch I want to convert to PDF format.
I'll learn every day = a bit more about lua and lua filters.

On Tuesday, May 5, 2020 at 6= :15:06 PM UTC+2, John MacFarlane wrote:

Cleanest way is to use a Span with an attribute, plus a
lua filter that reacts to Spans with that attribute by
adding some LaTeX color commands.

See the lua filter documentation and feel free to ask
if you have questions.

Something like this (untested)

function Span(el)
=C2=A0 if el.attributes.color then
=C2=A0 =C2=A0 return { pandoc.rawInline("latex", "\\text= color{" ..
=C2=A0 el.attributes.color .. "}"), el }
=C2=A0 end
end

"R. Wils" <rai...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Does anyone know how to color text in a PDF=20
> (converting from a pandoc.markdown text file)?
>
> I tried to use a span and div tag without success.=20
>
> (Sorry I'm a new pandoc user)
>
> --=20
> 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-...@googlegroups.com.
> To view this discussion on the web visit https://groups.= google.com/d/msgid/pandoc-discuss/5f7aae6a-8087-439d-874b-dcf547d= d10b1%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/d38ce0bc-44cc-4e70-9914-728835ead837%40googlegroups.co= m.
------=_Part_746_446134980.1588700192347-- ------=_Part_745_980554949.1588700192347--