4

Is there a way to do this?

enter image description here

My hunch is that I can simulate this by creating a table that has 20 columns, no separators, use the | as a manual column separator, and then draw a rectangle that can span rows (not sure how to do that exactly, but its probably possible.

I have a strong suspicion that this way of doing it is rather silly. What is the better way?

soandos
  • 2,211
  • 2
  • 23
  • 35

1 Answers1

5

Your request looks like a normal Gantt-Chart. Therefor you can use packages like pgfgantt (based on TikZ) or pst-gantt (based on PSTricks).

The following example uses pgfgannt.

enter image description here

\documentclass[]{article}
\usepackage{tikz}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}%
[hgrid=true,
 vgrid={*4{red,dashed}, *1{black},*4{red,dashed}, *1{black},*4{red,dashed}, *1{black},*4{red,dashed}, *1{black}},
 bar/.style={fill=gray}]{20}
\gantttitlelist{1,...,20}{1} \\
\ganttbar{A}{1}{3} \\
\ganttbar{B}{4}{9} \\
\ganttbar{C}{10}{14} \\
\ganttbar{D}{15}{18} \\
\ganttbar{E}{19}{20}
\end{ganttchart}
\end{document}

Soandos mentioned that he get the warning:

/tikz/*1{black}' and I am going to ignore it.

I don't get this warning and so I will provide my file list:

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
    tikz.sty    2012/08/29 v2.10-cvs (rcs-revision 1.100)
     pgf.sty    2008/01/15 v2.10-cvs (rcs-revision 1.12)
  pgfrcs.sty    2010/11/07 v2.10-cvs (rcs-revision 1.25)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v2.10-cvs (rcs-revision 1.7)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
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
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
  pgfsys.sty    2012/03/30 v2.10-cvs (rcs-revision 1.38)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2008/07/18  (rcs-revision 1.7)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v2.10-cvs (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v2.10-cvs (rcs-revision 1.1)
  pgffor.sty    2012/08/27 v2.10-cvs (rcs-revision 1.22)
 pgfkeys.sty    
 pgfkeys.code.tex
 pgfmath.sty    
 pgfmath.code.tex
  pgffor.code.tex
    tikz.code.tex
pgfgantt.sty    2012/01/25 v3.0 Draw Gantt diagrams with TikZ
supp-pdf.mkii
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 ***********
Moriambar
  • 11,466
Marco Daniel
  • 95,681
  • I am getting an warning that says "I do not know the key '/tikz/*1{black}' and I am going to ignore it." The error shows up by the \end{ganttchart} declaration – soandos May 02 '13 at 08:06
  • @soandos: I get no warning. Maybe we are using different versions. I will add my file list. – Marco Daniel May 02 '13 at 08:21
  • How can I get that list to print out? – soandos May 02 '13 at 08:24
  • @soandos: Add \listfiles to your preamble. See: http://tex.stackexchange.com/questions/13304/which-package-version-am-i-using/13305#13305 – Marco Daniel May 02 '13 at 08:26
  • Since the document does not compile, I am unable to get such a list, I just have the files names an locations – soandos May 02 '13 at 08:34
  • 1
    @soandos put \end{document} straight after \begin{document} then you won't get a document but the run will finish cleanly and list all the packages in the preamble – David Carlisle May 02 '13 at 08:44
  • @DavidCarlisle Here is my list of files. Not sure what is different though – soandos May 02 '13 at 08:49
  • @soandos Marco's list has some key related packages loaded that you do not kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO) kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO) kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO) – David Carlisle May 02 '13 at 08:55
  • @DavidCarlisle I seem to have all of these packages installed (according to MikTex). Is there a reason why they would not be referenced? – soandos May 02 '13 at 08:59
  • @soandos: I guess you didn't copy the complete file list. The file list ends with ***********. By the way please show us your complete log-file. – Marco Daniel May 02 '13 at 09:11
  • The main difference is pgfsys.sty. I am using 2012/03/30 v2.10-cvs (rcs-revision 1.38) and you have 2010/06/30 v2.10 (rcs-revision 1.37). How to install a current version of TikZ? – Marco Daniel May 02 '13 at 09:14
  • Interesting. The latest version the MikTex has is from 2011-11-05, but after uninstalling and reinstalling the package, I still end up with the same date that I had previously (and it is still not as recent as yours) – soandos May 02 '13 at 09:19
  • @soandos: Did you notice the link. Unfortunately the developers of TikZ doesn't provide any updates on CTAN. Every user must install it manual. – Marco Daniel May 02 '13 at 09:23