How can I set 2 pieces of text next to each other?

1,096

Several possibilities:

enter image description here

\documentclass{article}

\begin{document}

\setlength\parskip{1cm}

\section*{tabular}

\begin{tabular}{p{3cm}p{4cm}}
\raggedright
some text here on the left some text here on the left   &
\raggedleft
some more text on the right some more text on the right
\end{tabular}


\begin{tabular}{p{3cm}p{4cm}}
\centering
some text here on the left some text here on the left   &
\centering
some more text on the right some more text on the right
\end{tabular}

\section*{parbox}

\parbox[t]{3cm}{
\raggedright
some text here on the left some text here on the left}%
\hspace{1cm}%
\parbox[t]{4cm}{
\raggedleft
some more text on the right some more text on the right}

\parbox[t]{3cm}{
\centering
some text here on the left some text here on the left}%
\hspace{1cm}%
\parbox[t]{4cm}{
\centering
some more text on the right some more text on the right}

\section*{minipage}

\begin{minipage}[t]{3cm}
\raggedright
some text here on the left some text here on the left
\end{minipage}%
\hspace{1cm}%
\begin{minipage}[t]{4cm}
\raggedleft
some more text on the right some more text on the right
\end{minipage}

\begin{minipage}[t]{3cm}
\centering
some text here on the left some text here on the left
\end{minipage}%
\hspace{1cm}%
\begin{minipage}[t]{4cm}
\centering
some more text on the right some more text on the right
\end{minipage}



\end{document}
Share:
1,096

Related videos on Youtube

MariosA
Author by

MariosA

Updated on May 14, 2020

Comments

  • MariosA
    MariosA over 2 years

    I am new to LaTeX with very little knowledge. I've been experimenting with techniques like minipage, grouping, flushleft/flushright and others to get to have 2 pieces of texts (I like to think of it like individual textboxes as they would called in MS Word) next to each other, aligned at the top.

    I can't provide any example in LaTeX as my knowledge is very limited.

    I would greatly appreciate any help.

    • AndréC
      AndréC over 2 years
      Hi and welcome. Can you add a screenshot or freehand drawing of the result you are looking for?
    • Piroooh
      Piroooh over 2 years
      Welcome here ! There are several ways to achieve what you want. And it's hard for us to imagine what you've in mind. Does a two column format fits your requirements ?
    • John Kormylo
      John Kormylo over 2 years
      If you are doing translations, paracol is the package of choice.
    • MariosA
      MariosA over 2 years
      Thank you everybody for your responses. I was looking for something like David Carlisle posted, with 2 text pieces right next to each other. I also saw another really helpful answer a couple hours ago but it is deleted now. John Kormylo, can you please explain the usage of the paracol package?
    • MariosA
      MariosA over 2 years
      @Piroooh Two columns is what I have in mind, but not consistent 2 columns on the entire document. 2 columns of text for half a page maybe, then normal text with normal width.
  • Admin
    Admin over 2 years
    \section*{minpage} -> \section*{minipage}, please. ;-)
  • David Carlisle
    David Carlisle over 2 years
    @Schrödinger'scat it's Schrödinger's "i" it is there until you look for it.
  • Admin
    Admin over 2 years
    Purely imaginary, I think.
  • David Carlisle
    David Carlisle over 2 years
    @Schrödinger'scat seamless repair completed. No one will notice.
  • Admin
    Admin over 2 years
    I always thought imaginary i's need to be upright. Yours looks italic, almost egregious... ;-)
  • MariosA
    MariosA over 2 years
    Thanks for your response! That is one way of doing it, I tried it.