auctex
[Top][All Lists]
Advanced

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

Re: Add fictitious subsections to RefTeX TOC


From: Arash Esbati
Subject: Re: Add fictitious subsections to RefTeX TOC
Date: Sun, 22 Dec 2024 20:19:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Kourosh Kalayeh <k.kalayeh@gmail.com> writes:

> I have tried \phantomsection and \addcontentsline as below;
>
> \phantomsection
> \refstepcounter{subsubsection}
> \addcontentsline{toc}{subsubsection}{Aim 1}
>
> This works with \tableofcontents command in LaTeX but not with RefTeX.
>
> Is there a straightforward way to achieve this in RefTeX?

Not tested, but you can wrap the above in a macro like this:

\NewDocumentCommand\fsubsubsection{m}{%
  \phantomsection
  \refstepcounter{subsubsection}%
  \addcontentsline{toc}{subsubsection}{#1}%
}

and then add \fsubsubsection to `reftex-section-levels' accordingly:

,----[ C-h v reftex-section-levels RET ]
| reftex-section-levels is a variable defined in ‘reftex-vars.el’.
| 
| Its value is
| (("part" . 0) ("chapter" . 1) ("section" . 2) ("subsection" . 3)
|  ("subsubsection" . 4) ("paragraph" . 5) ("subparagraph" . 6)
|  ("addchap" . -1) ("addsec" . -2))
| 
| Commands and levels used for defining sections in the document.
| This is an alist with each element like (COMMAND-NAME . LEVEL).
| The car of each cons cell is the name of the section macro (without
| the backslash).  The cdr is a number indicating its level.  A negative
| level means the same level as the positive value, but the section will
| never get a number.  The cdr may also be a function which will be called
| to after the section-re matched to determine the level.
| This list is also used for promotion and demotion of sectioning commands.
| If you are using a document class which has several sets of sectioning
| commands, promotion only works correctly if this list is sorted first
| by set, then within each set by level.  The promotion commands always
| select the nearest entry with the correct new level.
| 
|   You can customize this variable.
| 
`----

Using \fsubsubsection{Aim 1} in your documentn should then work as expected.

Best, Arash



reply via email to

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