Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I compile the following,

\documentclass[a4paper]{article}

\usepackage{atbegshi}

\AtBeginShipout{\showlists}
\showboxdepth\maxdimen
\showboxbreadth\maxdimen

\usepackage{lipsum}

\newcommand\fnlipsum[1]
{%
  \begingroup
    \let\par\relax
    \lipsum[#1]\footnote{\lipsum[#1]}
  \endgroup
  \par
}


\begin{document}

\fnlipsum{1}
\fnlipsum{2}
\fnlipsum{3}
\fnlipsum{4}

\end{document}

then I see in the log file under

### current page: (held over for next output)

as well as under

### recent contributions:

some stuff in \insert253, on the current page the rest of footnote 3 which was split off from page 1, and in recent contributions the footnote 4 still embedded in the split off text from the main vertical list.

Now my questions:

  1. Where are "current page" and "recent contributions"? Are they boxes? Can I get at them? With LuaTeX maybe?
  2. I'd like to filter out the insertions, that is, extract the material they contain and remove them from their respective places (respectively, replace them by other inserts). Is this possible?
share|improve this question
1  
I have tried to replace the four new tags with (hopefully) appropriate existing tags. If you strongly feel about some of the new tags, please raise a question on meta (and perhaps point out some old questions where the new tags should be applied retroactively). –  lockstep Apr 5 '12 at 16:43
    
@lockstep No this is absolutely correct. Thanks for helping out. –  Stephan Lehmke Apr 5 '12 at 16:48
add comment

2 Answers 2

up vote 14 down vote accepted

Can't answer for luatex but the answer in classic tex is more or less that you can't get them (or at least you can't get at the data while it is there).

The afterpage package sort of needs to get hold of these so it can back up, insert the specified text before the text held over by the output routine so the specified text appears at the top of the next page.

The trick used there (which may or may not be useful to you) is to \aftergroup a special penalty to be inserted after the implict group of the output routine, so that the output routine is called again just at the point where material has been re-inserted on to the main vertical list. The special output routine then sees the held over material in box255 in the normal way. In the afterpage case it dumps the specified tokens followed by unboxing this material so it is re-collected by the normal output routine. It sort of half works sometimes if you close your eyes and don't worry too much about what could go wrong.

share|improve this answer
    
Thank you very much. I'll look into this. It might be less dirty than the workaround I had in mind ;-) Argh I can't vote up :-( –  Stephan Lehmke Apr 5 '12 at 16:46
    
This is perfect for my purpose! I could just load afterpage and get what I wanted with just a little tweaking! Thanks a lot for the hint. See my answer (tex.stackexchange.com/a/50942/12850). –  Stephan Lehmke Apr 5 '12 at 23:04
add comment

David's answer is excellent, but just to be complete: in luatex, the tex.lists table contains a small set of pointers to the node lists that hold that data.

  • page_ins_head: circular list of pending insertions
  • contrib_head: the recent contributions
  • page_head: the current page content
  • hold_head: used for held-over items for next page
  • adjust_head: head of the current \vadjust list
  • pre_adjust_head: head of the current \vadjust pre list

You can in fact alter those node lists in luatex (they are not boxes, just lists of nodes), but unless you are willing to experiment and test a lot, it is probably not wise to do so. For one, there are internal requirements for the internal structures of those lists (like that they are vertical mode material, and that page_ins_head has to be circular) and also, various parts of the internal typesetting engine maintain pointers into and pre-calculated information from (especially) the first four. The lua interface does not take any of that into account yet.

share|improve this answer
    
Thank you very much for this information. It is very good to know these things exist. In fact with Davids hint it was very easy to achieve what I wanted with plain LaTeX, but I'm constantly stumbling over limitations of the TeX engine like dissecting boxes with \lastbox. It is particularly frustrating that there are a lot of things you can print into the logfile in great detail but can't get a hold on from within TeX :-( So I believe LuaTeX is taking TeX to a completely new level. If I could only move to it immediately... –  Stephan Lehmke Apr 6 '12 at 9:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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