2

So far I have:

\documentclass{article}
\usepackage{tikz-cd}
\usepackage{stmaryrd}
\usetikzlibrary{arrows}
%
\begin{document}

\begin{center}
\begin{tikzcd}[column sep=large]
{\begin{tikzpicture}\draw[{[-]}] (0,0) -- (2,0);
\foreach \x in {0}
\draw (\x cm,0pt) -- (\x cm,0pt) node[anchor=north] {$0$};
\foreach \x in {2}
\draw (\x cm,0pt) -- (\x cm,0pt) node[anchor=north] {$1$};\end{tikzpicture}} \arrow[r, "\textrm{gluing}"] &
{\begin{tikzpicture}\draw (0,0) circle (1cm);
\draw (0.8,0) -- (1.2,0); \end{tikzpicture}}\mathbb{Z}
\end{tikzcd}
\end{center}

\end{document}

which looks like

enter image description here

but the \mathbb{Z} needs to be shifted downwards and to the right a bit.

5
  • 1
    do you need tikz-cd here? having gone that far why not just do the whole thing in the tikzpicture, and then you can place the Z by coordinates wherever you want? Jan 14, 2017 at 13:23
  • Is a tikz-cd solution difficult to do here? I'd prefer one since I'll later need to do things like this but in an environment where tikz-cd seems to be nicer (lots of pictures with lots of arrows around) Jan 14, 2017 at 13:26
  • probably not, just seemed worth asking:-) Jan 14, 2017 at 14:17
  • Put the ZZ inside the last tikz picture ... Try: \draw (0.8,0) -- (1.2,0) node[anchor=west]{$\mathbb{Z}$}; \end{tikzpicture}}
    – Thruston
    Jan 14, 2017 at 14:48
  • This is not a commutative diagram: a tikzpicture would be much better.
    – egreg
    Jan 14, 2017 at 15:31

2 Answers 2

3

The following code solves the problem in basically the same way as the other solution by @CarLaTeX, but also simplifies the code a bit.

enter image description here

\documentclass[border=2mm]{standalone}
\usepackage{tikz-cd}
\usetikzlibrary{arrows}
\usepackage{amssymb}
\begin{document}

\begin{tikzcd}[column sep=large]
  \tikz\draw[{[-]},yshift=0.5ex] (0,0)node[below]{$0$} -- (2,0)node[below]{$1$};
  \arrow[r, "\textrm{gluing}"]
& \tikz\draw (0,0) circle (1cm)  (0.8,0) -- (1.2,0) node[right]{$\mathbb Z$};
\end{tikzcd}

\end{document}
2

Could a solution like this be OK for you?

Edit: gernot has already posted a perfect solution, nevertheless, I'd like to add that you can also set the position you want for the node, for example node[below=.7em, right=-.3em]

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz-cd}
\usepackage{stmaryrd}
\usetikzlibrary{arrows}
%
\begin{document}

\begin{center}
\begin{tikzcd}[column sep=large]
{\begin{tikzpicture}\draw[{[-]}] (0,0) -- (2,0);
\foreach \x in {0}
\draw (\x cm,0pt) -- (\x cm,0pt) node[anchor=north] {$0$};
\foreach \x in {2}
\draw (\x cm,0pt) -- (\x cm,0pt) node[anchor=north] {$1$};\end{tikzpicture}} \arrow[r, "\textrm{gluing}"] &
{\begin{tikzpicture}\draw (0,0) circle (1cm);
\draw (0.8,0) -- (1.2,0) node[below=.7em, right=-.3em] {$\mathbb{Z}$}; \end{tikzpicture}}
\end{tikzcd}
\end{center}

\end{document}

enter image description here

3
  • Why don't you propose node[right]?
    – gernot
    Jan 14, 2017 at 14:58
  • @gernot right added, the OP asked also to put it downwards.
    – CarLaTeX
    Jan 14, 2017 at 15:06
  • Well, right moves it also a bit downwards. But in the end only the OP can tell what the right position is.
    – gernot
    Jan 14, 2017 at 15:11

You must log in to answer this question.

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