Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\documentclass{article}
\begin{document}
\hsize 200pt

%A wonderful serenity has taken possession of my entire soul, like these sweet
%mornings of spring which I enjoy with my whole heart.

\[ e=mc^2 \]
\end{document}

gives me an overfull hbox:

Overfull \hbox (22.0021pt too wide) in paragraph at lines 9--9
[][] 

using $$...$$ instead of \[...\] works fine.

Using a soon-to-be-released tool for visual debugging shows me a strange box sticking out to the right:

strangeboxstickingouttotheright

share|improve this question
    
I had to throw a dice which answer to accept. Both are perfect. Thanks. –  topskip Feb 22 '12 at 12:51
add comment

2 Answers 2

up vote 12 down vote accepted

Because you changed the TeX primitive \hsize without telling LaTeX you had done so. You should change \linewidth preferably by using a LaTeX display environment construct that keeps all the LaTeX data consistent. Or for the whole document set \textwidth in the preamble.

share|improve this answer
add comment

LaTeX's \[ refers to \linewidth, not to \hsize. From latex.ltx:

\def\[{%
   \relax\ifmmode
      \@badmath
   \else
      \ifvmode
         \nointerlineskip
         \makebox[.6\linewidth]{}%
      \fi
      $$%%$$ BRACE MATCH HACK
   \fi
}

So you should change \linewidth instead, or redefine \[ using \hsize. Try, and you will see the warning go away.

This shows again that mixing LaTeX and TeX code can sometimes be dangerous. If there's a LaTeX equivalent for a TeX command (or length), I would prefer the LaTeX command when writing LaTeX.

Regarding using the different widths, here's some further advice: Difference between \textwidth, \linewidth and \hsize.

share|improve this answer
    
Arrg, it's me, Mico, once again accidentally downvoting instead of upvoting an answer. Sorry! Please edit your answer a tiny bit to give me chance to change my vote. Thanks. –  Mico Feb 22 '12 at 11:25
    
Thanks! I'll delete my comments in a few minutes as they're now irrelevant. :-) –  Mico Feb 22 '12 at 12:49
add comment

Your Answer

 
discard

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.