public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Escape sequence in LUA filters, problems multiple citations conversion of docx to Latex
@ 2021-06-04 17:01 Ioan Muntean
       [not found] ` <3e06a866-8075-4031-886e-8c45cc4ab8bdn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Ioan Muntean @ 2021-06-04 17:01 UTC (permalink / raw)
  To: pandoc-discuss


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

Hello all,

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" in a Latex 
output . 
This is the function:
return pandoc.Str([[\cite{]]..latex_citekey.."}")

The output is: \textbackslash cite\{
How do I escape the converter if I want to get an output like "\cite"? I 
think it has something to do with inline characters, but I do not know how 
to use them.

Here is the bigger picture: 

I am trying to convert with Pandoc DOCX files to Latex. I use Zotero 
references and a Better than Bibtex style in docx to create references for 
pandoc.
The --citedoc --natlib --bibliography=<.bib file> options works with single 
reference in DOCX 
The entry: [@parker2009computinguncomputablediscrete]
is converted to \cite{parker2009computinguncomputablediscrete}

[@cartwright2006wellorderedscience; @cichy2019deepneuralnetworks; 
@parker2009computinguncomputablediscrete]

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


I am currently almost done with writing a Lua filter and the intention is 
to generate the correct output

\cite{cartwright2006wellorderedscience, cichy2019deepneuralnetworks, 
parker2009computinguncomputablediscrete}

Thanks in advance!

Ioan



-- 
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/3e06a866-8075-4031-886e-8c45cc4ab8bdn%40googlegroups.com.

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

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

* Re: Escape sequence in LUA filters, problems multiple citations conversion of docx to Latex
       [not found] ` <3e06a866-8075-4031-886e-8c45cc4ab8bdn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-06-04 21:43   ` Bastien DUMONT
  2021-06-06  1:40     ` Ioan Muntean
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien DUMONT @ 2021-06-04 21:43 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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 à 10:01:53AM, Ioan Muntean a écrit :
> Hello all,
> 
> 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" in a Latex output
> . 
> This is the function:
> return pandoc.Str([[\cite{]]..latex_citekey.."}")
> 
> The output is: \textbackslash cite\{
> How do I escape the converter if I want to get an output like "\cite"? I think
> it has something to do with inline characters, but I do not know how to use
> them.
> 
> Here is the bigger picture: 
> 
> I am trying to convert with Pandoc DOCX files to Latex. I use Zotero references
> and a Better than Bibtex style in docx to create references for pandoc.
> The --citedoc --natlib --bibliography=<.bib file> options works with single
> reference in DOCX 
> The entry: [@parker2009computinguncomputablediscrete]
> is converted to \cite{parker2009computinguncomputablediscrete}
> 
> [@cartwright2006wellorderedscience; @cichy2019deepneuralnetworks;
> @parker2009computinguncomputablediscrete]
> 
> 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 or 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 works.
> 
> 
> I am currently almost done with writing a Lua filter and the intention is to
> generate the correct output
> 
> \cite{cartwright2006wellorderedscience, cichy2019deepneuralnetworks,
> parker2009computinguncomputablediscrete}
> 
> Thanks in advance!
> 
> Ioan
> 
> 
> 
> --
> 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/3e06a866-8075-4031-886e-8c45cc4ab8bdn%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/YLqemAYD8VVVnCNZ%40localhost.


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

* Re: Escape sequence in LUA filters, problems multiple citations conversion of docx to Latex
  2021-06-04 21:43   ` Bastien DUMONT
@ 2021-06-06  1:40     ` Ioan Muntean
       [not found]       ` <805aa20b-322e-4420-9f4c-33b5c9adf109n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Ioan Muntean @ 2021-06-06  1:40 UTC (permalink / raw)
  To: pandoc-discuss


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

Dear Bastien
Thanks! I checked your idea and it is working perfectly fine! Thanks! I 
managed to create the exact filter I need to generate the right citation 
for Bibtex from a docx file. I managed to recreate the right entries by 
using \citetext and \citeapl for complex references.
Thanks. I can post my filter for those interested. There is still some 
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 à 10:01:53AM, Ioan Muntean a écrit :
> > Hello all,
> > 
> > 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" in a Latex 
> output
> > . 
> > This is the function:
> > return pandoc.Str([[\cite{]]..latex_citekey.."}")
> > 
> > The output is: \textbackslash cite\{
> > How do I escape the converter if I want to get an output like "\cite"? I 
> think
> > it has something to do with inline characters, but I do not know how to 
> use
> > them.
> > 
> > Here is the bigger picture: 
> > 
> > I am trying to convert with Pandoc DOCX files to Latex. I use Zotero 
> references
> > and a Better than Bibtex style in docx to create references for pandoc.
> > The --citedoc --natlib --bibliography=<.bib file> options works with 
> single
> > reference in DOCX 
> > The entry: [@parker2009computinguncomputablediscrete]
> > is converted to \cite{parker2009computinguncomputablediscrete}
> > 
> > [@cartwright2006wellorderedscience; @cichy2019deepneuralnetworks;
> > @parker2009computinguncomputablediscrete]
> > 
> > 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 or 
> 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 
> works.
> > 
> > 
> > I am currently almost done with writing a Lua filter and the intention 
> is to
> > generate the correct output
> > 
> > \cite{cartwright2006wellorderedscience, cichy2019deepneuralnetworks,
> > parker2009computinguncomputablediscrete}
> > 
> > Thanks in advance!
> > 
> > Ioan
> > 
> > 
> > 
> > --
> > 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > 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 "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/805aa20b-322e-4420-9f4c-33b5c9adf109n%40googlegroups.com.

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

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

* Re: Escape sequence in LUA filters, problems multiple citations conversion of docx to Latex
       [not found]       ` <805aa20b-322e-4420-9f4c-33b5c9adf109n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-08-23  9:56         ` Sandra Martin
       [not found]           ` <bdaeff69-16cc-4498-b678-84b6e19f0454n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Sandra Martin @ 2022-08-23  9:56 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi Ioan, I'm currently trying to do exactly the same thing: docx to tex 
with BBT references (I'm using their CSL script 
https://gist.githubusercontent.com/01baftb/dc769574b29891263588a89c62bc2476/raw/67035b0efef81c8633d99e0ddbf4f493c5f79af6/better-bibtex-citekeys-modded-to-use-cite-latex-command.csl). 
However, I'm failing with the Pandoc conversion steps since it also 
converts raw latex. Would you be willing to post your filter and Pandoc 
command? That would be immensely helpful! 
Best, Sandra

Ioan Muntean schrieb am Sonntag, 6. Juni 2021 um 03:40:13 UTC+2:

> Dear Bastien
> Thanks! I checked your idea and it is working perfectly fine! Thanks! I 
> managed to create the exact filter I need to generate the right citation 
> for Bibtex from a docx file. I managed to recreate the right entries by 
> using \citetext and \citeapl for complex references.
> Thanks. I can post my filter for those interested. There is still some 
> 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 à 10:01:53AM, Ioan Muntean a écrit : 
>> > Hello all, 
>> > 
>> > 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" in a 
>> Latex output 
>> > . 
>> > This is the function: 
>> > return pandoc.Str([[\cite{]]..latex_citekey.."}") 
>> > 
>> > The output is: \textbackslash cite\{ 
>> > How do I escape the converter if I want to get an output like "\cite"? 
>> I think 
>> > it has something to do with inline characters, but I do not know how to 
>> use 
>> > them. 
>> > 
>> > Here is the bigger picture: 
>> > 
>> > I am trying to convert with Pandoc DOCX files to Latex. I use Zotero 
>> references 
>> > and a Better than Bibtex style in docx to create references for pandoc. 
>> > The --citedoc --natlib --bibliography=<.bib file> options works with 
>> single 
>> > reference in DOCX 
>> > The entry: [@parker2009computinguncomputablediscrete] 
>> > is converted to \cite{parker2009computinguncomputablediscrete} 
>> > 
>> > [@cartwright2006wellorderedscience; @cichy2019deepneuralnetworks; 
>> > @parker2009computinguncomputablediscrete] 
>> > 
>> > 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 or 
>> 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 
>> works. 
>> > 
>> > 
>> > I am currently almost done with writing a Lua filter and the intention 
>> is to 
>> > generate the correct output 
>> > 
>> > \cite{cartwright2006wellorderedscience, cichy2019deepneuralnetworks, 
>> > parker2009computinguncomputablediscrete} 
>> > 
>> > Thanks in advance! 
>> > 
>> > Ioan 
>> > 
>> > 
>> > 
>> > -- 
>> > 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
>> > 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 "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/bdaeff69-16cc-4498-b678-84b6e19f0454n%40googlegroups.com.

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

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

* Re: Escape sequence in LUA filters, problems multiple citations conversion of docx to Latex
       [not found]           ` <bdaeff69-16cc-4498-b678-84b6e19f0454n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-10-27 20:36             ` Ioan Muntean
  0 siblings, 0 replies; 5+ messages in thread
From: Ioan Muntean @ 2023-10-27 20:36 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi Sandra
Thanks for the question. I do have a workable code I adapted to my needs 
and I will post it here. I plan to comment it heavily such that it can be 
used for different purposes.
Thansk for your patience.
I can send also a number of samples. My code converts everything into latex 
not tex.
Ioan

On Tuesday, August 23, 2022 at 4:56:47 AM UTC-5 Sandra Martin wrote:

> Hi Ioan, I'm currently trying to do exactly the same thing: docx to tex 
> with BBT references (I'm using their CSL script 
> https://gist.githubusercontent.com/01baftb/dc769574b29891263588a89c62bc2476/raw/67035b0efef81c8633d99e0ddbf4f493c5f79af6/better-bibtex-citekeys-modded-to-use-cite-latex-command.csl). 
> However, I'm failing with the Pandoc conversion steps since it also 
> converts raw latex. Would you be willing to post your filter and Pandoc 
> command? That would be immensely helpful! 
> Best, Sandra
>
> Ioan Muntean schrieb am Sonntag, 6. Juni 2021 um 03:40:13 UTC+2:
>
>> Dear Bastien
>> Thanks! I checked your idea and it is working perfectly fine! Thanks! I 
>> managed to create the exact filter I need to generate the right citation 
>> for Bibtex from a docx file. I managed to recreate the right entries by 
>> using \citetext and \citeapl for complex references.
>> Thanks. I can post my filter for those interested. There is still some 
>> 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 à 10:01:53AM, Ioan Muntean a écrit : 
>>> > Hello all, 
>>> > 
>>> > 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" in a 
>>> Latex output 
>>> > . 
>>> > This is the function: 
>>> > return pandoc.Str([[\cite{]]..latex_citekey.."}") 
>>> > 
>>> > The output is: \textbackslash cite\{ 
>>> > How do I escape the converter if I want to get an output like "\cite"? 
>>> I think 
>>> > it has something to do with inline characters, but I do not know how 
>>> to use 
>>> > them. 
>>> > 
>>> > Here is the bigger picture: 
>>> > 
>>> > I am trying to convert with Pandoc DOCX files to Latex. I use Zotero 
>>> references 
>>> > and a Better than Bibtex style in docx to create references for 
>>> pandoc. 
>>> > The --citedoc --natlib --bibliography=<.bib file> options works with 
>>> single 
>>> > reference in DOCX 
>>> > The entry: [@parker2009computinguncomputablediscrete] 
>>> > is converted to \cite{parker2009computinguncomputablediscrete} 
>>> > 
>>> > [@cartwright2006wellorderedscience; @cichy2019deepneuralnetworks; 
>>> > @parker2009computinguncomputablediscrete] 
>>> > 
>>> > 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 or 
>>> 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 works. 
>>> > 
>>> > 
>>> > I am currently almost done with writing a Lua filter and the intention 
>>> is to 
>>> > generate the correct output 
>>> > 
>>> > \cite{cartwright2006wellorderedscience, cichy2019deepneuralnetworks, 
>>> > parker2009computinguncomputablediscrete} 
>>> > 
>>> > Thanks in advance! 
>>> > 
>>> > Ioan 
>>> > 
>>> > 
>>> > 
>>> > -- 
>>> > 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
>>> > 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 "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/fe97c8d4-be89-4dad-94f1-6de3de0e08d5n%40googlegroups.com.

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

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

end of thread, other threads:[~2023-10-27 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 17:01 Escape sequence in LUA filters, problems multiple citations conversion of docx to Latex Ioan Muntean
     [not found] ` <3e06a866-8075-4031-886e-8c45cc4ab8bdn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-06-04 21:43   ` Bastien DUMONT
2021-06-06  1:40     ` Ioan Muntean
     [not found]       ` <805aa20b-322e-4420-9f4c-33b5c9adf109n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-08-23  9:56         ` Sandra Martin
     [not found]           ` <bdaeff69-16cc-4498-b678-84b6e19f0454n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-10-27 20:36             ` Ioan Muntean

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