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.

There are two macros defined in the LaTeX kernel named \@texttop and its opposite \@textbottom. The first is a bit of a mystery command in that in the source it is let to \relax. There is a note that the:

\@texttop : Command executed at top of vbox holding text of page (including figures). Used by letter style; can also be used to produce centered pages.

In the letter class it is set to a small value:

The document class letter sets |\@texttop| to |\vskip| 0pt \texttt{plus} .00006fil 
%    on the first page of a letter, which
%    centers a short letter on the page. This fil value may have to be
%    changed for other letterheads.  This setting has to be done after
%    |\raggedbottom| is executed, since the latter sets |\@texttop| to
%    |\relax|.

From my understanding in reading source2e, these are ideal hooks to insert top and bottom glue in the final output box. For example in a book of poems or a photo-book, we might want all the pages to be vertically centered. I have defined a short macro, shown in the minimal below named \nobottom to supplement the commands \raggedbottom and \flushbottom.

\documentclass{article}
\usepackage{lipsum}
\usepackage{graphicx,alltt}
\makeatletter
\def\nobottom{%
\def\@texttop{\ifnum\c@page>0\vskip \z@ plus 3fil\relax\fi}
\def\@textbottom{\ifnum\c@page>0\vskip \z@ plus 2fil\relax\fi}}
\nobottom
\begin{document}
\pagestyle{headings}
\lipsum[1]
\clearpage
\lipsum[1-2]
\clearpage
\begin{alltt}
This can be a poem
     to see how it will
print
\end{alltt}
\end{document}

Is my understanding of these commands correct? Is there another way to vertically position all pages or certain pages automatically? As you can see at the point of time LaTeX inserts these commands, it is safe to use the page counter, so for example one could automate the centering of all pages containing some preamble material (or these pages could be marked with a boolean to affect such an insertion of glue). Can you provide some other possibilities and examples for such commands?

Example for images (I think achieved in a much easier way than recent posts we had for the same subject i.e, caption on left and image on right).

enter image description hereenter image description here

share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

Your reading is correct. Those two commands are already part of the initial LaTeX 2.09 output routine (the documentation in ltoutput.dtx clearly show the age --- if something in typewriter looks like this then this is Leslie original):

%   \@textbottom    : Command executed at bottom of vbox holding text of
%                     page (including figures).  The \raggedbottom
%                     command almost \let's this to \vfil (actually sets
%                     it to \vskip \z@ plus.0001fil).
%                     Should have depth 0pt.
%
%   \@texttop       : Command executed at top of vbox holding text of
%                     page (including figures).  Used by letter style;
%                     can also be used to produce centered pages.
%                     Let to \relax by \raggedbottom and \flushbottom.
%

And indeed they offer the only way that I can think of (short of redefining internals) to automatically center page material (or position it 2/3 as you did).

The name \nobottom is a bit odd though, isn't it?

share|improve this answer
    
Thanks! On naming \flushbottom, raggedbottom, \nobottom! Sort of rhymes;) Any suggestions for a better name. I originally had \vcentered but it clashed with some maths macros I had plus it did not work well as a name at 2/3 center. –  Yiannis Lazarides Jan 9 '12 at 22:29
    
@YiannisLazarides can't think of a good name with "bottom" since it is not really related to it. Best I could come up with is \centeredpages but that isn't right either as you aren't centering ... dunno –  Frank Mittelbach Jan 9 '12 at 22:47
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.