9

The problem

The tikz/double option which is used by tikz/commuting diagrams/Rightarrow internally creates a wide black line and a slightly less wide white line on top of it to display what looks like a double stroked path (see pgf manual, /tikz/double=). This causes (at least) two types of visual glitches. Notably, several viewers do not display both "strokes" of the path on all zoom levels, as the white part sometimes completely overrides the black path (discussed here, see also the screenshot below). Furthermore, there is a spurious horizontal line at the tail and before the head of the arrow (discussed here):

glitch 1

glitch 2

Question

In a more general sense, the question would be "What is the best way to fix these issues?"

(Originally, there were some specific questions here on an attempted fix. The solution described below implements a more general solution to the problem, rendering the original questions obsolete. See also the discussion on Github for some context.)

5
  • I have solved parts of the problem myself and updated the question. Better solutions and improvement suggestions are very welcome.
    – Jonathan
    May 2, 2022 at 20:50
  • 1
    Welcome to TeX.SX. When you post a question, please provide a "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output.
    – Sandy G
    May 3, 2022 at 12:11
  • 1
    Maybe you can add your final answer as an proper answer and accept it? It would be good if your original question and the answer to it are somehow separated so that it fits the structure of this site. Otherwise, Community will bump this question to the main page xevery now and then since it is considered unsolved. Mar 28 at 14:51
  • 1
    I agree with @JasperHabicht. Feel free to talk about the advantages and (current) shortcomings in your answer (similar how it is in the manual). I wouldn't worry much about all of them. Even PGF makes weird corners with rounded corners if the specified radius is too big or the line segments are too short. You can't catch all weird things that could happen (PGF isn't CAD). I believe for most cases (and especially CDs) this accomplished a lot already. Mar 28 at 23:57
  • 2
    Q679434 would also be a case where nfold might come in handy. Mar 28 at 23:59

1 Answer 1

8

I have published my solution on CTAN under the name tikz-nfold. Arbitary TikZ paths and arrows of any order (triple, quadruple, ...) are now supported. Usage is as follows:

\usetikzlibrary{nfold}

[...]

\begin{tikzcd}
  a \ar[r, Rightarrow, bend right, nfold] &
  b \ar[d, Mapsto, nfold=3, "\alpha", "\beta"'] \\
  c \ar[r, Mapsfrom, double distance=4pt, nfold=4] &
  d
\end{tikzcd}

tikzcd tikz-nfold screenshot

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .