TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a text style that is centered and places words on lines in such a way that it looks justified on the left and right sides? I'm not looking for a fixed justified text, but kind of boxing whose width will adapt depending on the words to place.

The idea to to prevent single words to be put on a new line, but rather to take more words from the previous line to make it look more justified.

Here is an example to make it clearer. I have a macro that does this:

% opening quote

On some occasions it produces a line with a single word, such as the following: centered text with single word on last line

This is not very balanced, so I would like something like: centered text with carriage return

Same amount of lines, but more balanced. It's easy enough to achieve when needed, by adding a manual carriage return, but I'm wondering if there's some kind of automatic style that would achieve this.

Reducing the width of the paragraph to be under 110mm is not an option because I need most quotes to be quite large, and even then, the same problem might happen with just about any fixed width anyway.

In a kind of similar issue (which may have the same solution), I have a box defined by:

% central quote

which produces justified output such as:

justified box with two lines

Occasionally though, there is not enough to fill a whole line, so I get:

justified box with one line

which would probably look better centered. Is there a standard approach to fix this?

share|improve this question
I don't understand how a text that is justified left and right can be considered centered at the same time. Centered implies for me that the left and right side are ragged. Could you explain the desired result starting from the behavior of the center environment? – Christian Lindig Apr 14 '11 at 17:56
So the effect you want is centred text, but with some penalty for a short last line, which would cause the overall line width to be shorter, yielding more lines, but a more even number of words per line? – Alan Munn Apr 14 '11 at 19:24
locally for the paragraph that you want to have all lines the same length, set \parfillskip=0pt and end the paragraph before returning to outer mode. this might result in some spacy lines if you don't adjust the width of the text block, but i don't know offhand how to do that automatically. – barbara beeton Apr 14 '11 at 19:30
Sorry, I understand my question is not very clear. I will give some examples. – ℝaphink Apr 14 '11 at 19:45
up vote 2 down vote accepted

This is a known problem with LaTeX (and a regression from plain TeX), and the reason for the the ragged2e package. Maybe using the \Centering command (or Center environment) from this package will do what you want. Or just load the package with the [newcommands] option and keep the rest of the document unchanged. You may have to fiddle with the ragged2e parameters to get good results.

share|improve this answer
That's very nice. I'm not sure I want to go as far as hyphenating in centered text though. Just putting words on a new line to equilibrate the width dynamically would be better in my case. – ℝaphink Apr 16 '11 at 18:22
If you want to avoid hyphenation in the centered text then just add \hyphenpenalty=10000 (and maybe \exhyphenpenalty=10000) to your definition of dvquote. – Lev Bishop Apr 16 '11 at 18:57
That's the kind of behaviour I wanted. Thank you. – ℝaphink Apr 16 '11 at 19:33
By the way, I'm using [french]{babel} but the hyphenation produced in the center environment seems to follow English rules. Is that normal? – ℝaphink Apr 16 '11 at 22:50

If I understand what you are asking for, you can accomplish this by changing the margins.

If you are using memoir, you might use the adjustwidth environment. I use the following to semi-automate the process. It adjusts both margins by the same amount, but if you want to modify only one, it should point you in the right direction. (You still have to experiment to get the right width.)

%+ This will compute the absolute adjustment (in points) by which each margin must be increased

%+ to result in a \linewidth of the specified size. The value it provides should be used to

%+ change both the left and right margins, as shown in the usage example below. Left as an

%+ exercise for the user: specifying unequal proportions for left and right margin adjustment.

%+ Usage:

%+ \RKadjto{20em}\begin{adjustwidth}{\RKadj}{\RKadj}


%+ \end{adjustwidth}

  \typeout{RIK adjusting each margin \string\RKadj\space=\space\the\RKadj}
share|improve this answer
Thanks for your answer. I'm using koma's scrbook and I have fixed all my margins already. Also, my centered text is inside a parbox, so the document margins won't affect it. – ℝaphink Apr 15 '11 at 15:32
The adjustwidth environment in memoir is adapted from the changepage package, so you could try using that with scrbook. – Alan Munn Apr 15 '11 at 16:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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