我想在兩個煞車片中間打一個結。到目前為止我的想法:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{knots}
\begin{document}
$\left\langle \left\langle {\begin{tikzpicture}[domain=-2:2, scale=0.3]\begin{knot}
\strand (-1.3,1.3) to [out=right, in=right, looseness=2.2] (-1.3,-1.3);
\strand (1.3,1.3) to [out=left, in=left, looseness=2.2] (1.3,-1.3);
\end{knot}
\draw[dashed] (0,0) circle (2cm);
\end{tikzpicture}}\right\rangle\right\rangle $
\end{document}
現在我嘗試將網域從-2更改為2,但它沒有改變任何東西。也許有人可以給我提示,如何將 tikz 圖片精確地繪製在兩個小括號的中間?
預先非常感謝。
答案1
您可以使用baseline
調整 TiKZ 圖片的基線(手冊第 125 頁)。預設情況下,圖片的底部放置在基線上。透過僅傳遞baseline
,x-axis
(where y=0
) 與周圍文字的基線對齊。透過傳遞baseline=value
,進行調整,將 對應的水平線y=value
與基線對齊,從而有效地將圖片相對於該線居中。這可以與適當的方法一起使用value
,以有效地將圖片相對於數學分隔符號居中。
本來,我用的是-.5ex
.然而,感謝 Manuel 和egreg 提供了字體尺寸方面的正確值:\dimexpr-\fontdimen22\textfont2
。這將使用當前活動字體的適當尺寸使圖片相對於分隔符號居中——也就是說,此方法直接使用用於相對於文字基線排版數學公式的相同資訊。
一個對比:
\documentclass{article}
\usepackage{tikz,amsmath,mathtools}
\usetikzlibrary{knots}
\begin{document}
\noindent abc $\left\langle \sum_{i=1}^n \sqrt{f(x^{\sqrt[3]{i^x}})} \right\rangle$
$\left\langle \left\langle{%
\begin{tikzpicture}[domain=-2:2, scale=0.3]
\begin{knot}
\strand (-1.3,1.3) to [out=right, in=right, looseness=2.2] (-1.3,-1.3);
\strand (1.3,1.3) to [out=left, in=left, looseness=2.2] (1.3,-1.3);
\end{knot}
\draw[dashed] (0,0) circle (2cm);
\end{tikzpicture}%
}\right\rangle\right\rangle$
abc
$\left\langle \left\langle{%
\begin{tikzpicture}[baseline, domain=-2:2, scale=0.3]
\begin{knot}
\strand (-1.3,1.3) to [out=right, in=right, looseness=2.2] (-1.3,-1.3);
\strand (1.3,1.3) to [out=left, in=left, looseness=2.2] (1.3,-1.3);
\end{knot}
\draw[dashed] (0,0) circle (2cm);
\end{tikzpicture}%
}\right\rangle\right\rangle$
abc
$\left\langle \left\langle{%
\begin{tikzpicture}[baseline=\dimexpr-\fontdimen22\textfont2, domain=-2:2, scale=0.3]
\begin{knot}
\strand (-1.3,1.3) to [out=right, in=right, looseness=2.2] (-1.3,-1.3);
\strand (1.3,1.3) to [out=left, in=left, looseness=2.2] (1.3,-1.3);
\end{knot}
\draw[dashed] (0,0) circle (2cm);
\end{tikzpicture}%
}\right\rangle\right\rangle$
\end{document}
答案2
這是一個使用\vcenter
和 受約束 的解決方案\hbox
。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{knots}
\begin{document}
Try it like this:
$\left\langle \left\langle \vcenter{\hbox to 1.6cm{\hss\begin{tikzpicture}[domain=-2:2, scale=0.3]\begin{knot}
\strand (-1.3,1.3) to [out=right, in=right, looseness=2.2] (-1.3,-1.3);
\strand (1.3,1.3) to [out=left, in=left, looseness=2.2] (1.3,-1.3);
\end{knot}
\draw[dashed] (0,0) circle (2cm);
\end{tikzpicture}\hss}}\right\rangle\right\rangle$
\end{document}