By default the arrow labels in tikz-cd
are quite small. When the labels involve subscripts or superscripts, they can become unreadable. How can I increase the label text size for all tikz-cd
diagrams in my document?
[Tex/LaTex] Increasing the text size of tikz-cd labels
tikz-cd
Related Solutions
The package documentation contains examples of most of this. Section 1.1 gives examples for placing of labels, Section 2 provides ways to adjust the appearence of the diagram and control spacing. However, the package documentation is easiest to understand in conjunction with the manual for tikz
and its underlying language pgf
: see http://www.ctan.org/pkg/pgf in particular section 16.8 Placing Nodes on a Line or Curve Explicitly.
By default labels on arrows are to the left of the direction of travel. This my be changed by prefixing the label with [swap]
, so you can write \arrow{r}{a}[swap]{b}
to get an arrow to the right with label a
above and b
below.
[Code at end.]
Diagrams are set on a grid, so you can't make more space for a single arrow. However, you can open up the grid horizontally and vertically (if necessary with different factors).
Basic tikz
options such as for placing labels along the arrow are [pos=0.7]
for 0.7
of the way along the length and [near start]
/[near end]
for near to the beginning or the end.
Labels may be turned with [rotate=90]
, or some other angle. Doing this you will often need to shift the label with the options xshift
or yshift
, as in the example above, where one could write
\arrow{d}[anchor=center,rotate=-90,yshift=1ex]{\text{arrow name}}
However, as Qrrbrbrilbel points out it is easier to use sloped
together with above
or below
as in the code below (swap
no longer has an effect).
\documentclass{article}
\usepackage{tikz-cd}
\usepackage{mathtools}
\begin{document}
\begin{displaymath}
\begin{tikzcd}
x \arrow{r}{a} \arrow{d}[swap]{b} &y \arrow{d}{d} \\
z \arrow{r}{e}[swap]{c} &w \\
\end{tikzcd}
\end{displaymath}
\begin{displaymath}
\begin{tikzcd}[column sep=6em,row sep=6em]
x \arrow{r}{\text{arrow name}}
\arrow{d} &y \arrow{d}[sloped,above]{\text{arrow
name}} \\
z \arrow{r} &w \\
\end{tikzcd}
\end{displaymath}
\end{document}
If you need a non-grid layout then as in section 3.3 of the manual, you need to resort to basic tikz
to place elements.
The maintainer of the package has responded to a message about this problem---it turns out to be intended behavior.
Original answer
I would consider that a bug and would advice you to report this. You can use the following example:
% arara: lualatex
\documentclass{article}
\usepackage{tikz-cd}
\usepackage{lua-visual-debug}
\begin{document}
\begin{tikzcd}
A \arrow[bend left=60,"\mid" pos=.1,"\mid" pos=.2,"\mid" pos=.3,"\mid" pos=.4,"\mid" pos=.5,"\mid" pos=.6,"\mid" pos=.7,"\mid" pos=.8,"\mid" pos=.9]{r} & B\\
A \arrow[bend left=30,"\mid" pos=.1,"\mid" pos=.2,"\mid" pos=.3,"\mid" pos=.4,"\mid" pos=.5,"\mid" pos=.6,"\mid" pos=.7,"\mid" pos=.8,"\mid" pos=.9]{r} & B\\
A \arrow["\mid" pos=.1,"\mid" pos=.2,"\mid" pos=.3,"\mid" pos=.4,"\mid" pos=.5,"\mid" pos=.6,"\mid" pos=.7,"\mid" pos=.8,"\mid" pos=.9]{r} & B
\end{tikzcd}
\end{document}
I would report it to tikz-cd
as this seems not to be a problem of TikZ itself. Just see this (sorry, ugly) code:
% arara: pdflatex
\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node (1) {A};
\node (2) [right = of 1] {B};
\path[every node/.append style=above] (1) edge[bend left=60] node [pos=.1] {$\mid$} node [pos=.2] {$\mid$} node [pos=.3] {$\mid$} node [pos=.4] {$\mid$} node [pos=.5] {$\mid$} node [pos=.6] {$\mid$} node [pos=.7] {$\mid$} node [pos=.8] {$\mid$} node [pos=.9] {$\mid$} (2);
\end{tikzpicture}
\end{document}
Best Answer
In your preamble, add
The default font size appears to be
\scriptsize
. Other options include (from small to larger):\tiny
,\scriptsize
,\footnotesize
,\small
, and\normalsize
.