4

I created the following diagram:

\begin{equation}
\begin{array}{ccc}
&& A  \\
&\rotatebox{45}{$\longrightarrow$}& \rotatebox{90}{$\subseteq$}\\
B&\subset& C
\end{array}
\end{equation} 

But the diagonal arrow looks to short. I tried to use \xrightarrow{\hspace*{1cm}}, but it does not help: the second row of the diagram becomes too high.

Thruston
  • 42,268
Alex
  • 43
  • 3
  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Can you please post a drawing of what you actually want to achieve (maybe hand-written and scanned, or made as a sketch in some painting software or such)? From your question it seems to me that you try to find a complicated way to do something for which good LaTeX packages exist. – yo' Jan 18 '15 at 19:39
  • 3
    To the downvoter: If you have to downvote a newcomer's question, then at least have the dignity to comment on what do you think is wrong with it. – yo' Jan 18 '15 at 19:40
  • Thanks Yo! I will add a hand-written drawing tomorrow, since I don't a scanner handy. But basically, I want the arrow to go from B to A, and want it to start closer to B and to end close to A (then it is in the formula generated by the code I put in the original post). – Alex Jan 18 '15 at 19:47
  • @yo' to be fair the down vote might have just been finger trouble... – Thruston Jan 18 '15 at 20:07

3 Answers3

4

You can do this sort of diagram nicely with tikz-cd. The documentation is on CTAN here.

\documentclass[fleqn]{article}
\usepackage{tikz-cd}
\begin{document}
\begin{equation}
\begin{array}{ccc}
&& A  \\
&\rotatebox{45}{$\longrightarrow$}& \rotatebox{90}{$\subseteq$}\\
B&\subset& C
\end{array}
\end{equation} 
and now with tikz-cd
\begin{equation}
\begin{tikzcd}
    & A \\
    B \arrow[ru] \arrow[r,phantom, "{\subset}", description] 
    & C          \arrow[u,phantom, "\rotatebox{90}{$\subseteq$}", description]
\end{tikzcd}
\end{equation}
\end{document}

enter image description here

Thruston
  • 42,268
  • Wow! Thank you, Thruston! (1) is exactly what I have, and (2) is exactly what I need. Thank you so much! – Alex Jan 18 '15 at 20:04
  • You're welcome. And welcome to Tex.SE! – Thruston Jan 18 '15 at 20:06
  • 1
    Hi Thruston! I am about to submit a paper to arxiv, but arXiv's automated TeX processing has failed to process the diagram. Here is the log:

    ! Arrow direction argument must contain only the characters l, r, u or d. \tikzcd@parse ...only the characters l, r, u or d} \fi \fi \fi \fi \fi \tikzc... l.171 B \arrow[ru] \arrow [r,phantom, "{\subset}", description] ? ! Emergency stop. \tikzcd@parse ...only the characters l, r, u or d} \fi \fi \fi \fi \fi \tikzc... l.171 B \arrow[ru] \arrow [r,phantom, "{\subset}", description] ! ==> Fatal error occurred

    Do you know if this can be fixed?

    – Alex Feb 17 '15 at 19:13
  • @Alex I don't know arXiv - but their help pages indicate that they only support a subset of LaTeX, or they might be using out of date versions of tikz-cd. You could try the other solutions here, or ask for advice from the arXiv support team. Alternatively you might be able to make your diagram into an external standalone graphic file and import that using includegraphics. Good luck. – Thruston Feb 17 '15 at 22:04
  • As of today (Apr. 26, 2016) arxiv is still using texlive 2011, and apparently this only works for 2013 or later. One suggestion I saw that could work is the ugly creation of the CD on its own, and then inclusion in the final document by includegraphics. – Mike Apr 26 '16 at 21:00
4

Borrowing some code from LaRiFaRi

\documentclass[fleqn]{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{equation}
\begin{tikzcd}
    & A \\
    B \arrow[ru] \arrow[r,symbol=\subset]
    & C          \arrow[u,symbol=\subseteq]
\end{tikzcd}
\end{equation}
\end{document}

enter image description here

egreg
  • 1,121,712
3

A solution with the psmatrix environment, from pst-node. You can compile it with pdflatex, provided you use the compiler switch --enable-write18 (MiKTeX) or -shell-escape (TeX Live, MacTeX):

 \documentclass[a4paper,11pt, pdf]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}%
\usepackage{lmodern}

\usepackage{pst-node}

\newpsobject{ncemptyline}{ncline}{linestyle=none}
\newcommand*\ncsubset[2]{\ncemptyline{#1}{#2}\ncput[nrot=:U]{\subset}}
\newcommand*\ncsubseteq[2]{\ncemptyline{#1}{#2}\ncput[nrot=:U]{\subseteq}}
\newcommand*\ncsubsetneq[2]{\ncemptyline{#1}{#2}\ncput[nrot=:U]{\varsubsetneq}}
\newcommand*\ncvarsubsetneq[2]{\ncemptyline{#1}{#2}\ncput[nrot=:U]{\scalebox{1}[-1]{$ \varsubsetneq $}}}
\pagestyle{empty}

\begin{document}

\[ \psset{nodesep=2pt, linewidth=0.6pt, rowsep=6mm, colsep=8mm}
\begin{psmatrix}
& [name=A] A \\
[name=B] B& [name=C] C\\
\ncline[arrows=->]{B}{A}
\ncsubset{B}{C}\ncsubseteq{C}{A}
\end{psmatrix}
 \]
 \end{document} 

enter image description here

Bernard
  • 271,350