From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: Org equivalent to \chapter*
Date: Wed, 06 Aug 2014 11:18:10 +0200 [thread overview]
Message-ID: <87oavyj7sd.fsf@gmx.us> (raw)
In-Reply-To: 53E172B1.5020101@gmail.com
Alan L Tyree <alantyree@gmail.com> 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
next prev parent reply other threads:[~2014-08-06 9:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-06 0:11 Org equivalent to \chapter* Alan L Tyree
2014-08-06 1:11 ` Thorsten Jolitz
2014-08-06 2:28 ` Nick Dokos
2014-08-06 8:09 ` Thorsten Jolitz
2014-08-06 9:18 ` Rasmus [this message]
2014-08-06 17:15 ` Thomas S. Dye
2014-08-06 17:38 ` Rasmus
2014-08-06 19:52 ` Thomas S. Dye
2014-08-06 22:46 ` Alan L Tyree
2014-08-07 10:05 ` Rasmus
2014-08-07 22:07 ` Alan L Tyree
2014-08-08 8:42 ` Rasmus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oavyj7sd.fsf@gmx.us \
--to=rasmus@gmx.us \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.