GeneralToo much empty space at the end of the line

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Too much empty space at the end of the line

Post by avp3000 »

Hello everybody,

Normally, when I use \\ to start a new line in Latex, the previous line get's justified, that is, the space between the words is justified, so that the last word ends at the very end of the line. However, when I do this in a list, Latex doesn't justify the text with the result that the last word end in the middle of the line. Here is my example:

Code: Select all

\begin{itemize}

\item bla bla bla

\item Indifference condition for the mixed strategy equilibrium with\\
$Prob{\text{Reporting}}=p$

\end{itemize}
I want "with" to end at the end of the line. Can you help me?

Thank you.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Too much empty space at the end of the line

Post by Stefan Kottwitz »

Hi avp3000,

\\ forces a new line without justifying it. If the line is too short, you could prevent the breaking of the math formula and increase the tolerance. Have a look at this quick example with some text to compare:

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage{amstext}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{itemize}\tolerance=3000
\item bla bla bla
\item Indifference condition for the mixed strategy equilibrium with\\
$Prob{\text{Reporting}}=p$
\item Indifference condition for the mixed strategy equilibrium with 
${Prob{\text{Reporting}}=p}$
\end{itemize}
Indifference condition for the mixed strategy equilibrium with\\
$Prob{\text{Reporting}}=p$
\end{document}
Stefan
LaTeX.org admin
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Too much empty space at the end of the line

Post by gmedina »

avp3000 wrote:...Here is my example:

Code: Select all

\begin{itemize}

\item bla bla bla

\item Indifference condition for the mixed strategy equilibrium with\\
$Prob{\text{Reporting}}=p$

\end{itemize}
I want "with" to end at the end of the line. Can you help me?...
With the \linebreak command you will also get what you desire (although I consider it to be of poor quality; somehow it has the taste and looks of the outcome produced by a well known word processor).

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{itemize}
  \item bla bla bla
  \item Indifference condition for the mixed strategy equilibrium with\\
  $Prob{\text{Reporting}}=p$
  \item Indifference condition for the mixed strategy equilibrium with\linebreak
  $Prob{\text{Reporting}}=p$
\end{itemize}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Re: Too much empty space at the end of the line

Post by avp3000 »

Dear Stefan und Gmedina,

Thank you very much for the valuable hints.

Gmedina, you're right that the \linebreak command produces a look very similar to word and I admit, that's not optimal, but I find it somewhat better than the line ending about 25% before the end of the row. I guess that for this particular situation there's no good solution.

Stefan, I tried the \tolerance parameter. When I gave it values between 500 and 3000, it just had the "Prob{Reporting}=" part in the same line and "p" on the next line. However, that's not optimal, since it ended at the very end of the sheet (actually slide, since this is a presentation). When I gave it a value of 10000 it produced the same effect as the \linebreak command. What exactly is the meaning of the \tolerance parameter?

Thank you,
Alexander
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Too much empty space at the end of the line

Post by Stefan Kottwitz »

Hi Alexander,

perhaps you noticed that I used additional braces inside the math expression:

Code: Select all

${Prob{\text{Reporting}}=p}$
The reason behind was to prevent the linebreak inside the expression. TeX does not break it if you enclose the expression this way. So the mentioned problem will not occur. There are other ways to allow or to prevent breaks, for instance the commands \allowbreak and \nobreak.

The \tolerance parameter tells TeX how much badness is allowable without error in line breaking and can range from 0 to 10000. The default value is 200. If you are interested in knowing the exact linebreak calculations you may read about it in the freely available TeXbook by Knuth.

Stefan
LaTeX.org admin
Post Reply