simultaneous justification in Latex

1 view
Skip to first unread message

mark...@hotmail.com

unread,
Sep 20, 2006, 11:02:19 AM9/20/06
to

Hi,

I'd like left- and right-justified text on the same line. e.g.

Some text here And some text over here

I've tried tabularx and TabularC, but they are not precise enough to
line
up the text with the margins. Any suggestions?

Thanks,

Mark

Tim Love

unread,
Sep 20, 2006, 11:05:22 AM9/20/06
to
mark...@hotmail.com writes:


>Hi,

>I'd like left- and right-justified text on the same line. e.g.

>Some text here And some text over here

If it's only for a line or so, try something like

Some text here \hspace{\stretch{1}} And some text over here

Peter Flynn

unread,
Sep 20, 2006, 3:29:18 PM9/20/06
to
mark...@hotmail.com wrote:
> Hi,
>
> I'd like left- and right-justified text on the same line. e.g.
>
> Some text here And some text over here

This setting is referred to as a "spring margin". Very few systems
allow for it.

> I've tried tabularx and TabularC, but they are not precise enough to
> line
> up the text with the margins. Any suggestions?

How much of the textwidth do you want to allocate to each side?
50%-50%? or 60%-40%? You need to decide this first.

\documentclass{article}
\newcommand{\spring}[2]{\par\noindent\hbox to\columnwidth{%
\vtop{\hsize=.45\columnwidth\flushleft#1\par}\hss
\vtop{\hsize=.45\columnwidth\flushright#2\par}}}
\begin{document}
\spring{Hi, I'd like left- and right-justified text on the same line.
e.g.\ some text here\dots}{\dots and some text over here. I've tried
\textsf{tabularx} and \textsf{TabularC}, but they are not precise


enough to line up the text with the margins. Any
suggestions? Thanks, Mark}

\end{document}

///Peter

Scott Pakin

unread,
Sep 20, 2006, 8:36:23 PM9/20/06
to

I'd probably do it like Tim or Peter suggested. However, a tabular
certainly is precise enough. The trick is to suppress the extra padding
on the left and right of the extreme columns using @{} (and probably also
a \noindent):

\noindent
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}lr@{}}
Some text here & And some text over here \\
\end{tabular*}

-- Scott

Reply all
Reply to author
Forward
0 new messages