1

I want to write with tikz-cd a map, in such a way that the two arrows are aligned and have the same length. I got this by adding \phantom{} everywhere, but I wonder if there's a easier (smarter) way.

My attemp:

\documentclass{article}
\usepackage{amsmath,amsthm,amssymb,amsfonts,amscd}
\usepackage{tikz}
\usepackage{tikz-cd}
\usetikzlibrary{arrows}

\begin{document}

\begin{tikzcd}[row sep = 0ex]
\tau : I \arrow[rightarrow]{r} & \mathbb{R} \phantom{---------} \\
\phantom{\tau :. }  t \arrow[mapsto]{r} & \tau (t) := \displaystyle \int_{t_0}^{t} \sqrt{T \cdot T} \ \mathrm{d} s
\end{tikzcd}
\end{document}

enter image description here

  • Do you need tikz-cd for that display to begin with? – egreg Nov 6 '16 at 11:18
  • @egreg I suppose I do not need tikz-cd precisely (though I would like), I just thought it was a good tool. What I need is to write maps, in that way. – Minkowski Nov 6 '16 at 11:31
  • 1
    \begin{aligned}\tau\colon I &\longrightarrow\mathbb{R}\\ t&\longmapsto \tau(t)...\end{aligned} – egreg Nov 6 '16 at 11:34
1

You can do it with tikz-cd, but also with a simpler aligned:

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{tikz}
\usepackage{tikz-cd}
\usetikzlibrary{arrows}

\newcommand\diff{\mathop{}\!\mathrm{d}}

\begin{document}

\begin{tikzcd}[
  row sep = 0ex,
  /tikz/column 1/.append style={anchor=base east},
  /tikz/column 2/.append style={anchor=base west},
]
\tau\colon I \arrow[r] & \mathbb{R} \\
t \arrow[r,mapsto] & \tau (t) := \displaystyle \int_{t_0}^{t} \sqrt{T \cdot T} \diff s
\end{tikzcd}

$\begin{aligned}
\tau\colon I & \longrightarrow \mathbb{R} \\
t & \longmapsto \tau (t) := \int_{t_0}^{t} \sqrt{T \cdot T} \diff s
\end{aligned}$

\end{document}

enter image description here

| improve this answer | |
1

An align* environment will be much more flexible. B.t.w., you should use \colon, not : for a better spacing, and \coloneqq (from mathtools), as in := the colon is not centred on the maths axis.

\documentclass{article}
\usepackage{mathtools,amsthm,amssymb,amsfonts}
\usepackage{tikz}
\usepackage{tikz-cd}
\usetikzlibrary{arrows}
\usepackage[showframe]{geometry}
\begin{document}

\begin{tikzcd}[row sep = 0ex]
  τ: I \arrow[rightarrow]{r} & \mathbb{R} \phantom{---------} \\
  \phantom{τ:. } t \arrow[mapsto]{r} & τ(t) := \displaystyle ∫_{t₀}^{t} √{T · T} \ \mathrm{d} s
\end{tikzcd}

\begin{align*}
  τ\colon I & ―――→ \mathbb{R} & τ\colon I & \xrightarrow{\qquad} \mathbb{R} \\[-1ex]
  t & \longmapsto τ(t) ∶= ∫_{t₀}^{t} √{T · T} \, \mathrm{d} s & t & \xmapsto{\qquad} τ(t) ∶= ∫_{t₀}^{t} √{T · T} \, \mathrm{d} s
\end{align*}

\end{document} 

enter image description here

| improve this answer | |

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.