[OS X TeX] Suggestion for TeXShop

Bruno Voisin bvoisin at mac.com
Tue Feb 27 17:16:51 CET 2007


Le 27 févr. 07 à 16:16, Peter Dyballa a écrit :

> Am 27.02.2007 um 15:35 schrieb Christian Burk:
>
>> I included a lot of my images with \textwidth and got some  
>> Overfull hboxes. How do you treat this kind of warning?
>
> Reduce imagewidth. Every image is surrounded by some (frame) space.  
> So an image's width should not be \textwidth (and maybe it should  
> be a bit shifted into the right margin that it falls completely  
> into the text area) – except you set this extra space to zero.

You may try using \linewidth instead of \textwidth. \linewidth is  
originally \textwidth in single-column mode and \columnwidth in multi- 
column mode, and then it is reduced in list-based environments (such  
as itemize, quote, etc.) by \leftmargin and \rightmargin so as to  
adjust to list level (for imbricated lists).

You may also want to look for trailing spaces and spurious line  
breaks (try to comment them in the input text), yielding unwanted  
horizontal spaces in the output.

Other than that, I'm not sure space is added on the left and right of  
the images. Except maybe:

- In case you put \fbox around the image, to draw a frame around it.  
In this case a space of \fboxsep is added between the frame and its  
content. Just \setlength{\fboxsep}{0pt}.

- In case you include several images within a tabular environment,  
just make sure to remove the spaces on the left and right of the  
environment by using the @{} coumn specifier, as in \begin{tabular}{@ 
{}c@{\quad}c@{}}.

- In case you put the image at the start of a paragraph. Make sure to  
use \noindent, or \setlength{\parindent}{0pt}.

For example, to verify you're catching all possibly unwanted spaces,  
imagine you've got a graphics logo.pdf and try:

\documentclass[draft]{article}
\usepackage{graphicx}
\setlength{\parindent}{0pt}
\begin{document}
\hrule
\smallskip
\newlength{\figwidth}
\setlength{\figwidth}{\linewidth}
\addtolength{\figwidth}{-1em}
\divide\figwidth by2
\begin{tabular}{@{}c@{\quad}c@{}}
   \includegraphics[width=\figwidth]{logo} &
   \includegraphics[width=\figwidth]{logo} \\
   \includegraphics[width=\figwidth]{logo} &
   \includegraphics[width=\figwidth]{logo}
\end{tabular}
\par
\smallskip
\hrule
\end{document}

In this case the width of each figure is set to be (\linewidth-1em)/2  
(1em being the width of \quad). The above yields no overfull \hbox on  
my setup.

Finally, to catch all overfull \hboxes without referring to the log,  
you may restore plain TeX's default which is to highlight such  
overfull boxes with big black squares. Two possibilities:

- Use the [draft] option. The figures won't be shown (a rectangle  
will be drawn instead, with the name of the figure file inside), and  
overfull \hboxes will be shown.

- Redefine \overfullrule as in \setlength{\overfullrule}{5pt}.

Hope this helps,

Bruno Voisin


------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the macostex-archives mailing list