# How can I align a short bit in a tikz diagram with part of a longer expression without tearing the long expression apart?

I have this commutative diagram, drawn with tiz-cd:

$\begin{tikzcd}[row sep=0.1em] R \arrow[r, "T_R"] & T_R(R) \arrow[r, "G", dashed] & T_S(S) & S \arrow[l, "T_S"'] \\ & \rotatebox[origin=c]{270}{\subseteq} & \rotatebox[origin=c]{270}{\subseteq}\\ \left( -T_R(R) \right) \cup T_R(R) = & \ex{U_R'} \rar["\left. J' \right|_{\ex{U_R'}}"] & \ex{U_S'} = T_S(S) \cup \left( - T_S(S) \right) \end{tikzcd}$


Which gets rendered like this: I would like both equations in the last line to be kept together, the arrow in the last line to be centered and I need T_S(S) \subseteq \ex{U_S'} to be aligned like T_R(R) \subseteq \ex{U_R'} already is on the left of the arrow. How can I achieve this?

By the way, \ex is a normal math operator.

EDIT: It is important that T_R(R) is a subset of U_R' and T_S(S) is a subset of U_S', which I did achieve to show on the left of the arrow and want to have displayed in the same way on the right of the arrow in the bottom line.

I am not convinced that tikz-cd is the optimal tool for that but it can be done, of course.

\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\ex}{ex}
\usepackage{tikz-cd}

\begin{document}
$\begin{tikzcd}%[row sep=0.1em] R \arrow[r, "T_R"] & T_R(R) \arrow[d,"\subseteq" {sloped,marking},draw=none] \arrow[r, "G", dashed] & [8.5em]T_S(S) \arrow[d,"\subseteq" {sloped,marking},draw=none] & S \arrow[l, "T_S"'] \\ & \mathllap{\left( -T_R(R) \right) \cup\,} T_R(R)\mathrlap{{}= \ex{U_R'}} \arrow[r,"\left. J'\right|_{\ex{U_R'}}", shorten <={width("{}=\ex{U_R'}")}, shorten >={width("\ex{U_S'} ={}")}] &\mathllap{\ex{U_S'} ={}} T_S(S) \mathrlap{\,\cup \left( - T_S(S) \right)} \end{tikzcd}$
\end{document} As for the clarified question:

\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\ex}{ex}
\usepackage{tikz-cd}

\begin{document}
$\begin{tikzcd} \hphantom{\left( -T_R(R) \right)\cup}R \arrow[r, "T_R"] & T_R(R) \arrow[d,"\subseteq" {sloped,marking},draw=none] \arrow[r, "G", dashed] &[2.5em] T_S(S) \arrow[d,"\subseteq" {sloped,marking},draw=none] & S \arrow[l, "T_S"']\hphantom{\cup \left( - T_S(S) \right)} \\ & \mathllap{\left( -T_R(R) \right) \cup T_R(R)=} \ex{U_R'} \arrow[r,"\left. J'\right|_{\ex{U_R'}}"] &\ex{U_S'} \mathrlap{{}=T_S(S) \cup \left( - T_S(S) \right)} \end{tikzcd}$
\end{document} Note the \hphantoms to ensure that it also works with fleqn, and note that \rotatebox[origin=c]{270}{\subseteq} in your question causes an error because you'd have to switch to math mode, but I think that

 \arrow[d,"\subseteq" {sloped,marking},draw=none]


is cleaner.

• Thank you. This isn't exactly what I needed, but it helped me find a solution. Apr 26 '20 at 19:28
• @Strupp1 Rather than writing an answer could you consider making your question clearer? I just followed the question. If it is the case that you want something different then you can mention this in the comments and update the question rather than just adjusting an existing answer to fit your criteria.
– user194703
Apr 26 '20 at 19:29
• I emphasized the importance of the subset relations in my question now. If you implement this in your answer I will mark it as the solution since you also provide some other improvements for the diagram. Apr 26 '20 at 19:45
• Absolutely perfect, thank you! I did end up using the \arrow approach for the subset symbols as I did get the error and also think your approach is cleaner. Apr 27 '20 at 10:01