Graphics, Figures & TablesSimple Box Diagram

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Kotoschow
Posts: 28
Joined: Mon Apr 09, 2012 3:13 pm

Simple Box Diagram

Post by Kotoschow »

Hi,

I've been fussing about endlessly attempting to draw simple box diagrams. What I need is circular nodes connected with plain lines - no arrows. Every single option I tried failed somehow.

I tried using xymatrix, but whenever I asked for plain arrows, the command would not execute. I tried the diagrams package, but couldn't understand how to draw plain lines instead of arrows. Finally, I tried pgf/TikZ and pstricks, but whenever I try to import them to my code, the following error occurs (within the xcolor package).

Code: Select all

! TeX capacity exceeded, sorry
If anyone could give me a simple, working, fool-proof solution, I would name him my hero. Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Simple Box Diagram

Post by Johannes_B »

PGF/TikZ is a powerful tool to draw almost everything. Additionally, the package pgfplots is very good to draw almost every kind of diagram.

Try to make a self-contained and minimal working example of your attempts and post it here using the code button. This helps you to isolate the problem and us to help you.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Simple Box Diagram

Post by localghost »

Kotoschow wrote:[…] 've been fussing about endlessly attempting to draw simple box diagrams. What I need is circular nodes connected with plain lines - no arrows. Every single option I tried failed somehow. […]
As you know for sure, you should always show those efforts. Otherwise nobody knows what you are doing and what's gone wrong. But …

Lucky you! Although I fully agree with Johannes about a minimal example, I found a small sample code based on PGF/TikZ in my archives which can serve as a good starting point.

Code: Select all

\documentclass[11pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
  \begin{tikzpicture}[%
    node distance=1cm,
    noname/.style={%
      circle,
      minimum size=3em,
      draw
    }
  ]
    \node[noname] (1)                                             {1};
    \node[noname] (2) [below=of 1]                                {2};
    \node[noname] (4) [node distance=1cm and 3mm,below left=of 2] {4};
    \node[noname] (3) [left=of 4]                                 {3};
    \node[noname] (5) [below=of 4]                                {5};
    \node[noname] (6) [node distance=2cm,right=of 5]              {6};

    \path (1) edge                   node {} (2)
          (2) edge                   node {} (3)
          (2) edge                   node {} (4)
          (2) edge                   node {} (6)
          (3) edge                   node {} (5)
          (4) edge                   node {} (5)
          (5) edge [bend right=20pt] node {} (2);
  \end{tikzpicture}
\end{document}
Take the user guide, try some modifications and ask targeted questions if you run into trouble or don't get what you want..


Thorsten
Attachments
tmp.png
tmp.png (3.44 KiB) Viewed 7445 times
Kotoschow
Posts: 28
Joined: Mon Apr 09, 2012 3:13 pm

Simple Box Diagram

Post by Kotoschow »

Well, it's actually embarrassing to admit, but the problem was that I imported gb4e before importing pgf/TikZ. That's all. For this reason, my MWEs were working, but my articles weren't. I realized it while I successfully compiled your MWE. So thanks a lot! And I surely learned a lesson here about the importance of a MWE.
Post Reply