# [OS X TeX] writing twice to the same line

Herbert Schulz herbs at wideopenwest.com
Sun Dec 13 15:11:01 CET 2009

On Dec 13, 2009, at 7:47 AM, Florian Grammel wrote:

>
> Den 13.12.2009 kl. 13:20 skrev Nestor Aguilera:
>
>>> Have you tried the fancyhdr package?
>
>
> Please excuse me for being unprecise: It is the section-headING, not headER, that I have to set up in this way.
>
>
> ____________________________________________
>
> Florian Grammel
>
> Gentofte, Denmark
>

Howdy,

Try this:

\documentclass{article}
\newcommand{\secname}[3]{\makebox[0pt][l]{#1}\hfill #2\hfill\makebox[0pt][r]{#3}}
\begin{document}
\section*{\secname{Left Text}{Middle Text}{Long Right Text}}
And here's the head! And a nice long line to see that the text is very nicely placed.
\end{document}

The trick is to place the Left and Right text in a 0 width boxes, the Left text is left justified and Right text is right justified then the \hfill's center the Center text. Note that I used \section* you'll get an error with \section commands.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)