I’d like table cells to have automatic line breaking, but the first line should be on the left side of the cell and subsequent lines aligned to the right side of the cell, as if the first line were \raggedright and subsequent lines were \raggedleft.


One of my Glisterings columns in TUGboat, 28-2, 2007 (https://tug.org/TUGboat/tb28-2/tb89glister.pdf) discusses over 8 different unusual paragraph shapes, among which is \raggedlefthenright that provides the layout you are after.

% paraprob.tex  SE 593461
  \leftskip   =0pt plus 1fill
  \rightskip  =0pt plus 1fil
  \everypar{\hskip 0pt plus -1fill\relax}%



This paragraph is set following a \verb!\raggedrightthenleft!
declaration. It looks strange to me but there you go.

This paragraph follows the identical declaration. \lipsum[1]

Note that some lines in the previous paragraph are fully justified because
they are just the right length to fill the textwidth.


enter image description here

  • Thanks for the somewhat more comprehensive answer! It does look strange in a paragraph of prose, but in the context I’m using it, in table cells with Bible references, I think it looks better than any alternative.
    – dpk
    Apr 19 '21 at 9:00

Using a trick from the gmverse source, we can define our own tabularx column type:

    \leftskip=0pt plus 1fill%
    \rightskip=0pt plus 1fil%
    \hskip 0pt plus -1fill\relax{}}X}


\begin{tabularx}{0.8\linewidth}{r | U}
1 & \blindtext \\
2 & \blindtext \\

Example rendered

The same trick with leftskip and rightskip (note the use of fill vs fil!) can be used to define other environments and commands with similar behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.