From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/14912 Path: news.gmane.org!not-for-mail From: BP Jonsson Newsgroups: gmane.text.pandoc Subject: Re: Re-open #2889? Or create a new bug? Date: Mon, 2 May 2016 20:00:32 +0200 Message-ID: <572795C0.40203@gmail.com> References: <6f5f70b7-802d-4fcb-ba05-e211149c890a@googlegroups.com> <87mvo8zafi.fsf@fastmail.fm> 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 1462212044 6286 80.91.229.3 (2 May 2016 18:00:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 May 2016 18:00:44 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBQVLT24QKGQEK4PLOMY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon May 02 20:00:35 2016 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-lf0-f60.google.com ([209.85.215.60]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1axI95-0000qB-9A for gtp-pandoc-discuss@m.gmane.org; Mon, 02 May 2016 20:00:35 +0200 Original-Received: by mail-lf0-f60.google.com with SMTP id u64sf25887308lff.1 for ; Mon, 02 May 2016 11:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:subject:to:references:message-id:date:user-agent :mime-version:in-reply-to: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 :list-subscribe:list-unsubscribe; bh=csfwAPNFjirqvAQSRX91Y8txuz6AZz2HN2mxwuIDdnk=; b=HCWDaVaCif8DAEOL5BvJkWUAYwGgEypka3VlfGywf5iyGVNKTNHdc63q9A8FbtOEve 2YyNYLzYM0gfnzkluQOW/ok/aunDgdkAVseYPO3oDNXVBn2EeNes71ncLN82KsHJOKjF VL8wJ8m9QUd+P8HCpQAJI0QXZ+oRnK6Zs2LzGxaDNl7OsFcp0iI9SnQrKZbrqOviPoJY DcHUWo+vcsCOrAYSlOxCaRgMDVb5SrXM5iUhXmrdp2QtZ2HclgJKSkYmL4Fx9vKsK2KE rYELU3aW1hf/uKdWMMTBQVe6FhNgsH+csE+N5AZ3fbQj4eQ4NbI0xG5oYE2grCwDBBTl yptA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:subject:to:references:message-id :date:user-agent:mime-version:in-reply-to: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 :list-subscribe:list-unsubscribe; bh=csfwAPNFjirqvAQSRX91Y8txuz6AZz2HN2mxwuIDdnk=; b=cyfTgEDOeXmSfTQ9xRvBX0kvuGIoiTIONXSIW8iFHKdmRQd4MDFwHVLF2TVOj75YSG 43KYmwV1GiADBwHwRKU/pQxWxO6wKbRyM+8HtN79m1zMU5qvXFqIF7i+COS76TzYU2gh ciiEKzrAAiDFySlVpTvN+VmnQoxS+asW7eKlPVtcvsRYTnCPt8xwp8dCoqByy/6dDMeV 7H0Lb9n1L0r6/EmhPbz/CMO6t1LFMZsBAsODPkjDnBrMIMYLmxvPmZC/CgXZbxpT/f3I oLZTiwhvox6uPN6R0aQhmjBWGuuykkUv+7+SGLnVdG9FUSGORuRNUnWlYNsYXKVGXX6g 4mLg== X-Gm-Message-State: AOPr4FW1qIcbAjOAVFzD8xPKx7er9D9o963qVY3xG/ORfnd7X3WV4STiVXnsS2CrLwPF4Q== X-Received: by 10.28.130.73 with SMTP id e70mr81030wmd.4.1462212034953; Mon, 02 May 2016 11:00:34 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.28.53.69 with SMTP id c66ls608520wma.6.canary; Mon, 02 May 2016 11:00:34 -0700 (PDT) X-Received: by 10.28.29.205 with SMTP id d196mr1943267wmd.2.1462212034103; Mon, 02 May 2016 11:00:34 -0700 (PDT) Original-Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com. [2a00:1450:400c:c09::231]) by gmr-mx.google.com with ESMTPS id a65si1215953wma.0.2016.05.02.11.00.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 May 2016 11:00:33 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:400c:c09::231 as permitted sender) client-ip=2a00:1450:400c:c09::231; Original-Received: by mail-wm0-x231.google.com with SMTP id n129so116935448wmn.1 for ; Mon, 02 May 2016 11:00:33 -0700 (PDT) X-Received: by 10.194.57.168 with SMTP id j8mr37328291wjq.43.1462212033714; Mon, 02 May 2016 11:00:33 -0700 (PDT) Original-Received: from [192.168.1.250] ([178.249.150.192]) by smtp.gmail.com with ESMTPSA id f135sm20067311wmf.22.2016.05.02.11.00.32 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 02 May 2016 11:00:32 -0700 (PDT) Original-Sender: Melroch User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 In-Reply-To: <87mvo8zafi.fsf-97jfqw80gc6171pxa8y+qA@public.gmane.org> X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:400c:c09::231 as permitted sender) smtp.mailfrom=melroch-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:14912 Archived-At: Den 2016-05-02 kl. 18:33, skrev Joost Kremers: > A workaround is to put a \newpage after each heading, or some dummy > text, or even just a hard space. This is not something Pandoc can fix, > and fixing it in (La)TeX might even be undesirable if it increases the > possibility of headings appearing at the bottom of a page. It can be fixed with a simple pandoc filter (not to be run on the final document!) It inserts a raw latex block containing the command `\pagebreak[2]` after every heading, without the need to hardcode them in the source. \pagebreak[2] is what you want here. It 'suggests' a pagebreak with a not too low penalty, and does not insert any extra space /bpj ````python #!/usr/bin/env python """ heading-breaks.py A pandoc filter which inserts a raw \pagebreak[2] after headings, so that LaTeX breaks pages between headings in outlines. """ import pandocfilters as pf pagebreak = pf.RawBlock( 'latex', '\\pagebreak[2]' ) def filter_func(key, val, fmt, meta): if 'Header' != key: return None return [pf.Header(*val),pagebreak] if __name__ == "__main__": pf.toJSONFilter(filter_func) ````