This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| latex:tikz [2021/07/05 21:31] – [How to draw diagrams in LaTeX with TikZ] iwn | latex:tikz [2022/12/02 15:42] (current) – [For-loops: Pseudorapidity 𝜂 and polar angle 𝜃] iwn | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| - | * [[http:// | + | * [[http:// |
| - | * The examples below and much more are also available on [[https:// | + | * The examples below and many more are also available on [[https:// |
| * [[http:// | * [[http:// | ||
| - | * For Feynman diagrams, please see [[latex:feynmp]]. | + | |
| + | | ||
| ===== Control regions ===== | ===== Control regions ===== | ||
| Line 389: | Line 389: | ||
| </ | </ | ||
| + | Using a for-loop over two variables: | ||
| + | <WRAP group>< | ||
| + | <code latex> | ||
| + | \begin{tikzpicture}[scale=3] | ||
| + | | ||
| + | % limits | ||
| + | \def\R{1.2} % radius/ | ||
| + | | ||
| + | % axis labels | ||
| + | \node[scale=1, | ||
| + | \node[scale=1, | ||
| + | | ||
| + | % lines | ||
| + | \foreach \t/\e in {90/ | ||
| + | \pgfkeys{/ | ||
| + | \draw[->, | ||
| + | (0,0) -- (\t:\R) node[anchor=180+\t, | ||
| + | node[black, | ||
| + | } | ||
| + | | ||
| + | \end{tikzpicture} | ||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | {{ latex: | ||
| + | \\ | ||
| + | </ | ||
| + | Using for-loop and calculation + rounding: | ||
| <WRAP group>< | <WRAP group>< | ||
| <code latex> | <code latex> | ||
| Line 395: | Line 423: | ||
| | | ||
| % limits | % limits | ||
| - | \def\R{1.2} | + | \def\R{1.2} |
| | | ||
| % axis labels | % axis labels | ||
| - | \node[scale=0.9,below=5pt,left=2pt] at (0,\R) {$y$}; | + | \node[scale=1,below left=1] at (0,\R) {$y$}; |
| - | \node[scale=0.9,left=5pt, | + | \node[scale=1,below left=1] at (\R,0) {$z$}; |
| | | ||
| % lines | % lines | ||
| - | \foreach \t/\e in {90/0,60/0.55,45/0.88,30/1.32,10/2.44,0/\infty}{ | + | |
| - | \draw[->, | + | |
| - | (0,0) -- ({\R*cos(\t)},{\R*sin(\t)}) | + | \ifnum \t = 0 |
| - | | + | \def\e{+\infty} |
| - | \node[fill=white, | + | \else |
| + | \pgfmathparse{-ln(tan(\t/ | ||
| + | %\pgfmathroundto{\pgfmathresult} % round without traling zeroes | ||
| + | \pgfmathroundtozerofill{\pgfmathresult} % round with trailing zeroes | ||
| + | \pgfmathsetmacro\e{\t==90? | ||
| + | \fi | ||
| + | \draw[->, | ||
| + | (0,0) -- (\t:\R) node[anchor=180+\t, | ||
| + | node[black, | ||
| } | } | ||
| - | | + | |
| \end{tikzpicture} | \end{tikzpicture} | ||
| </ | </ | ||
| </ | </ | ||
| \\ | \\ | ||
| - | {{ latex:theta-eta.png ? 2000 }} | + | {{ latex:tikz: |
| \\ | \\ | ||
| </ | </ | ||
| Line 800: | Line 836: | ||
| ===== 3D axis with spherical coordinates & CMS coordinate system ===== | ===== 3D axis with spherical coordinates & CMS coordinate system ===== | ||
| - | This piece of code is based on [[https:// | + | This piece of code is based on [[https:// |
| <WRAP group>< | <WRAP group>< | ||
| Line 838: | Line 874: | ||
| - | An example of rotating the 3D axes with the CMS conventional coordinate system by using the option '' | + | An example of rotating the 3D axes with the CMS conventional coordinate system by using the option '' |
| <WRAP group>< | <WRAP group>< | ||
| Line 908: | Line 944: | ||
| \end{tikzpicture} | \end{tikzpicture} | ||
| </ | </ | ||
| - | |||
| - | |||
| - | |||
| - | |||
| Line 919: | Line 951: | ||
| ===== Tau lepton decay signatures ===== | ===== Tau lepton decay signatures ===== | ||
| - | Inspiration from [[http:// | + | Inspiration from [[http:// |
| \\ | \\ | ||
| Line 980: | Line 1012: | ||
| ===== Higgs decay planes ===== | ===== Higgs decay planes ===== | ||
| - | Decay planes of Higgs decay to measure the Higgs boson' | + | Decay planes of Higgs decay to measure the Higgs boson' |
| <WRAP group>< | <WRAP group>< | ||
| Line 998: | Line 1030: | ||
| ===== Impact parameters ===== | ===== Impact parameters ===== | ||
| - | Examples of defining impact parameters in proton collisions ([[latex:tikz:impact_parameters|full code]]). | + | Examples of defining impact parameters in proton collisions ([[https://tikz.net/impact_parameters/|full code]]). |
| <WRAP group>< | <WRAP group>< | ||
| Line 1010: | Line 1042: | ||
| ===== Timelines and scales ===== | ===== Timelines and scales ===== | ||
| - | Examples of a simple time or energy scale with labels and arrows ([[latex:tikz:timescales|full code]]). | + | Examples of a simple time or energy scale with labels and arrows ([[https://tikz.net/ |
| <WRAP group>< | <WRAP group>< | ||
| Line 1032: | Line 1064: | ||
| ===== Jets cones ===== | ===== Jets cones ===== | ||
| - | Two examples of cones. Full code can be found [[latex:tikz:jet_cones|here]]. | + | Two examples of cones. Full code can be found [[https://tikz.net/ |
| Line 1143: | Line 1175: | ||
| ===== Top jets === | ===== Top jets === | ||
| - | The full code can be found [[latex:tikz:jet_top|here]]. | + | The full code can be found [[https://tikz.net/jet_top/|here]]. |
| <WRAP group>< | <WRAP group>< | ||
| Line 1192: | Line 1224: | ||
| - | | + | |
| - | One can do some projections of jet and MET vectors to construct variables like MT2 in SUSY searches. The full code can be found [[latex:tikz:jet_vectors|here]]. | + | One can do some projections of jet and MET vectors to construct variables like MT2 in SUSY searches. The full code can be found [[https://tikz.net/jet_vectors/|here]]. |
| <WRAP group>< | <WRAP group>< | ||
| Line 1259: | Line 1291: | ||
| Some different methods of finding the tangent to a circle or ellipse in TikZ. | Some different methods of finding the tangent to a circle or ellipse in TikZ. | ||
| Using these methods a nice cone can be made. | Using these methods a nice cone can be made. | ||
| - | The full code can be found [[latex:tikz:circle_tangent|here]]. | + | The full code can be found [[https://tikz.net/circle_tangent/|here]]. |