How of to change font size for every nodes in tikzcd?
Since the TikZ cd
is a TikZ matrix
, you could use every matrix/.append style={nodes={font=...}}
.
I would also leave out all those \!
in the first label.
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows, matrix}
\tikzcdset{every label/.append style = {scale=0.6,yshift=0.6ex},
every matrix/.append style={nodes={font=\small}}
}
\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}
Edit:
As marmot pointed out, there is also the key cells=<options>
which appends <options>
to the style every cell
, which, in turn, by default contains the following:
/tikz/shape=asymmetrical rectangle,
/tikz/inner xsep=1ex,
/tikz/inner ysep=0.85ex
See the tikzcd package documentation, Section 2.1 General options.
MWE:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows, matrix}
\tikzcdset{
every label/.append style = {scale=0.6,yshift=0.6ex},
cells={nodes={font=\small}}
}
\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}
The result is the same as before.
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows, matrix}
\tikzcdset{every label/.append style = {scale=0.6,yshift=0.2ex},
nodes={font=\footnotesize}}
\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}
Btw how can readers read your supertiny text? I can't read it.