Tikz:在对齐环境中使用自交结库会引发错误

Tikz:在对齐环境中使用自交结库会引发错误

如果这是不好的风格,请纠正我,但我曾经align水平排列多个tikzpicture,并发现了以下情况。
以自相交的标准示例为例手动的对于 knots 包并将其放入align环境中。如果consider self intersections启用,则会引发错误,否则可以正常工作。
以下是代码:

\documentclass[12pt,a4paper]{scrartcl}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,knots}

\begin{document}        
\begin{align}
  \begin{tikzpicture}
    \begin{knot}[consider self intersections=true]
      \strand (0, 0)  .. controls  +(3, 1) and +(-3,1) .. (1,0);
    \end{knot}
  \end{tikzpicture}  
\end{align}
\end{document}

错误信息如下:

ERROR: Argument of \__fp_parse_expand:w has an extra }.

--- TeX said ---
<inserted text> 
                \par 
l.13 \end{align}

--- HELP ---
From the .log file...

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

有没有办法让自相交发挥作用align,或者我最好寻找其他方式来对图片进行排序?

答案1

在等式中将对象置于中心的常用方法是使用\vcenter{\hbox{...}}

\documentclass[12pt,a4paper]{scrartcl}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{knots}

\begin{document}        
\begin{align}
  \vcenter{\hbox{\begin{tikzpicture}
    \path[use as bounding box] (0,0) rectangle (1,0.78);
    \begin{knot}[consider self intersections=true]
      \strand (0, 0)  .. controls  +(3, 1) and +(-3,1) .. (1,0);
    \end{knot}
 \end{tikzpicture}}}&=7
\end{align}
\end{document}

在此处输入图片描述

我手动添加边界框的原因是 TiZ 高估了贝塞尔曲线的边界框。

答案2

库中有一个knots与比较 s 相关的错误fp,只有当 knot 环境包含在某种对齐环境中时才会暴露出来。我现在已经修复了这个问题github并将在适当的时候登陆 CTAN。

相关内容