In the case, when you have in some shape (rectangle in my case) a TikZ picture, than it seems that parameters of outer shape also influences on parameters of inner picture. This can be eliminate with redefinition of all this parameters. But, what to do, if outer shape has determined "text width", but in shape of inner picture I like to determine only minimum width" (that the width of shape is automatically adjust to width of text)? For example:


        \begin{tikzpicture}[start chain = going right]
        \node[rectangle split,rectangle split parts=2,
              inner ysep=1mm, inner ysep=2mm, text width=55mm, draw] 
        {adjust time\qquad
    \tikz[every node/.style={shape=rectangle,
                             inner xsep=0.5mm,outer sep=0mm, 
                             text width=1.1ex,% here I like to have minimum width ...
                             node distance=0.5mm,on chain}]
    \nodepart{two} only text

Is there a way to tell inside picture, that "text width" determined for outer shape should not influence on text width of text width of inner influence or to determine it in inner shape, that it will automatically adjust to width of actual text? enter image description here

On above picture the width of node with semicolon (:) is to wide, i like that width will be automatically adjusted to its width.

I also like to solve a problem, how to align text in inner rectangle with text in outer one.


To align the baseline of the text in the inner node on the baseline of the outer text you can use \tikz[baseline,nodes={anchor=base,...}] for the inner picture.

To prevent the influence of the outer node options save the inner picture in a box:


      start chain = going right,
        inner xsep=0.5mm,outer sep=0mm,
        on chain}
        ,node distance=.5mm
    \node[fill=none,inner xsep=0pt]{:};
    rectangle split,rectangle split parts=2,
    inner ysep=2mm,
    text width=55mm,
  {adjust time\qquad\usebox\mytikzBox
  \nodepart{two} only text

enter image description here

  • Thank you very much! Your solution also work if I collect options for inner picture as well four outer node in one "tikzset" (with different name, of course). – Zarko Apr 19 '14 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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