From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sharon Kimble Subject: Re: export to latex but *not* export the citations Date: Fri, 19 Jan 2018 21:22:36 +0000 Message-ID: <87r2qlv90j.fsf@skimble.plus.com> References: <87a7x9ylcr.fsf@skimble.plus.com> <878tctx0f4.fsf@skimble.plus.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ece7c-0001WD-Cm for emacs-orgmode@gnu.org; Fri, 19 Jan 2018 16:22:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ece7Z-0001mA-0m for emacs-orgmode@gnu.org; Fri, 19 Jan 2018 16:22:48 -0500 Received: from avasout03.plus.net ([84.93.230.244]:57483) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ece7Y-0001jp-Mo for emacs-orgmode@gnu.org; Fri, 19 Jan 2018 16:22:44 -0500 In-Reply-To: (John Kitchin's message of "Fri, 19 Jan 2018 12:17:12 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: org-mode-email --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable John Kitchin writes: > I don't think that it is possible for the snippet I sent to remove the th= e parentheses as they are not part of the link.=C2=A0 > > You can either replace them all interactively with a regexp, e.g. > > #+BEGIN_SRC emacs-lisp > (goto-char (point-min)) > (query-replace-regexp "(\\(cite:.*\\))" "\\1") > #+END_SRC > > That regexp assumes they are all cite links (e.g. no citep, etc), and tha= t there are no spaces between the (). This is what I would do, it should pr= ompt you for each replacement, and you will end up pressing y 381 times. > > Alternatively, you can use this approach to remove the links from a copy = of the buffer right before it is exported. This will leave the original lin= ks in place. > > #+BEGIN_SRC emacs-lisp > (let ((org-export-before-processing-hook (lambda (backend) > =C2=A0 =C2=A0(goto-char (point-max)) > =C2=A0 =C2=A0(while (re-search-backward "(cite:.*)" nil t) > =C2=A0 =C2=A0 =C2=A0(setf (buffer-substring (match-beginning 0) (match-en= d 0)) ""))))) > =C2=A0 (org-latex-export-as-latex)) > #+END_SRC Thanks very much for this John. I've used your second version with a slight alteration and the complete snippet now shows as - =2D-8<---------------cut here---------------start------------->8--- * Build :noexport: #+BEGIN_SRC emacs-lisp (let ((org-export-before-processing-hook (lambda (backend) =C2=A0 =C2=A0(goto-char (point-max)) =C2=A0 =C2=A0(while (re-search-backward "(cite:.*)" nil t) =C2=A0 =C2=A0 =C2=A0(setf (buffer-substring (match-beginning 0) (match-end = 0)) ""))))) =C2=A0 (org-latex-export-to-latex)) #+END_SRC =2D-8<---------------cut here---------------end--------------->8--- This then allows me to build my pdf file using my 'pdfbuild' script as per = normal. The reason why I've gone for your second code snippet is because it still leaves the original curled brackets in situ so that I can do a 'normal' build at any time and export it as a latex file for building with. I've tried it out on 3 different files which I am most readily converting to latex at the moment, and its worked very well in all of them, so thanks John kudos to you :) I suppose the next logical question is - how do I assign some keys to it so that I can trigger the revamped build from elsewhere in the document? Or even include it in my 'Mono' menu using "easymenu"? Thanks Sharon. > John > > ----------------------------------- > Professor John Kitchin=C2=A0 > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu > > On Fri, Jan 19, 2018 at 8:45 AM, Sharon Kimble wrote: > > John Kitchin writes: >=20=20=20=20 > > You can try this: > > > > * Build :noexport: > > > > Put this heading in your file, and run this block. > > > > #+BEGIN_SRC emacs-lisp > > (flet ((org-ref-format-cite (keyword desc format) "")) > >=C2=A0 (org-latex-export-to-latex)) > > #+END_SRC > > > > It will temporarily redefine the cite export function. It appears it > > replaces them with a space, but this should be a problem for latex. > > > Sorry list, I inadvertently sent this direct to John. >=20=20=20=20 > Thanks John for this, its not quite working as I'd like, so I'll expl= ain it with examples. >=20=20=20=20 > * Case 1 - original setup >=20=20=20=20 > --8<---------------cut here---------------start------------->8--- > Source =3D >=20=20=20=20 > The remaining 'other place' > deaths include over 150 described as 'psychiatric hospitals', 'psychi= atric hospitals (security)' or > 'psychiatric unit' (cite:0113). >=20=20=20=20 > Pdf =3D >=20=20=20=20 > The remaining > =E2=80=99other place=E2=80=99 deaths include over 150 described as = =E2=80=99psychiatric hospitals=E2=80=99, =E2=80=99psychiatric hospitals > (security)=E2=80=99 or =E2=80=99psychiatric unit=E2=80=99 (WILSON , 2= 015). > --8<---------------cut here---------------end--------------->8--- > > * Case 2 - brackets removed round citation >=20=20=20=20 > --8<---------------cut here---------------start------------->8--- > Source =3D >=20=20=20=20 > The remaining 'other place' > deaths include over 150 described as 'psychiatric hospitals', 'psychi= atric hospitals (security)' or > 'psychiatric unit' cite:0113. >=20=20=20=20 > Pdf =3D >=20=20=20=20 > The remaining > =E2=80=99other place=E2=80=99 deaths include over 150 described as = =E2=80=99psychiatric hospitals=E2=80=99, =E2=80=99psychiatric hospitals > (security)=E2=80=99 or =E2=80=99psychiatric unit=E2=80=99 WILSON , 20= 15. > --8<---------------cut here---------------end--------------->8--- >=20=20=20=20 > * Case 3 - with John's coding >=20=20=20=20 > --8<---------------cut here---------------start------------->8--- > Source =3D >=20=20=20=20 > The remaining 'other place' > deaths include over 150 described as 'psychiatric hospitals', 'psychi= atric hospitals (security)' or > 'psychiatric unit' (cite:0113). >=20=20=20=20 > And with your coding and built as pdf =3D >=20=20=20=20 > The remaining > =E2=80=99other place=E2=80=99 deaths include over 150 described as = =E2=80=99psychiatric hospitals=E2=80=99, =E2=80=99psychiatric hospitals > (security)=E2=80=99 or =E2=80=99psychiatric unit=E2=80=99 (). > --8<---------------cut here---------------end--------------->8--- > > * Case 4 - with John's coding >=20=20=20=20 > --8<---------------cut here---------------start------------->8--- > Source =3D >=20=20=20=20 > The remaining 'other place' > deaths include over 150 described as 'psychiatric hospitals', 'psychi= atric hospitals (security)' or > 'psychiatric unit' cite:0113. >=20=20=20=20 > And with your coding and built as pdf =3D >=20=20=20=20 > The remaining > =E2=80=99other place=E2=80=99 deaths include over 150 described as = =E2=80=99psychiatric hospitals=E2=80=99, =E2=80=99psychiatric hospitals > (security)=E2=80=99 or =E2=80=99psychiatric unit=E2=80=99 . > --8<---------------cut here---------------end--------------->8--- > > - Case 1 is the start point and as it currently is. > - Case 2 is an interim stage, with the circular brackets round the > =C2=A0 citation removed. When its exported the sentence looks ugly wi= th out > =C2=A0 any differentiation between the text and the citation. > - Case 3 is with John's coding snippet being applied and the whole > =C2=A0 exported, and it leaves the circular brackets round the citati= on > =C2=A0 behind but no citation. > - Case 4 is with John's coding snippet applied after the circular > =C2=A0 brackets have been removed, and is nirvana! :) >=20=20=20=20 > But it would be a mammoth undertaking going through and removing all = the > circular brackets round the citations, and there's 381 references in = the > bibliography, so is it possible for your code snippet to temporarily > remove the circular brackets as part of its building the tex file > please? >=20=20=20=20 > Thanks John, I do appreciate it >=20=20=20=20 > Sharon. > > > Sharon Kimble writes: > > > >> I'm writing a document which currently has 408 pages and over a 1,= 000 > >> footnotes, and with a size of 1.1 mbs. > >> > >> I'm exporting it to latex using 'org-latex-export-to-latex' and am= now > >> wondering is it possible to export it *and* omit the citations? The > >> citations currently are showing in the org-mode source file as > >> '(cite:xxxx)'. > >> > >> So to clarify - the org-mode document is exported to latex and then > >> built into a pdf file in a separate process. The org-mode document= has > >> citations, showing in the org-mode document as '(cite:xxxx)', wher= e the > >> 'xxxx' is any one of four figures which don't have any impact on r= eality > >> in org-mode, though org-ref allows them to be seen as a quasi-bibt= ex > >> display in the mini-buffer. When the pdf file is built they are > >> converted into authoryear citations, and its these citations that = I'm > >> looking to *not* display in the pdf file. I would like the citatio= ns to > >> still show in the org-mode source document but not to show in the = final > >> built pdf file. > >> > >> The file, or program, that is building the pdf can be seen at [fn:= 1]. > >> > >> So how can I do it please? > >> > >> Thanks > >> Sharon. > >> > >> [fn:1] 'pdfbuild' - from tex to PDF - version 2 =3D http://www.sha= rons.org.uk/pdfbuild2.html >=20=20=20=20 > -- > A taste of linux =3D http://www.sharons.org.uk > TGmeds =3D http://www.tgmeds.org.uk > DrugFacts =3D https://www.drugfacts.org.uk > Debian 9.3, fluxbox 1.3.7, emacs 25.3.2, org-mode 9.1.6-10-g0c9329-el= paplus > =2D-=20 A taste of linux =3D http://www.sharons.org.uk TGmeds =3D http://www.tgmeds.org.uk DrugFacts =3D https://www.drugfacts.org.uk=20=20 Debian 9.3, fluxbox 1.3.7, emacs 25.3.2, org-mode 9.1.6-10-g0c9329-elpaplus --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAlpiYZwACgkQNoGAGQr4 g1tiyA//c47JXd2nRfoggXNotDddjpdT8GbqKGZpiq/8Gi4NK/+YKbKtuYSMPZsA ZYWQLGf2VXc2kBv0peKWZSombyYWYtpsVQPnN4Cgy5/+WOy9WaAoKNNuB0jLL7Tg ADz3j900AfwXElrOCRZ63hB7ZM4G5meG1Kep1jFe4rZoNTqDWarZl0RzZHw73MTd PGjGoTt9i8ajc2TldvzC309Ckrh5EvOTls6n2a+rlKs7a8+GWTs0PSD8/cUoU4P/ 1ce3BQHiThLmb8vxKYaItSZHlPmdHTrkaSMSB7rTKF4VNRgvKg1MrJ9gN4iJNpDg WlXCAW5P7LFhmRUjZLoc47LAsLonnkszDw0b1IbEg7f8uiavxOgap1+1AwUkG44f wMuSQYv6bC3MAy6r+M9fFrz4Svs4fRZ8FVe5yvgJX5TICn+bf5eM87e274q5sW56 Y+GzZyxUuow0jYvK4zjyl1s/MkW5hkwXwqxlPa1lApGa/zKHw9yqAfgww2Tsb02I vlI46PYn489+nhoD1MjiMp0BWFYErQP9lPogrG3rIW9KbddVeofzwETB2+Hnk9tY 0c+setP9LAKcXfvlygv/0RXFzQ07uK95B3ULPBFvkd/WOYbL3ywM91Dm+VL6YGge 9gppA7Ky2w1kTG03KNoEyBVij+UmUldMZpawy9q9yRw3rB4NG6Y= =iwD4 -----END PGP SIGNATURE----- --=-=-=--