Most or all papers have a final paragraph in the introduction that describes the sections that are present. I'd like to generate it automatically, I guess this should be possible because it is mostly like an index, but in fact I have no idea about how this could be done (therefore I can't provide a mwe, I'm very sorry for this).

My guess is that it should be possible to add a description for each section, something like:

\description{we introduce the concepts that will be relevant along the paper}

What I would like is to insert at the end of the introduction something like this:


Which should expand to:

The structure of the paper is as follows: In Section 2 we introduce the concepts that will be relevant along the paper. In Section 3 we...

This is pretty much like the table of contents (TOC) that you would find in any book, this is prose and not a table and there is one additional field, but in short it's the same. Seems feasible.

Pointers to what should I check are also welcome, I really have no idea. I don't know how those TOCs are generated either.

PD: I'd prefer not to destroy the possibility of having a regular TOC additionally to this, i.e. I'd prefer not to modify the commands for the TOC (but maybe duplicate some of them).

PD: I found this package, but I get an error (\l@paragraph undefined) http://texblog.org/2008/07/13/define-your-own-list-of/

  • 2
    I'm a fan of automation, I can't help it, this may be taking it a bit too far. Maybe I'm an addict. This still looks cool to me. – Trylks May 29 '14 at 14:47
  • 1
    @egreg 's answer to tex.stackexchange.com/questions/60738/… may help you here – Ethan Bolker May 29 '14 at 15:01
  • thank you, this is fine, but it relies on commands for the toc that are still magic to me – Trylks May 29 '14 at 15:10
  • So I've been using the solution I linked for a while. Beyond 5 sections or so I get an error, solved with \usepackage{morewrites}, but beyond 7 sections I get a similar error ("no room for a new \read"). I also added a counter, which may interfere (showing how fragile and crappy LaTeX is in fact...). I'll try to find a solution, I simply wanted to add this comment here now because I may very well not find any. – Trylks Sep 8 '14 at 14:41
  • OMG!!!! I can't believe it was so easy! (after knowing the commands) The commands that are needed are \AtBeginDocument and \AtEndDocument. I've updated the gist accordingly. I'll try to have a MWE soon... – Trylks Sep 8 '14 at 15:56

Use the already provided infrastructure; we use a supplementary “table of contents”, which doesn't interfere with the standard one.

Just initialize the production of this “table of contents” and add a command \l@desc that will be used for printing the entries gathered in the previous run. Of course, two runs are necessary for synchronizing.


  The structure of the paper is as follows.
  \addcontentsline{dsc}{desc}{In Section \thesection\space#1}%



We say something about the paper.


\sectiondescription{we introduce the concepts that will be relevant along the

\sectiondescription{we are done.}


enter image description here

| improve this answer | |
  • I like your solution better than mine. The OP seems to want each section description in its section as well as at the beginning - easy to add that #1. – Ethan Bolker May 29 '14 at 23:58
  • I'm not particularly concerned with content-replication but more with an intelligent behaviour of some parts of the paper wrt to others. E.g. switching the order of two sections, which could now be as simple as switching two lines with \input{sectionfile}. – Trylks May 30 '14 at 13:32
  • I like this solution because it relies on commands that are already defined (and tested, and higher-level) but these commands make the text in the description clickable and that is puzzling (potentially annoying) to people reading the paper. Do you know if there is any way to avoid this? – Trylks May 30 '14 at 13:33
  • BTW: I have made some (really small) changes to this solution and put the code here: gist.github.com/trylks/6bbbdaff10b5dd35d676 in toclike.tex I should produce a mwe at some point. – Trylks May 30 '14 at 13:36

Compiling this twice does what you ask for. It's a little fragile.

Edited to use @Dan 's \InputIfFileExists but still prefer closing the file explicitly.




In Section \arabic{section} #1}
In this section #1 



\beginstructure{The structure of the paper is as follows.}

\addtostructure{we introduce the concepts that will be relevant along the

\addtostructure{we are done.}


enter image description here

Edit: If you don't like the tex extension on the auxiliary file you can give it any extension you like, and name it with the tex source filename - for example

| improve this answer | |
  • Probably \InputIfFileExists would be better than a plain \input, so that structure.tex wouldn't have to exist already. Also, one can close the file automatically by putting the commands to do so in \AtEndDocument{}. However, latex should automatically close all open files when it terminates. – Dan May 29 '14 at 18:04
  • What I like less from this solution is that the contents of this "special toc" are stored in a tex file, which is confusing visually (wrt icons) when exploring the folder, copy-pasting relevant files (*.tex), etc. therefore inspired by this solution I have made some modifications. They are in fileread.tex: gist.github.com/trylks/6bbbdaff10b5dd35d676 I'll produce a mwe at some point. – Trylks May 30 '14 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.