From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28367 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: LaTeX footnote citations parentheses Date: Sun, 16 May 2021 16:53:43 +0000 Message-ID: References: <26bec817-c8b4-4d63-ad5d-436aa281c0d7n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="64wzvblNqcFCWEMG" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15661"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBPE4QWCQMGQEN5TGWLA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun May 16 18:54:24 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f190.google.com ([209.85.208.190]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1liK23-0003uk-8m for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 16 May 2021 18:54:23 +0200 Original-Received: by mail-lj1-f190.google.com with SMTP id a14-20020a2e7f0e0000b02900b9011db00csf2185048ljd.8 for ; Sun, 16 May 2021 09:54:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1621184062; cv=pass; d=google.com; s=arc-20160816; b=R3HwwNk1rUnybNv0anDuAPJJRH9MrvO9BHSPEBu2+JMVHzqwMwti4MPej3sr85pTs3 pYSnkv1ERbs0ovyDxjozhNPnbZtoA690PLF8gI+TQ9zeuoD7noLSUuTd3gYAUz0SNAbf +t+LaqM179nak96Fe2kf+MBCxh1Ib5WviYT7MXL5C3EmcXxn1DrCus5bDYdhUAoOBgw9 VQSx53ZUCSj1N0GSqNGSZ0Aoudo1jGAEvJxmB3X7kj/RrWlHVkqD3tWlwB9D0tHeZxQE 8Y1sjzjgQnhR3dqdFeg7tasnSKjO3YR0UwXlM2iZwBv+G1CnNP0u/iZnz7xZbguOma+g fzgg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:dkim-signature; bh=TSoS1yVqO6lOPXuLeKKLGcx+eqa2K9mKY6ch4PLp0hs=; b=A/Vs6yUmhwWsKIULY8OROlXL08WCj9ki3NQrv2K6Fh4WdHxyfzYGN2Tuwm1rp2PuXN tqUJhh5IOXY8mB30CqzyvGlVXJ3NUIer71r0i+b/4Fjs99LokF+PIbOFAl81hlx11Cm0 YyCdDxdtLonIZT9C0eRnlLu+B3QF+yiu95gQqsRQ/f6oDnpXbWlNniMq0xKn4gIwjXKg OytygzAZvB/qzMiLWYpiBwiQgkv/scPk5nEyJf40QLCE3IkEeaBicdk580IS3EWKKiwV x6hgtMWjvd1kGpY3YAMXlvi4HhHuwMtTEwkXAQxc0y8bu+5dkSJLF9EffmMRGCa7DN5z rNYQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=RTYXTlbm; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=TSoS1yVqO6lOPXuLeKKLGcx+eqa2K9mKY6ch4PLp0hs=; b=OI13wk6D7XGGg+LA5pKlB7plvRvBgdAnD46NZvPjbA7FfIqiq7D7ZweGvrD4oehrXc bdjYK6eSpnZr80VTFZ3dwMrrUR+aliAWnJTYBoJVdroWg7q18+EOyZMmjncNSrymNfLp AE/+4fOy3EG6EPsfbSHqU02KlZnLkUxmkBo/MxUXAqOW4AeRlFEv9zjQRmeaOeyXP/e5 8Lx4YmVqFbqSB61d9XMiYWQWRtOvn0kv0GCjE5nOfUkwHunJ/s3o0oYifz0oLcuBUdnM if8AM3L/FnVOynl48wOklRsuYQ3li3uEPUnx/+u6WzaExAA9Xf5Q8z/plAsFFY3gU5fO DCwg== 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:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=TSoS1yVqO6lOPXuLeKKLGcx+eqa2K9mKY6ch4PLp0hs=; b=khy7Btk/8EEhXMAS6JwMZoQjIV8VGqmUBLuMUFR6dYiurTu59+9i8OxlRdeFs4J4/m F3xDdD9TUiHkzNYblTlCVBVXZAhubUH1AnltUgRPcFwH3DS7w9DzOBXBRJTn5Lj0HT5c rV6xPnBDtmKkReZJRWLv2R6JIo2V+y/69iYOnM+MyuD7AuGgKxOjVWJkkQKncxXIMlcI 2t5+yzmnYPkGFGzldMEm48Ya+QYDaeUcE38SmzSyauHL1wrAClCJlmsWP2sPFUsB4p1f Pn0woy3slYXdZNoX7XJeHSpomoHw4s6XMJ4erft5S4X1 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531/lWk1Uj4PAaP15bts9QvuIisL9YrJqv6ND3zVNIGZ2JXVHVCc 6/DYpNKuE28jJwacK1BS0Rw= X-Google-Smtp-Source: ABdhPJwT0gqNF55kMlDeZy3cJHVWAAzrOzM6xjX7Jv9+iWItAHgrQ3ycER7MHSP6VIiuktmGw4U4mw== X-Received: by 2002:a2e:b52e:: with SMTP id z14mr46004529ljm.158.1621184062834; Sun, 16 May 2021 09:54:22 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6512:230f:: with SMTP id o15ls8140082lfu.1.gmail; Sun, 16 May 2021 09:54:20 -0700 (PDT) X-Received: by 2002:a19:5208:: with SMTP id m8mr39503433lfb.372.1621184059922; Sun, 16 May 2021 09:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621184059; cv=none; d=google.com; s=arc-20160816; b=bbupcJwBupGhVVXQYvXjEot7orny7rEKY21CK8kC7UBaMu+ioM91JDwaR49uWANe5K lrsv059Dfh7GHBDMrjvrLcZ9HOKsmnXM1NiuwdUeCnokf8i1x5HgGa7gcbuznl7HU6vO 9PwjkpsqI1cEnzG+VbSpgvATvwNWWUaonlyTUa5aoskNoIh4PXvkzmFnu0Hthyu7Qts7 M3oxHKmdSbF+uNDFpML2D+ERt+IQuzlzLLUz66v64u2kJ14Lz3wnTbI0L2M18fa2VHaC zpkuIkNW4cKXprOpoDnTFOlbVVJTQFj2iWHN6PNPewUaUG97Zl3GWjDXpNTBm8OkQgp5 7Z5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=Tn4wJDsxyHqzBVxSm+9R1Mj1vBKvlGob0sUOeJaAajQ=; b=NM0d6EtliROVpo7eTRsP2Uglfo3PmBI+2UUwNjEOmh0tmC6LG3Vhb1tIY5nrLzElWh WI3QOyM41KIXbqkor9VsBx7taXM6BE81hc21ylaK/uRU4bDNsFRq8+qgyqoX7Y20bHIY WushUMJx4NiLEoF+YwkFkPDtU4ObsqOyfo7/VdAeasJLgGCuhi7AtwyyJBmA3b7dwoqZ udLgYok1HgxstmBeDcrWelt66hdMH44h1aeXm2JJLxPpGZ+KIsdm0mOfCzfctjJQ6zO5 JdSmsvJkWdk34p1MMZqeO16Wa1Hg39kOrmqO6UNS/xTA2r8bwE60gLPf/I9XTiR6CeyK d3BQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=RTYXTlbm; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Original-Received: from mout01.posteo.de (mout01.posteo.de. [185.67.36.65]) by gmr-mx.google.com with ESMTPS id w26si442953ljw.8.2021.05.16.09.54.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 May 2021 09:54:19 -0700 (PDT) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) client-ip=185.67.36.65; Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 0C086240029 for ; Sun, 16 May 2021 18:54:19 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FjpJT6FjGz9rxW for ; Sun, 16 May 2021 18:54:16 +0200 (CEST) Content-Disposition: inline In-Reply-To: <26bec817-c8b4-4d63-ad5d-436aa281c0d7n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=RTYXTlbm; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net 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:28367 Archived-At: --64wzvblNqcFCWEMG Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable You're welcome, I already had done much of the work for myself, so I am hap= py if it could be useful for others as well. I had'nt anticipate=CC=86d that you would also use \autocite in the body. I= restricted the scope of the filter to the footnotes, so you should not have errors any= more provided that all your use cases are documented in the text file. I suppose= d that you don't want the output of \autocite to be changed. Please try the file attached. Le Saturday 15 May 2021 =C3=A0 08:34:22PM, Jeffrey T a =C3=A9crit : > Hi Bastien, >=20 > Oh my, thank you very much for taking the time to assist! I downloaded yo= ur Lua > filter (I didn't realize that filters were possible with Pandoc!) and inc= luded > it in my Pandoc command: >=20 > pandoc --citeproc --lua-filter=3Dremove-parentheses-from-cite.lua Test.te= x > --bibliography=3Dtestref.bib --csl=3D > chicago-fullnote-bibliography-short-title-subsequent.csl -o test.docx >=20 > It worked perfectly for the \cite commands contained within \footnote. > Unfortunately the remainder of my book manuscript uses \autocite for refe= rences > outside of footnotes. When \autocite is included, I received an error mes= sage: > "bad argument #1 to 'gsub' (string expected, got nil)" >=20 > If helpful, I've attached the test .tex file I'm using? Your assistance i= s much > appreciated! >=20 >=20 > On Saturday, May 15, 2021 at 6:05:21 PM UTC-4 Bastien Dumont wrote: >=20 > I had a similar problem that I resolved with the attached Lua filter > (slightly > modified to adapt it to your needs). I hope that it will work for you= . > Simply > call it after --citeproc. >=20 > Note that it will throw an error if you have \cite commands outside > footnotes. > If that it the case, please let me know. >=20 > Le Saturday 15 May 2021 =C3=A0 12:13:37PM, Jeffrey T a =C3=A9crit : > > > > Hi all, > > I'm new to the group and Pandoc and would greatly appreciate your > assistance. > > I'm attempting to convert my LaTeX book manuscript into a Word doc = for my > > editor. Using a test .tex file, I have successfully converted the f= ile > using > > the following command in Mac Terminal : > > pandoc --citeproc Test.tex --bibliography=3Dtestref.bib --csl=3D > > chicago-fullnote-bibliography-short-title-subsequent.csl -o test.do= cx > > It works wonderfully, however, the only issue concerns the \cite > contained > > within \footnote. In particular, the resulting citation is now plac= ed > within > > parentheses which my editor has asked me to remove. Is there some s= ort of > > solution to my dilemma? Given the length of the book I fear it will= be > quite > > tedious to find/remove the offending parentheses manually. > > Thank you in advance! > > > > -- > > 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, s= end 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/f4c18da4-6145-4f93-8779-fe2bd2816c38n%40googlegroups= .com. >=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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgi= d/ > pandoc-discuss/26bec817-c8b4-4d63-ad5d-436aa281c0d7n%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/YKFOF9MI2IHxJS4t%40localhost. --64wzvblNqcFCWEMG Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="remove-parentheses-from-cite.lua" local function getLastInnermostElem(elemsList) local lastInnermostElem = elemsList[#elemsList] if not lastInnermostElem.t == "Str" then getLastInnermostElem(lastInnermostElem) end return lastInnermostElem end local function getFirstInnermostElem(elemsList) local firstInnermostElem = elemsList[1] if not firstInnermostElem.t == "Str" then getFirstInnermostElem(firstInnermostElem) end return firstInnermostElem end local function removeTrailingSpace(formattedCitation) if formattedCitation[1].t == "Space" then formattedCitation:remove(1) end end local function removeParentheses(formattedCitation) local lastInnermostElem = getLastInnermostElem(formattedCitation) lastInnermostElem.text = string.gsub(lastInnermostElem.text, "%)$", "") local firstInnermostElem = getFirstInnermostElem(formattedCitation) firstInnermostElem.text = string.gsub(firstInnermostElem.text, "^%(", "") end local correct_citation = { Cite = function(cite) removeTrailingSpace(cite.content) removeParentheses(cite.content) return cite end } function Note(note) return pandoc.walk_inline(note, correct_citation) end --64wzvblNqcFCWEMG--