2

I am trying to draw the attached diagram in Tex (the attached is from Microsoft Word). Happy to make some tweaks, but it needs to look something like this. Thank you very much! enter image description here

edit: could you give me a link to some good tutorial to use the most appropriate tool in your opinion, knowing what diagram I want to draw ?

  • 7
    Welcome! That's not really how this site is meant to work: that you post an image, somebody draws it and you do the tweaks. The idea is more that you come up with some code and post it because you want to tweak it in a particular way and don't know how to do it. Then somebody else takes your code, makes the tweak and answers the question. You may get lucky, especially if your diagram appeals to somebody. But it isn't really a fair question and you may not like to rely on luck or depend on the popularity of your diagram's visual appeal. In that case, please show us the code you've got. – cfr Jan 28 '16 at 0:57
  • 2
    The diagram is really pretty simple to do in something like TikZ. Just a bunch of boxes and an arrow. That said, it is not very clear to me and I don't think I would want something with its ambiguities. It looks to me as if the time arrow goes vertically and then horizontally and I'm not clear what the status of the Round IX box is. Is this of the same kind as the boxes with dates? But it isn't a date box. The other 'Rounds' are all inside date boxes. Why not this one? Does the font change have any significance? The scaling is off, so I guess that's intentional? Is the arrow time? – cfr Jan 28 '16 at 1:03
  • 3
    I didn't read the question this way, I read that they are flexible on what the diagram looks like and need a push in the right drection to know how to accomplish this. Just my two cents, and agreed it's supposed to be "I have tried this, is this right" so not to negate your whole comment, just to show an alternatvie way to read a newb question, so we don't scare them away :) – JimLohse Jan 28 '16 at 1:48
4

As it was said, tikz and pgf will work nicely. You will find documentation here. I suggest that you start reading about nodes. For instance start with

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning} % Necessary to use right=5cm of A
\begin{document}
\tikz{
  \node (A) [rectangle,draw] {Text of A};
  \node (B) [rectangle,draw,right=5cm of A] {Text of B} edge (A.east);
}
\end{document}

see what it produces and tweak around...

  • Where can I find in the manual the syntax edge (A.east) to produce the line as you did? – Marco Jan 28 '16 at 9:53
  • @Marco. The index pages 1124-1125 give you a list of pages addressing the edge operation. – Tom-Tom Jan 28 '16 at 10:00
4

If you can use lualatex to process your document, then another alternative is luamplib and Metapost which I used to create this sketch of parts of your diagram.

enter image description here

The nice thing about doing this sort of diagram "programmatically" is that you can draw it as a graph, so that, for example, the arrow is now an x-axis with a scale of years and the boxes are in the "correct" places.

I think luamplib is pretty mature now, it's fast and (as I hope you can see from the example) it integrates with LaTeX nicely. But I'm not sure I would yet recommend it as a beginner tool; (a) because the excellent tutorial material available for Metapost does not really cover using it as part of LuaLatex yet, and (b) the debugging environment is still horrible.

\documentclass[border=5mm]{standalone}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
vardef census_box(expr yy) = 
  save box; path box;
  box = unitsquare shifted (-1/2,-1/2) xscaled 42 yscaled 28  
        shifted 28 up;
  image(
    draw box withpen pencircle scaled 1.2;
    draw point 0.5 of box -- origin;
    label("\textbf{" & decimal yy & "}", center box + 5up);
    label("Census", center box + 5 down);
  ) shifted ((yy-alpha)*u,0)
enddef;
vardef rounds_box(expr dx, dy, yy, rtext, rnumbers) = 
  save box; path box;
  box = (superellipse(5/8 right, 1/2 up, 5/8 left, 1/2 down, 0.76)) xscaled 42 yscaled 38  
         shifted 38 down
         shifted (dx,dy);
  image(
    draw box; 
    draw point 2 of box {up} .. {up} origin;
    label("\textbf{" & decimal yy & "}", center box + 10 up);
    label(rtext, center box);
    label(rnumbers, center box + 10 down);
  ) shifted ((yy-alpha)*u,0)
enddef;

beginfig(1);
alpha = 1978;
omega = 2015;
span  = omega-alpha;
size  = 12cm;
u = size/span;

drawarrow origin -- right scaled size withpen pencircle scaled 1;

draw census_box(1982);
draw census_box(1990);
draw census_box(2001);
draw census_box(2010);

draw rounds_box(-12,  0, 1985, "Rounds","I, II");
draw rounds_box(  0,-40, 1987, "Rounds","III, IV, V");
draw rounds_box( 21,  0, 1988, "Round", "VI");
draw rounds_box(  0,  0, 1997, "Rounds", "VII, VIII");
draw rounds_box( 20,  0, 2001, "\textit{Round}", "\textit{IX}");

endfig;
\end{mplibcode}
\end{document}

Compile with lualatex.

2

Here is my solution

\begin{figure}[H]
\center
%Timeline
\begin{tikzpicture} [
catg/.style={draw,dashed, minimum height=2em},
thick/.style=      {line width=0.8pt}
]

%line
\draw [thick][arrows={->[scale=2]}] (0,0) -- (15,0) ;
\draw [thick,dashed] (0.5,0) -- (0.5,-2.53);
\draw [thick](1,0) -- (1,0.3);
\draw [thick](5,0) -- (5,0.3);
\draw [thick](11,0) -- (11,0.3);
\draw [thick](14,0) -- (14,0.3);
\draw [thick] (3.5,0) -- (3.5,-0.5); % 1987
\draw [thick] (8,0) -- (8,-0.5); % 1997
\draw [thick] (11,0) -- (11,-0.5); % 2001
\draw [thick,dashed] (8,-2.1) -- (8,-2.53); 
\draw [thick,dashed] (3.5,-2.1) -- (3.5,-2.53); 

%census
\node [text width=1.5cm, align=center] at (1, 0.8)  { 1982  Census};
\node [text width=1.5cm, align=center] at (5, 0.8)  { 1990  Census};
\node [text width=1.5cm, align=center] at (11, 0.8)  { 2001  Census};
\node [text width=1.5cm, align=center] at (14, 0.8)  { 2010  Census};

%rounds
\node [text width=2.5cm, align=center] at (3.5, -1.3) [rectangle,draw,thick] { 1985-1987\\ Rounds I - VI};
\node [text width=1.8cm, align=center] at (8, -1.3) [rectangle,draw,thick] { 1997\\ Rounds VII, VIII};
\node [text width=1.4cm, align=center] at (11, -1.3) [rectangle,draw,thick] { 2001\\ \itshape Round IX};

%category
\node [catg] at (0.5, -3) (Pre) [rectangle,draw,thick] {Pre-Round};
\node [catg] at (3.5, -3) (A) [rectangle,draw,thick] {Part A} ;
\node [catg] at (8, -3) (B) [rectangle,draw,thick] {Part B} ;

\end{tikzpicture}
\caption{Timing of Bidding Rounds and Censuses}
\label{fig:speciation}\end{figure}
  • Can you complete your code to provide an example people can compile? – cfr Sep 30 '16 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.