3

I'm using

\documentclass[10pt,twocolumn]{article}

\usepackage{hhline}
\usepackage[left=1cm,right=1cm,top=1cm,bottom=2cm]{geometry}

\addtolength{\columnsep}{0.4cm}
\addtolength{\textwidth}{\columnsep}

\setlength\parindent{0pt}

\begin{document}

\begin{tabular}{ll}
1 & Aron climbed down a narrow gap between  \\
2 & the walls of the canyon. Suddenly a large  \\
3 & rock fell on his right arm. It trapped his arm  \\
4 & against the canyon wall. He tried to pull is  \\
5 & arm out, but the rock weighed 360 kilograms.\\
\end{tabular}

\end{document}

I'd like to have the four lines of each long text justified, is there way to accomplish this?


I've added a more complete example to show what I want.

2
  • Are you sure you want to use a tabular for this? Are you trying to number lines? There's no way to justify each line without awful interword spacing.
    – Alan Munn
    Mar 7, 2016 at 2:01
  • I'll upload a photo so that you can see the result I want.
    – Schwale
    Mar 7, 2016 at 2:06

1 Answer 1

2

I'm assuming this is what you want, but it will ultimately look awful (or a LaTeX imitation of MSWord...)

To number the lines, I've just made a counter, which will save you some typing. For the spacing, I've used a macro from Bruno LeFloch which splits space delimited text and applies a macro to it. I've then appended \hfill to each word in the cell, using the collectcell package. This fills out each line with as much space as needed to fill the line width. Ugh. :)

\documentclass[10pt,twocolumn]{article}

\usepackage{array}
\usepackage{collcell}
\usepackage{xparse}
\usepackage{etoolbox}

\ExplSyntaxOn
% This macro based on https://tex.stackexchange.com/a/25704/
\NewDocumentCommand {\hfillspace}
  { > { \SplitList { ~ } } m }
  { \tl_map_inline:nn {#1} { ##1\hfill } }
\ExplSyntaxOff

\newcounter{myline}
\AtBeginEnvironment{tabular}{\setcounter{myline}{0}}

\begin{document}
\begin{tabular}{>{\stepcounter{myline}\themyline\quad\collectcell\hfillspace}p{.9\columnwidth}<{\endcollectcell}}
Aron climbed down a narrow gap between\\
the walls of the canyon. Suddenly a large\\
rock fell on his right arm. It trapped his arm\\
against the canyon wall. He tried to pull is\\
arm out, but the rock weighed 360 kilograms. 
\end{tabular}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .