From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: export to LaTeX with TOC but without numbers Date: Wed, 05 Jun 2013 09:14:47 +0200 Message-ID: <87obbl3u6w.fsf@med.uni-goettingen.de> References: <87hahe5nyc.fsf@med.uni-goettingen.de> <87sj0yt7v4.fsf@pinto.chemeng.ucl.ac.uk> <87a9n65bun.fsf@med.uni-goettingen.de> <87txld29pz.fsf@ucl.ac.uk> <8761xt6457.fsf@med.uni-goettingen.de> <87bo7l1id2.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uk7wG-0007Rn-9w for emacs-orgmode@gnu.org; Wed, 05 Jun 2013 03:15:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uk7w2-0007VZ-6J for emacs-orgmode@gnu.org; Wed, 05 Jun 2013 03:15:20 -0400 Received: from plane.gmane.org ([80.91.229.3]:59491) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uk7w1-0007V7-V3 for emacs-orgmode@gnu.org; Wed, 05 Jun 2013 03:15:06 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Uk7w0-0007jT-FI for emacs-orgmode@gnu.org; Wed, 05 Jun 2013 09:15:04 +0200 Received: from genepi110.genepi.med.uni-goettingen.de ([134.76.140.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 05 Jun 2013 09:15:04 +0200 Received: from andreas.leha by genepi110.genepi.med.uni-goettingen.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 05 Jun 2013 09:15:04 +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 Eric Abrahamsen writes: > Andreas Leha writes: > >> Hi Eric, >> >> Eric S Fraga writes: >> >>> Andreas Leha writes: >>>> Eric S Fraga writes: >>> >>> [...] >>> >>>>> There are workarounds but they involve using latex directly (to add >>>>> entries to a TOC basically). >>>> >>>> I am aware of that. Sorry for being unclear. I would like to automate >>>> exactly that. >>>> >>>> I use several LaTeX export classes and I would like that possibility >>>> (TOC with unnumbered sections/subsections/...) in each of these classes. >>>> Thus, I am searching for a (more) general approach, that I could 'switch on' >>>> and have it insert the latex statement on its own. >>>> >>>> Best, >>>> Andreas >>> >>> Ah, I see. Well, you could do something along these lines (completely >>> untested and likely to be wrong...): >>> >>> #+latex_header: \newcommand{\mysection}[1]{\section*{#1}\addcontentsline{toc}{section}{#1}} >>> >>> and similar for subsection, subsubsection, ... >>> >>> Then customise org-latex-classes and replace, for instance, >>> \\section*{%s} by \\mysection{%s}. >>> >>> However, you'll probably need to put a bit more TeX in the >>> addcontentsline bit if you want some proper formatting (have a look at >>> latex.ltx [around line 5659 in my version of this file] to see how >>> content lines are handled by default...). >>> >>> Not trivial but also not impossible! >>> >>> I would suggest you look at latex-specific fora for answers to the more >>> general question of generating tables of contents for unnumbered >>> headings as I can imagine that there are simpler solutions. >>> >> >> Thanks for these hints! When I follow that route I'll have to do >> more work I guess: >> 1. either I have to provide two versions of my org-latex-classes (one >> for numbered and one for un-numbered cases) >> 2. or I have to provide a filter or sth similar to replace sections >> with mysections, correct? > > I've gone the filter route before, with pretty good success: checking > for the type of heading and adding toc statements. In my case I *wanted* > something more complicated, though, using tocloft and \addtocontents. If > you don't need all that then Nick's suggestion seems perfect. The more I think about it, the more I get the impression, that it would have been faster (even given my elisp 'skills') to write such a filter than to raise that here. And I might even need a similar and more complicated TOC handling soon, so it would have been a good start. Anyway, Nick's suggestion works for now. As I said in the other post, it works at least as long as I do not want odt as well... Best, Andreas