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 want to draw a big block with several small blocks, which is outside but adhere to the big one, as my picture showed below. I have no idea how to set "node distance" relatively based on big block's width and height. please help on that.

my output:

enter image description here

my expectation: I would like the two blocks in same horizon level, and the small one will adhere to big one.

enter image description here

\documentclass{article}
\usepackage[a4paper,landscape]{geometry}
\usepackage{fontspec}
\setmainfont[Scale=0.9]{Verdana}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\pagestyle{empty}

\tikzstyle{big} = [rectangle,draw,fill=blue!20,text width = 5em,text centered,minimum width=6em,minimum height=8em]
\tikzstyle{small} = [rectangle,draw,fill=green!40,text width=0.8em, text centered,minimum height = 1em]

\begin{tikzpicture}
  \node [big] (in1) {1st instance};
  \node [small, above right of=in1] (port1) {1};
\end{tikzpicture}

\end{document}
share|improve this question
1  
You could use \node [small, anchor=north west, at=(in1.north east)] (port1) {1}; –  Ulrike Fischer Dec 31 '13 at 16:21
    
It looks not what I want, I want the small box OUTSIDE of big box. but this anchor still keep the small boxes inside. –  Coeus Wang Dec 31 '13 at 16:38
    
The box is outside for me. Are you sure you did use "west" in the anchor and "east" in the at? –  Ulrike Fischer Dec 31 '13 at 16:57
    
What a amazing trick... I did use both as east. Now it works perfectly for me. –  Coeus Wang Dec 31 '13 at 17:08
    
BTW - I also tried \matrix{} and it also works for me, and it can adjust column sep. :) –  Coeus Wang Dec 31 '13 at 17:09

1 Answer 1

up vote 2 down vote accepted

You could use \node [small, anchor=north west, at=(in1.north east)] (port1) {1};

share|improve this answer

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.