Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Place boundary of two adjacent nodes on top of each other

If I place two nodes adjacent to each other the resulting boundary between the nodes is doubled making it more thick than other boundarys. Is it possible to place them on top of each other in order to keep the original thickness?

Here my code and below some example pictures:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{figure}
\begin{center}
\begin{tikzpicture}

\tikzstyle{node} = [draw, rectangle, minimum width=1cm]
\node [node] (n_one) {node 1};
\node [node, right = 0cm of n_one.north east, anchor = north west] (n_two) {node 2};

\end{tikzpicture}
\end{center}
\end{figure}

\end{document}

Overall look

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Closer look

>Solution :

You can shift the right node by one line width:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{figure}
\begin{center}
\begin{tikzpicture}

\tikzstyle{node} = [draw, rectangle, minimum width=1cm]
\node [blue,node] (n_one) {node 1};
\node [red,node, right = -\the\pgflinewidth of n_one.north east, anchor = north west] (n_two) {node 2};

\end{tikzpicture}
\end{center}
\end{figure}

\end{document}

enter image description here

Or you could draw only a single node:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes.multipart} 

\begin{document}

\begin{figure}
\begin{center}
\begin{tikzpicture}
\node[
  rectangle split, 
  rectangle split parts=2,
  draw, 
  rectangle split horizontal,
  rectangle split part align={center, top, bottom}
] at (0,0)  {node 1\nodepart{two}node 2};
\end{tikzpicture}
\end{center}
\end{figure}

\end{document}

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading