# How does plain TeX \insert work?

My question is about Plain TeX command \insert.

I understood that every insert series have a dedied box. But I did'nt understand if the use of \insert adds content to the box, or if the box is constructed at the end of the page, from a list.

If the second answer is true, my question is : are the elements in the list of insert (for one series) concatened in one hbox, or are they concatened in vbox, with a paragraph break between them.

My problematic is for the some change in ledmac.

Actually, ledmac provide some "paragraphed" notes, which are ultimate producted by

\insert\paragraphednote
\bgroup
\hbox{content of my note}
\egroup


That makes that all note are in the same paragraph. But as you know, an hbox can't be broken. An so, it's problematic.

But if I just put the content without \hbox, my notes are not in the same paragraph, but I obtain one paragraph by note.

I hope to be clear.

If you want to see the real code, it is at http://bit.ly/VcI0ix

-

\insert is a TeX primitive not a plain TeX command.

If you go

\insert\boxregister{
.... vertical mode material ...
}


then two things happen, the vertical mode material is saved away and an insert node is placed in the current list.

If the current list is a horizontal list in a paragraph the node "migrates" to the surrounding vertical list.

Any insert nodes that end up being inside a box are essentially lost.

Insert nodes that end up on the main vertical list affect the page breaker in several ways.

depending on \count\boxregister and \skip\footins the output routine leaves space for the inserts when chopping off the page.

Inside the output routine \box\boxregister contains the contents of the insertion boxes u to a maximum of \dimen\boxregister. Any additional inserts are held over on to the next page (and the last insert on the page may be split if it doesn't fit (and is splittable)

so in your example the output routine will be handed \box\paragraphednote which will be a vbox with a sequence of hboxes. the output routine is responsible for adding (or not) those boxes to the page before it is shipped out, it could unbox the contents or process them in any way or it could decide not to make any inserts on the page being shipped out and re-insert them into the material returned to the main vertical list.

You probably need to add an actual runnable example showing any problem. The code you link to is rather long to take in by eye but as far as I can see the intention is that teh boxing is only temporary and the \removehboxes macro is invoked to unbox and re-package the notes.

You say that \hbox prevents line breaking but that does not appear to be the intention of the code.

-
 Thank for you answer. Yes, of course, insert was a primitive : it's a mistake ... You say that \hbox prevents line breaking but that does not appear to be the intention of the code. -> yes of course, it's what I want to disable.... may I understand my output routin should unhbox the box inside vbox ? – Maieul Sep 21 '12 at 8:02 from a quick reading of the code that was what the original did (or intended to do) It would be easier if your question had included a runnable example – David Carlisle Sep 21 '12 at 8:33 Hum,I'm not sur to understand you. You would like to have an example to correct the code I link you ? – Maieul Sep 21 '12 at 12:36 If yes, I have one example, but the author don't want I publish it. But I could do a fictif example – Maieul Sep 21 '12 at 12:36 Hi, @David Carlisle. I send an example of problem on github.com/maieul/ledmac/commit/… – Maieul Sep 23 '12 at 10:05