1

I would like to crop the following TikZ figures, and also to center the figure regarding the baseline.

enter image description here

Here is my starting code.

\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 Answer 1

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}

enter image description here

1
  • Thanks a lot! One new thing learned.
    – projetmbc
    Feb 12, 2022 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .