0

This question already has an answer here:

Is there a way to let Latex automatically insert a line break not when it runs out of space, but earlier so that the lines in that paragraph have roughly equal length? In my case, I am trying to create this effect with a sentence that is just a little longer than one line. To make sure I have more than two words in the second line of my centered environment.

Such a function exists in Adobe InDesign, for example; it's called "Balance Ragged Lines" there.

OK, thanks for the comments, I got it right in one case. In the other case, the @flushglue just deletes my margins for that paragraph:

\documentclass[12pt,parskip=full]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[australian]{babel}
\usepackage{geometry}
\geometry{a4paper}
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist 
\clubpenalty = 10000
\widowpenalty = 10000
\usepackage{kpfonts}
\usepackage[nodayofweek]{datetime}
\longdate
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{array, bm, booktabs, microtype, paralist, subfig, todonotes, verbatim}
\usepackage{csquotes}
\begin{document}
\begin{changemargin}{1cm}{1cm}
{\csname @flushglue\endcsname=0pt plus .25\textwidth
\begin{center}
Does this statement resonate with your own interpretation of Hamlet?
\end{center}}
\end{changemargin}
\end{document}

If you remove the flushright command, the additional margins will be applied.

Is there a way to get both?

marked as duplicate by Werner, Xavier, T. Verron, David Carlisle, Mico Jun 8 '13 at 11:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Probably your question has already an answer. See Is there a way to avoid short lines?. – karlkoeller Jun 8 '13 at 6:03
  • as @karlkoeller comments this is essentially a duplicate of the linked question, it's worth noting that where I used center there you could also use flushleft if you wanted the lines all to start at the left margin, the same \@flushglue is used in both environments. – David Carlisle Jun 8 '13 at 10:44
  • I changed the question slightly. – chaosflaws Jun 8 '13 at 11:10