Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!stanford.edu!agate!spool.mu.edu!cs.umn.edu!uc!apctrc!voyager!zjdg11 From: zjdg11@hou.amoco.com (Jim Graham) Newsgroups: comp.text.tex Subject: TeXnical question Message-ID: <1991Jun19.125224.19855@hou.amoco.com> Date: 19 Jun 91 12:52:24 GMT Sender: news@hou.amoco.com Organization: Amoco Lines: 53 Originator: zjdg11@earth I've been working on setting up a macro within my standard macro collection that would (in plain TeX) create a table of contents as the file is processed. a file, referred to by \contentsfile , is opened, and when various heading macros are called, they write the heading, etc., and the current pageno to the file. The macros look something like this: \def\mainheading#1{\goodbreak \centerline{\subtitles\uppercase{#1}} \par \ifcontents \immediate\write\contentsfile{|countitem \uppercase{#1} |dotfill \folio} \immediate\write\contentsfile{} \fi } Note, when the table of contents is pulled in, "|" is defined as an escape char, just like \ normally is. I had to do this because I couldn't figure out how to print the "\" to the file as such (if someone can help there as well, I'm all ears...or eyes, as the case may be ;-) ). If I call this as \mainheading{foo} I'll end up with something like |countitem FOO |dotfill 42 Most of the time, this works out to be correct. HOWEVER, and this is where I need some assistance, if it just so happens that the heading WAS going to be written in at the bottom of the page (with the paragraph starting at the top of the next page) before the \goodbreak fixed that, TeX still lists the page number for that section as being the previous page, when in fact it has been moved into the next page. Now, I'm sure there's something stupid that I'm missing....but.... I'm kinda looking for 2 things here. First, I'd really like to know how to fix this situation. Second, if someone can point me to the right page numbers in The TeXbook to learn more about this situation, I'd love to hear it. Thanks in advance, --jim Standard disclaimer....These thoughts are mine, not my employer's. ------------------------------------------------------------------------------ Share and Enjoy! (Sirius Cybernetics Corporation, complaints division) 73, de n5ial Internet: zjdg11@hou.amoco.com or grahj@gagme.chi.il.us Amateur Radio: TCP/IP: jim@n5ial.ampr.org (44.72.47.193) Packet: BBS went QRT for good...still searching for new one. ------------------------------------------------------------------------------