Control the alignment of each "cell" in amsmath's aligned environment
A tikz-cd
attempt
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
\sigma\colon\hspace*{-4.5em} & F(\alpha) \arrow{r}{\sim} \arrow[dash]{d}
& F'(\beta) \arrow[dash]{d} \\
\varphi\colon\hspace*{-4.5em} & F \arrow{r}{\sim}
& F'
\end{tikzcd}
\end{document}
Surely the code can be improved, I'm not a tikz
expert at all...
This is the result if you substitute dash
with equal
You may be better off with tikz-cd
or ..... But here, you can use a newcommand
:
\newcommand*{\mbc}[2]{\makebox[\widthof{$F(\alpha)$}][#1]{$#2$}}
which makes a box of width same as $F(\alpha)$
with the help of calc
package.
\documentclass{article}
\usepackage{amsmath,calc}
\newcommand*{\mbc}[2]{\makebox[\widthof{$F(\alpha)$}][#1]{$#2$}}
\begin{document}
\[
\begin{aligned}
\mbc{r}{\sigma} & \colon & \mbc{c}{F(\alpha)} & \overset{\sim}{\to} & F'(\beta)\\
& & \mbc{c}{|} & & \mbc{c}{|}\\
\phi & \colon & \mbc{c}{F} & \overset{\sim}{\to} & \mbc{c}{F'}
\end{aligned}
\]
\end{document}
Use c
for center, l
for left and r
for right alignment.
For such a simple construction you can use the good old CD
environment:
\documentclass{article}
\usepackage{amsmath,amscd}
\begin{document}
\[
\begin{CD}
\sigma\colon @. F(\alpha) @>\sim>> F'(\beta) \\
@. @| @| \\
\varphi\colon @. F @>\sim>> F'
\end{CD}
\]
\end{document}
However, it's better to switch to modern packages such as tikz-cd
that are more flexible and powerful.