Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!SC.ZIB-BERLIN.DBP.DE!Schoepf From: Schoepf@SC.ZIB-BERLIN.DBP.DE (Rainer Schoepf) Newsgroups: comp.text.tex Subject: Forcing \addcontentsline to write to "toc" file Message-ID: <9103250915.AA27648@sc.ZIB-BERLIN.DBP.DE> Date: 25 Mar 91 09:15:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 108 From: "George D. Greenwade" On Fri, 22 Mar 1991 16:56:06 EST, Jon E. Ahlquist submitted the following to LaTeX-help@sumex-aim.stanford.edu. I am unable t o help Jon directly, but thought that the collective wisdom of LaTeX-help-toughies and INFO-TeX would have an answer. Recall that the questioner in this case and the one in need of immediate assistance is: AHLQUIST@metsat.met.fsu.edu Regards, George %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% George D. Greenwade, Ph.D. Bitnet: BED_GDG@SHSU Department of Economics and Business Analysis THEnet: SHSU::BED_GDG P. O. Box 2118 Voice: (409) 294-1266 Sam Houston State University FAX: (409) 294-3612 Huntsville, TX 77341 Internet: bed_gdg%shsu.decnet@relay.the.net %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Dear Sir/Madam: I am modifying suthesis.sty to create a style for theses at Florida State University. Everything is fine except for one LaTeX problem. My LaTeX "root" file, thesis.tex, contains the following lines as it attempts to set up the appendix section of a thesis: \addcontentsline{toc}{chapter}{Appendices} \appendix \include{append_a} % Include appendix A stored in append_a.tex \clearpage (The complete files thesis.tex and fsuthesis.sty are appended at the end of this letter just in case I have omitted something important from my example.) Despite the fact that: \addcontentsline{toc}{chapter}{Appendices} precedes: \include{append_a} \clearpage the table of contents file contains the entries in reversed order: \contentsline {chapter}{\numberline {A}Reaction Rates}{9} \contentsline {chapter}{Appendices}{9} If this were only for myself, I would edit the ".toc" file to reverse the lines, but I am trying to prepare something that any and all graduate students at Florida State University could use. Therefore, I would like to find a "clean" solution to the problem. Is there a way to force the \addcontentsline message to be written before the chapter listing for appendix A? Thank you. - Jon Dr. Jon E. Ahlquist, Dept. of Meteorology B161, Florida State University Tallahassee, FL 32306-3034 Telephone: (904) 644-1558 Internet: ahlquist@met.fsu.edu or ahlquist@metsat.met.fsu.edu The problem comes from an unfortunate interaction between \addcontentsline and \include. \addcontentsline works by writing the relevant information to the .aux file, more precisely, by putting there a write statement to the .toc file. But this information is only written when the current page is shipped out, since \write commands are not executed earlier, unless they are preceded by \immediate. \include, on the other hand, \immediate'ly writes the command \@input{append_a.aux} to the .aux file which means that it comes earlier than the \@writefile command produced by the \addcontentsline. Since there are these two mechanisms involved, there are two ways to circumvent this: either you use \input instead of \include, or put the \addcontentsline and \appendix commands into append_a.tex. Another solution is impossible until the whole .aux file handling has been rewritten completely. I'd like to add one or two comments on the fsuthesis.sty file. First of all, you are making the common mistake to implement your thesis style as a document style *option*. Fsuthesis should be a document style by itself, and replace `report' (which is only an example document style anyway). Use of report as base document style leads to strange code like the one in \tableoftables and \tableoffigures. If you don't want extra vertical space you should define \@chapter appropriately. Regarding the single spacing in floats and footnotes: isn't a redefinition of \@parboxrestore exactly what you want? I'm not sure about this since it also is applied to the text in a \parbox command and the minipage environment. Rainer Dr. Rainer Schoepf Konrad-Zuse-Zentrum ,,Ich mag es nicht, wenn fuer Informationstechnik Berlin sich die Dinge so frueh Heilbronner Strasse 10 am Morgen schon so D-1000 Berlin 31 dynamisch entwickeln!'' Federal Republic of Germany or