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.

This seems trivial, but I'd like a single line to have some text with left-justification and right-justification at the same time, eg.

left text here                                               right text here
normal text, normal text, normal text, normal text, normal text, normal text,
normal text, normal text, normal text, normal text, normal text, normal text,
normal text, normal text, normal text, normal text, normal text, normal text,

Would it be some combination of ragged lefts and rights? My (non-working) solution would be something like:

{\raggedleft left text here} {\raggedright right text here}  
share|improve this question
add comment

2 Answers

up vote 19 down vote accepted

How about \noindent left text here \hfill right text here?

share|improve this answer
    
Thanks, it's perfect! I feel it will take some take for me to internalize all of the commands so that things like this are obvious! –  Hooked Dec 2 '10 at 22:41
3  
It should be noted that this solution will only work as intended if left text and right text are only on one line. If you want to allow line breaks, you'll need to enclose each block of text in something like a minipage. –  ESultanik Dec 2 '10 at 22:46
    
@ ESultankik - While locksteps answer is perfect for what I need, it would be useful for myself (and others) if you could post a working minipage example. –  Hooked Dec 2 '10 at 23:10
    
What if this text is math inside of a displayed math environment? The given solution doesn't work for that situation. –  Tyson Williams Nov 2 '12 at 12:41
    
@TysonWilliams Sorry, display math mode is not my area of expertise. –  lockstep Nov 2 '12 at 12:43
add comment

At the request of Hooked (see the comment to the other answer), here is a working minipage example:

\documentclass{article}
\usepackage{lipsum} %% For the random text
\begin{document}
\noindent\begin{minipage}[b]{0.49\hsize}
  \raggedright
  \lipsum[1]
\end{minipage}
\hfill
\begin{minipage}[b]{0.49\hsize}
  \raggedleft
  \lipsum[2]
\end{minipage}
\lipsum[3]
\end{document}

which produces this: Screenshot of the minipage example.

share|improve this answer
    
I would use a \parbox here. I don't see what the minipage buys you. –  TH. Dec 3 '10 at 6:18
2  
@TH.: I know that you prefer \parbox to minipage. One reason for using the latter is that one might prefer is semantically: You don't have to wait that long for the matching closing brace. –  Hendrik Vogt Dec 3 '10 at 7:32
    
@Hendrik's semantic argument is exactly why I use it: I can visually parse the \begin and \end statements much quicker than unlabeled braces. @TH is correct though: A \parbox would work just as well. One can always label the closing braces with comments, I guess. –  ESultanik Dec 3 '10 at 15:02
    
@Hendrik and Esulanik: One can use \begin{parbox}[b]{.49\linewidth}{ ... }\end{parbox}, but that's sort of silly. I think it comes down to writing readable code. If one is a programmer, one is used to matching braces and using proper indentation to facilitate that matching. That applies here too. That said, your comments make a lot of sense. Thanks. –  TH. Dec 4 '10 at 3:55
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.