Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a string in the form of .[field].[field].[field] where each [field] needs to be replaced with user specific information. I would like to create some sort of instruction/guidance on what specific information is needed in each field.

My ideas (sorry for the poor drawings):

  • 1st example:

  • 2nd example:

I don't know whether this is the best way to do it, but I think some visualization will help the user to understand better than a block of text (the users are ordinary people).

How can I create such a diagram as seen above using TikZ? I've been playing around with nodes and paths, but I did get really far as I have not been using TikZ a lot. Any help is appreciated!


EDIT:

Thanks to Gonzalo Medina for providing the two examples. I made some changes to it, here's my final result:

enter image description here

\documentclass[dvipsnames]{standalone}
\usepackage{tikz}
\usetikzlibrary{backgrounds,positioning}

\newcommand{\intval}[1]{\textbf{\color{RoyalBlue}#1}}
\tikzset
    { field/.style  = { draw=RoyalBlue, minimum height=20pt }
    , pdval/.style  = { draw=black!10, font=\strut\LARGE
              , minimum height=20pt, text depth=-2pt }
    , dot/.style    = { fill=black, circle, anchor=south
              , inner sep=1.2pt, xshift=-5pt, yshift=3pt }
    , desc/.style   = { fill=black!10, rounded corners=5pt, inner sep=5pt }
    , num/.style    = { draw, circle }
    }

\begin{document}
\begin{tikzpicture}[node distance=10pt, scale=.8, transform shape]
    % fields
    \node[field,text width=60pt]            (user)      {};
    \node[field,right=of user,text width=30pt]  (year)      {};
    \node[pdval,right=of year]          (function)  {st};
    \node[field,right=of function,text width=20pt]  (realm)     {};
    \node[pdval,right=of realm]         (entity)    {foo};
    \node[pdval,right=of entity]            (school)    {bar};

    % dots
    \foreach \n in {user,year,function,realm,entity,school}
        \node[dot] at (\n.south west) {};

    % numbers & descriptions
    \node[num,above=4cm of user.west,xshift=5pt] (user_num) {\textbf{1}};
    \node[desc,right=5pt of user_num] ()
        {Your \textbf{username}, f.e. \textit{foobar}};

    \node[num,above=2cm of year.west,xshift=5pt] (year_num) {\textbf{2}};
    \node[desc,above=5pt of year_num,xshift=7pt] ()
        {Your \textbf{year of joining}, f.e. \textit{2012}};

    \node[num,above=1.5cm of realm.west,xshift=5pt] (realm_num) {\textbf{3}};
    \node[desc,right=5pt of realm_num,yshift=30pt,text width=5cm] ()
    {
        Your \textbf{realm}:\\[10pt]
        \noindent
        \begin{tabular}{@{}ll}
        Architecture            & \intval{A} \\
        Constructional engineering  & \intval{CE} \\
        Chemistry           & \intval{C} \\
        Digital technology      & \intval{DT} \\
        Telecommunication       & \intval{T} \\
    \end{tabular}
    };

    % lines
    \draw (user_num.south)  -- ([xshift=5pt]user.north west);
    \draw (year_num.south)  -- ([xshift=5pt]year.north west);
    \draw (realm_num.south) -- ([xshift=5pt]realm.north west);
\end{tikzpicture}
\end{document}
share|improve this question
    
Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. –  Jubobs Apr 22 at 11:54
    
You would have a better chance to get an answer in UX-SX –  percusse Apr 22 at 11:57
    
Thanks for your comments. I already feared that my question is too specific. I'll try to improve the TikZ code that I started to write and will post it as soon as possible. –  watain Apr 22 at 12:08

1 Answer 1

up vote 6 down vote accepted

One option for both alternatives:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}

\tikzset{
descr/.style={
  fill=gray!30,
  text width=#1
  },
field/.style={
  draw,
  text width=3cm,
  minimum height=15pt
  },
dot/.style={
  fill=black,
  circle,
  inner sep=1.2pt
  },
number/.style={
  draw,
  circle,
  minimum size=20pt,
  font=\Large
  }      
}
\begin{document}

\begin{tikzpicture}[node distance=1cm and 10pt]
% the field nodes
\node[field]
  (left) {};  
\node[field,right=of left]
  (middle) {};
\node[field,right=of middle]
  (right) {};
\node[right=10pt of right.south east,anchor=south west,inner sep=0pt,font=\LARGE]
  (foo) {foo};
\node[right=10pt of foo.south east,anchor=south west,inner sep=0pt,font=\LARGE]
  (bar) {bar};

% dots between the fields
\node[dot,xshift=-5pt,anchor=south]
  at (left.south west) {};
\foreach \Nombre in {left,middle,right,foo}
{
  \node[dot,xshift=5pt,anchor=south]
    at (\Nombre.south east) {};
}    

% the boxes for the descriptions
\node[descr=8cm,above=6cm of left,anchor=south west,xshift=10pt]
  (lefttext)
  {Some descriptive text for the first field and some more text and some more text and some more text};
\node[number,anchor=east]
  (leftnumber)
  at (lefttext.west) {1};
\node[descr=4.4cm,above=4cm of middle,anchor=south west,xshift=10pt]
  (middletext)
  {Some descriptive text for the first field and some more text and some more text and some more text};
\node[number,anchor=east]
  (middlenumber)
  at (middletext.west) {2};
\node[descr=4cm,above=2cm of right,anchor=south east,xshift=-5pt]
  (righttext)
  {Some descriptive text for the first field and some more text and some more text and some more text};
\node[number,anchor=west]
  (rightnumber)
  at (righttext.east) {3};

% the connecting lines
\foreach \Nombre in {left,middle}
  \draw (\Nombre number.west) -| ([xshift=10pt]\Nombre.north west);  
\draw (rightnumber.east) -| ([xshift=-10pt]right.north east);  
\end{tikzpicture}

\vspace{1cm}

\begin{tikzpicture}[node distance=1cm and 10pt]
% the field nodes
\node[field]
  (left) {};  
\node[field,right=of left]
  (middle) {};
\node[field,right=of middle]
  (right) {};
\node[right=10pt of right.south east,anchor=south west,inner sep=0pt,font=\LARGE]
  (foo) {foo};
\node[right=10pt of foo.south east,anchor=south west,inner sep=0pt,font=\LARGE]
  (bar) {bar};

% dots between the fields
\node[dot,xshift=-5pt,anchor=south]
  at (left.south west) {};
\foreach \Nombre in {left,middle,right,foo}
{
  \node[dot,xshift=5pt,anchor=south]
    at (\Nombre.south east) {};
}    

% the boxes for the descriptions
\node[descr=8cm,above=6cm of left.west,anchor=south west]
  (lefttext)
  {Some descriptive text for the first field and some more text and some more text and some more text};
\node[descr=4.4cm,above=4cm of middle.west,anchor=south west]
  (middletext)
  {Some descriptive text for the first field and some more text and some more text and some more text};
\node[descr=4.4cm,above=2cm of right.west,anchor=south west]
  (righttext)
  {Some descriptive text for the first field and some more text and some more text and some more text};

% the connecting lines
\foreach \Nombre in {left,middle,right}
  \draw ([xshift=10pt]\Nombre text.south west) -- ([xshift=10pt]\Nombre.north west);  
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
Thank you very much for the two examples, these are excellent - exactly what I needed. I made some changes to it and I will post my example in a minute. –  watain Apr 23 at 13:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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