gantt.sty 与 \framebox{} 之间的冲突

gantt.sty 与 \framebox{} 之间的冲突

我最近一直在使用爱德华·塔夫特启发式文件(讲义选项)用于我的文档和甘特图包。但是,如果我\usepackage{gantt}在序言中放入,它会阻止一些以前运行良好的代码(图形环境中的一组框架框)工作。有没有办法解决这个问题?我认为这与每个包中变量的命名空间有关,但我对 latex 标记了解不够多,无法检查这一点。

我在装有 OSX 的 Mac 上使用 TeXshop,工作文件夹中有两个 .sty 文件。问题似乎出在以下结构上:

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

我在其中制作了一个框架框(并在框架框中放置了一个图像,但当其中没有任何图像时却发生了错误)。

以下是我正在使用的代码:

\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}

\listfile的内容如下:

*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
 ***********

答案1

我把这个作为答案发布出来,因为它是对你问题的回答,即使你的问题实际上不是正确的问题。和之间没有冲突tufte-handoutgantt.sty如果你制作了一份真正的最小文档来查找问题的原因,你就会自己发现这一点。(这就是为什么构建最小文档既重要又有益的原因。)这是一个最小显示您遇到的问题的文档:

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

\begin{document}

\framebox(150,150){}

\end{document}

gantt.sty这表明命令和存在问题\framebox。看一下gantt.sty就会发现问题:它全局设置了\unitlength(1cm) 的值,而不是定义自己的长度。 命令和\unitlength中也使用了它\framebox,它试图制作一个边长为 150cm 的正方形,比页面稍大一些。

修复gantt.sty相对简单,但需要小心进行。

  1. 添加\newlength{\ganttunitlength}
  2. 代替全部\unitlength风格实例\ganttunitlength
  3. 从 gantt.sty 中删除\makeatletter\makeatother(它们不应该在包中使用)
  4. 更改\usepackage\RequirePackage(等效包命令)
  5. 添加\ProvidesPackage{gantt.sty}[2011/03/14 Gantt diagrams]为第一行

显然gantt.sty还没有为黄金时段做好准备。我已向其作者发送了修复版本。

更新:现在有新版本gantt.sty发布在作者的网站

答案2

我对你的测试文件没有任何问题。将其放入\listfiles你的序言中并比较文件列表,该文件列表位于你的日志文件的末尾:

 *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    2010/01/28 v2.1 Provides the ifpdf switch (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
titlesec.sty    2007/08/12 v2.8 Sectioning titles
titletoc.sty    2007/08/12 v1.6 TOC entries
hyperref.sty    2010/12/16 v6.81z Hypertext links for LaTeX
 ltxcmds.sty    2010/04/26 v1.7 LaTeX kernel commands for general use (HO)
pdftexcmds.sty    2010/04/01 v0.9 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/message (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
kvsetkeys.sty    2010/03/01 v1.9 Key value parser (HO)
etexcmds.sty    2010/01/28 v1.3 Prefix for e-TeX command names (HO)
pdfescape.sty    2010/03/01 v1.9 Provides hex, PDF name and string conversions 
(HO)
  ifvtex.sty    2010/03/01 v1.5 Switches for detecting VTeX and its modes (HO)
 hycolor.sty    2009/12/12 v1.6 Color options of hyperref/bookmark (HO)
xcolor-patch.sty    2009/12/12 xcolor patch
letltxmacro.sty    2008/06/24 v1.3 Let assignment for LaTeX macros (HO)
kvoptions.sty    2010/02/22 v3.7 Keyval support for LaTeX options (HO)
  pd1enc.def    2010/12/16 v6.81z Hyperref: PDFDocEncoding definition (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable integer calculations (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
   puenc.def    2010/12/16 v6.81z 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)
bigintcalc.sty    2007/11/11 v1.1 Expandable big integer calculations (HO)
atbegshi.sty    2010/03/25 v1.12 At begin shipout hook (HO)
 hpdftex.def    2010/12/16 v6.81z Hyperref driver for pdfTeX
atveryend.sty    2010/03/24 v1.5 Hooks at very end of document (HO)
rerunfilecheck.sty    2010/03/16 v1.6 Rerun checks for auxiliary files (HO)
uniquecounter.sty    2009/12/18 v1.1 Provides unlimited unique counter (HO)
ragged2e.sty    2009/05/21 v2.1 ragged2e Package (MS)
everysel.sty    2009/05/30 v1.1 EverySelectfont Package (MS)
geometry.sty    2010/09/12 v5.6 Page Geometry
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    2010/01/10 v2.4 Robust letterspacing (RS)
setspace.sty    2000/12/01 6.7 Contributed and Supported LaTeX2e package
  natbib.sty    2010/09/13 8.31b (PWD, AO)
bibentry.sty    2007/10/30 1.5 (PWD)
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    2010/11/26 v0.05c 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    2010/10/13 v2.10 (rcs-revision 1.76)
     pgf.sty    2008/01/15 v2.10 (rcs-revision 1.12)
  pgfrcs.sty    2010/10/25 v2.10 (rcs-revision 1.24)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v2.10 (rcs-revision 1.7)
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    2010/04/23 v1.9 graphics configuration of TeX Live
  pgfsys.sty    2010/06/30 v2.10 (rcs-revision 1.37)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2008/07/18  (rcs-revision 1.7)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v2.10 (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v2.10 (rcs-revision 1.1)
  pgffor.sty    2010/03/23 v2.10 (rcs-revision 1.18)
 pgfkeys.sty    
 pgfkeys.code.tex
  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    2010/05/14
  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    2010/04/30 v2.40 Cross-referencing by name of section
refcount.sty    2008/08/11 v3.1 Data extraction from references (HO)
gettitlestring.sty    2009/12/18 v1.3 Cleanup title references (HO)
      zz.out
      zz.out
supp-pdf.mkii
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2007/09/30 v1.0 Managing graphics extensions (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 ***********

相关内容