[OS X TeX] headers and footers

Bruno Voisin bvoisin at mac.com
Sun Apr 10 10:13:38 CEST 2005


Le 10 avr. 05, à 08:50, Bruno Voisin a écrit :

> Le 10 avr. 05, à 01:09, lichtner a écrit :
>
>> \parbox worked! Except for one little problem: I wanted the first 
>> line in the footer to be left justified and the second line (the 
>> date) right justified. I tried using \hfill on the second line but it 
>> didn't take effect. I am trying to mimic a msword.doc format for a 
>> conference proceedings, but maybe I am close enough.
>
> Tabular environments are one way to get specific alignments in LaTeX, 
> without having to specify the width in advance (contrary to \parbox). 
> Try something like:
> [...]

On second thought: my solution won't help for getting lines the width 
of the page. Actually the only significant problem in your solution is 
\hfill: \hfill is synonymous to \hspace{\fill}, and for inserting 
horizontal space that isn't removed at the beginning or end of lines 
you must replace it by \hspace*{\fill}.

Here's something which I think should work. There are two solutions, 
one using {tabular} and the other \parbox which is probably all the 
better as it's simpler (and {tabular} also has problems mixing with 
normal text, as the way interline skip is created in {tabular} -- by 
inserting struts -- is different from the way that it is created in 
normal text). here are the solutions:

	\documentclass[a4paper,12pt]{article}

	% For avoiding overfull \hbox'es
	\newlength{\boxedlinewidth}
	\setlength{\boxedlinewidth}{\linewidth}
	\addtolength{\boxedlinewidth}{-2\fboxsep}
	\addtolength{\boxedlinewidth}{-2\fboxrule}

	\begin{document}

	\centering

	\fbox{%
	  \begin{tabular}{@{}p{\boxedlinewidth}@{}}
	    left-aligned line: words, words, words to go \\
	    \hfill centered line \hspace*{\fill} \\
	    \hfill right-aligned line
	  \end{tabular}%
	}

	\fbox{%
	  \parbox{\boxedlinewidth}{
	    left-aligned line: words, words, words to go \\
	    \hspace*{\fill}centered line \hspace*{\fill} \\
	    \hspace*{\fill}right-aligned line
	  }%
	}

	\end{document}

Bruno Voisin
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list