[Tex/LaTex] Conflict between gantt.sty and \framebox{}

incompatibilitypackagestufte

I've recently been using the Edward Tufte inspired style file (the handout option) for my documents and a Gantt chart package. However, if I put \usepackage{gantt} in my preamble it prevents some code that previously worked fine (a set of frameboxes in a figure environment), from working. Is there any way around this issue? I assume it is something to do with the namespace of variables in each package, but I don't know enough latex markup to be able to inspect this.

I'm using TeXshop on a Mac with OSX, and have both .sty files in the folder where I am working. The problem appears to be with this structure:

\framebox(150,150){\includegraphics[width=0.3\linewidth]{image1.pdf}}

where I make a framebox (and place an image in the framebox, though the error occurs without any image in there).

Here is the code that I am using:

\documentclass[justified,marginals=raggedright]{tufte-handout}% justification

%\geometry{showframe}% for debugging purposes -- displays the margins

\usepackage{amsmath}
\usepackage{gantt}

% Set up the images/graphics package
\usepackage{graphicx}

\usepackage{minibox}
\setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
\graphicspath{{graphics/}}

\title{Analysis}
\author[]{The authors}
\date{\today{}}  % if the \date{} command is left out, the current date will be used

% The following package makes prettier tables.  We're all about the bling!
\usepackage{booktabs}

% The units package provides nice, non-stacked fractions and better spacing
% for units.
\usepackage{units}

% The fancyvrb package lets us customize the formatting of verbatim
% environments.  We use a slightly smaller font.
\usepackage{fancyvrb}
\fvset{fontsize=\normalsize}

% Small sections of multiple columns
\usepackage{multicol}

% Provides paragraphs of dummy text
\usepackage{lipsum}

% These commands are used to pretty-print LaTeX commands
\newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically
\newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument
\newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument
\newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment
\newcommand{\docenv}[1]{\textsf{#1}}% environment name
\newcommand{\docpkg}[1]{\texttt{#1}}% package name
\newcommand{\doccls}[1]{\texttt{#1}}% document class name
\newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name

\begin{document}

\maketitle% this prints the handout title, author, and date

%\printclassoptions

\section{Objective of Analysis} \label{sec:objective}

\begin{figure*}[htbp]
\mbox{
\framebox(150,150){}
\framebox(150,150){}
\framebox(150,150){}
}
 \caption{Data sources used in this analysis;}
 \label{fig:map1} 
\end{figure*}
The analysis description is here


\end{document}

The contents of \listfile is as follows:

*File List*
tufte-handout.cls    2009/12/11 v3.5.0 Tufte-handout class
tufte-common.def    2009/12/11 v3.5.0 Common code for the Tufte-LaTeX styles
 xkeyval.sty    2008/08/13 v2.6a package option processing (HA)
 xkeyval.tex    2008/08/13 v2.6a key=value parser (HA)
 xifthen.sty    2009/04/17 v1.3 Extended ifthen features
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
    calc.sty    2007/08/22 v4.3 Infix arithmetic (KKT,FJ)
  ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
 ifmtarg.sty    2009/09/02 v1.2a check for an empty argument
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
   ifpdf.sty    2009/04/10 v2.0 Provides the ifpdf switch (HO)
 ifxetex.sty    2009/01/23 v0.5 Provides ifxetex conditional
titlesec.sty    2007/08/12 v2.8 Sectioning titles
titletoc.sty    2007/08/12 v1.6 TOC entries
hyperref.sty    2009/10/09 v6.79a Hypertext links for LaTeX
  ifvtex.sty    2008/11/04 v1.4 Switches for detecting VTeX and its modes (HO)
 hycolor.sty    2009/10/02 v1.5 Code for color options of hyperref/bookmark (HO
)
xcolor-patch.sty    2009/10/02 xcolor patch
  pd1enc.def    2009/10/09 v6.79a Hyperref: PDFDocEncoding definition (HO)
etexcmds.sty    2007/12/12 v1.2 Prefix for e-TeX command names (HO)
infwarerr.sty    2007/09/09 v1.2 Providing info/warning/message (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
kvoptions.sty    2009/08/13 v3.4 Keyval support for LaTeX options (HO)
kvsetkeys.sty    2009/07/30 v1.5 Key value parser with default handler support 
(HO)
   puenc.def    2009/10/09 v6.79a Hyperref: PDF Unicode definition (HO)
     url.sty    2006/04/12  ver 3.3  Verb mode for urls, etc.
  bitset.sty    2007/09/28 v1.0 Data type bit set (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable integer calculations (HO)
bigintcalc.sty    2007/11/11 v1.1 Expandable big integer calculations (HO)
pdftexcmds.sty    2009/09/23 v0.6 LuaTeX support for pdfTeX utility functions (
HO)
ifluatex.sty    2009/04/17 v1.2 Provides the ifluatex switch (HO)
 ltxcmds.sty    2009/08/05 v1.0 Some LaTeX kernel commands for general use (HO)

atbegshi.sty    2008/07/31 v1.9 At begin shipout hook (HO)
 hpdftex.def    2009/10/09 v6.79a Hyperref driver for pdfTeX
ragged2e.sty    2009/05/21 v2.1 ragged2e Package (MS)
everysel.sty    1999/06/08 v1.03 EverySelectfont Package (MS)
geometry.sty    2008/12/21 v4.2 Page Geometry
geometry.cfg
changepage.sty    2009/10/20 v1.0c check page and change page layout
paralist.sty    2002/03/18 v2.3b Extended list environments (BS)
textcase.sty    2004/10/07 v0.07 Text only upper/lower case changing (DPC)
letterspace.sty    2009/03/27 v2.3d Robust letterspacing (RS)
setspace.sty    2000/12/01 6.7 Contributed and Supported LaTeX2e package
  natbib.sty    2009/07/16 8.31 (PWD, AO)
bibentry.sty    2007/10/30 1.5 (PWD)
     Jan.bbl
optparams.sty    2004/08/14 v0.9 multiple optional parameters in macros
placeins.sty    2005/04/18  v 2.2
mathpazo.sty    2005/04/12 PSNFSS-v9.2a Palatino w/ Pazo Math (D.Puga, WaS) 
  helvet.sty    2005/04/12 PSNFSS-v9.2a (WaS) 
beramono.sty    2004/01/31 (WaS)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
textcomp.sty    2005/09/27 v1.99g Standard LaTeX package
  ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
fancyhdr.sty    
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2009/08/25 v0.04m Graphics/color for pdfTeX
dvipsnam.def    1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
  svgnam.def    2007/01/21 v2.11 Predefined colors according to SVG 1.1 (UK)
multicol.sty    2008/12/05 v1.6h multicolumn formatting (FMi)
 amsmath.sty    2000/07/18 v2.13 AMS math features
 amstext.sty    2000/06/29 v2.01
  amsgen.sty    1999/11/30 v2.0
  amsbsy.sty    1999/11/29 v1.2d
  amsopn.sty    1999/12/14 v2.01 operator names
   gantt.sty    
    tikz.sty    2008/02/13 v2.00 (rcs-revision 1.27)
     pgf.sty    2008/01/15 v2.00 (rcs-revision 1.12)
  pgfrcs.sty    2008/02/20 v2.00 (rcs-revision 1.21)
  pgfrcs.code.tex
 pgfcore.sty    2008/01/15 v2.00 (rcs-revision 1.6)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2009/08/28 v1.8 graphics configuration of TeX Live
  pgfsys.sty    2008/02/07 v2.00 (rcs-revision 1.31)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2008/01/23  (rcs-revision 1.6)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v2.00 (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v2.00 (rcs-revision 1.1)
  pgffor.sty    2007/11/07 v2.00 (rcs-revision 1.8)
  pgffor.code.tex
    tikz.code.tex
 forloop.sty    2006/09/18 v3.0 For Loops for LaTeX
 minibox.sty    2009/04/21 v0.1 Another type of box.
booktabs.sty    2005/04/14 v1.61803 publication quality tables
   units.sty    1998/08/04 v0.9b Typesetting units
nicefrac.sty    1998/08/04 v0.9b Nice fractions
fancyvrb.sty    2008/02/07
  lipsum.sty    2005/01/26 v1.0 150 paragraphs of Lorem Ipsum dummy text
  ts1cmr.fd    1999/05/25 v2.5h Standard LaTeX font definitions
  t1pplj.fd    2004/09/06 font definitions for T1/pplj.
 nameref.sty    2007/05/29 v2.31 Cross-referencing by name of section
refcount.sty    2008/08/11 v3.1 Data extraction from references (HO)
     Jan.out
     Jan.out
supp-pdf.mkii
 ***********

Best Answer

I'm posting this as an answer, because it is an answer to your question, even though your question is not, in fact, the right question. There is no conflict between tufte-handout and gantt.sty; if you had produced a true minimal document to find what was causing the problem, you would have discovered this yourself. (This is why constructing minimal documents is both important and informative.) Here is a minimal document that shows the problem you are having:

\documentclass{article}
\usepackage{gantt} % comment out to see the correct output

\begin{document}

\framebox(150,150){}

\end{document}

This shows that there is a problem with gantt.sty and the \framebox command. A look at gantt.sty reveals the problem: it globally sets a value for \unitlength (1cm) instead of defining its own length. \unitlength is also used in the \framebox command and which tries to make a square 150cm on a side, which is a little bigger than the page.

The fix to gantt.sty is relatively simple, but needs to be done carefully.

  1. add \newlength{\ganttunitlength}
  2. replace all instances of \unitlength in the style with \ganttunitlength
  3. remove \makeatletter and \makeatother from gantt.sty (they shouldn't be used in packages)
  4. change \usepackage to \RequirePackage (equivalent package command)
  5. add \ProvidesPackage{gantt.sty}[2011/03/14 Gantt diagrams] as the first line

Clearly gantt.sty wasn't quite ready for primetime. I've sent its author a fixed version.

UPDATE: There is now a new version of gantt.sty posted on the author's web site.