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

3
  • Do you need tikz-cd for that display to begin with? Commented Nov 6, 2016 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. Commented Nov 6, 2016 at 11:31
  • 1
    \begin{aligned}\tau\colon I &\longrightarrow\mathbb{R}\\ t&\longmapsto \tau(t)...\end{aligned} Commented Nov 6, 2016 at 11:34

2 Answers 2

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

2

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.