From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28541 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ioan Muntean Newsgroups: gmane.text.pandoc Subject: Re: Escape sequence in LUA filters, problems multiple citations conversion of docx to Latex Date: Sat, 5 Jun 2021 18:40:13 -0700 (PDT) Message-ID: <805aa20b-322e-4420-9f4c-33b5c9adf109n@googlegroups.com> References: <3e06a866-8075-4031-886e-8c45cc4ab8bdn@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_22_897686891.1622943613210" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27356"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDFZBUNSQQLBB7WO6CCQMGQEBCLXBRI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Jun 06 03:40:16 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f64.google.com ([209.85.161.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lphlw-0006va-J4 for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 06 Jun 2021 03:40:16 +0200 Original-Received: by mail-oo1-f64.google.com with SMTP id c25-20020a4ad7990000b029020e67cc1879sf8770163oou.18 for ; Sat, 05 Jun 2021 18:40:16 -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=3FjuxkqGhQfDyYVvYAxxs37RRfleq4AqIFifdqkXluw=; b=lYPKV40m7tl5csJvOm6OrXP+abUKvUURxakzVC8snkkzBhKG2OqO9mSu4ssQMZURZb fE5cEgqMtMBDO4Q5e76UecB4Aisf2uenEITTLw4mcv2Gkzsci52e0SFjB8k+0x5GPsvu SW4Z+zaU6HLoVAvRfutMysuiGnSFaYTHrPawg4zpcbtvjTY4fUX8XTGyU/9sZ0HgEuB9 wqEkpv3dBqJW13KZwtB9ZYxeeMmzbFDi7m4auTMjrHEErh7C64ZdQq2ets7c6Ln2F9An R3Wu1LALhmIqTtZbkZFYGRVy50UIrBpmr0nTTJD4P3oOXblPhPirU0n+zZg235OmKdyQ qXFw== 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=3FjuxkqGhQfDyYVvYAxxs37RRfleq4AqIFifdqkXluw=; b=KN7wf9kryX6eVMnP4Xy+HDB650RcvBnr4yUJiK4uUdVfTrmHAiL7spGGXZC8L1RxRU JCBPjNhf/Dg6g40ZtY3eolzSFsFRO9+m9ulWw8gp3ZCyZGm2fqpyy7ZzYuMHcKHayht4 djOua98f6vqWsgt24oqP0mJw4jtUMyHF0pbobjKYNa/29bJQI13nfGPoAHV+me66kqwS jtitqoT0Zgg6IFKFEhxhYJBQx2CfY4UExLX3mhWBYhm9oKQYXJEvxRUxwOqJjwoo71tK AYnnNmq67B22vaPkrSwGxDAQp0gJsx2z/S76jFUrkjp/v36ogOOfJD0CeJE4cHtsy49h Kpwg== 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=3FjuxkqGhQfDyYVvYAxxs37RRfleq4AqIFifdqkXluw=; b=rBopL8ZWohfDgm/wecnNRvoeK2QbbSNaPgxiINIJ1Vzayp+vwW3F0QYQNCI3EWHniY rDwSGwKt0kQcFkB9Ay+ptYII1yZt6x7OYzx9x86IocwBy0Dv4ooCnO6Y5JUBW6N1PK3E tuL5V/QEPRE/bkAbgnPvjTb14hrIucGH6VIJO7cUjoKGAJpHiP7Eusyd46LcxuR1AD63 TGPz/06v70gJY0XxegGkX+TMGJBYUbb4kpq2hUADN9iLYaSBqLwh7NtGl1m9+RzlG9U8 i+81KjfDdZYPN/UUk6g/eR8gfwtCiHnuIS1SZRo7nfHqXpTqukPB7/x5ivSLQUOW8422 UZBw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531q+CZ+FrHzM2eX932vLjpJpiv9pGRPd1SgV1HrutX8cl4ohMVi JZdO93g6moZnctGCLQsNtnY= X-Google-Smtp-Source: ABdhPJyW0pr2gHw/gPraXYBW6R719TmNGDTxBK9/BJzx0mNrfmeUyc4xXGrDT7osZJA6R3UhaitLoA== X-Received: by 2002:aca:d983:: with SMTP id q125mr7529552oig.87.1622943615666; Sat, 05 Jun 2021 18:40:15 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:230b:: with SMTP id e11ls3484979oie.11.gmail; Sat, 05 Jun 2021 18:40:14 -0700 (PDT) X-Received: by 2002:a05:6808:1396:: with SMTP id c22mr14920571oiw.85.1622943613885; Sat, 05 Jun 2021 18:40:13 -0700 (PDT) In-Reply-To: X-Original-Sender: imuntean-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:28541 Archived-At: ------=_Part_22_897686891.1622943613210 Content-Type: multipart/alternative; boundary="----=_Part_23_1685557767.1622943613210" ------=_Part_23_1685557767.1622943613210 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dear Bastien Thanks! I checked your idea and it is working perfectly fine! Thanks! I=20 managed to create the exact filter I need to generate the right citation=20 for Bibtex from a docx file. I managed to recreate the right entries by=20 using \citetext and \citeapl for complex references. Thanks. I can post my filter for those interested. There is still some=20 major differences between the docx filter and the md conversions to latex. Best Ioan On Friday, June 4, 2021 at 5:44:32 PM UTC-4 Bastien Dumont wrote: > Your problem doesn't have anything to do with Lua escaping rules, but > with Pandoc conversion of strings to LaTeX. What you tell Pandoc to do > is to convert a string beginning with a backslash to LaTeX, so it uses > (rightly) \textbackslash. Instead, what you would like to pass is raw > LaTeX code: to that end, use pandoc.RawInline. > > Le Friday 04 June 2021 =C3=A0 10:01:53AM, Ioan Muntean a =C3=A9crit : > > Hello all, > >=20 > > I have some troubles with escaping sequence in a Lua filter. I am using= =20 > the > > function Str() and I simply want to generate the text "\cite" in a Late= x=20 > output > > .=20 > > This is the function: > > return pandoc.Str([[\cite{]]..latex_citekey.."}") > >=20 > > The output is: \textbackslash cite\{ > > How do I escape the converter if I want to get an output like "\cite"? = I=20 > think > > it has something to do with inline characters, but I do not know how to= =20 > use > > them. > >=20 > > Here is the bigger picture:=20 > >=20 > > I am trying to convert with Pandoc DOCX files to Latex. I use Zotero=20 > references > > and a Better than Bibtex style in docx to create references for pandoc. > > The --citedoc --natlib --bibliography=3D<.bib file> options works with= =20 > single > > reference in DOCX=20 > > The entry: [@parker2009computinguncomputablediscrete] > > is converted to \cite{parker2009computinguncomputablediscrete} > >=20 > > [@cartwright2006wellorderedscience; @cichy2019deepneuralnetworks; > > @parker2009computinguncomputablediscrete] > >=20 > > is not converted but kept exactly like that in the Latex file. But the= =20 > Docx > > conversion does not work for multiple references or for prefixes or=20 > suffixes of > > citations. But the same pandoc command for a markdown input works fine.= I > > suspect there is some difference on how the docx and markdown converter= =20 > works. > >=20 > >=20 > > I am currently almost done with writing a Lua filter and the intention= =20 > is to > > generate the correct output > >=20 > > \cite{cartwright2006wellorderedscience, cichy2019deepneuralnetworks, > > parker2009computinguncomputablediscrete} > >=20 > > Thanks in advance! > >=20 > > Ioan > >=20 > >=20 > >=20 > > -- > > You received this message because you are subscribed to the Google Grou= ps > > "pandoc-discuss" group. > > To unsubscribe from this group and stop receiving emails from it, send= =20 > an email > > to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit=20 > https://groups.google.com/d/msgid/ > > pandoc-discuss/3e06a866-8075-4031-886e-8c45cc4ab8bdn%40googlegroups.com= . > > --=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 e= mail 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/805aa20b-322e-4420-9f4c-33b5c9adf109n%40googlegroups.com. ------=_Part_23_1685557767.1622943613210 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dear Bastien
Thanks! I checked your idea and it is working perfectly fi= ne! Thanks! I managed to create the exact filter I need to generate the rig= ht citation for Bibtex from a docx file. I managed to recreate the right en= tries by using \citetext and \citeapl for complex references.
Tha= nks. I can post my filter for those interested. There is still some major d= ifferences between the docx filter and the md conversions to latex.
Best
Ioan

On Friday, June 4, 2021 at 5:44:32 PM UTC-4 Bast= ien Dumont wrote:
Your problem doesn't have anything to do with Lua escaping rules, = but
with Pandoc conversion of strings to LaTeX. What you tell Pandoc to do
is to convert a string beginning with a backslash to LaTeX, so it uses
(rightly) \textbackslash. Instead, what you would like to pass is raw
LaTeX code: to that end, use pandoc.RawInline.

Le Friday 04 June 2021 =C3=A0 10:01:53AM, Ioan Muntean a =C3=A9crit :
> Hello all,
>=20
> I have some troubles with escaping sequence in a Lua filter. I am = using the
> function Str() and I simply want to generate the text "\cite&= quot; in a Latex output
> .=20
> This is the function:
> return pandoc.Str([[\cite{]]..latex_citekey.."}")
>=20
> The output is: \textbackslash cite\{
> How do I escape the converter if I want to get an output like &quo= t;\cite"? I think
> it has something to do with inline characters, but I do not know h= ow to use
> them.
>=20
> Here is the bigger picture:=20
>=20
> I am trying to convert with Pandoc DOCX files to Latex. I use Zote= ro references
> and a Better than Bibtex style in docx to create references for pa= ndoc.
> The --citedoc --natlib --bibliography=3D<.bib file> options = works with single
> reference in DOCX=20
> The entry: [@parker2009computinguncomputablediscrete]
> is converted to \cite{parker2009computinguncomputablediscrete}
>=20
> [@cartwright2006wellorderedscience; @cichy2019deepneuralnetworks;
> @parker2009computinguncomputablediscrete]
>=20
> is not converted but kept exactly like that in the Latex file. But= the Docx
> conversion does not work for multiple references or for prefixes o= r suffixes of
> citations. But the same pandoc command for a markdown input works = fine. I
> suspect there is some difference on how the docx and markdown conv= erter works.
>=20
>=20
> I am currently almost done with writing a Lua filter and the inten= tion is to
> generate the correct output
>=20
> \cite{cartwright2006wellorderedscience, cichy2019deepneuralnetwork= s,
> parker2009computinguncomputablediscrete}
>=20
> Thanks in advance!
>=20
> Ioan
>=20
>=20
>=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-discus...@goo= glegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/
> pandoc-discuss/3e06a866-8075-4031-886e-8c45cc4ab8bdn%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/805aa20b-322e-4420-9f4c-33b5c9adf109n%40googlegroups.= com.
------=_Part_23_1685557767.1622943613210-- ------=_Part_22_897686891.1622943613210--