7

I wish to write the code of the picture displayed below..

How do I code this? I am confusedenter image description here

musarithmia
  • 12,463
Zay
  • 331

2 Answers2

9

One simple way to put a short portion of text into two columns, if the rows need to line up, is to use the basic tabular environment. You can use the p specification to get a row with wrapped text.

\documentclass{article}
\begin{document}
\begin{tabular}{l p{0.5\linewidth}}
Line 1 on the left  & Line 1 on the right\\
Line 2 on the left  & Line 2 on the right overflowing with a lot of extra text\\
\end{tabular}
\end{document}

For beginners in TeX who find this answer helpful, you can find a basic introduction to LaTeX by entering texdoc lshort at a terminal.

musarithmia
  • 12,463
  • Is there a way to allow spaces to align the columns in the source document without getting overfull hbox errors? – Andrew Hundt Sep 15 '15 at 04:47
  • @AndrewHundt Yes, TeX ignores most extra whitespace so you can insert spaces or tabs between columns to align the source code. Overfull hboxes happen when there is too much text in a table cell to fit in the box allotted to it, among other reasons. – musarithmia Sep 15 '15 at 05:38
3

As seen on https://stackoverflow.com/questions/1491717/how-to-display-a-content-in-two-column-layout-in-latex there are multiple useful options:

Multicol

Use the multicol package (if you omit the \columnbreak, the columns will balance automatically):

\usepackage{multicol}
\begin{multicols}{2}
Column 1
\columnbreak
Column 2
\end{multicols}

Minipages

Alternatively, for precise control, add a minipage:

\begin{minipage}[position]{width}
text
\end{minipage}

You may also find this useful: How do I force a column-break in a multi-column page?

xeruf
  • 175