2

I am trying to draw a commutative diagram using tikz-cd. I have two sets A,B, placed in an up-down manner. Now I want to typeset $A\subset B$, but given their relative positions the \subset notation must face upward. How can I do that?

p.s. It does matter whether the notation appears as an arrow object or an entry.


My program is something like this

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}
B\ar[rdd]&\\
\subset&\\
A\ar[r,hook]&C\\
\end{tikzcd}\]
\end{document}

And what I am trying to achieve is to make the \subset face upward.

egreg
  • 1,121,712
trisct
  • 207
  • Could you please add a small complete document that shows your diagram? – Marijn Sep 21 '19 at 08:47
  • Take a look here: https://tex.stackexchange.com/questions/184576/how-can-i-rotate-in-by-90-degrees – pdanese Sep 21 '19 at 08:57
  • @Marjin I've updated my question. – trisct Sep 21 '19 at 09:07
  • You add only code fragment. You were asked for complete document, which we can test as it is (missed are document preamble, etc ... – Zarko Sep 21 '19 at 09:50
  • With complete document I meant MWE (Minimal Working Example), not your complete document, which reproduce your problem. – Zarko Sep 21 '19 at 09:58
  • @Zarko Question edited. But tikz-cd seems to work incorrectly on some computers. You might need to use [ampersand replacement=&] for the tikz-cd environment. – trisct Sep 21 '19 at 10:04
  • your code has an error. Correct is \begin{tikzcd} ... \end{tikzcd}. do you try to use \cup instead of ˙subset`? – Zarko Sep 21 '19 at 10:10
  • @trisct good to see that you provided the code, it improved the question - you could tell because you got two answers now. However, when you provide code make sure to test it as well before you post it, and correct any mistakes that you may have made. For this question that would have prevented the \begin{tikz-cd} mistake - it is not so serious, and the code is short so it is easy to see and correct, but in other cases something like this might make it a lot harder to answer the question. – Marijn Sep 21 '19 at 15:16
  • 1
    @Marjin Thanks for the comment. I didn't have a computer with me at the time and I had to post the code with my cellphone. Will pay more attetion next time. – trisct Sep 21 '19 at 16:15

3 Answers3

3

it is not very clear what you like to obtain. something like this?

enter image description here

\documentclass[margin=3mm]{standalone}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}  % <---
B\ar[rdd]   &       \\
 \cup       &       \\ % <---
A\ar[r,hook]&   C   
\end{tikzcd}
\end{document}

Addendum: Maybe you like the following solution:

enter image description here

\documentclass[margin=3mm]{standalone}
\usepackage{graphicx}
\newcommand\rot[1]{\rotatebox[origin=c]{270}{#1}}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}[row sep=-3pt]
\rot{B}\ar[rdd]   &       \\
 \cup       &       \\
\rot{A}\ar[r,hook]&   C   
\end{tikzcd}
\end{document}
Zarko
  • 296,517
  • Yeah, something like this. I gotta say this is an interesting suggestion. Although, it would be better if there is a way to do this for other notations as well. – trisct Sep 21 '19 at 10:47
3

Borrowing Larifari's code from https://tex.stackexchange.com/a/280775/4427

\documentclass{article}
\usepackage{tikz-cd}

\tikzset{%
  symbol/.style={
    draw=none,
    every to/.append style={
      edge node={node [sloped, allow upside down, auto=false]{$#1$}}
    },
  },
}


\begin{document}

\[
\begin{tikzcd}
B\arrow[rd]
\\
A\arrow[r,hook] \arrow[u,symbol=\subset] & C
\end{tikzcd}
\]

\end{document}

Note that the package is tikz-cd, but the environment is tikzcd.

enter image description here

egreg
  • 1,121,712
2

Is it possibile to realize your commutative diagram also with xy package. With the option cmtip you have the same style of the arrows of tikz-cd. Here there is a MWE with the relative image.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage[all,cmtip]{xy}
\begin{document}
\xymatrix@R=.5pc@C=3pc{B \ar[ddr]&\\
\cup &\\
A \ar@{^{(}->}[r]& C 
}
\end{document}
Sebastiano
  • 54,118