2

In the following code, I used node distance=0 and outer sep=0 to position the nodes besides each other seamlessly.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{chains}

\begin{document}
\begin{tikzpicture}[
    start chain=going right,
    every node/.style={on chain, fill=black, text=white},
    text height=.8em,
    text depth=.2em,
    node distance=0,
    outer sep=0pt
  ]
  \node {a};
  \node {bc};
  \node {def};
\end{tikzpicture}
\end{document}

However, the result still shows gaps.

small gaps are still left between the nodes

What did I miss?

5

It indeed is a problem of the PDF viewer program, not the LaTeX rendering. The document shows with gaps in some viewers, for example

  • evince
  • zathura
  • pdf.js viewer included in Firefox
  • Perfect Viewer for Android

and without in others, notably

  • the google drive viewer.

Workaround

But still you can use -\pgflinewidth as the node distance.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{chains}

\begin{document}
\begin{tikzpicture}[
    start chain=going right,
    every node/.style={on chain, fill=black, text=white},
    text height=.8em,
    text depth=.2em,
    node distance=-\pgflinewidth,
    outer sep=0pt
  ]
  \node {a};
  \node {bc};
  \node {def};
\end{tikzpicture}
\end{document}

enter image description here

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.