# how to compact text up arrow in tikzcd

How to compact the size of text written upper an arrow in tikz-cd?

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows, matrix}
\tikzcdset{every label/.append style = {font = \tiny}}
\begin{document}
$\begin{tikzcd} 0\rar & \mathrm{Hom}_R(L, E) \arrow{r}{\mathrm{Hom}(\beta, \mathrm{id}_E)} & \mathrm{Hom}_R(N, E) \arrow{r}{\mathrm{Hom}(\alpha, \mathrm{id}_E)} & \mathrm{Hom}_R(M, E) \end{tikzcd}$
\end{document}


You just have to enlarge the column width.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows, matrix}
\tikzcdset{every label/.append style = {font = \tiny}}
\begin{document}
$\begin{tikzcd}[column sep=1.5cm] 0\rar & \mathrm{Hom}_R(L, E) \arrow{r}{\mathrm{Hom}(\beta, \mathrm{id}_E)} & \mathrm{Hom}_R(N, E) \arrow{r}{\mathrm{Hom}(\alpha, \mathrm{id}_E)} & \mathrm{Hom}_R(M, E) \end{tikzcd}$
\end{document}


You can scale it to any size

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows, matrix}
\tikzcdset{every label/.append style = {scale=0.5,yshift=0.2ex}}
\begin{document}
$\begin{tikzcd} 0\rar & \mathrm{Hom}_R(L, E) \arrow{r}{\mathrm{Hom}(\beta, \mathrm{id}_E)} & \mathrm{Hom}_R(N, E) \arrow{r}{\mathrm{Hom}(\alpha, \mathrm{id}_E)} & \mathrm{Hom}_R(M, E) \end{tikzcd}$
\end{document}


but I personally would rather increase the distance between the columns as suggested by Joule V.

• thank you all. How ever i mean how to reduce the distance between the letters in for all text upper the arrow. – H.Gorbanzad May 18 '19 at 14:40
• @H.Gorbanzad Do you really think that there is substantial space between the letters? You could do \tikzcdset{every label/.append style = {xscale=0.5,yshift=0.2ex}} but this doesn't look good IMHO. – user121799 May 18 '19 at 14:43
• Dear friend i really mean to reduce the space between the letters. – H.Gorbanzad May 18 '19 at 14:55
• Is it possible? – H.Gorbanzad May 18 '19 at 15:07
• @H.Gorbanzad How about \documentclass{article} \usepackage{amsmath} \usepackage{tikz-cd} \usetikzlibrary{arrows, matrix} \tikzcdset{every label/.append style = {scale=0.6,yshift=0.2ex}} \begin{document} $\begin{tikzcd} 0\rar & \mathrm{Hom}_R(L, E) \arrow{r}{\mathrm{Hom}\!(\!\beta\!, \mathrm{id}\!_E\!)} & \mathrm{Hom}_R(N, E) \arrow{r}{\mathrm{Hom}(\alpha, \mathrm{id}_E)} & \mathrm{Hom}_R(M, E) \end{tikzcd}$ \end{document} ? – user121799 May 18 '19 at 15:14

I wouldn't use tikzcd for this. Anyway, by reducing the font size and enlarging the column separation you get some result. Below I also show how I'd do it.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}

\DeclareMathOperator{\Hom}{Hom}
\newcommand{\id}{\mathrm{id}}

\begin{document}
$\begin{tikzcd}[column sep=large] 0\arrow[r] & \Hom_R(L, E) \arrow[r,"{\scriptscriptstyle\Hom(\beta, \id_E)}"] & \Hom_R(N, E) \arrow[r,"{\scriptscriptstyle\Hom(\alpha, \id_E)}"] & \Hom_R(M, E) \end{tikzcd}$

$0\longrightarrow \Hom_R(L, E) \xrightarrow{\Hom(\beta, \id_E)} \Hom_R(N, E) \xrightarrow{\Hom(\alpha, \id_E)} \Hom_R(M, E)$

\end{document}