Graphics, Figures & TablesTiks graphic aggregating parts with curly brackets

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
danst0
Posts: 2
Joined: Wed Jul 21, 2010 4:51 pm

Tiks graphic aggregating parts with curly brackets

Post by danst0 »

Hi,

I am using the Tiks library to draw a simple chain in Latex:

Code: Select all

\begin{tikzpicture}[start chain,node distance=5mm, every node/.style={on chain,join}, every join/.style={->}] 
        \node [nonterminal] {A};
        \node [nonterminal]	{B};
        \node [nonterminal]	{C};
\end{tikzpicture}
Since the nodes A and B form a logical unit I would like to add a short description underneath the chain for these two and a separate description for node C.

Best would be if I could use a lying curly bracket to show the proper affiliation.

Can anyone help me out. The manual hasn't been so informative...

Thanks,

Daniel

Recommended reading 2024:

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

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

torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

Tiks graphic aggregating parts with curly brackets

Post by torbjorn t. »

Please provide complete, compilable, examples, and not just a snippet of code[1]. I had to look up in the manual to know that the chains library had to be loaded. Also, the style called "nonterminal" is undefined, and doesn't do anything, as far as I can see.

A possible solution, if I understand you correctly:

Code: Select all

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{chains,positioning,decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}[decoration={brace,amplitude=3}] 
  \begin{scope}[start chain,node distance=5mm, every node/.style={on chain,join}, every join/.style={->}]
    \node (A) [] {A};
    \node (B) [] {B};
    \node     [] {C};
  \end{scope}
  \draw [decorate] (B.south east) -- node[below,text width=2.5cm]{Some description of said affiliation} (A.south west);
\end{tikzpicture}
\end{document}
I'm not sure why the positioning library has to be called, but without it the above code wouldn't compile.

[1] Avoidable mistakes
danst0
Posts: 2
Joined: Wed Jul 21, 2010 4:51 pm

Tiks graphic aggregating parts with curly brackets

Post by danst0 »

Great, thanks for the code!

With my own text I just had to adjust the brace amplitude (=15) and shift the text a little:

Code: Select all

\draw [decorate] (C.south west) -- node[below,yshift=-1cm,text width=4cm]{Some description of said affiliation} (A.south west);
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Tiks graphic aggregating parts with curly brackets

Post by localghost »

Now that the problem is solved, please mark the topic accordingly as described in Section 3 of the Board Rules.


Best regards and welcome to the board
Thorsten
Post Reply