fixmarks.sty 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. % Patch LaTeX's output routine to handle marks correctly with two columns.
  2. % Version 1.0
  3. % Joe Pallas <[email protected]>
  4. % Version 1.1
  5. % Corrected by Piet van Oostrum <[email protected]> on Feb 5, 1993
  6. % Originally this file was called "fixhead.sty" which doesn't make sense.
  7. % The original version of this file used a comparison between \firstmark
  8. % and \topmark to check if a mark was given in the first column. However
  9. % this fails in the case that a mark is given that is identical to the one
  10. % on the previous page. Although this can be considered a pathological case
  11. % I didn't want it. The use of the \vsplit should solve this. The only case
  12. % that it doesn't solve is if the user inserts empty marks, but LaTeX marks
  13. % are always of the form {}{}.
  14. % Note: the \topmarks are generally useless in LaTeX because they are
  15. % destroyed by the float mechanism.
  16. % The above comment added Oct 3, 1994.
  17. % Version 1.2
  18. % Oct 5, 1994: replaced \expandafter's by \xdef, which does the same but
  19. % looks less complicated.
  20. % Version 1.3
  21. % Oct 6, 1994: replaced "\global\setbox\@leftcolumn\vsplit\@outputbox
  22. % to\ht\@outputbox" by the two \setbox's below. This ensures that no
  23. % anomalies may occur in pathological cases. These can occur if there are
  24. % large negative glues near the end of the box.
  25. % Oct 6, 1994: save and restore \split*mark just in case someone was going
  26. % to use it and got interrupted by us. The code doesn't make a difference
  27. % between no marks and empty marks, but that difference isn't visible at
  28. % the user level. The strange way to do this is necessary as the marks
  29. % don't obey grouping rules. (Actually also \clearpage processing destroys
  30. % these marks, so the saving/restoring may be of limited value)
  31. % Version 1.4
  32. % Oct 7, 1994: saving of the \split*marks now done by putting them directly
  33. % in a box. Added \vbadness=10000 to get rid of underfull vbox warning.
  34. % Note: we rely on the grouping mechanism to reset various things, as this
  35. % is about the last thing to happen in the output routine.
  36. % Version 1.5
  37. % Oct 11, 1994: suppressed unwanted expansion of the marks. This includes
  38. % undoing the change mentioned in version 1.2.
  39. \def\@outputdblcol{\if@firstcolumn \global\@firstcolumnfalse
  40. % save the left column
  41. \global\setbox\@leftcolumn\copy\@outputbox
  42. % save the \split*marks
  43. \setbox\@tempboxa\vbox{
  44. \toks@\expandafter{\splitfirstmark}
  45. \mark{\the\toks@}
  46. \toks@\expandafter{\splitbotmark} % we don't use \splitbotmark but
  47. \mark{\the\toks@}} % it gets clobbered by the \vsplit below
  48. % Remember the marks from the first column
  49. \splitmaxdepth=\maxdimen \vbadness=10000
  50. \setbox\@outputbox\vsplit\@outputbox to\maxdimen
  51. \expandafter\gdef\expandafter\@firstcoltopmark\expandafter{\topmark}%
  52. \expandafter\gdef\expandafter\@firstcolfirstmark
  53. \expandafter{\splitfirstmark}%
  54. \ifx\@firstcolfirstmark\empty\global\let\@setmarks\relax\else
  55. \gdef\@setmarks{\let\firstmark\@firstcolfirstmark
  56. \let\topmark\@firstcoltopmark}%
  57. \fi
  58. % Restore the \split*marks
  59. \setbox\@tempboxa\vsplit\@tempboxa to 0pt % this resets the \split*marks
  60. % End of change
  61. \else \global\@firstcolumntrue
  62. \setbox\@outputbox\vbox{\hbox to\textwidth{\hbox to\columnwidth
  63. {\box\@leftcolumn \hss}\hfil \vrule width\columnseprule\hfil
  64. \hbox to\columnwidth{\box\@outputbox \hss}}}\@combinedblfloats
  65. % Override current first and top with those of first column if necessary
  66. \@setmarks
  67. % End of change
  68. \@outputpage \begingroup \@dblfloatplacement \@startdblcolumn
  69. \@whilesw\if@fcolmade \fi{\@outputpage\@startdblcolumn}\endgroup
  70. \fi}