User Tools

Site Tools


latex:exampe_eta

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
latex:exampe_eta [2021/10/02 08:55] iwnlatex:exampe_eta [2022/12/02 15:43] iwn
Line 6: Line 6:
  // //  // //
 </WRAP><WRAP column 42%> </WRAP><WRAP column 42%>
-{{ latex: theta-eta.png ? 0x1000 }}+{{ latex:tikz:axis2d_pseudorapidity.png ? 0x1000 }}
 </WRAP><WRAP column 2%> </WRAP><WRAP column 2%>
  // //  // //
Line 14: Line 14:
  
 <file latex theta-eta.tex> <file latex theta-eta.tex>
-% Author: Izaak Neutelings (July 2017) +% Author: Izaak Neutelings (June 2017) 
- +% Updated: December 2022 
-\documentclass{article} +\documentclass[border=3pt,tikz]{standalone}
-\usepackage{amsmath} % for \text +
-\usepackage{tikz}+
 \tikzset{>=latex} % for LaTeX arrow head \tikzset{>=latex} % for LaTeX arrow head
-\definecolor{mylightred}{RGB}{255,200,200} 
-\definecolor{mylightblue}{RGB}{172,188,63} 
-\definecolor{mylightgreen}{RGB}{150,220,150} 
- 
-% split figures into pages 
-\usepackage[active,tightpage]{preview} 
-\PreviewEnvironment{tikzpicture} 
-\setlength\PreviewBorder{1pt}% 
  
 \begin{document} \begin{document}
  
  
 +% SIMPLE FOR-LOOP
 \begin{tikzpicture}[scale=3] \begin{tikzpicture}[scale=3]
      
Line 52: Line 42:
  
  
 +% PSEUDORAPIDITY with manual for-loop over theta, eta
 +\begin{tikzpicture}[scale=3]
 +  \def\R{1.2} % radius/length of lines
 +  \node[scale=1,below left=1] at (0,\R) {$y$}; % y axis
 +  \node[scale=1,below left=1] at (\R,0) {$z$}; % z axis
 +  \foreach \t/\e in {90/0,60/0.55,45/0.88,30/1.32,10/2.43,0/+\infty}{ % loop over theta/eta
 +    \pgfkeys{/pgf/number format/precision=2}
 +    \draw[->,black!60!red,thick,line cap=round] % eta lines
 +      (0,0) -- (\t:\R) node[anchor=180+\t,black] {$\eta=\e$}
 +      node[black,pos=0.7,fill=white,scale=0.8,inner sep=1.5pt] {$\theta=\t^\circ$};
 +  }
 +  %\draw[black!60!red,thick] (0,0.1*\R) |- (0.1*\R,0) ; % overlap in corner
 +\end{tikzpicture}
  
 +
 +% PSEUDORAPIDITY with automatic calculation of eta
 \begin{tikzpicture}[scale=3] \begin{tikzpicture}[scale=3]
-   +  \pgfkeys{/pgf/number format/precision=2% two decimals 
-  % limits +  \def\R{1.2} % radius/length of lines 
-  %\def\N{4+  \node[scale=1,below left=1] at (0,\R) {$y$}; % y axis 
-  \def\R{1.2} +  \node[scale=1,below left=1] at (\R,0) {$z$}; % z axis 
-   +  \foreach \t in {90,60,45,30,10,0}{ % loop over theta 
-  axis labels +    \ifnum \t = 0 
-  \node[scale=0.9,below=5pt,left=2pt] at (0,\R) {$y$}; +      \def\e{+\infty} % infinity symbol 
-  \node[scale=0.9,left=5pt,below=2pt] at (\R,0) {$z$}; +    \else 
-   +      \pgfmathparse{-ln(tan(\t/2))} % pseudorapidity 
-  lines +      %\pgfmathroundto{\pgfmathresult} % round without traling zeroes 
-  \foreach \t/\e in {90/0,60/0.55,45/0.88,30/1.32,10/2.44,0/\infty}{ +      \pgfmathroundtozerofill{\pgfmathresult} % round with trailing zeroes 
-    \draw[->,black!60!red,thick] %samples=\N,variable=\x,domain=0:1+      \pgfmathsetmacro\e{\t==90?0:\pgfmathresult} % no trailing zeroes for theta = 0 
-      (0,0) -- ({\R*cos(\t)},{\R*sin(\t)}) +    \fi 
-      %plot({\x*\R*cos(\t)},{\x*\R*sin(\t)}) % alternative way with plotting a linear function +    \draw[->,black!60!red,thick,line cap=round% eta lines 
-      node[anchor=180+\t,black] {$\eta=\e$}; +      (0,0) -- (\t:\R) node[anchor=180+\t,black] {$\eta=\e$} 
-    \node[fill=white,scale=0.8] at ({0.8*cos(\t)},{0.8*sin(\t)}) {$\theta=\t^\circ$};+      node[black,pos=0.7,fill=white,scale=0.8,inner sep=1.5pt] {$\theta=\t^\circ$};
   }   }
-    +  %\draw[black!60!red,thick] (0,0.1*\R) |- (0.1*\R,0) ; % overlap in corner
 \end{tikzpicture} \end{tikzpicture}
- 
  
  
 \end{document} \end{document}
 </file> </file>
latex/exampe_eta.txt · Last modified: 2022/12/02 15:44 by iwn