TransWikia.com

tikz: tabbing environment in nodes

TeX - LaTeX Asked on April 9, 2021

I need to use the tabbing environment in a TikZ node. When I try the following:

documentclass{standalone}
usepackage{tikz}
begin{document}

begin{tikzpicture}[box/.style={rectangle,minimum size=1cm,text width=3cm,
  text centered}]
  
  node[box] (mybox) at (0.0,0.0) {
    begin{tabbing}
      abcdef = abcdef kill
      hello > there
    end{tabbing}
  };
end{tikzpicture}

end{document}

it results in an empty line before the "hello there":

enter image description here

How can I get rid of the empty line (other than adding vspace{-baselineskip}?

One Answer

Put the contents that tikz has difficulties to handle into a savebox.

documentclass[border=2pt]{standalone}
usepackage{tikz}

newsaveboxhello
saveboxhello{%
  begin{minipage}{3cm}
    begin{tabbing}
      abcdef = abcdef kill
      hello > there
    end{tabbing}%
  end{minipage}%
}

begin{document}

begin{tikzpicture}
  node[draw]{useboxhello};
end{tikzpicture}

end{document}

enter image description here

Correct answer by gernot on April 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP