From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29934 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Barrington-Leigh Newsgroups: gmane.text.pandoc Subject: Re: Conversion tex to docx - endfloat package? Date: Sun, 9 Jan 2022 09:11:16 -0800 (PST) Message-ID: References: <7e3777d8-7ceb-4493-83bc-3b972a1cdb76@googlegroups.com> <20151127194235.GA49129@MacBook-Air-2.local> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_4412_1555188627.1641748276671" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11624"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDJYVYOZTIGBBNNO5SHAMGQEB7RM7QQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Jan 09 18:11:21 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f192.google.com ([209.85.167.192]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n6biy-0002pf-Ci for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 09 Jan 2022 18:11:20 +0100 Original-Received: by mail-oi1-f192.google.com with SMTP id s127-20020aca5e85000000b002c807e9c48asf5003996oib.10 for ; Sun, 09 Jan 2022 09:11:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=E5T7utrEoPrbXS6rKf2ROeMXwS8Kq704lxXlrMjrPY4=; b=mlrKA5EWt3ZM2UDwtbyY/E+1QbufDs6dAwKcHpclSt0OI7yQG1+cj+Cbsn1DpfKDWc qNbPuFp6MzUw3sLvFdKP4VdMOgxMlBFPEOpXUvune7c7CXONAO11mjmjCU4PaHn8f0cu qVUTnr4ZzNzQcSy7hnrbKHG/++Zt7FncOV3ABL9/Y5zH+b/dvSLkzCz4mmdSHBH0xbSi S9tjuCQhJf7DBEHXtIIwLKN1tlXh31PWHTj6izpshbyFGEb+def4Q7DS7lixNhvMQdVJ JEP/6hllJWe/yPnfBr1HsB4chMWgYxE+1QgQG2RtwCdk7xhtL1O1BvfEXPxPTbp1YCPX chnQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=E5T7utrEoPrbXS6rKf2ROeMXwS8Kq704lxXlrMjrPY4=; b=em+1AKUyjHkEGCOyDNGvFFFWOn7cfBm6+ShJOTpWwG3s98zQwQlGsQ2E60AUDq84Rs 41JpZs16JK+gt33A5RvLu/2ZelZI8DjdvhshBvL52QnTDuUXyPZ+0CioZ4FnpcX4hpjk jB2SHWzWq6C1oPa31c2Zi5P7VivKOLeeOdZXwFZaF8M0lnCUtNWq4dr6r3P+i6ObNE5f vhevoALPVuKbHjELy7VAEImboh/OcM2o6HXpImkQXJefXYqFDVCKqBjbBELBjJERgGiT SAUVwp0lYjXCznoP5V1SzUuXCj8pGM/tRxlMPK6hAfJyMtiHCozIz2UP82zfGO71/Ryh fZXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=E5T7utrEoPrbXS6rKf2ROeMXwS8Kq704lxXlrMjrPY4=; b=FVQwehh47T6Nh+xla39Zvl2lloGB/04qqIdwuFXI1oSg9VrrQ0muJNf0SiKpIU1e9f hgWKJOEbmgaIPp8nNCMi+AxEoKD6j3Ed1OiAQa9N1A28jGvjjQcfKeFR2urXR6Vy7zdd kis1IUX69yjqrUK7NbZ7NJMQJYLsl+Vt1JRuPCcv5abG2UgEG1HF9kZpmclIQfrNcSz5 ThgcsdO1WZoxyzkELszeHAKXoAERpmzQBQ4bR30m6X/m4oS0KjOhZzw/MJXqRkdA19bX hb47rmldaObweFwYUTyadLTvOmJMTAqcHq7o3xtzVYPYVr/eznpoKzRuhFAw81WIKySx SEMA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5314j/8Jgq5ogM38pG/5JeK3JX/9xW0HOu+j25qsaAvrSc0BqJkg 1X8FD9CnTnanc5I7j/w3cog= X-Google-Smtp-Source: ABdhPJxwOIonM4mK1sLBr0pv6YaewstGT1LfVvI7szbHaIFMoTGwDe7nYErw6GnsBX9R3OdfVsuZJA== X-Received: by 2002:a4a:c3c8:: with SMTP id e8mr12232430ooq.4.1641748278716; Sun, 09 Jan 2022 09:11:18 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6830:2b22:: with SMTP id l34ls1863717otv.6.gmail; Sun, 09 Jan 2022 09:11:17 -0800 (PST) X-Received: by 2002:a9d:60db:: with SMTP id b27mr7337007otk.154.1641748277212; Sun, 09 Jan 2022 09:11:17 -0800 (PST) In-Reply-To: <20151127194235.GA49129-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org> X-Original-Sender: christopherbl-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:29934 Archived-At: ------=_Part_4412_1555188627.1641748276671 Content-Type: multipart/alternative; boundary="----=_Part_4413_2122149266.1641748276671" ------=_Part_4413_2122149266.1641748276671 Content-Type: text/plain; charset="UTF-8" This BP Jonsson filter apparently doesn't work with any recent pandoc. I am trying to convert latex to odt, moving floats (which aren't rendered well at all) to the end. Is anyone doing this successfully? On Friday, 27 November 2015 at 14:42:51 UTC-5 John MacFarlane wrote: > +++ Rainer M Krug [Nov 26 15 04:39 ]: > > Hi > > I am using pandoc to convert a tex document to docx for my co-authors > > (which works very nicely!), and they want to have figures and tables at > > the end of the document. > > I am using in LaTeX the package endfloat for this. Using pdflatex, this > > works perfectly to generate the pdf, but when I use pandoc to convert > > the tex to a docx, the package "endfloat" is ignored and all floats are > > where they would be without "endfloat". > > Is there a way to force all floats (figures and tables) to the end of > > the document in pandoc? > > The only way I can think of would be to write a filter that > moves all the tables and figures to the end of the document. > Note: the following is untested, but something like this > should work: > > -- floatsToEnd.hs > import Text.Pandoc.JSON > import Text.Pandoc.Walk > > main :: IO () > main = toJSONFilter floatsToEnd > > floatsToEnd :: Pandoc -> Pandoc > floatsToEnd (Pandoc meta bs) = > Pandoc meta $ walk (remove isFloat) bs ++ query isFloat bs > > isFloat :: Block -> Bool > isFloat (Table{}) = True > isFloat (Para [Image{}]) = True > isFloat _ = False > > remove :: (Block -> Bool) -> Block -> Block > remove pred b | pred b = Null > | otherwise = b > > -- 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/msgid/pandoc-discuss/f2028dcb-18b2-40b5-aba3-98c58135c270n%40googlegroups.com. ------=_Part_4413_2122149266.1641748276671 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This BP Jonsson  filter  apparently doesn't work with any recent = pandoc.  I am trying to convert latex to odt, moving floats (which are= n't rendered well at all) to the end.  Is anyone doing this successful= ly?

On Friday, 27 November 2015 at 14:42:51 UTC-5 John MacFarlane wrote:
=
+++ Rainer M Krug= [Nov 26 15 04:39 ]:
> Hi
> I am using pandoc to convert a tex document to docx for my co-au= thors
> (which works very nicely!), and they want to have figures and ta= bles at
> the end of the document.
> I am using in LaTeX the package endfloat for this. Using pdflate= x, this
> works perfectly to generate the pdf, but when I use pandoc to co= nvert
> the tex to a docx, the package "endfloat" is ignored a= nd all floats are
> where they would be without "endfloat".
> Is there a way to force all floats (figures and tables) to the e= nd of
> the document in pandoc?

The only way I can think of would be to write a filter that
moves all the tables and figures to the end of the document.
Note: the following is untested, but something like this
should work:

-- floatsToEnd.hs
import Text.Pandoc.JSON
import Text.Pandoc.Walk

main :: IO ()
main =3D toJSONFilter floatsToEnd

floatsToEnd :: Pandoc -> Pandoc
floatsToEnd (Pandoc meta bs) =3D
Pandoc meta $ walk (remove isFloat) bs ++ query isFloat bs

isFloat :: Block -> Bool
isFloat (Table{}) =3D True
isFloat (Para [Image{}]) =3D True
isFloat _ =3D False

remove :: (Block -> Bool) -> Block -> Block
remove pred b | pred b =3D Null
| otherwise =3D b

--
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/f2028dcb-18b2-40b5-aba3-98c58135c270n%40googlegroups.= com.
------=_Part_4413_2122149266.1641748276671-- ------=_Part_4412_1555188627.1641748276671--