From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Org equivalent to \chapter* Date: Wed, 06 Aug 2014 11:18:10 +0200 Message-ID: <87oavyj7sd.fsf@gmx.us> References: <53E172B1.5020101@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XExMr-0005YP-Eo for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 05:18:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XExMj-0004ue-Uz for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 05:18:45 -0400 Received: from plane.gmane.org ([80.91.229.3]:36469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XExMj-0004uS-ON for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 05:18:37 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XExMe-000442-Q7 for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 11:18:32 +0200 Received: from 46.166.186.241 ([46.166.186.241]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 06 Aug 2014 11:18:32 +0200 Received: from rasmus by 46.166.186.241 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 06 Aug 2014 11:18:32 +0200 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Alan L Tyree writes: > I'm sure this has been asked before, but I can't seem to find it. Is > there an org markup that produces a starred latex heading? > > In a book, for example, I want the Preface to be at chapter level, but > not included in the numbering. Same for HTML export, of course. You would probably need some sort of filter for this. Most certainly you will be able to find implementations on this list. Here's something from my init file that works with LaTeX. Other formats such as txt and html are harder since Org generates section numbers and the TOC. The filter will translate this file #+OPTIONS: tags:nil * preface :nonum: my preface * introduction this is numbered. To something like this: \section*{preface} \label{sec-1} my preface \section{introduction} \label{sec-2} this is numbered. If your other filters require #+OPTIONS: tags:t then you will have to manually clean up the tag remedies. I will not work on verbatim-only headlines. (defun rasmus/get-org-headline-string-element (headline backend info) "Return the org element representation of an element. Does not work with verbatim only headlines, e.g. \"* ~Verb~.\"" (let ((prop-point (next-property-change 0 headline))) (if prop-point (plist-get (text-properties-at prop-point headline) :parent)))) (defun rasmus/org-export-nonum (headline backend info) "Remove the number from LaTeX headlines with the tag \"nonum\"" (when (org-export-derived-backend-p backend 'latex 'ascii) (let* ((e (rasmus/get-org-headline-string-element headline backend info)) (tags (org-element-property :tags e)) (level (org-element-property :level e)) (class (assoc (plist-get info :latex-class) org-latex-classes))) (when (and level (member-ignore-case "nonum" tags)) (string-match (format "\\(\\%s\\)" (replace-regexp-in-string "{.*?}" "" (car (nth (1+ level) class)))) headline) (replace-match (replace-regexp-in-string "{.*?}" "" (concat "\\" (cdr (nth (1+ level) class)))) nil nil headline 0))))) (add-to-list 'org-export-filter-headline-functions 'rasmus/org-export-nonum) -- Governments should be afraid of their people