2

Consider the following example, you can see that there is a white background behind the text label, which is not consistent to the page color. Is there any way to fix this behavior?

enter image description here

\documentclass{article}

\usepackage{tikz-cd}
\pagecolor{yellow}

\begin{document}

\[
    \begin{tikzcd}
        X & X & \cdots & X \\
        Y & Y & \cdots & Y
        \arrow["T", from=1-1, to=1-2]
        \arrow["S", from=2-1, to=2-2]
        \arrow["\Phi"', from=1-1, to=2-1]
        \arrow["\Phi", from=1-2, to=2-2]
        \arrow["T", from=1-2, to=1-3]
        \arrow["S", from=2-2, to=2-3]
        \arrow["T", from=1-3, to=1-4]
        \arrow["S", from=2-3, to=2-4]
        \arrow["\Phi", from=1-4, to=2-4]
        \arrow["\displaystyle\cdots"{description}, draw=none, from=1-3, to=2-3]
    \end{tikzcd}
\]

\end{document}

1 Answer 1

5

The fill is designed to partly obscure an arrow in a description. Use background color=none like this:

\documentclass[tikz, border=1cm]{standalone}
\usepackage{tikz-cd}
\pagecolor{yellow}
\begin{document}
\begin{tikzcd}
  X & X & \cdots & X \\
  Y & Y & \cdots & Y
  \arrow["T", from=1-1, to=1-2]
  \arrow["S", from=2-1, to=2-2]
  \arrow["\Phi"', from=1-1, to=2-1]
  \arrow["\Phi", from=1-2, to=2-2]
  \arrow["T", from=1-2, to=1-3]
  \arrow["S", from=2-2, to=2-3]
  \arrow["T", from=1-3, to=1-4]
  \arrow["S", from=2-3, to=2-4]
  \arrow["\Phi", from=1-4, to=2-4]
  \arrow["\displaystyle\cdots"{description}, background color=none, draw=none, from=1-3, to=2-3]
\end{tikzcd}
\end{document}

Cumulative diagram on yellow background

3
  • Thank you! Just to be curious, if my page color is called paper, is it possible to globally set the background color to be paper?
    – Jinwen
    Apr 28 at 8:24
  • 1
    Yes - add to preamble: \tikzset{/tikz/commutative diagrams/background color=paper} Apr 28 at 8:28
  • Thank you for the help, your answer and the comment above work perfectly :)
    – Jinwen
    Apr 28 at 8:30

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.