Text Formattingsetting \tolerate environment

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
RAPhomme
Posts: 7
Joined: Thu Mar 25, 2010 11:30 pm

setting \tolerate environment

Post by RAPhomme »

Hello,

I read in the UK Tex FAQ that it's possible to use the following to define an environment that will change the spacing/hyphenation tolerance in the surrounded paragraphs:

Code: Select all

\newenvironment{tolerant}[1]{%
  \par\tolerance=#1\relax
}{%
  \par
}
This is exactly what I want to do (I'm getting a couple of overfull boxes I want to adjust). But as a novice user, I don't know (and I can't find anywhere online) how to implement this idea.

I put the \newenvironment{tolerant} command in the preamble. But then what exactly do I put around the paragraphs I want to affect?

Code: Select all

\begin{tolerant}{300}
paragraphs to be affected
\end{tolerant}
doesn't seem to do anything. Am I missing something simple? The more basic and explicit the advice the better! Thanks for your help, RP
Last edited by RAPhomme on Wed Jan 19, 2011 5:34 pm, edited 1 time in total.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: setting \tolerate environment

Post by josephwright »

Could you post a full minimal example? Just altering the tolerance will not necessarily deal with problematic paragraphs.
Joseph Wright
RAPhomme
Posts: 7
Joined: Thu Mar 25, 2010 11:30 pm

setting \tolerate environment

Post by RAPhomme »

Thanks for the response.

I realized my error when I looked back at the definition of sloppypar. For some reason I had it in my head that the infinite setting for \tolerance was 1000, when in fact it's 10000. Sloppypar sets it to 9999 (not 999 as I was thinking), so that's why it worked in my problematic paragraph. Once I had the units right, I could use \begin{tolerant} to dial in the precise amount of \tolerance to effect the change I wanted, without having to go all the way to 9999. As it turned out, my line flipped from overfull at \tolerance=1881. The wrong ceiling on \tolerance I had in mind would never allow me to reach the adjustment I needed!

Anyway, I can now recommend the tolerant environment as a very useful solution to a common problem. RP
Post Reply