How can I set 2 pieces of text next to each other?
1,096
Several possibilities:
\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}
Related videos on Youtube

Author by
MariosA
Updated on May 14, 2020Comments
-
MariosA over 3 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 over 3 yearsHi and welcome. Can you add a screenshot or freehand drawing of the result you are looking for?
-
Piroooh over 3 yearsWelcome 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 over 3 yearsIf you are doing translations, paracol is the package of choice.
-
MariosA over 3 yearsThank 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 over 3 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 over 3 years
\section*{minpage}
->\section*{minipage}
, please. ;-) -
David Carlisle over 3 years@Schrödinger'scat it's Schrödinger's "i" it is there until you look for it.
-
Admin over 3 yearsPurely imaginary, I think.
-
David Carlisle over 3 years@Schrödinger'scat seamless repair completed. No one will notice.
-
Admin over 3 yearsI always thought imaginary i's need to be upright. Yours looks italic, almost egregious... ;-)
-
MariosA over 3 yearsThanks for your response! That is one way of doing it, I tried it.