From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/14016 Path: news.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: Conversion tex to docx - endfloat package? Date: Fri, 27 Nov 2015 11:42:35 -0800 Message-ID: <20151127194235.GA49129@MacBook-Air-2.local> References: <7e3777d8-7ceb-4493-83bc-3b972a1cdb76@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed X-Trace: ger.gmane.org 1448653377 5013 80.91.229.3 (27 Nov 2015 19:42:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Nov 2015 19:42:57 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBN7E4KZAKGQELP6LB3Y-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Nov 27 20:42:48 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-qg0-f63.google.com ([209.85.192.63]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a2Ous-0000O0-Me for gtp-pandoc-discuss@m.gmane.org; Fri, 27 Nov 2015 20:42:46 +0100 Original-Received: by qgae107 with SMTP id e107sf20786245qga.1 for ; Fri, 27 Nov 2015 11:42:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=from:date:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :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:sender:list-subscribe:list-unsubscribe; bh=hlizzpzG13dhDNbrsrdePilztGn4ewTYdfICsIy7KXg=; b=ZeZactunY8Apku2L1C2ed2BKOcRqjjzS6dAuccykVm09vEXDhkIsvlHWEMPSOMPhVA RubGSuOniB6qGOGUoDRafyMcuuAg5aMGuHLm16z2GhRW9tXH7wlUIaQBdlMJuyhvhFW0 z/EwK3OfEYineeBeDuIEqiAkaGrwm3zXqFla9TSC2ixiMkduMKYl4W2odxUM+912FCLZ eeiQbY3zCmCvk308qwpWqtlVABcXWoG+hxYTbDhabIaKttMGSHBNJdgGg81YEaQ2Pm4g sXEaLdGJYfUPxkQ6uN4WjPvO2OOynvMfWd0paRJzqeTGvVnm/xTFbPNUBMOiiSKtOjg3 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent: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:sender:list-subscribe :list-unsubscribe; bh=hlizzpzG13dhDNbrsrdePilztGn4ewTYdfICsIy7KXg=; b=SNiK4qf2cjcTaQzQzJzX/RpTaZRVSZKE2YOLb5qm/yWyH8XXC6qP+MIFceVJarj+kD IN4LtIZ2zZmVQullaDJRJtkAgcdQucmHhBGiE1QBVhTNMpsn1WPorbqo42O+TNPFOiMU WIwcHeiUSukQafXjeISUpTNWgHpnUdcf4Kbb7dqiS3ec60yJ3J1lsY+MHGeHRzHXSOYS k4uw3fMMrkLOII+GPpAEhpTdAk3koCIfDlN3LI0T497u9y66z1dBWcny3WN/QrYPqyey adNuzA7J2jtVNk5Qg0rFTi3BwGlpGxbT7HogU20g1C7RIB X-Received: by 10.140.43.135 with SMTP id e7mr844978qga.13.1448653369158; Fri, 27 Nov 2015 11:42:49 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.140.94.148 with SMTP id g20ls867587qge.30.gmail; Fri, 27 Nov 2015 11:42:47 -0800 (PST) X-Received: by 10.140.138.147 with SMTP id 141mr45063442qhk.11.1448653367244; Fri, 27 Nov 2015 11:42:47 -0800 (PST) Original-Received: from mail-pa0-x235.google.com (mail-pa0-x235.google.com. [2607:f8b0:400e:c03::235]) by gmr-mx.google.com with ESMTPS id 70si3479546pfr.1.2015.11.27.11.42.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Nov 2015 11:42:47 -0800 (PST) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c03::235 as permitted sender) client-ip=2607:f8b0:400e:c03::235; Original-Received: by mail-pa0-x235.google.com with SMTP id fh17so125507046pab.0 for ; Fri, 27 Nov 2015 11:42:47 -0800 (PST) X-Gm-Message-State: ALoCoQnSCOMCvGpssDS6ZkkwpVmjP+7JlYKhLrV0dRX2U3CwubKY4rBI92H2OExwcIjRO7R7FgUX X-Received: by 10.98.68.201 with SMTP id m70mr51039159pfi.101.1448653367068; Fri, 27 Nov 2015 11:42:47 -0800 (PST) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id st5sm36233482pab.42.2015.11.27.11.42.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Nov 2015 11:42:43 -0800 (PST) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 76672A5E9; Fri, 27 Nov 2015 14:42:32 -0500 (EST) Content-Disposition: inline In-Reply-To: <7e3777d8-7ceb-4493-83bc-3b972a1cdb76-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-PGP-Key: http://johnmacfarlane.net/jgm.asc User-Agent: Mutt/1.5.23 (2014-03-12) X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c03::235 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@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:14016 Archived-At: +++ 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