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...-/JYPxA39Uh5TLH3MbocFFw@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-/JYPxA39Uh5TLH3MbocFFw@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.