samedi 6 octobre 2018

How to extract a function with its args ? Lua Code

I was trying to write some Lua code to search list all occurrences of a macro I made in my .tex file and to put them at the end of my file. So I'd like to find all the occurrences of "\Citation{text1}{text2}{text2}" in a string and to return a list containing all the occurrences with the same format. I have :

output = {}
for elt in string.gmatch(str,"\\Citation(%b{}%b{}%b{})") do 
    output[#output + 1] = elt
end

But the issue is that it only returns text1text2text3 concatenated and not "\Citation{text1}{text2}{text2}". I'm not very familiar with Lua. If someone could help me

Sincerely,

Aucun commentaire:

Enregistrer un commentaire