我正在使用 Quiver,但在製作帶有彎曲箭頭的圖表時遇到了麻煩。例如,它建議我將這是我的文檔:
\begin{tikzcd}[ampersand replacement=\&,column sep=2.25em]
A \& B
\arrow[curve={height=-12pt}, from=1-1, to=1-2]
\end{tikzcd}
但是,它無法編譯。 TexMaker 告訴我:套件 tikz 錯誤:+ 或 - 預期,並且 \tikz@curveCdot 的使用與其定義不匹配。
我在序言中同時使用了tikz
和。tikz-cd
微量元素:
\documentclass{article}
\usepackage[french,english]{babel}
\usepackage{tikz-cd}
\usetikzlibrary{calc}
% A TikZ style for curved arrows of a fixed height, due to AndréC.
\tikzset{curve/.style={settings={#1},to path={(\tikztostart)
.. controls ($(\tikztostart)!\pv{pos}!(\tikztotarget)!\pv{height}!270:(\tikztotarget)$)
and ($(\tikztostart)!1-\pv{pos}!(\tikztotarget)!\pv{height}!270:(\tikztotarget)$)
.. (\tikztotarget)\tikztonodes}},
settings/.code={\tikzset{quiver/.cd,#1}
\def\pv##1{\pgfkeysvalueof{/tikz/quiver/##1}}},
quiver/.cd,pos/.initial=0.35,height/.initial=0}
\begin{document}
\begin{tikzcd}[ampersand replacement=\&]
A \& B
\arrow[curve={height=-12pt}, from=1-1, to=1-2]
\end{tikzcd}
\end{document}
答案1
您忘記加載babel
庫。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[french,english]{babel}
\usepackage{tikz-cd}
\usetikzlibrary{calc,babel} % <--- IMPORTANT!
% A TikZ style for curved arrows of a fixed height, due to AndréC.
\tikzset{
curve/.style={
settings={#1},
to path={
(\tikztostart)
.. controls ($(\tikztostart)!\pv{pos}!(\tikztotarget)!\pv{height}!270:(\tikztotarget)$)
and ($(\tikztostart)!1-\pv{pos}!(\tikztotarget)!\pv{height}!270:(\tikztotarget)$)
.. (\tikztotarget)\tikztonodes
},
},
settings/.code={%
\tikzset{quiver/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/quiver/##1}}%
},
quiver/.cd,
pos/.initial=0.35,
height/.initial=0,
}
\begin{document}
\begin{tikzcd}[ampersand replacement=\&]
A \& B
\arrow[curve={height=-12pt}, from=1-1, to=1-2]
\end{tikzcd}
\begin{tikzcd}
A & B
\arrow[curve={height=-12pt}, from=1-1, to=1-2]
\end{tikzcd}
\end{document}
不需要ampersand replacement
。