我想要裁剪以下 TikZ 图形,并将图形置于基线的中心。
这是我的起始代码。
\documentclass[12pt]{article}
\usepackage{pgf,tikz}
\newcommand\parallelogram[2]{%
\begin{tikzpicture}[xslant=1]
\draw[->](0,0) -- (0,0.5);
\draw[->](0,0) -- (0.75,0);
\draw(0.75,0) -- (0.75,0.5);
\draw(0,0.5) -- (0.75,0.5);
\node[below] at (0.25,0) {\tiny$\vec{#1}$};
\node[left] at (0,0.35) {\tiny$\vec{#2}$};
\end{tikzpicture}%
}
\begin{document}
$Area \left( \parallelogram{u}{v} \right) = \dots$
$Area \left( \parallelogram{a}{b} \right) = \dots$
\end{document}
答案1
\documentclass[12pt]{article}
\usepackage{tikz}
\newcommand\parallelogram[2]{%
\begin{tikzpicture}[xslant=1,
baseline=(current bounding box)] % <--------------
\draw[->](0,0) -- (0,0.5);
\draw[->](0,0) -- (0.75,0);
\draw(0.75,0) -- (0.75,0.5);
\draw(0,0.5) -- (0.75,0.5);
\node[below] at (0.25,0) {\tiny$\vec{#1}$};
\node[left] at (0,0.35) {\tiny$\vec{#2}$};
\end{tikzpicture}%
}
\begin{document}
$Area \left( \parallelogram{u}{v} \right) = \dots$
$Area \left( \parallelogram{a}{b} \right) = \dots$
\end{document}