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 change the height of one part of the node to the minimum possible. How can I do this?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
  \begin{tikzpicture}
    \node[rectangle split,rectangle split parts=3] {
      first
      \nodepart{second}
      \nodepart{third}
      third
    };
  \end{tikzpicture}
\end{document}

I want the second part (which is empty) to be 0.1cm in height.

share|improve this question

1 Answer 1

You can use the key rectangle split empty part height to set the height of empty parts. However, this key only adds a a invisible rule with the given height to an internal macro. Therefore the height can't be reduced once set. The default value is 1ex. The overwrite this use the key rectangle split every empty part={} which deletes all previous set height, depth and width values.

The inner sep value is still added around the empty part which makes it very difficult to make it smaller without reducing this value.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
  \begin{tikzpicture}
    \node[rectangle split,rectangle split parts=3,draw] {
      XgX
      \nodepart{second}
      \nodepart{third}
      XgX
    };
  \end{tikzpicture}
  \begin{tikzpicture}
    \node[rectangle split,rectangle split parts=3,inner sep=0pt,
    rectangle split every empty part={},% delete existing height, depth and width
    rectangle split empty part height=0.1cm,
    draw] {
      XgX
      \nodepart{second}%
      \nodepart{third}
      XgX
    };
  \end{tikzpicture}
\end{document}
share|improve this answer
    
this is what LaTeX processor says: Package pgfkeys Error: I do not know the key '/tikz/rectangle split every empty part' and I am going to ignore it. Perhaps you misspelled it. Any ideas? –  yegor256 Feb 22 '11 at 19:02
2  
@yegor256: Yes, update your TikZ/PGF package. Your seems to be outdated. –  Martin Scharrer Feb 22 '11 at 19:11

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.