emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: insert automatically a reference to a section header and a link


From: John Kitchin
Subject: Re: insert automatically a reference to a section header and a link
Date: Wed, 17 Nov 2021 09:06:54 -0500

there is nothing like that that I know of. You can write your own, in org (following Eric's use of radio targets) it might look like this.

(defun my-heading ()
  (interactive)
  (let* ((title (string-trim (read-string "title: ")))
(tokens (split-string title " " t))
(label (format "<<sec:%s>>"
(string-join
(seq-take tokens (min 3 (length tokens)))
"-"))))
    (insert (format "%s %s" label title))))

you could also insert the leading * if you prefer.

John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803


On Wed, Nov 17, 2021 at 8:59 AM Uwe Brauer <oub@mat.ucm.es> wrote:

>>> "ESF" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Wednesday, 17 Nov 2021 at 08:36, Uwe Brauer wrote:
>> In auctex+reftex it is possible that when I insert a new section header
>> a reference label is inserted automatically:

> I do the following usually:

> * <<introduction>> Introduction

Right, but how do you do this automatically?

Maybe I did not explain this clearly enough: in auctex+reftex, when I
fire up the command LaTeX-section, I am

    1. Asked for the title

    2. And then the title *and* a label is inserted automatically. (I
       can configure what is inserted to a certain extend). Usually I
       obtain \section{Alternativa de Fredholm}
       \label{sec:altern-de-fredh}


I am looking for a similar functionality in org mode

> In section [[introduction]], I show something.

> I prefer visible labels instead of custom IDs although the latter works
> as well but you need to say [[id:introduction]].

> HTH,
> eric



reply via email to

[Prev in Thread] Current Thread [Next in Thread]