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.

I desire make a template as

IIIIIIIIIIIIIIIIIIIIII
line 1 I line a
line 2 I line b
IIIIIIIIIIIIIIIIIIIIII
Another text

The I are just column localization.

I found the multicol package but I have not had success using it.

\begin{multicols}{2}
    \hline line 1 line a\\
    \hline line 2 line b\\
\end{multicols}
Another text

How I put line a and b to right centralized?

share|improve this question
    
You don't need multicol for this. You can place the content in a tabular. If you provide some more context, in the form of a minimal example (that would include what you actually want as "line 1", "line 2", "line a" and "line b", then it would easy to provide an alternative. Also, what is the alignment requirements for "Another text"? –  Werner Feb 29 '12 at 17:17
    
I'm at work, so don't have the entire code. I will post later. Sorry. –  André Andrade Feb 29 '12 at 17:28
add comment

2 Answers

Here is a minimal example duplicating your output for a much larger portion of text (I defined \text to contain some Lorem Ipsum-style dummy text).

enter image description here

\documentclass{article}
\usepackage{array}% http://ctan.org/pkg/array
\newcolumntype{L}{@{}>{\raggedright\arraybackslash}p{\dimexpr.5\linewidth-\tabcolsep}}
\newcolumntype{R}{>{\raggedleft\arraybackslash}p{\dimexpr.5\linewidth-\tabcolsep}@{}}

\newcommand{\text}{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque.%
}
\begin{document}
\text

\noindent\begin{tabular}{LR}
  \hline
  \text & \text \text \\
  \hline
  \text \text & \text \\
  \hline
\end{tabular}

\text
\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

Two column types are created using array's \newcolumntype:

  • L: a \raggedleft paragraph column of width exactly .5\linewidth-\tabcolsep. This allows for the text to be spread of 50% of the text block while still taking care of the column separation inherent to tabulars; and
  • R: a \raggedright paragraph column that mimics L.

The tabular column separation is removed on the outer edges of both L and R using @{}. Other alignment options are also possible, together with vertical spacing between tabular and the rest of the document content.

Note that, since the content is placed inside a tabular, it will not break across page boundaries.

share|improve this answer
add comment

If all you need is to flush short lines to the sides and want to input them on a line-by-line basis, you don't require any environment whatsoever, because \hfill will suffice.

\documentclass[12pt, a4paper]{article}
\begin{document} 
\parbox{5cm}{ \parindent=.5cm % just for show

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

\noindent
line 1 \hfill line a\\
line 2 \hfill line b\\
line 3 \hfill line c

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

}
\end{document} 

To keep the display small I have put everything in a narrow parbox. Here's the output: enter image description here

share|improve this answer
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.