TikZ
- Why outside `\centering` outside the `tikzpicture` affect the LR-mode in tikz's content?by Explorer on November 1, 2025 at 6:58 pm
Description Here below are four examples: First. Without \centering and align=center: \documentclass[tikz]{standalone} \begin{document} % \centering% \begin{tikzpicture} \node [ % align=center ] {first\\second}; \end{tikzpicture} \end{document} Second. With \centering but not align=center: \documentclass[tikz]{standalone} \begin{document} \centering% \begin{tikzpicture} \node [ %align=center ] {first\\second}; \end{tikzpicture} \end{document} Third. With align=center but not \centering outsize: \documentclass[tikz]{standalone} \begin{document} % \centering% \begin{tikzpicture} \node [ align=center ] {first\\second}; \end{tikzpicture} \end{document} Fourth. With both \centering and align=center: \documentclass[tikz]{standalone} \begin{document} \centering \begin{tikzpicture} \node [ align=center ] {first\\second}; \end{tikzpicture} \end{document} Result case I: work. case II: failed. case III: work. case IV: work. The failed case, TeX complains that: ! LaTeX Error: Not allowed in LR mode. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.7 ] {first\\s econd}; Question: I was very surprised that \centering could even affect the node's content. IMO, the node's contents in deeply inside tikzpicture, which is safely protected by the group intuitively, and only control by tikz option align=<alignment>. My detailed questions are: In case I, without neigther align=center nor outside \centering, why the \\ didn't raise an error with LR-mode? In case II, why outside \centering would affect the node's contents mode?
- Tikz arrow difference in difference PDF-viewer?by Explorer on November 1, 2025 at 6:03 pm
I have the following mwe: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture}[% foo/.tip={Latex[width=0pt 5, length=5pt]}, line cap=round,line join=round,scale=1.3 ] \begin{scope} \coordinate (A) at (-1,0); \coordinate (B) at (1,0); \coordinate (C) at (0,{sqrt(3)}); \draw[foo-foo] (A) -- (B); \draw[foo-foo] (A) -- (C); \draw[foo-foo] (B) -- (C); \end{scope} \end{tikzpicture} \end{document} Then the output's arrow differs in different PDF-viewers: case1: PDF.js in LaTeXWorkshop case2: Edge browser case3: PDF-Xchange-Editor The abnormal arrow tip only shown with PDF-Xchange-Editor. Is this the PDF-viewer to be blamed, what caused this difference?
- What package is being used to generate these 3d plots? and advice on how to efficiently produce similar figures without hand-drawing everythingby userא0 on November 1, 2025 at 4:51 pm
In the following 4800 pages long topology book one can see lots of images like this: At the moment I am writing a document (Using Lyx) in which I would like to include similar plots. Does anyone know what package is being used here? (ctrl+F -ing the documents makes my whole pc crash) Is this simply Tikz? From my experience (prior question of mine) generating such plots usually involves quite complicated calculations (to get the precise shape you want), so I would also love to get some advice on how to "make some shortcuts" if possible. In the linked book one can find (I would assume) hundreds of such (very complicated) figures, so I am very skeptical that the author "hand tailored" each and every one of them. Thank you!
- pgfplots: declare function and parameters globallyby PatrickT on November 1, 2025 at 12:11 am
As I was intent on moving function declarations further up, so as to use them in multiple files, I noticed something unexpected. The first code plots a thin black line. The second code plots thick blue dots. I asked a well-known LLM and got a plausible explanation together with a hallucination. Do you have a suggestion to declare functions higher up while preserving the style? See a motivation further down. Example 1 \documentclass[border=3pt,tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \tikzset{define functions/.style={% declare function={ A = 1.0; a = 0.5; f(\x) = A*\x^a; }, }, } \begin{document} \begin{tikzpicture} \begin{axis}[ domain=0:100, samples=100, ] \addplot[define functions] {f(x)}; \end{axis} \end{tikzpicture} \end{document} Example 2 \documentclass[border=3pt,tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \tikzset{define functions/.style={% declare function={ A = 1.0; a = 0.5; f(\x) = A*\x^a; }, }, } \pgfplotsset{ every axis plot/.append style={define functions}, } \begin{document} \begin{tikzpicture} \begin{axis}[ domain=0:100, samples=100, ] % [define functions] not used here \addplot {f(x)}; \end{axis} \end{tikzpicture} \end{document} LLM talking now: Example 1 \addplot[define functions] {f(x)}; You explicitly attach the define functions style only to that plot. No other styles are affected. PGFPlots uses the default plot style, which is a thin black line (black, line width 0.4pt). Example 2 \pgfplotsset{every axis plot/.append style={define functions}} \addplot {f(x)}; You append the define functions style to every plot. But here’s the subtlety: every axis plot applies before the default plot style is applied, and declare function is a key that is not strictly separate from plotting keys. What happens internally: PGFPlots interprets your appended style as including both the function declaration and the style from the first plot in your style list. Because of key expansion order, the default line style is overridden. The plot falls back to the first "unknown" style PGFPlots sees for drawing, which is often the blue mark=* style (used for points), producing thick blue dots. Why this happens every axis plot is applied before \addplot options are merged. declare function is technically a "style key" in the PGFPlots system. PGFPlots sees a style (from every axis plot) that contains no explicit draw key, so it falls back to its default marker style (mark=*, thick, blue). When you attach [define functions] directly to \addplot, the default line style is preserved, so you get a thin black line. How to fix it You need to combine your define functions style with the standard line style: if you want to keep PGFPlots defaults but still append: \pgfplotsset{ every axis plot/.append style={define functions, /pgfplots/line} } Me speaking again: No this doesn't work and nor do the several other suggestions I received. Motivation: I would save different parameter values in distinct files and load them with, say \input{func1.tex}, so I can share code across multiple figures. The syntax used in declare function is natural, unlike an alternative like \pgfmathdeclarefunction{f}{1}{\pgfmathparse{1.0*#1^(0.5)}}. I'm not averse to trying something radically different from my current approach, including using LuaTeX or Python.
- Including a Mathematica graphic within TikZ picture: aligning the originsby murray on October 30, 2025 at 8:13 pm
I want to include a plot generated by Mathematica within a TikZ picture so that the origin (0,0) of the included plot is exactly at the TikZ origin (0,0). Here's how I create the Mathematica plot: SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"] cm = 72/2.54; parab = Plot[x^2/2, {x, 0, 3}, PlotRange -> {0, 4.5}, Ticks -> None, Axes -> True, AxesOrigin -> {0, 0}, AspectRatio -> Automatic, ImageSize -> 1 -> cm, Epilog -> {Purple, PointSize[Medium], Point[{1, 1/2}], Point[{2, 2}],Point[{3, 9/2}]}] Export["parabola.png", parab] Here is the exported .png (as was requested in a comment): And here is the LaTeX code where the Mathematica-generated graphic is imported and then the result of typesetting that LaTeX code: \documentclass{article} \usepackage{graphicx} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[anchor= south west] at (0,0) {\includegraphics{parabola.png}}; \draw[dashed] (0,0) grid (4,5); \fill[red] (0,0) circle (0.1); % origin (0,0) from TikZ \end{tikzpicture} \end{document} The LaTeX output: Problem: The origin of the graphic inserted there does not match the origin in the TikZ picture. (This is the case even if I include in the Mathematica Plot command the options ImagePadding -> None, ImageMargins -> 0.) Rather, the graphic exported from Mathematica is shifted a bit upwards and rightwards so that its origin is no longer at the TikZ picture origin. So the question is whether there is some extra space to the left and bottom of the graphic being exported from Mathematica, on the one hand, or whether there is something I don't understand about placement of the import within the TikZ picture. Further information: Following a comment, I directly included the Mathematica-exported .png into a box with: \documentclass{article} \usepackage[top=0.1cm,left=0.1cm]{geometry} \usepackage{graphicx} \usepackage{tikz} \begin{document} \fboxsep=0pt \fbox{\includegraphics{parabola.png}} \end{document} And the result (ta-da!) as a .png (to allow import here) already shows the shifting of the origin (0,0) upwards and to the left of the lower-left corner: [![LaTeX boxed image from Mathematica export][3]][3] (I originally aksed about this in https://mathematica.stackexchange.com/questions/316827/make-graphics-units-exactly-1-cm but the answer proffered there does not resolve the issue.) The cure: in Mathematica! By changing the option Axes -> True to Axes -> None when generating the Mathematica graphic, I discovered that Mathematica is inserting extra space to the left of the y-axis and below the x-axis when those axes are actually drawn. For me, the solution, at least in this case, is to use Axes -> None; then the coordinate origin (0,0) is precisely at the lower-left corner of the graphic exported. Thank you to all those who suggested cures through TikZ or editing the exported graphic! [3]: https://i.sstatic.net/8MSy2nFT.png
- Selectively Shift Axis Ticks in 3D Plotby Ludger on October 29, 2025 at 12:36 pm
I am currently working on a 3D surface plot in which both x-, and y-axis are logarithmic. The issue I am facing and why I am posting is that the measurements are too close to each other, and I hence end up with overlapping axis ticks on the x-, and y-axis. Is there a good way to transform individual ticks, bet it an odd/even selection, or directly picking out individual ticks and then shifting them? Thank you for your help! \documentclass[crop,tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.17} \usepgfplotslibrary{groupplots} \usepackage{xcolor} \begin{document} \begin{tikzpicture} % Ablation 1 (Linear System) \begin{axis}[ grid=major, tick align=outside, tick pos=left, view={210}{30}, xmin=0.0001, xmax=0.05, xmode=log, ymin=0.0001, ymax=0.0005, ymode=log, xtick={0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05}, xticklabels={$10^{-4}$, $5 \cdot 10^{-4}$, $10^{-3}$, $5 \cdot 10^{-3}$, $10^{-2}$, $5 \cdot 10^{-2}$}, ytick={0.0001, 0.0005}, yticklabels={$10^{-4}$, $5 \cdot 10^{-4}$}, ] \addplot3+ [mesh,scatter] table { 0.0001 0.0005 10 0.0001 0.0001 10 0.0005 0.0005 11 0.0005 0.0001 11 0.0010 0.0005 12 0.0010 0.0001 12 0.0050 0.0005 13 0.0050 0.0001 13 0.0100 0.0005 14 0.0100 0.0001 14 0.0500 0.0005 16 0.0500 0.0001 16 }; \end{axis} \end{tikzpicture} \end{document}
- spath3: bridges at nodes (rather than intersections)by BGaraiko on October 29, 2025 at 8:51 am
How can spath3 split a path at its coordinates? I have used spath3 to mark line intersections with an arc, but now I want the same arcs at the coordinates my line runs through. My understanding of the documentation is not sufficient to apply split at in a correct way. \documentclass[tikz]{standalone} \usetikzlibrary{spath3,intersections} \begin{document} \begin{tikzpicture} \path[nodes={circle,fill=red}] (-1.5,-.6) node(a) {a} (-.9, -.2) node(b) {b} (-1.5,1.5) node(c) {c} (-.3, .7) node(d) {d} (.5, 1.7) node(e) {e} (1.1, 1.1) node(f) {f} (.3, -.6) node(g) {g} (1.8, -.7) node(h) {h}; \path[spath/save=mainline] plot [smooth, tension=1] coordinates {(a) (b) (c) (d) (e) (f) (g) (h)}; \path[spath/save=arc] (0,0) arc[radius=1cm,start angle=180, delta angle=-180]; \tikzset{ % spath/split at intersections with={mainline}{???} spath/insert gaps after components={mainline}{5mm}, spath/join components with={mainline}{arc} } \draw[->,spath/use=mainline,line join=round]; \end{tikzpicture} \end{document}
- Centering Loop in rectangleby Nick B on October 28, 2025 at 11:38 pm
I am trying to create this image from Bryan Passwater. I can move my digits around, and would like the numbers to be centered (same distance from border on each side (see image). Is there a better way to make this? \documentclass{article} \usepackage{parskip,fullpage,hyperref} \usepackage{tikz} \usetikzlibrary{positioning,arrows.meta} \usetikzlibrary{backgrounds} %<- New Today \title{Drawing in the Background Using TiKZ} \author{\href{https://www.youtube.com/@UnlockingLaTeXGraphics}{@UnlockingLaTeXGraphics}} \date{} \begin{document} \begin{tikzpicture}[font=\Huge] % box (width 14, height 2) \draw (0,0) rectangle (14,2); % digits 0..9, evenly spaced from x=1 to x=13 at mid-height y=1.5 \foreach \n in {0,...,9} \node[align=center] at ({1 + 1.32*\n}, 1) {\n}; \end{tikzpicture} \end{document}
- How do I make a quantum circuit with parititioned maximally entangled states?by jrobins on October 28, 2025 at 6:24 pm
I want to make a quantum circuit (with possibly quantikz) that starts in a maximally entangled state for which each tensor factor is partitioned. That is, I want to replicate some of the quantum circuits as below (from https://arxiv.org/abs/1911.06314, p26): I know quantikz has the command \makeebit[s]{l} (p13), but it seems like it's only possible to use it for the lines connecting Br and Bl on the right hand side, not both and not either side. I am looking for a way to at least replicate the right side of the figure, preferably also the left side and preferably using a package. Is that possible? A satisfactory answer would be: some command like \eebit that generates the drawn line as in the 'desired outcome' some alternative tensor graphing package that does the job I'd greatly appreciate your considerations and thanks in advance. MWE \documentclass[border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{quantikz2} \input{preamble} \begin{document} \begin{quantikz} &\\ \makeebit[angle=-20]{$\ket{\text{epr}}$} &\\ &\\ & \end{quantikz} \end{document} outcome MWE vs desired outcome
- nested tikzmarknode is not supported to draw this "labelscope" figure?by Explorer on October 28, 2025 at 3:24 am
I want to plot something as below: Yep, it can be done by pure-TikZ with patience, but I wonder whether it could be done more elegantly via, for example tikzmark: \documentclass{article} \usepackage{lipsum} \usepackage{tikz} \usepackage{amsmath,amsfonts} \usepackage{newtxmath} \usetikzlibrary{tikzmark,calc} \NewDocumentCommand{\labelscope}{ O{.5} O{.1} O{.25} m m }{ % #1 pos of the start point % #2 voffset of the horizontal line % #3 voffset of the vertical line \draw ([yshift=-#2cm]#4.south west) -- ([yshift=-#2cm]#4.south east); \coordinate (aux1) at (#4.south west); \coordinate (aux2) at (#4.south east); \coordinate (aux) at ($(aux1)!#1!(aux2)$); \draw[-latex] ([yshift=-#2cm]aux) -- ++(0,-#3cm) -| ([yshift=-#2cm]#5.south); } \begin{document} \lipsum[2] \[ \forall y(A(\overset{\uparrow}{x},y) \land \ \tikzmarknode{n1}{\exists} y\ \tikzmarknode{n2}{B(y)} \to \tikzmarknode{m1}{\exists} x\ \tikzmarknode{m2}{(A(x,\bar{y}) \lor \ \tikzmarknode{n3}{\forall} y\ \tikzmarknode{n4}{B(y)})} ) \] \begin{tikzpicture}[remember picture,overlay,thick] \labelscope{n2}{n1} % \labelscope{n4}{n3} \labelscope{m2}{m1} \end{tikzpicture} \lipsum[2] \end{document} It gives the wrong result for the sake of nested \tikzmarknode, is that good method to handle this case, or workaround the limitation? Edit: Or is that any good method to locate the .south west and .south east? Any possible thoughts is welcome!
- tikzpicture lthe images dont displayby mehyeddine on October 27, 2025 at 1:34 pm
I want to display the images of \sqrt{3} and -\sqrt{3} and I want a single up arrow and not horizontal arrows but it doesn't work with \tkzTabVal{1}{3}{0.5}{}{$-3\sqrt{3}-2$} \tkzTabVal[draw]{2}{4}{1}{}{$3\sqrt{3}-2$} please help me \begin{tikzpicture} \tkzTabInit[lgt=1.5, espcl=3.5, deltacl=0.5] {$x$ / 0.9, $f'(x)$ / 0.9, $f$ / 2.5} {$-\infty$, $-\sqrt{3}$, $\sqrt{3}$, $+\infty$} \tkzTabLine{ , + , z , +, z , + , } \tkzTabVar{ - / $-\infty$, R , R , + / $+\infty$ } \tkzTabVal{1}{3}{0.5}{}{$-3\sqrt{3}-2$} \tkzTabVal[draw]{2}{4}{1}{}{$3\sqrt{3}-2$} \end{tikzpicture}
- Escape curly brackets from command output when passed as tikz argumentsby UnderscorePoY on October 27, 2025 at 12:01 pm
I'm trying to make a command that dynamically changes the brackets of a tikz line via \draw. Here's a MWE : \documentclass[crop,tikz]{standalone} \usetikzlibrary{arrows.meta} \newcommand{\intervalleArrowTip}{% {Bracket[reversed, width=1em]} } \newcommand{\intervalle}{ \def\lat{\intervalleArrowTip};% left arrow tip \draw[\lat-] (0,0) -- (1,0); } \begin{document} \begin{tikzpicture} \intervalle; \end{tikzpicture} \end{document} Here's the error code : Package pgf Error: Unknown arrow tip kind 'Bracket'. ... l.17 \intervalle ; When typed inside the \draw arguments, the curly brackets surrounding Bracket[reversed, width=1em] are required. But they seem to either disappear after \intervalleArrowTip is called, or trigger the tikz evaluation process within the tikzpicture block. I tried using \noexpand inside the command, inside the \def or inside the \draw options; i also added more surrounding curly braces, without success. I eventually tried escaping them with \{ and \}, in which case \draw receives the backslashes and produces a similar error. Is there a way to escape these curly braces ? Thanks in advance.
- lyluatex: How to get coordinates of a score element (note, clef) for use in TikZ?by cjorssen on October 27, 2025 at 11:01 am
I am using lyluatex to embed LilyPond scores in my lualatex document. I would like to use TikZ to draw complex annotations (like arrows or circles) over these scores. To do this, I need to get the precise (x,y) coordinates of specific musical elements (like a notehead, a clef, or a rest) and make them available to LaTeX/TikZ. My question is: What is the mechanism (if any) provided by lyluatex to "mark" a point inside the LilyPond code and retrieve its coordinates outside in LaTeX? Ideally, I am looking for two things: A command/function to place inside the \begin{lilypond} environment (e.g., next to a note). A LaTeX macro to use outside (in a tikzpicture environment) to access the coordinates of that mark, likely using the score's id. Here is a conceptual MWE. The commands \SomeLilypondMarkCommand and \SomeLatexPointCommand are placeholders for the real commands I am looking for. \documentclass{article} \usepackage{lmodern} \usepackage{geometry} \usepackage{lyluatex} \usepackage{tikz} \usetikzlibrary{overlay, remember picture} % --- PSEUDO-CODE: These commands are what I am looking for --- % \newcommand{\SomeLilypondMarkCommand}[1]{} % This would be used inside LilyPond % \newcommand{\SomeLatexPointCommand}[2]{(0,0)} % This would retrieve the point in LaTeX % --- \begin{document} Here is the score I want to annotate: % I assume I need [remember picture] for TikZ overlay \begin{lilypond}[id=myScore, remember picture] \relative c' { \clef treble % This is what I WANT to do: g4 % \SomeLilypondMarkCommand #"noteG" a % \SomeLilypondMarkCommand #"noteA" b c } \end{lilypond} Some text following the score. % Then, I want to use those marks in a TikZ picture \begin{tikzpicture}[remember picture, overlay] % I imagine retrieving the coordinates like this: % \node (G_node) at (\SomeLatexPointCommand{myScore}{noteG}) {}; % \node (A_node) at (\SomeLatexPointCommand{myScore}{noteA}) {}; % If (G_node) and (A_node) were defined, % I could then draw annotations easily: % % \draw [red, thick, opacity=0.7] (G_node) circle (4pt); % \draw [blue, ->, thick] (G_node) to (A_node); \end{tikzpicture} \end{document}
- I received ! Incomplete \iffalse; with a \foreach in a tikZ image générationby Nico59000 on October 27, 2025 at 10:45 am
I tried to compile a TikZ image generation for some elements tables and obtained in the first foreach at end } in tikz picture generation ! Incomplete \iffalse; all text was ignored after line 254. <inserted text> \fi I don't perceive where that \iffalse statement is generated! Can someone help? \documentclass[11pt,a4paper]{article} % --- Encodage & langue --------------------------------------------------------- \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[french]{babel} \usepackage{lmodern} \usepackage{microtype} % --- Maths & unités ------------------------------------------------------------ \usepackage{amsmath,amssymb} \usepackage{siunitx} \sisetup{detect-weight=true,detect-family=true} % --- Dessin ------------------------------------------------------------------- \usepackage{tikz} \usetikzlibrary{calc,arrows.meta,positioning,decorations.pathmorphing} % --- Mise en page -------------------------------------------------------------- \usepackage{geometry} \geometry{margin=2.2cm} \setlength{\parskip}{0.5em} \setlength{\parindent}{0pt} % Disques : 7 périodes empilées du bas (p=1) vers le haut (p=7) \newcommand{\LayerSep}{1.9} % écart vertical entre centres des disques (cm) \newcommand{\Rbase}{1.8} % rayon du disque de la période 1 (cm) \newcommand{\Rstep}{0.35} % incrément de rayon par période (cm) \newcommand{\PeriodFromZ}[1]{%% renvoie p ∈ {1,...,7} \pgfmathparse{int( (#1<=2) ? 1 : ( (#1<=10) ? 2 : ( (#1<=18) ? 3 : ( (#1<=36) ? 4 : ( (#1<=54) ? 5 : ( (#1<=86) ? 6 : 7 )))) ))} \pgfmathresult } % Rayon du disque pour la période p \newcommand{\RadiusFromPeriod}[1]{%% R_p = Rbase + (p-1)*Rstep \pgfmathparse{\Rbase + ( (#1 - 1) * \Rstep )} \pgfmathresult } % Centre (x,y) du disque pour la période p (pile verticale, x=0) \newcommand{\CenterYFromPeriod}[1]{%% y_p = (p-1)*LayerSep \pgfmathparse{( #1 - 1 ) * \LayerSep} \pgfmathresult } % — Produit un noeud nommé : node-<sym>-<A>-s<state> \newcommand{\PlaceNuclide}[9]{% % Période, géométrie du disque \pgfmathsetmacro{\p}{\PeriodFromZ{#2}} \pgfmathsetmacro{\Ry}{\CenterYFromPeriod{\p}} \pgfmathsetmacro{\Rp}{\RadiusFromPeriod{\p}} \end{scope}% } \begin{document} \section*{Exemple minimal (schéma)} \begin{center} \begin{tikzpicture}[scale=1] % Disques des 7 périodes \foreach \p in {1,...,7} {% \pgfmathsetmacro{\Ry}{\CenterYFromPeriod{\p}} \pgfmathsetmacro{\Rp}{\RadiusFromPeriod{\p}} \draw[disk] (0,\Ry) circle (\Rp); \node[layerlab, anchor=east] at (-\Rp-0.25,\Ry) {p,=,\p}; } % --- Démonstration : H (Z=1), A∈{1,2,3} --- % bornes A_min/A_max pour H : 1..3 (exemple simple) % 1H: I=1/2^+ (g) ; 2H: I=1^+ (g) ; 3H: I=1/2^+ (g) \PlaceNuclide{H}{1}{1}{0.5}{+1}{0}{0.0}{1}{3} \PlaceNuclide{H}{1}{2}{1.0}{+1}{0}{0.0}{1}{3} \PlaceNuclide{H}{1}{3}{0.5}{+1}{0}{0.0}{1}{3} \ConnectIsotopes{node-H-1-s0,node-H-2-s0,node-H-3-s0} % --- Démonstration : He (Z=2), A∈{3,4} --- % 3He: I=1/2^+ ; 4He: I=0^+ \PlaceNuclide{He}{2}{3}{0.5}{+1}{0}{0.0}{3}{4} \PlaceNuclide{He}{2}{4}{0.0}{+1}{0}{0.0}{3}{4} \ConnectIsobars{node-H-3-s0,node-He-3-s0} % --- Exemple d’état métastable : 99mTc (Z=43,A=99,I≈1/2^-, m1, E≈0.142 MeV) \PlaceNuclide{Tc}{43}{99}{0.5}{-1}{1}{0.142}{97}{103} \end{tikzpicture} \end{center} \end{document}
- Arrows along path are misaligned after unrelated calculationsby PatrickT on October 27, 2025 at 7:08 am
The objective is to draw arrows that show convergence to a particular coordinate. The code below has served me well in simple cases. But attempting to use coordinates calculated with the intersections library caused a vertical misalignment. In the MWE the derived coordinates are not even used: the misalignment seems to be caused by the calculations. I would appreciate help fixing the issue. Any other advice to optimize the code is welcome. \documentclass[border=3pt,tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{calc} \usetikzlibrary{intersections} % set up all axes \pgfplotsset{% every axis/.append style={% axis styles xmin = 0, xmax = 250, ymin = 0, ymax = 60, ticks = none,% remove all ticks grid = none,% remove all grids clip = false,% remove clip },% }% % Define coordinates \newcommand{\SetCoordinates}{% % coordinates \coordinate (A) at (0,30); \coordinate (B) at (100,0); % calculations below interfere somehow... % define first path \addplot [draw=none, forget plot, domain=-1:200, restrict y to domain=-1:100, name path global=first path] {sqrt(x)}; % define second path \addplot [draw=none, forget plot, domain=-1:200, restrict y to domain=-1:100, name path global=second path] {0.10*x}; % find the intersection of first path and second path \path [name intersections={of=first path and second path, by={E}}]; }% % define styles for arrows along path \usetikzlibrary{arrows} \usetikzlibrary{decorations.markings} % see: https://tikz.dev/library-decorations#sec-50.2 \usetikzlibrary{fpu}% use with [/pgf/fpu/install only={reciprocal}] \tikzset{ set arrows onpath/.code={\pgfqkeys{/tikz/arrows onpath}{#1}}, set arrows onpath={end/.initial=>, opt/.initial=}, /pgf/decoration/Mark/.style={ mark/.expanded=at position #1 with { \noexpand\arrow[\pgfkeysvalueof{/tikz/arrows onpath/opt}]{\pgfkeysvalueof{/tikz/arrows onpath/end}} } }, arrows onpath/.style 2 args={ set arrows onpath={#1}, postaction={ decorate,decoration={ markings, Mark/.list={#2}, },% },% },% }% % Arrow | x-axis | Convergence \NewDocumentCommand{\hArrows}{ m O{ 30pt } }{% \path [draw=none, arrows onpath={end=latex, opt={black,scale=0.9}}{0.50,0.75,1.00}] ($(#1)+(+#2,0)$) -- (#1); \path [draw=none, arrows onpath={end=latex, opt={black,scale=0.9}}{0.50,0.75,1.00}] ($(#1)+(-#2,0)$) -- (#1); }% % Arrow | y-axis | Convergence \NewDocumentCommand{\vArrows}{ m O{ 30pt } }{% \path [draw=none, arrows onpath={end=latex, opt={black,scale=0.9}}{0.50,0.75,1.00}] ($(#1)+(0,+#2)$) -- (#1); \path [draw=none, arrows onpath={end=latex, opt={black,scale=0.9}}{0.50,0.75,1.00}] ($(#1)+(0,-#2)$) -- (#1); }% \begin{document} \begin{tikzpicture} \begin{axis} \SetCoordinates \hArrows{B}[50pt] \vArrows{A}[10pt]% buggy \node [left, align=center, anchor=south west] at (40,20) {The vertical alignment\\ is thrown off\\ by the calculations inside\\ command \texttt{SetCoordinates}.\\ Why?}; \end{axis} \end{tikzpicture} \end{document}
- Parsing command arguments with xstring within tikzpicture blockby UnderscorePoY on October 26, 2025 at 10:26 pm
I'm trying to write a custom command to automatically adapt the shape of intervals in Tikz. I'm currently trying to pass an orientation argument to the command \intervalle to parse it via another command \intervalleParseOrientation. Here's a MWE: \documentclass[crop,tikz]{standalone} \usepackage{xstring} \newcommand{\intervalleParseOrientation}[2]{ \IfStrEqCase{#1}{ {h}{{#2}, 0} {v}{0, {#2}} }[\GenericError{}{}{}{h (horizontal) or v (vertical)}] } \newcommand{\intervalle}[1]{ \draw[|-|] (0, 0) -- (\intervalleParseOrientation{h}{1}); } \begin{document} \begin{tikzpicture} \intervalle{1}; \end{tikzpicture} \end{document} This gives the error Illegal parameter number in definition of \tikz@scan@point@coordinate., pointing at the argument within the call to \intervalle. Anyone happens to have encountered such error ? I'd really appreciate some help on that one. Thanks in advance!
- Segmented cake symbolby Sebastiano on October 26, 2025 at 9:50 pm
Let's take as an example an old request of mine, where I asked to create small symbols (eyes) to indicate the difficulty of an exercise. TikZ or symbol eyes for difficulty of examples/exercises Since I can't find a symbol, among those available in the symbol manual, that represents 1/4 of a cake to indicate time (and that can be associated with 1/2, 3/4, and 4/4), I wonder if it's possible to adapt the Marsupilam code to use a symbol that can be found in an Italian national newspaper. I think that is an image and not a symbol. \documentclass[12pt]{standalone} \usepackage{tikz} \newcommand\straightEye[1][1.2ex] {% \begin{tikzpicture}[scale=#1/1cm] \draw (0,0) circle (.5); \fill (0,0) circle (.25); \end{tikzpicture}% } \newcommand\downwardsEye[1][1.2ex] {% \begin{tikzpicture}[scale=#1/1cm] \draw (0,0) circle (.5); \fill (0,-.25) circle (.25); \end{tikzpicture}% } \newcommand\rightEye[1][1.2ex] {% \begin{tikzpicture}[scale=#1/1cm] \draw (0,0) circle (.5); \fill (.25,0) circle (.25); \end{tikzpicture}% } \begin{document} \straightEye \downwardsEye \ look at me \rightEye\rightEye \end{document}
- TikZ: How to transform text to make it realistically appear as if it is drawn on a 3D cylindrical surface?by Diaa on October 25, 2025 at 11:15 am
The required behavior of the drawn text is as follows: It should be transformed or slanted to appear as if it is drawn on a 3D cylindrical surface, based on the viewing angle. It should gradually diminish in size or visibility when approaching a top-view (bird’s-eye) 3D perspective. \documentclass[tikz, border=10pt]{standalone} \usepackage{tikz} \usepackage{animate} \usetikzlibrary{3d, perspective, calc, decorations.markings, decorations.text} \tikzset{ my cylinder parameters/.search also = {/pgf,/tikz}, my cylinder parameters/.cd, radius/.store in = \cylRadius, radius=1, height/.store in = \cylHeight, height=2, view azimuth/.store in = \cylViewAzimuth, view azimuth=\rotZ, color/.code = {\colorlet{cylColor}{#1}}, color = blue, topstyle aux/.style = {fill = cylColor!20, fill opacity=0.1}, topstyle/.code = {\tikzset{my cylinder parameters/topstyle aux/.append style={#1}}}, facestyle aux/.style = {fill = cylColor!50, fill opacity=0.1}, facestyle/.code = {\tikzset{my cylinder parameters/facestyle aux/.append style={#1}}}, bottomstyle aux/.style = {fill = cylColor!20, fill opacity=0.1}, bottomstyle/.code = {\tikzset{my cylinder parameters/bottomstyle aux/.append style={#1}}}, edgestyle aux/.style = {thick, color = cylColor}, edgestyle/.code = {\tikzset{my cylinder parameters/edgestyle aux/.append style={#1}}}, } \tikzset{ pics/mycylinder/.style = { code = { \tikzset{my cylinder parameters/.cd,#1} \coordinate (edge1 bottom) at ({\cylViewAzimuth}:\cylRadius); \coordinate (edge1 top) at ({\cylRadius*cos(\cylViewAzimuth)}, {\cylRadius*sin(\cylViewAzimuth)}, \cylHeight); \coordinate (edge2 bottom) at ({\cylViewAzimuth+180}:\cylRadius); \coordinate (edge2 top) at ({\cylRadius*cos(\cylViewAzimuth+180)}, {\cylRadius*sin(\cylViewAzimuth+180)}, \cylHeight); \begin{scope}[canvas is xy plane at z=0] \path[thick, cylColor, my cylinder parameters/bottomstyle aux] (0,0) circle(\cylRadius); \end{scope} % Fill the cylinder face \path[draw, my cylinder parameters/facestyle aux] (edge2 bottom) arc[start angle={\cylViewAzimuth-180}, end angle={\cylViewAzimuth}, radius=\cylRadius] -- (edge1 top) {[canvas is xy plane at z=\cylHeight] arc[start angle={\cylViewAzimuth}, end angle={\cylViewAzimuth-180}, radius=\cylRadius]} -- cycle; % Draw the top circle \begin{scope}[canvas is xy plane at z=\cylHeight] \draw[thick, cylColor, my cylinder parameters/topstyle aux] (0,0) circle(\cylRadius); \end{scope} \coordinate (-bottom-center) at (0, 0, 0); \coordinate (-top-center) at (0, 0, \cylHeight); % Draw BOTTOM HALF (Red) \path[fill=red!70, opacity=0.8] (edge2 bottom) arc[start angle={\cylViewAzimuth-180}, end angle={\cylViewAzimuth}, radius=\cylRadius] -- ($(edge1 bottom)!0.5!(edge1 top)$) {[canvas is xy plane at z=\cylHeight] arc[start angle={\cylViewAzimuth}, end angle={\cylViewAzimuth-180}, radius=\cylRadius]} -- cycle; \begin{scope}[canvas is xy plane at z = 0.25*\cylHeight] \path[ decorate, decoration={ text along path, text={|\bfseries\color{black}|North Pole}, text align=center, } ] % This arc follows the actual cylinder surface ($(edge2 bottom)!0.25!(edge2 top)$) arc[start angle={\cylViewAzimuth-180}, end angle={\cylViewAzimuth}, radius=\cylRadius]; \end{scope} % Draw TOP HALF (Blue) \path[fill=blue!70, opacity=0.8] ($(edge2 bottom)!0.5!(edge2 top)$) arc[start angle={\cylViewAzimuth-180}, end angle={\cylViewAzimuth}, radius=\cylRadius] -- (edge1 top) {[canvas is xy plane at z=\cylHeight] arc[start angle={\cylViewAzimuth}, end angle={\cylViewAzimuth-180}, radius=\cylRadius]} -- cycle; \begin{scope}[canvas is xy plane at z = 0.75*\cylHeight] \path[ decorate, decoration={ text along path, text={|\bfseries\color{black}|South Pole}, text align=center } ] % This arc follows the actual cylinder surface ($(edge2 bottom)!0.75!(edge2 top)$) arc[start angle={\cylViewAzimuth-180}, end angle={\cylViewAzimuth}, radius=\cylRadius]; \end{scope} } }, } \begin{document} \foreach \rotX in {10,30,60,...,170}{ \foreach \rotZ in {10,30,60,...,170}{ \begin{tikzpicture}[3d view={\rotZ}{\rotX}] \begin{scope}[->, black, thin] \draw (0,0,0)-- (3,0,0) node[anchor=north east]{$x$}; \draw (0,0,0) -- (0,3,0) node[anchor=north west]{$y$}; \draw (0,0,0) -- (0,0,3) node[anchor=south]{$z$}; \end{scope} \pic at (2,4) {mycylinder}; \node[anchor=south,inner sep=20pt] at (current bounding box.north) {Elevation:\rotX° Azimuth:\rotZ°}; \end{tikzpicture} } } \end{document} P.S. I would be grateful if someone could advise me on how to export a more stable GIF animated image instead of the shaky one I've attached here.
- Is it possile to make smaller half lefts in Feynman-Tikz?by DominikSz on October 20, 2025 at 5:52 pm
I'm attempting to recreate the below diagrams using the feynman-tikz package. I've attempted the below code, \begin{subfigure}{0.4\textwidth} \centering \feynmandiagram[layered layout, horizontal = a to b]{ a -- [fermion] d -- [fermion, edge label =$e^-$] c -- [fermion] b, d -- [photon, half left, edge label =$\gamma$] c, }; \caption{An electron emits a photon which is then reabsorbed.} \end{subfigure} \begin{subfigure}{0.4\textwidth} \centering \feynmandiagram[horizontal = a to b]{ a -- [fermion] d -- [fermion, edge label=$e^-$] c -- [fermion] b, d -- [photon, quarter left, edge label=$\gamma$] e -- [fermion, half left=0.5cm, edge label=$e^-$] f -- [fermion, half left=0.1cm, edge label=$e^+$] e, f -- [photon, half left] c, }; \caption{Vacuum polarisation.} \label{fig:polarisation} \end{subfigure} however, my diagram (b) looks less than ideal, as shown below. Is there a way to make the latex diagram look more like the drawn one without having to resort to specifying vertices manually? Thanks.
- Strange brace positions in Tikz and adding texts at the bottomby user37891 on May 22, 2025 at 11:32 am
I made this flow chart template in draw.io and would like to replicate this in Tikz to make it prettier. My current code (see below) can't seem to work right as the top brace keeps floating around, can't be put in the correct position. Will really appreciate if someone could point out the error and fix my code. \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning, shapes, decorations.pathreplacing, calc} \begin{document} \begin{tikzpicture}[ every node/.style={font=\sffamily}, box/.style={draw, rounded corners, align=center, minimum width=3.3cm, minimum height=1cm, fill=gray!10}, level 1/.style={sibling distance=6cm}, level 2/.style={sibling distance=4cm}, level 3/.style={sibling distance=3.5cm}, edge from parent/.style={draw, thick}, edge from parent path={(\tikzparentnode.south) -- ++(0,-5pt) -| (\tikzchildnode.north)} ] % Tree structure \node[draw=none] {} child { node[box] (group1) {Group 1} child { node[box] (cme1) {A} child { node[box] {D} child { node[box] {C} } } } child { node[box] (group2) {group 2} child { node[box] (cme2) {A} child { node[box] {B} } } }; % Add a brace over Group 1 and Group 2 \path (group1.north west) ++(-0.3,0.4) coordinate (braceleft); \path (group2.north east) ++(0.3,0.4) coordinate (braceright); \draw [decorate, decoration={brace, amplitude=6pt}, thick] (braceleft) -- (braceright); \end{tikzpicture} \end{document}
- Tikz 3D-Graphic; background, foreground, intersectionsby Mika on January 1, 2025 at 4:36 pm
I need to draw something like this in Tikz. My problem is that the edges crossing in the back have to stop at every intersection... I already saw some examples using \usetikzlibrary{cd} \tikzcdset{3d cd/.style={/tikz/every odd row/.append style={xshift={#1}}}} But as I don´t want to draw a diagram, it seems to be the wrong way for me... This the code I used to draw the picture, but I´m very sure it´s way too complicated =) As I am realle new to Tikz, I´d be very thankful for any help =) \documentclass{article} \usepackage{tikz} \usetikzlibrary{patterns} \usetikzlibrary{calc} \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{10pt}% \usetikzlibrary{intersections} \usepackage{tkz-euclide} \usetikzlibrary{3d} \usepackage{tikz-3dplot} \begin{document} \tdplotsetmaincoords{60}{120} % Radius intersection \def\radius{1.mm} \begin{tikzpicture}[tdplot_main_coords, scale=1.5] %XYZ \path[->] (0,0,0) -- (10,0,0) node[anchor=north east] {$x$}; \path[->] (0,0,0) -- (0,10,0) node[anchor=north west] {$y$}; \path[->] (0,0,0) -- (0,0,10) node[anchor=south] {$z$}; %Corners \coordinate (1) at (0,0,0); \coordinate (2) at (0,8,0); \coordinate (3) at (0,8,7); \coordinate (4) at (0,0,7); \coordinate (5) at (5,0,0); \coordinate (6) at (5,8,0); \coordinate (7) at (5,8,7); \coordinate (8) at (5,0,7); \coordinate (9) at (2.5,6,9); \coordinate (10) at (2.5,2,9); \draw [name path=front] (5) -- (6) -- (7) -- (8) -- cycle; \path[name path=back] (1) -- (2) -- (3) -- (4) -- cycle; \path[name path=uL] (1) -- (5); \path[name path=uR] (2) -- (6); \path[name path=oR] (3) -- (7); \path[name path=oL] (4) -- (8); \path[name path=DhL] (4) -- (10); \path[name path=DvL] (8) -- (10); \path[name path=DhR] (3) -- (9); \path[name path=DvR] (7) -- (9); \path[name path=Do] (9) -- (10); \path [name intersections={of = front and back}]; \coordinate (i) at (intersection-1); \coordinate (ii) at (intersection-2); \path [name intersections={of = DvL and back}]; \coordinate (iii) at (intersection-1); % circle around intersection \path[name path=circle1] (i) circle(\radius); \path [name intersections={of = circle1 and back}]; \coordinate (i1) at (intersection-1); \coordinate (i2) at (intersection-2); %bottom; y-axis; hidden \draw [dashed] (1) -- (i1); \draw [dashed](2) -- (i2); \path[name path=circle2] (ii) circle(\radius); \path [name intersections={of = circle2 and back}]; \coordinate (i3) at (intersection-1); \coordinate (i4) at (intersection-2); \path[name path=circle3] (iii) circle(\radius); \path [name intersections={of = circle3 and back}]; \coordinate (i5) at (intersection-1); \coordinate (i6) at (intersection-2); %roof \draw (4) -- (10); \draw(8) -- (10); \draw (3) -- (9); \draw (7) -- (9); \draw (9) -- (10); %front -> back; visible \draw (2) -- (6); %bottom right \draw (3) -- (7); %top right \draw (4) -- (8); %top left %back visible \draw (2) -- (3); %back hidden \path [name path = oH, dashed](3) -- (i6); \draw [dashed](4) -- (i5); \path [name path=Hl] (4) -- (i3); \path [name intersections={of = Hl and DvL}]; \coordinate (4i) at (intersection-1); \path[name path=circle4] (4i) circle(\radius); \path [name intersections={of = circle4 and Hl}]; \coordinate (i7) at (intersection-1); \coordinate (i8) at (intersection-2); \path [name intersections={of = oH and DvR}]; \coordinate (5i) at (intersection-1); \path[name path=circle5] (5i) circle(\radius); \path [name intersections={of = circle5 and oH}]; \coordinate (i9) at (intersection-1); \coordinate (i10) at (intersection-2); %back top \draw [dashed](3) -- (i10); \draw [dashed](i6) -- (i9); %left; z-axis; hidden \draw [dashed](4) -- (i7); \draw [dashed](i3) -- (i8); \draw [dashed](1) -- (i4); %left; x-axis; hidden \draw [dashed](1) -- (5); %draw visible parts XYZ \draw[->] (5,0,0) -- (10,0,0) node[anchor=north east] {$x$}; \draw[->] (2) -- (0,10,0) node[anchor=north west] {$y$}; \draw[->] (0,0,7) -- (0,0,10) node[anchor=south] {$z$}; \draw(0,0,0) node[anchor=east] {O}; \end{tikzpicture} \end{document}
- How to Properly Colorize PDF Figures in LaTeX: Fill Color and Transparency Problemsby Mycroft_47 on June 7, 2024 at 6:41 pm
I've been trying to include a monochromatic PDF vector figure in my LaTeX document and change its fill color directly within LaTeX, without using any external tools. I found two main solutions: Sol1: Setting the PDF color space to RGB and using the decodearray option in \includegraphics. Unfortunately, this method didn't work for me. Sol2: Using TikZ pictures. This method gave me better results but still isn't perfect. I'm running into two main problems with the TikZ method: Inconsistent Fill Color: Even though I used the same color for the top and bottom borders of the hlines in tblr, the colors of the figure and the \hline don’t look the same. Unwanted Background: The figure has a white background behind it, even though the original figure is black on a transparent background. I set fill=transparent!0 in the TikZ picture, but it didn’t fix the issue. Any suggestions on how to resolve these issues? Original figure is black (you can download it from here: "left_logo.pdf"). Shown on the right side of the attached image. Here’s the LaTeX code I’m using: \documentclass{article} \usepackage[table, dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{fadings} \usepackage{tabularray} \UseTblrLibrary{varwidth} \begin{document} \begin{tikzfadingfrompicture}[name=left] \node [fill=transparent!0,draw=none] {\includegraphics[width=2.05cm,height=2cm]{./Resources/Figures/left_logo}}; \end{tikzfadingfrompicture} \begin{titlepage} \pagecolor{gray} \begin{tblr}{ width=\textwidth, colspec = {Q[c,2.65cm]X[c]Q[c,2.65cm]}, rowspec = {Q[b]}, hlines={1pt, MidnightBlue}, measure=vbox} \fbox{ \begin{tikzpicture}[ outer sep=0pt, inner sep=0pt, baseline=(current bounding box.center)] \node[left color=MidnightBlue,right color=MidnightBlue,minimum width=2.16cm,minimum height=1.85cm]{}; \path[scope fading=left,fit fading=false]; \node[fill=transparent!0,minimum width=2.16cm+1mm,minimum height=1.85cm+1mm]{}; \end{tikzpicture}} &{ \textcolor{MidnightBlue}{Lorem ipsum dolor sit amet} \\ \textcolor{MidnightBlue}{Proin non mauris maximus, pretium} \\ \textcolor{MidnightBlue}{In convallis eros convallis nunc} \\ \textcolor{MidnightBlue}{Integer eleifend sit amet risus} \\ \textcolor{MidnightBlue}{Fusce vulputate ac felis et} }& \fbox{\includegraphics[width=2.05cm,height=2cm]{./Resources/Figures/left_logo}} \end{tblr} \end{titlepage} \end{document} Edit I forgot to mention that I'm compiling my document with LuaLaTeX.
- level distance not working consistentlyby mk9y on July 28, 2021 at 6:22 pm
The present question is a continuation of this one, and relies on answers given there. Here is the code that generates the image below. \documentclass{standalone} \usepackage{tikz} \usetikzlibrary {calc, graphs, graphdrawing} \usegdlibrary {trees} \usegdlibrary{layered} \begin{document} \begin{tikzpicture}[ > = stealth, every node/.append style = {font = \sf\vphantom{gf}}, connect/.style = {to path = {(\tikztostart) -- ($(\tikztostart)!.5!(\tikztostart |- \tikztotarget)$) -| (\tikztotarget)}}, connectEffects/.style = {to path = {(\tikztostart) -- node[pos = 0.5, fill = white]{effects} ($(\tikztostart)!.65!(\tikztostart |- \tikztotarget)$) -| (\tikztotarget)}}, connectSubjects/.style = {to path = {(\tikztostart) -- node[pos = 0.5, fill = white]{subjects} ($(\tikztostart)!.65!(\tikztostart |- \tikztotarget)$) -| (\tikztotarget)}}, connectFactors/.style = {to path = {(\tikztostart) -- node[pos = 0.5, fill = white]{block factors} ($(\tikztostart)!.65!(\tikztostart |- \tikztotarget)$) -| (\tikztotarget)}}, connectSize/.style = {to path = {(\tikztostart) -- node[pos = 0.5, fill = white]{block size} ($(\tikztostart)!.65!(\tikztostart |- \tikztotarget)$) -| (\tikztotarget)}}, ] \graph [ layered layout, nodes = {draw, fill = white}, edge quotes = {fill = white}, level 1/.style = {level distance = 1.5 cm}, level 2/.style = {level distance = 1.5 cm}, level 3/.style = {level distance = 1.5 cm}, level 4/.style = {level distance = 1.5 cm}, level 5/.style = {level distance = 0.75 cm}, level 6/.style = {level distance = 0.75 cm}, level 7/.style = {level distance = 0.75 cm}, level 8/.style = {level distance = 0.75 cm}, sibling distance = 2 cm ]{ experiment ->[connectEffects] { fixed ->[connectSubjects] { homogeneous -> [minimum layers = 4] CRD -> CRFD -> CRSP, heterogeneous ->[connectFactors] { one ->[connectSize] { large -> { RCB -> GCB -> RCBF -> RBSP }, small -> PBIB or BTIB -> BIB }, two -> [minimum layers = 2] LSD } }, mixed } }; \end{tikzpicture} \end{document} I want to make the distance between levels 1.5 cm until level 5, and then switch to 0.75 cm. This seems to fail after level 6. A subsidiary question: I would like to make the code that defines the four connectors connectEffects/.style = ... more general and concise.
- Making a tree where some nodes contain node objectsby Akash Kumar on February 19, 2021 at 11:06 am
I want to create a tree using tikz. However, I have a few constraints. Most of the nodes at all the levels are standard usual nodes. However, I want to have the following at some level (say level 3) in this tree: All nodes at this level should be drawn bigger (perhaps elliptical). Moreover, I also want each of these big nodes to contain some dots. In the picture below, I mark these dots in purple. There is a "home" node for these purple dots where most of them live. And a few of these purple dots appear in other nodes at this level. I can add the tikz code I obtained from online sources to create trees, but it is pretty bare-bones. Please let me know if that would be helpful in getting help with this question. EDIT (Added Later) Here are some variations that I tried so far on overleaf. Mostly, it revolves around attempts to define some new node objects. But then the picture I end up with is not particularly nice. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amsthm} \usepackage{algorithm} \usepackage{algorithmicx} \usepackage{subcaption} \usepackage{tikz} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{decorations.markings} \usetikzlibrary{shapes.gates.logic.US,trees,positioning,arrows} \tikzset{ standard/.style = {circle, white, draw=black, inner sep = 1.5}, containerNode/.style={circle, draw=black, minimum size=1cm, node contents=\draw \Huge $\dots$ $\dots$ $\dots$}, } \begin{document} \begin{figure*}[t!] \centering \scalebox{.6}{ \begin{tikzpicture}[level/.style={sibling distance=60mm/#1,level distance = 2cm}] \node [standard] (z){} child {node [standard] {}edge from parent [draw=black, very thin] child {node [standard] {}edge from parent [draw=black,very thin] child {node [standard] {}edge from parent [draw=black,very thin]} child {node [standard] {}edge from parent [draw=black,very thin]} } child {node [standard] {}edge from parent [draw=black, very thin] child {node [containerNode] (a) {}edge from parent [draw=black, very thin] child {node [standard] (x) {}edge from parent[draw=black, very thin]} child {node [standard] (y) {}edge from parent[draw=black, very thin]} } child {node [standard] {}edge from parent [draw=black,very thin]} } } child { node [standard] {} edge from parent [draw=black, very thin] child {node [standard] {}edge from parent [draw=black, very thin] child {node [standard] {}edge from parent [draw=black,very thin] } child {node [standard] (b) {}edge from parent [draw=black, very thin]} } child {node [standard] {}edge from parent [draw=black, very thin] child {node [standard] (c){}edge from parent [draw=black, very thin]} child {node [standard] {} edge from parent [draw=black,very thin]} } }; \end{tikzpicture} } \end{figure*} \end{document} The image generated on overleaf is shown below. Apologies for the huge delay in adding the edits.
- TikZ - Explain the computation of the determinant of a square matrix of dimension 3by projetmbc on June 15, 2020 at 8:48 am
I would like to show the classical trick to calculate the determinant of a square matrix of dimension 3. Here is my very beginning code. \documentclass{article} \usepackage{tikz} \usepackage{nicematrix} \begin{document} $\begin{NiceArray}{|ccc|cc} a & b & c & a & b \\ r & s & t & r & s \\ x & y & z & x & y % \CodeAfter % \tikz\draw[blue] (1-1.south east) -- (3-3.south east) ; \end{NiceArray}$ \end{document} Here is the unwanted output. I would like the path to be hidden by the text as with the a below, and I need the line to be longer as in the picture below.
- How to draw 3d matrix using tikzby Tgy Aldeen Abdo on November 12, 2019 at 4:16 am
i want to draw a matrix like the pic below, i just don't know how to do it?
- How to display a Tikz Flowcharts properly in a RTL Beamer documentby Abdelhak Elfengour on March 26, 2019 at 4:37 pm
\documentclass[hyperref=unicode]{beamer} \usepackage{hologo} \mode<presentation>{\usetheme{Warsaw}} \usepackage[nil,bidi=basic-r]{babel} \babelprovide[import=ar-DZ, main]{arabic} \babelprovide[import,language=Default]{english} \babelfont{rm}{Amiri} \babelfont{sf}{Amiri} \usepackage{beamer-rl} \usepackage{tikz}% \usetikzlibrary{shapes.geometric, arrows} \begin{document} \begin{frame} \tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=4em, text centered, rounded corners, minimum height=3em] \tikzstyle{line} = [draw, -latex'] \begin{tikzpicture}[node distance = 2.6cm, auto] \node [block] (init) {start}; \node [block, left of=init] (Start2) {test}; \node [block, left of=Start2] (Start3) {test2}; \node [block, below of=init] (init3) {process}; \node [block, below of=init3] (End) {end}; \node [block, left of=init3] (End1) {end1}; \node [block, left of=End] (End2) {end2}; \path [line] (init) -- (Start2); \path [line] (init3) -- (End1); \path [line] (End) -- (End2); \end{tikzpicture} \end{frame} \end{document}
- Is there a standard way to represent the file tree in a rather elaborate code?by Eugenio on February 11, 2017 at 8:19 am
I've got a program which is split into some files located in two main folders, src and include, with the header .h files in the include folder while .cpp and .cu files in the other. Here is a little drawing for the whole routine Note#1 this is not exactly what I want to achieve but it may be a starting point. Note#2 here you can find the meaning of the word routine, but here I mean just a complex application split into multiple files. Is there a standard way to represent the tree of the files which a program is composed of? I mean the file tree, along with the folders tree. I'm looking for some solution to even add some of the relations within the files with some arrows. I'd like to use tikz if possible. Right now this is my poor, far-to-be-optimized tikz image I realized: \documentclass[]{standalone} \usepackage{tikz} \usetikzlibrary{arrows,positioning} \usetikzlibrary{calc} \tikzset{ %Define standard arrow tip >=stealth', pil/.style={ ->, thick, shorten <=2pt, shorten >=2pt,}, gpufile/.style={ rectangle, rounded corners, draw=red, very thick, minimum height=2em, minimum width=8em, text centered }, cpufile/.style={ rectangle, rounded corners, draw=black, thick, minimum height=2em, text centered }, header/.style={ rectangle, draw=gray, thin, minimum height=2em, minimum width=5em, text centered }, folder/.style={ rectangle, draw=yellow, thin, minimum height=3em, minimum width=5em, text centered } } \begin{document} \begin{tikzpicture}[node distance=1.5cm, auto,] \tikzstyle{every path}=[-latex,thick] \node[ folder, xshift=-2cm] (src) {src}; \node[ cpufile, right of=src, xshift=40pt] (main) {\texttt{main.cpp}}; \node[ gpufile, right of=main, xshift=40pt, yshift=0pt] (trbdf2) {\texttt{tr-bdf2.cu}} ; \node[ gpufile, right of=trbdf2, xshift=40pt, yshift=0cm ] (jacobian) {\texttt{jacobian.cu}}; \node[ gpufile, right of=jacobian, xshift=60pt ] (inversion) {\texttt{matrix\_inversion.cu}}; \node[ gpufile, right of=inversion, xshift=60pt] (tr) {\texttt{newton\char`_tr.cu}}; \node[ gpufile, right of=tr, xshift=60pt] (bdf2) {\texttt{newton\char`_bdf2.cu}}; \node[ folder, below of=src, yshift=-1cm] (include) {include}; \node[ header, right of=include, xshift=40pt] (libs) {\texttt{libs.h}}; \node[ header, right of=libs, xshift=40pt] (constants) {\texttt{constants.h}}; \node[ header, right of=constants, xshift=40pt] (fdefs) {\texttt{functions\char`_defs.h}}; \node[ header, right of=fdefs, xshift=40pt] (defs) {\texttt{defs.h}}; \node[ header, right of=defs, xshift=40pt] (linsolver) {\texttt{linear\char`_solver.h}}; ; \end{tikzpicture} \end{document} I need to highlight .cu files in the project, they have a different meaning from the clasic .cpp files. While sliding through the tikz library samples the closest I found to what I mean is this example, which is recommended just for a filesystem directory tree though.
- How to make add tick to node in tikzby user2249626 on September 12, 2013 at 12:58 pm
I'm trying to draw a simple timeline in tikz. Here's what I have: \documentclass[12pt,a4paper,bibtotoc]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[ngerman]{babel} \usepackage{microtype} \usepackage{tikz} \begin{document} Ablauf der Schadenregulierung bei einem typischen Schadenfall \\ \\ % Zeitstrahl zur Schadenregulierung \begin{tikzpicture} \draw[black, ultra thick, ->] (0,0) -- (2,0) node [below]{Schadeneintritt} --(14,0); \end{tikzpicture} \end{document} What I would like is for there to be a tick on the line at node "Schadeneintritt". I've tried adding tick to the options of the node but that produces an error (apparently tickz doesn't know the tick option). I'm still new to tikz and so far I've only found solutions for full blown axes / coordinate systems. I know that I could do: \draw (2,0.2) -- (2,-0.2); but I wonder whether there's an easier solution (i.e. specifying this directly at the node). Cheers!
- Work breakdown structure (WBS) TikZby ABu on November 7, 2012 at 3:30 pm
How can I draw WBS diagrams (Work breakdown structures) in LaTeX? I need to draw in LaTeX things like: I've searched on the Internet a lot but I've found nothing.