4

I would like to remove the white space between "Box 1" and "Box 3." Using "below=0cm and of box1" works to remove the white space below "Box 1" but "right=0cm and of box1" does not remove the white space to the right.

MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}

\tikzstyle{Box} = [draw=black, minimum width=2.5cm, minimum height=3.75cm]
\node [name=box1, Box] {Box 1.};
\node [name=box2, below=0cm and of box1, Box] {Box 2.};
\node [name=box3, right=0cm and of box1, Box] {Box 3.};

\end{tikzpicture}
\end{document}
5

Just remove the ands in the specifications for below and right.

Also, the boxes can be shifted by the line width to avoid the appearance of thicker lines between the boxes.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}

\tikzstyle{Box} = [draw=black, minimum width=2.5cm, minimum height=3.75cm]
\node [name=box1, Box] {Box 1.};
\node [name=box2, below=-\pgflinewidth of box1, Box] {Box 2.};
\node [name=box3, right=-\pgflinewidth of box1, Box] {Box 3.};

\end{tikzpicture}
\end{document}

Result

The keyword and is only supported for the two-part directions above left, below left, above right, and below right.

  • Great...however I can not figure out how to re-work this so that one line is drawn between each box instead of sandwiching adjacent boxes which gives visibly thicker internal lines. – v.walter Mar 10 '18 at 17:08
  • @v.walter See updated answer. – Heiko Oberdiek Mar 10 '18 at 17:34

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.