0

MWE:

\documentclass{article}
\begin{document}
\begin{tabular}{|p{2cm}|}
sdlj lsadfj sdlafjk sdlfj a \\
\end{tabular}
\end{document}

screnshot1

The last line is flushed left. I want it to justify.

Similar can be obtained with \linebreak:

sdlj lsadfj sdlafjk sdlfj a \linebreak\\

screenshot2

But it has an obvious side effect: an excessive line. How to justify it without an excessive line? I found a trick for paragraphs, but it doesn't work for cells.

  • I'm not able to experiment so this is just a guess. Try wrapping the content of the cell in braces, and using the "trick" as the last thing inside the braces. – barbara beeton Sep 18 at 19:01
  • 1
    If I replace your \linebreak with \parfillskip 0pt, it works, no braces required. – Steven B. Segletes Sep 18 at 19:03
  • This is related to Is there a tool that makes paragraphs into rectangles? (possible duplicate). – Werner Sep 18 at 19:04
  • 1
    @StevenB.Segletes works this way, thanks. – bodqhrohro Sep 18 at 19:10
  • 1
    However, it will fail if any line ends up with just a single word, as in \begin{tabular}{|p{2cm}|} succulent cucumbers are delectible\parfillskip 0pt\\ \end{tabular}. It goes back to Ulrike's comment, I am sure. – Steven B. Segletes Sep 18 at 19:15

Your Answer

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

Browse other questions tagged or ask your own question.