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'm trying to remove the white space that appears between two lines as a result of going to an empty node. Specifically, I have a node drawing to the left of the empty node and then the empty node drawing to the a new full node.

I've already used inner sep=0 and outer sep=0 on the node to reduce the empty gap. However,a small sliver still remains.

I need to have the empty node there for space reasons.

Image: empty location

MWE:

\documentclass{article}
\usepackage{tikz}%pictures
\usetikzlibrary{shapes,arrows}
\begin{document}
\begin{tikzpicture}[auto,>=latex'] 
    \tikzstyle{block} = [draw, shape=rectangle, minimum height=3em, minimum width=3em, node distance=2cm, line width=1pt]
    \tikzstyle{sum} = [draw, shape=circle, node distance=1.5cm, line width=1pt, minimum width=1.25em]
    \tikzstyle{connection}=[inner sep=0,outer sep=0]
 %Creating Blocks and Connection Nodes
\node [block, right of=input] (h1) {$0.99$};
 \node [right of=h1] (hsum) {};
    \node [connection, right of=hsum] (cont) {};
    \path (h1) -- coordinate (hmed) (h1);
    %Connecting Blocks
    \begin{scope}[line width=1pt]
         \draw (input) -- (h1);\draw (h1) -- (cont);
    \end{scope}
 %Creating Blocks and Connection Nodes
\node [block, right of=cont] (m1) {$0.18$};\node [block, right of=m1] (m2) {$0.16$};
 \node [right of=m2] (msum) {};
    \node [connection, right of=msum] (output) {};
    \path (m1) -- coordinate (mmed) (m2);
    %Connecting Blocks
    \begin{scope}[line width=1pt]
         \draw (cont) -- (m1);\draw (m1) -- (m2);\draw (m2) -- (output);
    \end{scope}
 \end{tikzpicture}
\end{document}
share|improve this question

1 Answer 1

up vote 9 down vote accepted

You can use a coordinate like

\coordinate[right of=hsum] (cont);

Code:

\documentclass{article}
\usepackage{tikz}%pictures
\usetikzlibrary{shapes,arrows}
\begin{document}
\begin{tikzpicture}[auto,>=latex']
    \tikzstyle{block} = [draw, shape=rectangle, minimum height=3em, minimum width=3em, node distance=2cm, line width=1pt]
    \tikzstyle{sum} = [draw, shape=circle, node distance=1.5cm, line width=1pt, minimum width=1.25em]
    \tikzstyle{connection}=[inner sep=0,outer sep=0]
 %Creating Blocks and Connection Nodes
 \coordinate (input);
\node [block, right of=input] (h1) {$0.99$};
 \node [right of=h1] (hsum) {};
    \coordinate[right of=hsum] (cont);
    \path (h1) -- coordinate (hmed) (h1);
    %Connecting Blocks
    \begin{scope}[line width=1pt]
         \draw (input) -- (h1);\draw (h1) -- (cont);
    \end{scope}
 %Creating Blocks and Connection Nodes
\node [block, right of=cont] (m1) {$0.18$};\node [block, right of=m1] (m2) {$0.16$};
 \node [right of=m2] (msum) {};
    \node [connection, right of=msum] (output) {};
    \path (m1) -- coordinate (mmed) (m2);
    %Connecting Blocks
    \begin{scope}[line width=1pt]
         \draw (cont) -- (m1);\draw (m1) -- (m2);\draw (m2) -- (output);
    \end{scope}
 \end{tikzpicture}
\end{document}

enter image description here

If you want to stick to the node, use cont.center for the connections instead of cont like:

\draw (input) -- (h1);\draw (h1) -- (cont.center);

Code again:

\documentclass{article}
\usepackage{tikz}%pictures
\usetikzlibrary{shapes,arrows}
\begin{document}
\begin{tikzpicture}[auto,>=latex']
    \tikzset{block/.style = {draw, shape=rectangle, minimum height=3em, minimum width=3em, node
                              distance=2cm, line width=1pt},
              sum/.style = {draw, shape=circle, node distance=1.5cm, line width=1pt, minimum 
                            width=1.25em},
              connection/.style={inner sep=0,outer sep=0}
    }
 %Creating Blocks and Connection Nodes
 \coordinate (input);
\node [block, right of=input] (h1) {$0.99$};
 \node [right of=h1] (hsum) {};
    \node [connection, right of=hsum] (cont) {};
    \path (h1) -- coordinate (hmed) (h1);
    %Connecting Blocks
    \begin{scope}[line width=1pt]
         \draw (input) -- (h1);\draw (h1) -- (cont.center);
    \end{scope}
 %Creating Blocks and Connection Nodes
\node [block, right of=cont] (m1) {$0.18$};\node [block, right of=m1] (m2) {$0.16$};
 \node [right of=m2] (msum) {};
    \node [connection, right of=msum] (output) {};
    \path (m1) -- coordinate (mmed) (m2);
    %Connecting Blocks
    \begin{scope}[line width=1pt]
         \draw (cont.center) -- (m1);\draw (m1) -- (m2);\draw (m2) -- (output);
    \end{scope}
 \end{tikzpicture}
\end{document}

Also, use tikzset instead of tikzstyle (deprecated) as I did in the second code.

share|improve this answer
    
Perfect! Thank you very very much. –  Coatless Jun 24 at 0:53

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.