From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/13544 Path: news.gmane.org!not-for-mail From: nickbart1980-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Newsgroups: gmane.text.pandoc Subject: Re: Specifying location of bibliography in document Date: Mon, 31 Aug 2015 02:28:43 -0700 (PDT) Message-ID: References: <20150829140403.GA47273@MacBook-Air.local> <20150829142113.GA47586@MacBook-Air.local> <20150829154527.GA49705@MacBook-Air.local> <20150831055419.GC60048@MacBook-Air.local> <42c762b6-b9b7-4748-b2b9-12daa5046c78@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_149_890922860.1441013323521" X-Trace: ger.gmane.org 1441013328 591 80.91.229.3 (31 Aug 2015 09:28:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 31 Aug 2015 09:28:48 +0000 (UTC) To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDIPX6WQ4INBBTF4SCXQKGQERMIM6VI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Aug 31 11:28:45 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-ig0-f185.google.com ([209.85.213.185]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZWLOO-0007uE-UC for gtp-pandoc-discuss@m.gmane.org; Mon, 31 Aug 2015 11:28:45 +0200 Original-Received: by igbuu8 with SMTP id uu8sf19576552igb.1 for ; Mon, 31 Aug 2015 02:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe; bh=SEa5674RRil7zodK/42h7aVQ1EyO5i/LhAICQaYkngU=; b=sNQ2IqU1mG1d/TmmIT3HvKhowmtl9XZIyKFwExhgT9izjDyT5HoQhrP3Hi8RTgw8yQ Aa6ST7kjRApZ68vdjVYHUmOZEIBWo90YPBUCZLKzqfQ/6uw78hJUZj55Nt4MHGYsKih9 ogBOrf6or4oYzRer8Ilsrahr443ippFChdjfkVaOsgoZBVyUs1c6d2ySBi5YDvUwWARl tcOeOU3Az9QaTZgAKWdBZbRdIgPRElc5ZNrKihBrQU04kgORyZBHzTD/YmFTgGR+ao9j 3tcxWm711+yuas1/0WZwRO9eMJz/jjwAm9GLJ4s0HhGo9jSdnCnPU1VssoFHkLseUqmB qpGA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe; bh=SEa5674RRil7zodK/42h7aVQ1EyO5i/LhAICQaYkngU=; b=Q0XT1ewmTyiGJuBcov/52PoOn9x/p1W7cUejpgY2zkgINi3hJS3TfbhxfEbtPbGwsv I6WvmFua0aVxEf6zaPsq0GVer38A66ehjauImha/weVpMzx9i2K7fa58wyN/jIOEP9h4 mL5qKdW0G4MLrt9MiN7DDJddd8VIVlFDtIGvRCAvc9fnYX+/2EFTjeqOGL0XU3xiKzeG ox1j8o1egCHnSQTTilpcLoY7pi9xNJOZBrtMNFJ0vavVDnLZV/nm/umKF7sd8y2jQBbN 772G0NOSCOe9NRKc/FGoXp39OBW5gGfbZpVJ9qLzhm56nSE0BJM0ubjwJtBbbjn4uGyQ jTiQ== X-Received: by 10.182.186.6 with SMTP id fg6mr20701obc.33.1441013324569; Mon, 31 Aug 2015 02:28:44 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.182.121.194 with SMTP id lm2ls3537966obb.21.gmail; Mon, 31 Aug 2015 02:28:44 -0700 (PDT) X-Received: by 10.182.81.9 with SMTP id v9mr316792obx.40.1441013324072; Mon, 31 Aug 2015 02:28:44 -0700 (PDT) In-Reply-To: <42c762b6-b9b7-4748-b2b9-12daa5046c78-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: nickbart1980-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-Spam-Checked-In-Group: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:13544 Archived-At: ------=_Part_149_890922860.1441013323521 Content-Type: multipart/alternative; boundary="----=_Part_150_1717671761.1441013323521" ------=_Part_150_1717671761.1441013323521 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable For clarity: the hanging indent filter above inserts `\item` in front of=20 every entry, and requires the definition of a `references` environment in= =20 a template: ~~~ \newenvironment{references} {\list{}{% hanging indent,=20 src/myfilters/addRefEnvItem.hs \leftmargin1.5em% \itemindent-\leftmargin% \itemsep0.5ex% \parsep0pt% }} {\endlist} ~~~ I wonder whether the latex writer itself shouldn=E2=80=99t insert such a=20 `references` environment by default. Hanging indent is required by many=20 styles anyway but could be redefined as necessary. Even better, pandoc(-citeproc) could parse the CSL `hanging` and=20 `second-field-align` flags, and inject appropriate formatting instructions= =20 into the `references` environment. On Monday, August 31, 2015 at 7:09:15 AM UTC, nickba...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > I have a filter that adds the needed raw latex commands: > > ~~~ > #!/usr/bin/env runhaskell > > -- addRefEnvItem.hs > > import Text.Pandoc.JSON > > main :: IO () > main =3D toJSONFilter addRefEnvItem > > addRefEnvItem :: Maybe Format -> Block -> Block > addRefEnvItem (Just (Format "latex")) > (Div ("",["references"],[]) (h@(Header _ _ _) : blocks)) =3D > Div ("",["references"],[])=20 > ( [h, latex "\\begin{references}\\sloppy"] ++=20 > concatMap addItem blocks ++ [latex "\\end{references}"] ) > where latex =3D RawBlock (Format "latex") > addRefEnvItem _ x =3D x > > addItem :: Block -> [Block] > addItem x =3D [RawBlock (Format "latex") "\\item", x]=20 > ~~~ > > =E2=80=A6 but it has stopped working after the latest updates. What are t= he=20 > adjustments needed? > > On Monday, August 31, 2015 at 5:54:33 AM UTC, John MacFarlane wrote: >> >> +++ Andrew Dunning [Aug 30 15 13:06 ]:=20 >> > Will this also allow for the insertion of extra markup through a=20 >> > template? (For instance, a LaTeX class I am using wants the=20 >> > bibliography to be surrounded=20 >> > by \begin{thebibliography}...\end{thebibliography}, and it would be= =20 >> > fantastic to be able to achieve that.)=20 >> >> The bibliography was never part of a template and still=20 >> isn't. It is inserted directly into the document body.=20 >> >> There are various ways to achieve what you want. One is=20 >> write a simple filter that can run after pandoc-citeproc.=20 >> It would intercept a Div with id =3D references, and=20 >> add the needed raw latex commands to the beginning and end=20 >> of its contents.=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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/ea6da5d7-d98f-47f9-be3e-193adaa10333%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_150_1717671761.1441013323521 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
For clarity: the hanging indent filter above inserts `\ite= m` in front of every entry, and requires the definition of a=C2=A0 `referen= ces` environment in a template:

~~~
\newenvironment{references} {= \list{}{% hanging indent, src/myfilters/addRefEnvItem.hs
=C2=A0=C2=A0=C2= =A0 \leftmargin1.5em%
=C2=A0=C2=A0=C2=A0 \itemindent-\leftmargin%
=C2= =A0=C2=A0=C2=A0 \itemsep0.5ex%
=C2=A0=C2=A0=C2=A0 \parsep0pt%
=C2=A0= =C2=A0=C2=A0 }}
=C2=A0=C2=A0=C2=A0 {\endlist}
~~~

I wonder whe= ther the latex writer itself shouldn=E2=80=99t insert such a `references` e= nvironment by default. Hanging indent is required by many styles anyway but= could be redefined as necessary.

Even better, pandoc(-citeproc) cou= ld parse the CSL `hanging` and `second-field-align` flags, and inject appro= priate formatting instructions into the `references` environment.

On Monday, August 31, 2015 at 7:09:15 AM UTC, nickba...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:<= blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bord= er-left: 1px #ccc solid;padding-left: 1ex;">
I have a filte= r that adds the needed raw latex commands:

~~~
#!/usr/bin/env run= haskell

-- addRefEnvItem.hs

import Text.Pandoc.JSON

ma= in :: IO ()
main =3D toJSONFilter addRefEnvItem

addRefEnvItem :: = Maybe Format -> Block -> Block
addRefEnvItem (Just (Format "l= atex"))
=C2=A0 (Div ("",["references"],[]) (h@(= Header _ _ _) : blocks)) =3D
=C2=A0 Div ("",["references&= quot;],[])
=C2=A0=C2=A0=C2=A0 ( [h, latex "\\begin{references}\\sl= oppy"] ++
=C2=A0=C2=A0=C2=A0 concatMap addItem blocks ++ [latex &q= uot;\\end{references}"] )
=C2=A0 where latex =3D RawBlock (Format &= quot;latex")
addRefEnvItem _ x =3D x

addItem :: Block -> = [Block]
addItem x =3D [RawBlock (Format "latex") "\\item&= quot;, x]
~~~

=E2=80=A6 but it has stopped working after the lat= est updates. What are the adjustments needed?

On Monday, August 31, = 2015 at 5:54:33 AM UTC, John MacFarlane wrote:
+++ Andrew Dunning [Aug 30 15 13:06 ]:
> =C2=A0 Will this also allow for the insertion of extra markup thro= ugh a
> =C2=A0 template? (For instance, a LaTeX class I am using wants the
> =C2=A0 bibliography to be surrounded
> =C2=A0 by \begin{thebibliography}...\end{thebibliography}, an= d it would be
> =C2=A0 fantastic to be able to achieve that.)

The bibliography was never part of a template and still
isn't. =C2=A0It is inserted directly into the document body.

There are various ways to achieve what you want. =C2=A0One is
write a simple filter that can run after pandoc-citeproc.
It would intercept a Div with id =3D references, and
add the needed raw latex commands to the beginning and end
of its contents.

--
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/ea6da5d7-d98f-47f9-be3e-193adaa10333%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_150_1717671761.1441013323521-- ------=_Part_149_890922860.1441013323521--