User Tools

Site Tools


latex:example_projection

Example of adding and projecting vectors. For more, please visit https://tikz.net/category/physics/particle-physics/.

projection.tex
% Author: Izaak Neutelings (June 2017)
 
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\tikzset{>=latex} % for LaTeX arrow head
\usetikzlibrary{calc} % to sum coordinates
\newcommand*{\vv}[1]{\vec{\mkern0mu#1}} % correct \vec misalignment
 
% split figures into pages
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}
 
\begin{document}
 
 
 
% PZETA VIS
\begin{tikzpicture}
 
  % vector labels
  \def\pT{ \vv{p}^\text{\tiny\,vis}_\text{\tiny\,T}}
  \def\pTA{\vv{p}^\text{\tiny\,vis}_\text{\tiny\,T,1}}
  \def\pTB{\vv{p}^\text{\tiny\,vis}_\text{\tiny\,T,2}}
 
  % define point
  \coordinate (O)  at (0.0, 0.0);
  \coordinate (Z)  at (3.5, 0.0);
  \coordinate (A)  at (1.0, 1.8);
  \coordinate (B)  at (1.2,-2.16);
  \coordinate (AB) at ($(A)+(B)$);
  \path let \p{AB}=(AB) in coordinate (P) at (\x{AB},0); % projection
 
  % axis
  \draw[->,thick,dashed]
    (-0.8,0) -- (Z)
    node[at end,below] {$\vv{\zeta}$};
 
  % main vectors
  \draw[->,thick,color=red]
    (O) -- (A)
    node[below=4pt,left=4pt,color=red] {$\pTA$};
  \draw[->,thick,color=red]
    (O) -- (B)
    node[above=2pt,left=2pt,color=red] {$\pTB$};
  \draw[->,color=red]
    (O) -- (AB)
    node[below=4pt,right,color=red,scale=1] {$\pT$}; %{$\sq\pTA+\,\pTB$};
 
  % helplines
  \draw[dashed,color=red]
    (A) -- (AB);
  \draw[dashed,color=red]
    (B) -- (AB);
  \draw[dashed,color=purple]
    (AB) -- (P);
 
  % vector sum
  \draw[->,thick,color=purple]
    (O) -- (P)
    node[right=4pt,above,color=purple] {$\vv{p}^\text{\tiny\,vis}_{\tiny\,\zeta}$};
 
\end{tikzpicture}
 
 
 
\end{document}
latex/example_projection.txt · Last modified: 2021/10/02 08:55 by iwn