From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33286 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alex Newsgroups: gmane.text.pandoc Subject: Re: Preserving citations between docx and markdown conversions Date: Wed, 8 Nov 2023 13:32:26 -0800 (PST) Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_58238_501863862.1699479146945" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38755"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCGZTIEMX4GRB3H4V6VAMGQEJ5PJXAY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Nov 08 22:32:34 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f62.google.com ([209.85.161.62]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1r0qA5-0009rE-R4 for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 08 Nov 2023 22:32:34 +0100 Original-Received: by mail-oo1-f62.google.com with SMTP id 006d021491bc7-581dc6915b5sf156981eaf.1 for ; Wed, 08 Nov 2023 13:32:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1699479152; x=1700083952; darn=m.gmane-mx.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=woRAzHfnRFaVIeM+WWMNCxzDWid/HbJVnMyp3QiQVhM=; b=ZpF2egMySc2v02tHnslCjh+Z0Ii+gqA94BhovlthlJNOhRYqdDKI6d06Dy1C4JoWQf sCDpTrpU9rRc41649Ls11XMx+IqIVDgxxw2xKNIzvN0pntGATlqFjbz/x71Al1FMH1Yq MI7vSBKQ9W2/cemx7zFddSSzPRb6k4TG+WcSN65O9M46s4tus3PUlmIm5QPASU6XHqci GCvnvb+bwO6p2g1mujP/QaIiQiX3VuNVSTI0Dk3rDydpDcf+vPYLUwXRmrQFC/VD44bM J1ZhTbuCL0yHGtWq2/4j0JWppbVNYF6AdxEfvCIUAeGplpxWG1xlLk6VuBRwEMHAmXee 6/9w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699479152; x=1700083952; darn=m.gmane-mx.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=woRAzHfnRFaVIeM+WWMNCxzDWid/HbJVnMyp3QiQVhM=; b=NEzatOro0srhk9FVVo7lHK61DUYS6C5AK0M12RjQiSqrQGZnHWsRY/EUdzXdUeIKl7 WfEsXzGk8MydIr1qGPWOOV074LyksTe3oBBbzzNNOR+CW2flF6TiSkvfEP/xv2pNBVoj mWH2hX89Zwb407ID51lcC6zPu1E0IVkdLomdoO9n+crzCPFr/dzaBrX035iuVqGxef8i 6Hv6PgjumW1hF7WYJSbGt2qdd0iw8CLMAlI7MiWobuK+no9n34RgL+Vl/VdnNnERu5Q+ iQmQe6z3nW2LILmvLR1YgYAWzbkQPMjZBG8e/N35eq23fyORYFThfONmoOaraN3vYj1m sIrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699479152; x=1700083952; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:references:in-reply-to :message-id:to:from:date:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=woRAzHfnRFaVIeM+WWMNCxzDWid/HbJVnMyp3QiQVhM=; b=MgywZjX+YaaTRMolv92W2C1mZEgsNBihs81sBbLolB6rKTuhe1Jn6QYHWChsBa2vZ7 sEOW9thmfBgZ93ML0QtyrnkDEuuDl3+9o7X3GuoxePfrms98NSQcgT4yh2am6c7jaDP9 RMHSeKOyrVzE4t0Ih0swQY+YugLqSq2h9we/v9fqIVrxcTPCgC+u9EypgBssBWK5dwe6 r7ZBtDroH5ZWgnCHa5tpS8XmTvijNZIJ/n+zwk9O6g17xCK93D076I6I2wbFDoqhB+SU 3ayQF9+YTqwAmbuBtHq/6+zIpKoPgGF9KRWK2gbYbodcdfmImb Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0YyqdSGN03k994zwrKn6/vyPldyL1cdx/w46gy82EWNmX7Ma6gwR nz6MLfIYhtPLQ35+SM3UUQM= X-Google-Smtp-Source: AGHT+IFoF6ml/azrwKpKJGA5CHQdA3wnVy1Y9Fd9dqvNy68KbegegEFLJVzYJhif8ISnbzAYGJsOmA== X-Received: by 2002:a4a:eac3:0:b0:581:40d0:7166 with SMTP id s3-20020a4aeac3000000b0058140d07166mr3170327ooh.8.1699479152617; Wed, 08 Nov 2023 13:32:32 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a4a:8c48:0:b0:587:9479:818f with SMTP id v8-20020a4a8c48000000b005879479818fls113283ooj.0.-pod-prod-01-us; Wed, 08 Nov 2023 13:32:28 -0800 (PST) X-Received: by 2002:a05:6808:140e:b0:3ad:fc2e:fbc6 with SMTP id w14-20020a056808140e00b003adfc2efbc6mr1197182oiv.10.1699479147713; Wed, 08 Nov 2023 13:32:27 -0800 (PST) In-Reply-To: X-Original-Sender: ac.ringeri-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:33286 Archived-At: ------=_Part_58238_501863862.1699479146945 Content-Type: multipart/alternative; boundary="----=_Part_58239_1108444875.1699479146945" ------=_Part_58239_1108444875.1699479146945 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for your help Denis, I think I'm starting to get a grasp on how this is working.=20 If I run my document through the zotero-better-bibtex filter, then the=20 docx+citations reader. I get some markdown like this: --- ... references: -=20 ... citation-key: Aigrain2021 ... id: 476 --- # Introduction Here is a reference to one of the entries in my bibliography [@476]. # References {#references .unnumbered} It seems the zotero/better-bibtex filter is using an internal id (476)=20 instead of the original citation key. I presume this is required for the=20 integration between Zotero and Word. I might try and dig in to the docx to markdown conversion to: 1. Switch the ids of the citations back to the original citation key=20 strings. 2. Consider exporting the 'references' metadata as a separate .bib file= =20 instead of in the header. =20 On Wednesday, November 8, 2023 at 2:33:30=E2=80=AFAM UTC+11 denis...@unibe.= ch wrote: > Pandoc will resolve citations when converting to docx. Your =C2=AB -t=20 > docx+citations =C2=BB seems to have no effect here. > > =20 > > However, there exists a filter that might be useful here:=20 > https://retorque.re/zotero-better-bibtex/exporting/pandoc/index.html#from= -markdown-to-zotero-live-citations > > This will enable you to convert markdown citations to Zotero fields.=20 > Obviously, this means you=E2=80=99ll need to manage your references with = Zotero. > > Converting them back to Markdown citations should work out of the box=20 > since 2.18, see the changelog :=20 > https://pandoc.org/releases.html#pandoc-2.18-2022-04-04=20 > > Docx reader: > > - Enable citations extension for docx reader (#7840=20 > ). When enabled, Zotero,=20 > Mendeley, and EndNote citations embedded in a docx are parsed as nativ= e=20 > pandoc citations. (When disabled, the generated citation text and=20 > bibliography are passed through as regular text.) The bibliography=20 > generated by the plugin is suppressed. Instead, bibliographic data emb= edded=20 > in citation items is added to the references metadata field so that it= =20 > can be used with --citeproc. > > So, here you=E2=80=99ll also see what the citations extension does for do= cx=E2=80=A6 > > =20 > > Best, > > Denis > > =20 > > *Von:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org *Im=20 > Auftrag von *Alex > *Gesendet:* Dienstag, 7. November 2023 10:03 > *An:* pandoc-discuss > *Betreff:* Preserving citations between docx and markdown conversions > > =20 > > Sie erhalten nicht oft eine E-Mail von ac.ri...-Re5JQEeQqe9fmgfxC/sS/w@public.gmane.org Erfahren Sie,= =20 > warum dies wichtig ist > > Hello! I am investigating using pandoc for my academic writing. I intend= =20 > to do the majority of the writing in markdown but will have others=20 > reviewing and giving feedback through word (docx), and would like a way t= o=20 > re-integrate the edits back to markdown while keeping the text as close a= s=20 > possible. (md -> docx -> md) > > =20 > > In my markdown I have citations using the [@citekey] format: > > =20 > > Here is a reference to one of the entries in my bibliography=20 > [@Aigrain2021]. > > =20 > > I would like a way to preserve citations when converting between docx and= =20 > md. > > I've tried the following approach but just get plain text (in the=20 > markdown) where the citation was. > > =20 > > Here is a reference to one of the entries in my bibliography (Aigrain > 2021). > > =20 > > I am not sure whether the citations are being lost in the md to docx step= =20 > or the docx to md step. (I am not familiar with the how word even stores= =20 > citations) > > =20 > > Is what I want to do supported? > > I have the files: > > main.md > > main.bib > > nature-conservation.csl > > =20 > > The command I'm using to convert to docx (md -> docx): > > pandoc --citeproc \ > --bibliography main.bib \ > --csl nature-conservation.csl \ > -t docx+citations -o main.docx \ > -f markdown+citations main.md > > =20 > > The command I'm using to convert back to markdown: > > pandoc -s --citeproc \ > --bibliography main.bib \ > --csl nature-conservation.csl \ > -t markdown+citations -o main.md \ > -f docx+citations main.docx > > =20 > > Any ideas would be much appreciated. Thanks! > > --=20 > You received this message because you are subscribed to the Google Groups= =20 > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an= =20 > 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/eead1157-56fa-4259-a223-= a365c852e0cbn%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 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/c85d1876-2c1e-41cf-a735-15ca9a5be81en%40googlegroups.com. ------=_Part_58239_1108444875.1699479146945 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for your help Denis,
I think I'm starting to get a gr= asp on how this is working.

If I run my document through the zo= tero-better-bibtex filter, then the docx+citations reader. I get some markd= own like this:

---
..= .
references:
-=C2=A0
=
...
=C2=A0 citation-key: Aigrain2021
...
<= /span>
=C2=A0 id: 476
---

# Introd= uction

Here is a reference to one of the entries in my bibliogra= phy [@476].

#
References {#references .un= numbered}

It seems the zotero/better-bibtex filter is usi= ng an internal id (476) in= stead of the original citation key. I presume this is required for the inte= gration between Zotero and Word.
I might try and dig in to the docx to= markdown conversion to:
  1. Switch the ids of the citations = back to the original citation key strings.
  2. Consider exporting the '= references' metadata as a separate .bib file instead of in the header.
On Wednesday, November 8, 2023 at 2:33:30=E2=80=AFAM UTC+11 denis..= .@unibe.ch wrote:

Pandoc will resolve citations w= hen converting to docx. Your =C2=AB=C2=A0-t docx+citations=C2=A0=C2=BB seem= s to have no effect here.

=C2=A0

However, there exists a filter that might be u= seful here: https://retorque.re/zotero-better-bibtex/exporting/pandoc/index.html#from-m= arkdown-to-zotero-live-citations

This will enable you to convert= markdown citations to Zotero fields. Obviously, this means you=E2=80=99ll = need to manage your references with Zotero.

Converting them back to Markdown citations should w= ork out of the box since 2.18, see the changelog=C2=A0: https://pandoc.org/releases.html#pandoc-2.18-2022-04-04

Docx reader:

  • Enable citations extension for docx reader (#7840). When enabled, Zotero, Mendeley, and EndNote citations embedded in a docx a= re parsed as native pandoc citations. (When disabled, the generated citatio= n text and bibliography are passed through as regular text.) The bibliograp= hy generated by the plugin is suppressed. Instead, bibliographic data embedded in citation items is added to the references metadata field so that = it can be used with --citeproc.

So, here you=E2=80=99ll also see what the cita= tions extension does for docx=E2=80=A6

=C2=A0

Best,

Denis

=C2=A0

Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-...@googlegroups.c= om> Im Auftrag von Alex
Gesendet: Dienstag, 7. November 2023 10:03
An: pandoc-discuss <pa= ndoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Preserving citations between docx and markdown conversions<= u>

=C2=A0

Hello! I am investigating using pandoc for my academ= ic writing. I intend to do the majority of the writing in markdown but will= have others reviewing and giving feedback through word (docx), and would l= ike a way to re-integrate the edits back to markdown while keeping the text as close as possible. (md -> do= cx -> md)

=C2=A0

In my markdown I have citations using the [@citekey]= format:

=C2=A0

Here is a re= ference to one of the entries in my bibliography [@Aigrain2021].

=C2=A0

I would like a way to preserve citations when conver= ting between docx and md.

I've tried the following approach but just get p= lain text (in the markdown) where the citation was.

=C2=A0

Here is a re= ference to one of the entries in my bibliography (Aigrain
2021).

=C2=A0

I am not sure whether the citations are being lost i= n the md to docx step or the docx to md step. (I am not familiar with the h= ow word even stores citations)

=C2=A0

Is what I want to do supported?

I have the files:

= main.md

= main.bib

= nature-conservation.csl

=C2=A0

The command I'm using to convert to docx (md -&g= t; docx):

pandoc --citeproc \
--bibliography main.bib \
--csl nature-conservation.csl \
-t docx+citations -o main.docx \
-f markdown+citations=C2=A0main.md

=C2=A0

The command I'm using to convert back to markdow= n:

pandoc -s --citeproc \
--bibliography main.bib \
--csl nature-conservation.csl \
-t markdown+citations -o main.md \
-f docx+citations=C2=A0main.docx

=C2=A0

Any ideas would be much appreciated. Thanks!<= u>

--
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 pandoc-discus...-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.org= m.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/eead1157-56fa-4259-a223-a3= 65c852e0cbn%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/c85d1876-2c1e-41cf-a735-15ca9a5be81en%40googlegroups.= com.
------=_Part_58239_1108444875.1699479146945-- ------=_Part_58238_501863862.1699479146945--