如何使框的倾斜红线与 tikz-cd 箭头的斜率相匹配?除了通过目视检查更改坐标外,还有其他方法可以使边界红线与箭头的斜率完全匹配吗?我还收到了警告Overfull \hbox (12.18117pt too wide) in paragraph at lines 7--16
。我想将图形居中,以便它也位于幻灯片的中心。xshift
通过目视检查手动添加到中心似乎会使图形混乱。如果文本也在框中垂直居中,那就太好了。
\documentclass[10pt]{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz, tikz-cd, adjustbox}
\begin{document}
\begin{frame}[fragile]
\begin{tikzcd}[execute at end picture={
\draw[thick, red] (-1.15,-2.8) -- (-2.3,-0.65) -- (-5.6,-0.65) -- (-5.6,1.1) -- (-1.9,1.1) -- (0,-0.9) -- (5.6,-0.9) -- (5.6,-2.8) -- cycle;
}]
& & {\begin{array}{@{}c@{}}\text{Jones} \\ \text{algebra}\end{array}} \arrow{r}{\text{\normalsize Markov}}[swap]{\text{\normalsize trace}} &[5em] {\begin{array}{@{}c@{}}\text{Jones} \\ \text{polynomial}\end{array}} \\
{\begin{array}{@{}c@{}}\text{Oriented}\\ \text{link}\end{array}} \arrow[r] & {\begin{array}{@{}c@{}}\text{Artin} \\ \text{braid} \\ \text{group}\end{array}} \arrow[rd, sloped, "\text{Repres.}"] \arrow[ru, sloped, "\text{Repres.}"] & & \\
& & {\begin{array}{@{}c@{}}\text{Temperley--} \\ \text{Lieb} \\ \text{algebra}\end{array}} \arrow{r}{\text{\normalsize Diagrammatic}}[swap]{\text{\normalsize trace}} &[5em] {\begin{array}{@{}c@{}}\text{Normalised}\\ \text{bracket}\\ \text{polynomial}\end{array}} \arrow[uu, leftrightarrow, sloped, above, "\text{\normalsize Substitution}"]
\end{tikzcd}
\end{frame}
\end{document}
答案1
如果你的背景是空白的,那么你可以使用double
非常大的选项double distance
。这里我只是猜测5em
,虽然可以让 TikZ 测量所有节点并更自动地计算出来。
代码
\documentclass[tikz]{standalone}
%\documentclass[10pt]{beamer}
%\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usetikzlibrary{cd, backgrounds}
\newcommand*\tmnl[2][c]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
\begin{document}
%\begin{frame}[fragile]
\begin{tikzcd}[
math mode=false, labels={align=center},
execute at end picture={
\scoped[on background layer]
\draw[red, thick, name prefix=\tikzcdmatrixname-,
double distance=5em, line cap=rect]
plot coordinates {(2-1)(2-2)(3-3)(3-4)};}]
&
& \tmnl{Jones \\ algebra} \arrow[r, "Markov\\trace" auto=false]
&[5em] \tmnl{Jones \\ polynomial} \\
\tmnl{Oriented \\ link} \arrow[r]
& \tmnl{Artin \\ braid \\ group} \arrow[rd, sloped, "Repres."]
\arrow[ru, sloped, "Repres."] \\
&
& \tmnl{Temperley-- \\ Lieb \\ algebra}
\arrow[r, "Diagrammatic\\swap"' auto=false]
& \tmnl{Normalised \\ bracket \\ polynomial}
\arrow[uu, leftrightarrow, sloped, "Substitution"]
\end{tikzcd}
%\end{frame}
\end{document}