• TikZ: good method to add dimension arrows
    by cis on October 11, 2026 at 6:03 pm

    I would like to add dimension arrows like the ones shown here. What is the most elegant way to do this in common? (Note that I am showing an example here; however, a good general method would be interesting.) So, for instance, the dimension arrows and labels should be placed evenly and systematically. Here is my own rather clumsy attempt: \documentclass[margin=5pt, tikz]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta} \begin{document} %% Values \pgfmathsetmacro{\R}{2.0} \pgfmathsetmacro{\a}{1.9} \pgfmathsetmacro{\b}{sqrt(\R^2 - \a^2) + \R} \pgfmathsetmacro{\x}{\R+(sqrt(2)*sqrt(\R*(2*\R-\b)) +\b -2*\R)-\b} \begin{tikzpicture}[scale=1.5, font=\footnotesize, >={Triangle[length=0pt 2*4,width=0pt 4]}, ] %% Coordinates on the main segment \coordinate[label=below:$M$] (M) at (0,0); \coordinate[label=below:$O$] (O) at (-\R,0); \coordinate[label=below:$A$] (A) at (\R,0); \coordinate[label=below:$C$] (C) at (\R-\b,0); %% Draw main segment OA \draw[] (O) -- (A); %% Solution elements on the main segment \coordinate[label=below:$X$] (X) at (\x,0); % Dimension arrows \foreach \P in {C,M,X,A}{%% \path[draw=none, shorten <=1em] (\P) -- +(0,-1.125) coordinate[pos=0.3] (\P-1) coordinate[pos=0.6] (\P-2) coordinate[pos=0.8] (\P-3) coordinate[pos=1.0] (\P-4); }%% \draw[shorten <=1em] (X) -- (X-2); \draw[<->] (C-1) -- (X-1) node[midway, fill=black!1]{$r$}; \draw[shorten <=0.25em] (M-1) -- (M-2); \draw[<->] ([yshift=0.5em]M-2) -- ([yshift=0.5em]X-2) node[midway, below]{$x$}; \draw[shorten <=1em] (C) -- (C-4); \draw[shorten <=1em] (A) -- (A-4); \draw[<->] (C-3) -- (A-3) node[midway, fill=black!1]{$b$}; %% Draw points on the axis (solution) \foreach \P in {A, X} \draw[fill=black!1] (\P) circle (1.5pt); %% Draw points on the axis (task) \foreach \P in {C, M} \draw[fill=black!1] (\P) circle (1.5pt); \draw[fill=black!1] (O) circle (1.5pt); \end{tikzpicture} \end{document}

  • constructing relative joined plot's and --'s with --cycle in tikz
    by Jasper on October 11, 2026 at 6:48 am

    I was looking at Use "plot" inside a \draw path in tikz. I want to fill such a region, and improve my (very inconvenient currently) syntax. Is it possible to do cycle in a way like this too? \documentclass[border=1cm]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}[trig format=rad] \draw (0,1) coordinate (T0) -- (1,1) coordinate (T1) [shift={(T1)}] plot[domain=0:2*pi] (\x,{sin(\x)}) coordinate (T2) [shift={($(T1) + (T2)$)}] (0,0) -- (1,0) coordinate (T3) [shift={(T3)}] (0,0) -- (1,3) coordinate (T4) [shift={(T4)}] plot[domain=0:pi] (-2*\x,{sin(\x)}) coordinate (T5) [shift={($(T4) + (T5)$)}] plot[domain=0:1] (-\x,\x) [shift= {(T0)}] -- (0,0) ; \end{tikzpicture} \end{document}

  • How could I make a template from this bit of code?
    by Jolia on October 9, 2026 at 8:32 am

    I'm a teacher and for my tests, I have a template like that : \documentclass[11.5pt, oneside]{report} \usepackage{tikz} \RequirePackage{geometry} \geometry{a4paper,left=1.5cm,top=2.5cm,right=1.5cm,bottom=1cm} \begin{document} \begin{minipage}{0.60\linewidth} \begin{flushleft} \large NAME : {\dotfill} \\ \vspace{0.3cm} Forname : {\dotfill} \end{flushleft} \end{minipage} \hfill \begin{minipage}{0.15\linewidth} \begin{flushright} \large class \\ \vspace{0.3cm} date \end{flushright} \end{minipage} \vspace{0.5cm} \begin{center} {\Large \textbf{Contrôle number : test name}} \medbreak {\Large Sujet A} \medbreak {\Large Durée : duration.} \end{center} \vspace{0.5cm} \begin{tikzpicture} \draw[thick] (0,0)--(18,0)--(18,2.5)--(0,2.5)--cycle; \draw[thick] (0,0)--(2.5,2.5)--(2.5,0); \draw (1.8,0.7) node{\Huge maxgrade}; \end{tikzpicture} \end{document} I created a documentclass for my tests but I would like to find a way to define the date, the class, the number and name of the test, the duration of the test and the maximum grade and have them automatically be implemented in that way without having all those lines that make it hard to see and to modify. Does anyone have any idea of how I could do that?

  • How to show that a sinusoidal function continues indefinitely to the left?
    by Marco Moldenhauer on October 8, 2026 at 4:18 pm

    I plotted a sinusoidal function using the axis environment from the pgfplots package. My code \documentclass[margin=3mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ width=50cm, height=0.80\textwidth, axis y line=middle, axis x line=middle, axis on top, % <-- Correct pgfplots key to draw ticks, grid, and lines over plots xmin=-15, xmax=5.8, ymin=-125, ymax=125, xtick={-14,-3*pi,-5*pi/2,-2*pi,-3*pi/2,-pi,-pi/2,0,1,pi/2,pi,3*pi/2,2*pi}, xticklabels={$-\inf$,$-3\cdot\pi$,$-\frac{5}{2}\cdot\pi$,$-2\cdot\pi$,$-\frac{3}{2}\cdot\pi$,$-\pi$,$-\frac{1}{2}\cdot\pi$,$0$,1,$\frac{1}{2}\cdot\pi$,$\pi$,$\frac{3}{2}\cdot\pi$,$2\cdot\pi$}, ytick={-112.5,-112.5/sqrt(2),0,112.5/sqrt(2),112.5}, yticklabels={-112.5,,0,,112.5}, legend cell align={left}, grid=both, grid style={line width=.1pt, draw=gray!10}, major grid style={line width=.2pt, draw=gray!20}, xlabel={$\alpha=\omega\cdot t$ in rad}, ylabel={$p(t)$ in Watt}, xlabel style={at={(ticklabel* cs:1)}, anchor=north west}, ylabel style={at={(ticklabel* cs:1)}, anchor=south west} ] % 1. Colored area between x = 0 and x = 1 \addplot[ domain=0:1, samples=100, fill=green!30, draw=none ] {-112.5*sin(deg(x))} \closedcycle; % 2. Colored area between x = -4*pi and x = 0 \addplot[ domain=-4*pi:0, samples=100, fill=red!30, draw=none ] {-112.5*sin(deg(x))} \closedcycle; % Main curve \addplot[ domain=-4*pi:2*pi, samples=200, smooth, blue, thick ] {-112.5*sin(deg(x))}; \end{axis} \end{tikzpicture} \end{document} My output What I would like to achieve I would like to visually indicate that the sinusoidal function continues to oscillate periodically indefinitely in the negative "x"-direction. I'm totally open to creative ideas or completely different approaches. Any suggestions are very welcome! 🙂

  • How can I depict X-ray beams as wavefronts that interfere above the sample to form a standing wave?
    by user449589 on October 7, 2026 at 7:24 am

    I'm not very skilled using TikZ but I wanted to use it for all the figures in my bachelors thesis. So far I created this TikZ-picture: \documentclass{article} \usepackage{tikz} \usetikzlibrary{patterns} \usetikzlibrary{patterns.meta} \usetikzlibrary{decorations.pathreplacing} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{decorations.markings} \usetikzlibrary{snakes} \usetikzlibrary{arrows.meta} \usetikzlibrary{calc,patterns,angles,quotes} \usepackage[table]{xcolor} \definecolor{Minzgrün}{RGB}{0,140,79} \definecolor{Fenstergrau}{RGB}{128,128,128} \definecolor{Telegrau 4}{RGB}{230,230,230} \definecolor{Tomatenrot}{RGB}{140,28,0} \begin{document} \begin{tikzpicture} [x=0.35cm,y=0.2cm,line cap=round,line join=round] \draw[line width=1.5pt] (17.5,12.5) arc [start angle=0, end angle=180, x radius=2.5, y radius=1]; \draw [black, line width=1pt] (16,13) -- (21,14) node [align=center,right]{Detector\\window}; \draw[line width=1.5pt] (19,2) arc [start angle=0, end angle=180, x radius=4, y radius=1.5]; \draw[black,line width=1.5pt] (5,0.5) -- (25,0.5) -- (25,2) -- (5,2) -- cycle; \draw[black,line width=1.5pt] (10,25) -- (10,12.5) -- (20,12.5) -- (20,25); \draw[black,line width=1.5pt] (12.5,17.5) -- (17.5,17.5) -- (17.5,20) -- (12.5,20) -- cycle; \fill[black,pattern=crosshatch dots] (12.5,17.5) -- (17.5,17.5) -- (17.5,20) -- (12.5,20) -- cycle; \draw [black,line width=1pt] (12,20) -- (8.5,21) node[align=center,left] {Energy-dispersive\\detector}; \draw[Fenstergrau,line width=1pt,postaction={decorate,decoration={markings,mark=at position 0.15 with{\arrow{>}},mark=at position 1 with {\arrow{>}}}}] (-5,4) -- (10,2) -- (25,4); \draw[Fenstergrau,line width=1pt,postaction={decorate,decoration={markings,mark=at position 0.15 with{\arrow{>}},mark=at position 1 with {\arrow{>}}}}] (5,4) -- (20,2) -- (35,4); \node[align=center] at (0,6.5){Incident beam}; \node[align=center] at (30,6.5){Reflected beam}; \draw[black,line width=1pt] (12.5,1.25) -- (10,-2.5) node [below, align=center] {Sample carrier\\(\textit{reflector})}; \draw[black,line width=1pt] (16,2.5) -- (21,-2.5) node [below, align=center] {Sample}; \draw[Minzgrün,line width=1.25pt,->,decorate,decoration={snake,amplitude=0.1cm,segment length=0.4cm, post length=0.2cm}](15,2.5) -- (15,17); \draw [black, line width=1pt] (14,8) -- (9,12) node [align=center, left] {Fluorescence\\radiation}; \end{tikzpicture} \end{document} But I would like to include the X-ray beams as wave fronts which interfere above the sample to form a standing wave like in this image: Sadly this is beyond my TikZ-skills. Maybe somebody can help me or tell me where to look for answers. Thanks a lot!

  • Canvas 3D effect for vectors flattened along an axis or plane
    by Sebastiano on July 15, 2026 at 7:39 pm

    I would like to realize the following image in TikZ, which I had created very roughly in Adobe Illustrator. I am interested in understanding how to use TikZ 3d canvas to squash vectors along planes or lines. I would also like to see how it is used for labels. Here my attempt. See after the missing pieces. \documentclass{article} \usepackage{amsmath} \usepackage{bm} \usepackage{tikz} \usetikzlibrary{arrows.meta, angles, calc} \tikzset{rhtip/.tip={Triangle[line width=1pt, fill=white, length=9pt, width=9pt]}} \definecolor{vectorgreen}{RGB}{76, 181, 93} \definecolor{vectororange}{RGB}{235, 104, 38} \definecolor{vectorbrown}{RGB}{175, 110, 52} \definecolor{ellipseblue}{RGB}{112, 196, 172} \definecolor{spherepurple}{RGB}{155, 120, 200} \begin{document} \begin{tikzpicture}[>=latex] \coordinate (O) at (0,0); \draw[thin, black!70] (O) -- (0, 4.2) node[right, font=\Large] {$z$}; \draw[thin, black!70] (O) -- (5.5, -1.0) node[below right, font=\Large] {$y$}; \draw[thin, black!70] (O) -- (-4.8, -1.9) node[left, font=\Large] {$x$}; \coordinate (C) at (-2.2, -0.88); \fill[black] (C) circle (3.5pt) node[below=8pt, font=\Large] {$C$}; \begin{scope}[shift={(C)}, rotate=12] \draw[ellipseblue, line width=1.5pt] (0,0) ellipse (1.1 and 2.5); \draw[ellipseblue, line width=1.5pt, ->, >=latex] (131:1.1 and 2.5) -- (130:1.1 and 2.5); \draw[thin, black!60] (0,0) -- (225:1.1 and 2.5) node[midway, below right, font=\Large] {$r$}; \shade[ball color=spherepurple] (155:1.1 and 2.5) circle (0.18); \end{scope} \coordinate (P) at (4.0, 2.3); \coordinate (P_proj) at (4.0, -1.6); \draw[dashed, thick, black!80] (P) -- (P_proj); \draw[dashed, thick, black!80] (O) -- (P_proj); \draw[-rhtip, vectororange, line width=2pt] (O) -- (0, 1.9); \node[above right=2pt, font=\Large] at (0, 1.9) {$\bm{\beta}$}; \draw[-rhtip, vectorbrown, line width=2pt] (O) -- (-1.4, -0.56); \node[above=6pt, font=\Large] at (-0.7, -0.15) {$\mathbf{a}$}; \draw[-rhtip, vectorgreen, line width=2pt] (O) -- (3.9, 2.2); \node[below right=4pt, font=\Large] at (1.8, 1.1) {$\mathbf{R}$}; \fill[black] (P) circle (3.5pt) node[above right=4pt, font=\Large] {$P$}; \shade[ball color=spherepurple] (O) circle (0.22); \node[above left=6pt, font=\Large] at (O) {$q$}; \draw[<->, >=latex, semithick, black!80] (30:1.3) arc (30:90:1.3); \node[font=\Large] at (60:1.65) {$\theta$}; \node[font=\Large, below left=6pt] at (1, 0, 1) {$\varphi$}; \end{tikzpicture} \end{document}

  • Use "plot" inside a \draw path in tikz
    by flawr on April 30, 2026 at 5:36 pm

    Is there a way to continue a path we draw using \draw with a plot, just as we do for instance also with arc or similar commands? In the example below I have a straight line, but I'd like the plot to append directly to that line, as indicated by the red dots. I can of course do that e.g. with plot[shift={(1,1)},...], but that means that I have to repeat that second coordinate in the path, which makes it again more cumbersome to use if we want to change something later (and the second straight line segment then points to the original endpoint without the shift). So this is more a question about "ergonomically" using this plot command inside other paths. E.g., I also like using the ++ syntax to precisely extend a path a certain distance horizontally, without having to repeat the previous y-coordinate, and I was wondering whether there is something similar we can do with the plot command inside such a path. \documentclass{standalone} \usepackage{tikz} \usepackage{xcolor} \usepackage{pgfplots} \pgfplotsset{compat=1.17} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}[domain=0:4] \draw[black!10!white, dashed] (0, 0) grid (4, 2); \draw (0, 1) -- (1, 1) node[left] {} plot[domain=0:1, samples=100] function{sin(6.3*x)} node[right] {} -- ++(1, 0); \end{tikzpicture} \end{document}

  • Nicely organized graph representing Feynman
    by FishDrowned on April 3, 2026 at 1:26 pm

    I don't quite understand why the first node is no longer pointing toward $C_0$. How can I move $C_0$ to be on the far right side, still level with the first node (kind of looking like a trapezoid) while still connected to the first node? \documentclass{article} \usepackage{tikz} \usetikzlibrary{graphs} \begin{document} \begin{center} \scalebox{1.2}{ \tikz \graph [grow right sep]{ x1 [as =$\displaystyle \int_a^b{f(x)dx}$] -> {x2[as=$C_0$, red], x3[as=$F(t)$] -> x4[as=$F^\prime(t)$] -> x5[as=$\displaystyle \int{F^\prime(t)dt}$] -> x6[as=$C(t) + C_{1}$, red]->x2}; }; } \end{center} \end{document} This is what it currently looks like: This is the intended result (essentially, ignore the terrible drawing lol): Any help or a push toward some sort of useful resource is much appreciated.

  • Drawing a porous sandwich beam
    by Tldi You on January 16, 2026 at 9:03 am

    Can we reproduce this image in LaTeX Tikz? I try this \documentclass[tikz,border=5pt]{standalone} \usepackage{tikz} \usetikzlibrary{patterns,arrows.meta,decorations.pathmorphing} \begin{document} \begin{tikzpicture}[scale=1] %------------------------------------------------- % Common styles %------------------------------------------------- \tikzset{ block/.style={draw, thick, fill=orange!20}, caps/.style={draw, thick, fill=blue!40}, axis/.style={->, thick}, profile/.style={thick}, } %================================================= % (b) SD %================================================= \begin{scope}[xshift=0cm] % Top and bottom caps \draw[caps] (0,4) rectangle (4,4.5); \draw[caps] (0,0) rectangle (4,0.5); % Main block with layered patterns \draw[block] (0,0.5) rectangle (4,4); % Internal layers \draw[pattern=checkerboard, pattern color=orange!70] (0,2.7) rectangle (4,4); \draw[pattern=crosshatch, pattern color=orange!70] (0,1.6) rectangle (4,2.7); \draw[pattern=grid, pattern color=orange!70] (0,0.5) rectangle (4,1.6); % Axes \draw[axis] (0,2.25) -- (5,2.25) node[above] {$x$}; \draw[axis] (0,2.25) -- (0,5) node[above] {$z$}; % Right profile \draw[domain=0.5:4,smooth,,red,variable=\z] plot ({6-cos(180*\z/((4-0.5)))},{\z}); % Labels \node[right] at (4.1,3.9) {$E_{\max},\,\rho_{\max}$}; \node[right] at (4.1,0.6) {$E_{\max},\,\rho_{\max}$}; \node at (2,-0.6) {(b) SD}; \end{scope} %================================================= % (c) ASD %================================================= \begin{scope}[xshift=8cm] % Top and bottom caps \draw[caps] (0,4) rectangle (4,4.5); \draw[caps] (0,0) rectangle (4,0.5); % Main block \draw[block] (0,0.5) rectangle (4,4); % Gradient-like pattern layers \draw[pattern=checkerboard, pattern color=orange!70] (0,2.5) rectangle (4,4); \draw[pattern=crosshatch dots, pattern color=orange!70] (0,0.5) rectangle (4,2.5); \draw[pattern=checkerboard, pattern color=orange!70] (0,0.5) rectangle (4,1.6); % Axes \draw[axis] (0,2.25) -- (5,2.25) node[above] {$x$}; \draw[axis] (0,0.5) -- (0,5) node[above] {$z$}; % Right profile (asymmetric) % \draw[profile] % (4,4) .. controls (4.8,3.5) and (4.8,1.5) .. (4,0.5); % Labels \node[right] at (4.1,3.9) {$E_{\max},\,\rho_{\max}$}; \node[right] at (4.1,0.6) {$E_{\min},\,\rho_{\min}$}; \node at (2,-0.6) {(c) ASD}; \draw[domain=0.5:4,smooth,,red,variable=\z] plot ({1*(5-cos(45+(180*\z)/(2*(4-0.5)))))},{\z}); \end{scope} \end{tikzpicture} \end{document} Current result:

  • Draw objects in tikz in "stamp"-style
    by Martin on March 30, 2025 at 6:55 pm

    I want to change the style of objects in tikz to some kind of "stamp"-style, where the objects are kind of not perfectly drawn and contain "imperfections" or faded elements. For me it is hard to explain what I mean by that, so I have included a picture that shows what I mean: I want to be able to apply this kind of effect (as "irregular" and "asymmetric" as possible) to different objects in tikz, in particular to texts (even if using a different font with xetex), lines, rectangles, ellipses and if possible even pictures. This should work with different colors. The following MWE includes the objects that I wish to apply this effect to (but I have no idea how to even start): \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{decorations.text} \usepackage[T1]{fontenc} \usepackage{xltxtra} \setmainfont{Algerian} \begin{document} \begin{tikzpicture} \draw (0,0) ellipse (4cm and 2cm); \draw[line width=1.5mm, yellow] (0,0) ellipse (3.8cm and 1.8cm); \node at (0,0) {\includegraphics[height=2.2cm]{example-image}}; \draw[white,thick,postaction={decorate,decoration={text along path,text align=center,text={This Is A Text}}}] (-2,1.0) to [bend left=15] (2,1.0); \draw[white,thick,postaction={decorate,decoration={text along path,text align=center,text={This Is Another Text}}}] (-2,-1.42) to [bend left=-15] (2,-1.42); \draw[red, fill=yellow] (2,-0.5) rectangle (3,0.5); \draw[green, fill=green](-3,-0.5) rectangle (-2,0.5); \end{tikzpicture} \end{document}

  • genus-2 torus using tikz-3dplot
    by userא0 on March 12, 2025 at 12:41 pm

    I'm attempting to create a 3D plot of a connected sum of two tori in LyX using the tikz-3dplot package, aiming for a visual representation similar to the image linked here Link Here. I have seen similar plots online, generated by Alternative packages (most of the are similar to the picture in Wikipedia under "Connected Sum"), In which I have no interest. Searching the internet and with the help of some AI engines, I was able to come up with this \documentclass[margin=5pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[] \begin{axis}[ hide axis, view={40}{60}, ] % Hyperboloid Tube (hyperboloid of one sheet) % Parameters: a = 1.5, c = 5*sqrt(2) % Here: the PGFPlots parameter "x" is used for t, and "y" for theta. \addplot3[ surf, faceted color=black, fill=none, samples=20, samples y=30, domain=-1:1, % t from -1 to 1 domain y=0:2*pi, % theta from 0 to 2pi z buffer=sort, ] ( { (1/(sqrt(2))) * ( 1.5*sqrt(1+x*x)*cos(deg(y)) + 4*sqrt(2)*x ) }, { (1/(sqrt(2))) * ( -1.5*sqrt(1+x*x)*cos(deg(y)) + 4*sqrt(2)*x ) }, { 1.5*sqrt(1+x*x)*sin(deg(y)) } ); % First Torus (centered at (-5,-5,0)) \addplot3[ surf, faceted color=black, fill=none, samples=22, samples y=30, domain=0:2*pi, domain y=0:2*pi, z buffer=sort, ] ({ (5+2*cos(deg(x)))*cos(deg(y))-7 }, { (5+2*cos(deg(x)))*sin(deg(y))-7 }, { sin(deg(x)) }); % Second Torus (centered at (5,5,0)) \addplot3[ surf, faceted color=black, fill=none, samples=22, samples y=30, domain=0:2*pi, domain y=0:2*pi, z buffer=sort, ] ({ (5+2*cos(deg(x)))*cos(deg(y))+7 }, { (5+2*cos(deg(x)))*sin(deg(y))+7 }, { sin(deg(x)) }); \end{axis} \end{tikzpicture} \end{document} which after compiling looks like this I'm not sure how to get these three surfaces to look like they're all part of one piece, besides maybe trying to plot the whole surface as a graph of a single function, which I also don't know how to do. Any help or ideas on either way would be awesome!. Thanks The full latex code: % Preview source code %% LyX 2.4.1 created this file. For more info, see https://www.lyx.org/. %% Do not edit unless you really know what you are doing. \documentclass[english,hebrew,no-math]{extarticle} \usepackage{amsmath} \usepackage{amsthm} \usepackage{fontspec} \setmainfont[Mapping=tex-text]{Hadasim CLM} \setsansfont[Mapping=tex-text]{FreeSerif} \setmonofont{FreeMono} \usepackage[a4paper]{geometry} \geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2cm,rmargin=2cm,headheight=2cm,headsep=2cm} \usepackage{setspace} \doublespacing \usepackage[pdfusetitle, bookmarks=true,bookmarksnumbered=false,bookmarksopen=false, breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false] {hyperref} \makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands. \numberwithin{equation}{section} \@ifundefined{date}{}{\date{}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. \PassOptionsToPackage{all,color}{xy} \usepackage{tikz} \usepackage{tikz-3dplot} \usetikzlibrary{shapes.geometric} \usetikzlibrary{3d,calc} \usetikzlibrary{matrix,shapes} \usetikzlibrary{arrows.meta} \usetikzlibrary{decorations.markings} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepackage{faktor} \usepackage{graphicx, nicefrac} \usepackage[all]{xy} % Define a command to reflect box \let\rfb\reflectbox \newcommand{\uglyfrac}[2]{\scalebox{1.35}{\rfb{\nicefrac{\raisebox{0.7ex}{\rfb{#1}}}{\raisebox{-0.7ex}{\rfb{#2}}}}}} \newcommand{\muglyfrac}[2]{\uglyfrac{\ensuremath{#1}}{\ensuremath{#2}}} \usepackage{xcolor} \hypersetup{ colorlinks, linkcolor={red!24!blue}, citecolor={blue!75!black}, urlcolor={blue!75!black} } \usepackage{fancyhdr} \pagestyle{fancy} \usepackage{bbm} \usepackage{xfrac} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \newcommand\bquotient[2]{ \mathchoice {% \displaystyle \text{\lower1ex\hbox{$#2$}\Big/\raise1ex\hbox{$#1$}}% } {% \textstyle #1\,/\,#2 } {% \scriptstyle #1\,/\,#2 } {% \scriptscriptstyle #1\,/\,#2 } } \newcommand\Bquotient[2]{ \mathchoice {% \displaystyle \text{\lower1ex\hbox{$#2$}\Bigg/\raise1ex\hbox{$#1$}}% } {% \textstyle #1\,/\,#2 } {% \scriptstyle #1\,/\,#2 } {% \scriptscriptstyle #1\,/\,#2 } } \newcommand\Anquotient[3][-22]{% #1 is the optional angle, default is 45 \mathchoice {% \displaystyle \text{\lower0.8ex\hbox{$#3$}\rotatebox{#1}{$\big/$}\raise0.8ex\hbox{$#2$}}% } {% \textstyle #2\rotatebox{#1}{/}#3 } {% \scriptstyle #2\rotatebox{#1}{/}#3 } {% \scriptscriptstyle #2\rotatebox{#1}{/}#3 } } \newcommand\Abquotient[3][-22]{% #1 is the optional angle, default is 45 \mathchoice {% \displaystyle \text{\lower0.8ex\hbox{$#3$}\rotatebox{#1}{$\Big/$}\raise0.8ex\hbox{$#2$}}% } {% \textstyle #2\rotatebox{#1}{/}#3 } {% \scriptstyle #2\rotatebox{#1}{/}#3 } {% \scriptscriptstyle #2\rotatebox{#1}{/}#3 } } \newcommand\ABquotient[3][-22]{% #1 is the optional angle, default is 45 \mathchoice {% \displaystyle \text{\lower0.8ex\hbox{$#3$}\rotatebox{#1}{$\Bigg/$}\raise0.8ex\hbox{$#2$}}% } {% \textstyle #2\rotatebox{#1}{/}#3 } {% \scriptstyle #2\rotatebox{#1}{/}#3 } {% \scriptscriptstyle #2\rotatebox{#1}{/}#3 } } \newcommand\ABQuotient[3][-22]{% #1 is the optional angle, default is 45 \mathchoice {% \displaystyle \text{\lower0.8ex\hbox{$#3$}\rotatebox{#1}{\scalebox{1.5}{$\Bigg/$}}\raise0.8ex\hbox{$#2$}}% } {% \textstyle #2\rotatebox{#1}{/}#3 } {% \scriptstyle #2\rotatebox{#1}{/}#3 } {% \scriptscriptstyle #2\rotatebox{#1}{/}#3 } } \newcommand\fquotient[3][22]{% #1 is the optional angle, default is 22 \mathchoice {% \displaystyle \text{\raise1ex\hbox{\hspace{0.4em}$#3$\hspace{-0.4em}}\rotatebox{#1}{$\Big\backslash$}\lower0.8ex\hbox{\hspace{-0.3em}$#2$\hspace{0.3em}}}% } {% \textstyle \hspace{0.8em}#2\rotatebox{#1}{/}\hspace{-0.8em}#3 } {% \scriptstyle \hspace{0.8em}#2\rotatebox{#1}{/}\hspace{-0.8em}#3 } {% \scriptscriptstyle \hspace{0.8em}#2\rotatebox{#1}{/}\hspace{-0.8em}#3 } } \makeatother \usepackage{polyglossia} \setdefaultlanguage{hebrew} \setotherlanguage{english} \begin{document} \begin{center} \begin{tikzpicture} \begin{axis}[ hide axis, view={40}{60}, ] \addplot3[ surf, colormap name=viridis, faceted color=violet, fill=none, samples=22, samples y=30, domain=0:2*pi, domain y=0:2*pi, z buffer=sort, ] ({(3+cos(deg(x)))*cos(deg(y))}, {(3+cos(deg(x)))*sin(deg(y))}, {sin(deg(x))}); \end{axis} \end{tikzpicture} \end{center} \end{document}

  • How to draw the ribbon shape as decoration in TikZ?
    by Explorer on January 10, 2025 at 4:31 pm

    What I want is to draw the following shape with TikZ and make it as a node, I have tred my attempt.And I have consulted some related tape link on TSE,but none of them satisfied my ideal result. I didn't find it in tikz.shapes, I wonder is there exists any wheels to achieve it as a node? My Final result is to draw a shape wrapped-tape as if the shapes in the tikz.shapes library, that means I can use SYNTAX like \node[shape=wrapped-tape,align=left] {\lipsum[2]}; to typeset the shape. My very first attempt is as below: \documentclass[tikz,border=3.14pt]{standalone} \begin{document} \begin{tikzpicture}[line cap=round] \node[ minimum size=1cm, inner sep=5pt, dashed,draw ] (O) {Hello, world!}; \foreach \side/\s in {west/1,east/-1} { \draw[cyan] (O.north) -- (O.north \side) arc (270:{270-180*\s}:.05cm) -- ([xshift=\s*.3cm,yshift=.1cm]O.north \side) arc (270:{270+180*\s}:.05cm) -- ++(-\s*1.5cm,0) -- ([xshift=-\s*.5cm,yshift=.1cm]O.\side) -- ([xshift=-\s*1.2cm,yshift=.1cm]O.south \side) -- ([xshift=-\s*.05cm,yshift=.1cm]O.south \side); \draw[magenta] ([yshift=.05cm,xshift=-\s*.05cm]O.north \side) -- ([xshift=-\s*.05cm]O.south \side) arc ({90+90*\s}:{90+180*\s}:.05cm) -- ([yshift=-.05cm]O.south); \filldraw[fill=gray!50,draw=cyan] ([yshift=.15cm,xshift=\s*.35cm]O.north \side) -- ++(0,-.15cm) -- ++(-\s*.35cm,0) arc (270:{270-180*\s}:.05cm) -- ([xshift=\s*.3cm,yshift=.1cm]O.north \side) arc (270:{270+90*\s}:.05cm); } \end{tikzpicture} \end{document} And it turn out to be as below: But there remains some flaws: some coordinates are fixed, and it's hard to be extended if the text in node is \lipsum but not Hello, world! the arc used maybe replaced by some control points, but it may make it hard to locate their exact coordiate for the latter points How can I make the style into tikz.shape(declare a new one style)? I want to know any possible thoughts, advise or tunning of the case. Best wishes! some maybe relative wrap-tape style in M$Office

  • How to tune the function of line-to operation `|-` and `-|` in TikZ?
    by Explorer on December 27, 2024 at 4:29 am

    I was plot the flowchart as below with the MWE: \documentclass[border=8pt,tikz]{standalone} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[ cap = round, every rectangle node/.style = {draw,outer sep=0pt,minimum width=2cm}, empty/.style = {circle,inner sep=0pt,outer sep=0pt,minimum size=0pt}] \node[rectangle] (A) {input $x$}; \node[empty] (B) [right=1 of A] {}; \node[rectangle] (C) [above right=.3 and 3 of A] {$\frac15x$}; \node[rectangle] (D) [below right=.3 and 3 of A] {$x+4$}; \node[empty] (E) [right=5.5 of A] {}; \node[rectangle] (F) [right=1.5 of E] {output}; \node[empty] (F1) [below=1.2 of F] {}; \node[empty] (F2) [below=1.2 of A] {}; \draw[-latex] (A) -- (B) |- node [empty,sloped,pos=.75,above=-.2] {$x\ne1$} (C); \draw[-latex] (B) |- node [empty,sloped,pos=.75,below=-.2] {$x=1$} (D); \draw[-latex] (C) -| (E) (D) -| (E) -- (F); \draw[-latex] (F) -- (F1) -- node[empty,sloped,below=-.2] {$x<99$} (F2) -- (A); \end{tikzpicture} \end{document} However, I found that the Horizontal and Vertical Lines Operation |- and -| reached a limited function as the document below shown: In my above code: I have the following three questions: \draw[-latex] (A) -- (B) |- node [empty,sloped,pos=.75,above=-.2] {$x\ne1$} (C); \draw[-latex] (B) |- node [empty,sloped,pos=.75,below=-.2] {$x=1$} (D); \draw[-latex] (C) -| (E) (D) -| (E) -- (F); \draw[-latex] (F) -- (F1) -- node[empty,sloped,below=-.2] {$x<99$} (F2) -- (A); the code above of FOUR \draw of FOUR arrows is a little superfluous, but the arrow is based on \path Is there any tune of my code to avoid defining the node of (B) and (E) explicitly in my case, what I want is a more powerful |- and -| provide a parameter such as proportion=<fp in 0~1> which decide the horizonal/vertical length of the conjunction automatically In the framework of TikZ, is there exists better solution to plot flowchart like this without immersed in multiple seperate \path operation?

  • How do Tikz-3D local planes work?
    by gabyy_rx on September 22, 2024 at 9:38 pm

    I am trying to use the canvas system to define scopes with local planes. When defining a local plane, according to the documentation we define: plane origin=⟨point⟩ Origin of the plane plane x=⟨point⟩ Unit vector of the x-direction in the new plane plane y=⟨point⟩ Unit vector of the y-direction in the new plane So the default plane (in 3D) should be : plane origin = (0,0,0), plane x = (1,0,0), plane y = (0,1,0) If I run this code, I should get a green vector corresponding to the x direction starting from the origin, and the same vector in red starting from (0,3): \documentclass[tikz,border=3.14mm]{standalone} \begin{document} \usetikzlibrary {3d, angles, calc, patterns, quotes, math} \begin{tikzpicture} \draw[->,green] (0,0,0) -- (1,0,0) node[right] {$\vec u_x$}; \begin{scope}[plane x = {(1,0,0)}, plane y = {(0,1,0)}, plane origin = {(0,3,0)}, canvas is plane, transform shape]; \draw[->,red] (0,0) -- (1,0) ; \end{scope} \end{tikzpicture} \end{document} But I get this and I can't figure out why (3D/2D conversions... ??)

  • how can get 3d axis labels in latex tikzpicture?
    by Samia Rani on August 28, 2024 at 8:28 pm

    I am trying to draw the latex picture as same as shown in the given image. Almost all I have done but I am unable to draw the axis label as shown in the image. Please anyone can help me? \documentclass[tikz, border=1pt]{standalone} \usetikzlibrary{arrows.meta, ext.topaths.arcthrough, decorations.markings} \usetikzlibrary{math} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ view={60}{30}, axis lines=none, % Draw axes lines samples=30, samples y=10, domain=0:360, xmax=20, ymax=20, zmax=20, grid=major, enlargelimits=true, axis on top, shader=flat, opacity=1.0, colormap={gray}{color(0cm)=(lightgray); color(1cm)=(lightgray)}, xtick=\empty, % Remove x-axis ticks ytick=\empty, % Remove y-axis ticks ztick=\empty % Remove z-axis ticks ] % Upper cone z = sqrt(x^2 + y^2) \addplot3 [ surf, faceted color=black, % Color of the grid lines draw=black, % Draw the edges with black lines z buffer=sort, domain=0:360, y domain=0:10, ] ({y*cos(x)},{y*sin(x)},{y}); % Lower cone z = -sqrt(x^2 + y^2) \addplot3 [ surf, faceted color=black, % Color of the grid lines draw=black, % Draw the edges with black lines z buffer=sort, domain=0:360, y domain=0:10, ] ({y*cos(x)},{y*sin(x)},{-y}); \end{axis} \end{tikzpicture} \end{document}

  • Tikz library: what prevents this code from working? Unable to call the sin() function
    by Adam Daniels on February 7, 2024 at 5:10 am

    I've tried to call a mathematical function in the x-coordinate part of an (x,y) coordinate, to no avail. Strangely it works for the y-coordinate. Something must be wrong with the syntax but I can't figure it out. This code demonstrates the problem: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (0,0) to [out=30,in=-120] (.5,{cos(60)}); % WORKS \draw (0,0) to [out=30,in=-120] ({.5},{cos(60)}); % WORKS \draw (0,0) to [out=30,in=-120] ({sin(30)},.5); % ATTEMPT 1: DOES NOT WORK \draw (0,0) to [out=30,in=-120] (sin(30),.5); % ATTEMPT 2: DOES NOT WORK \draw (0,0) to [out=30,in=-120] ({sin(30)},{.5}); % ATTEMPT 3: DOES NOT WORK \draw (0,0) to [out=30,in=-120] ({sin(30),.5}); % ATTEMPT 4: DOES NOT WORK \draw (0,0) to [out=30,in=-120] {(sin(30),.5)}; % ATTEMPT 5: DOES NOT WORK \draw (0,0) to [out=30,in=-120] ({{sin(30)},.5}); % ATTEMPT 6: DOES NOT WORK \draw (0,0) to [out=30,in=-120] {({sin(30)},.5)}; % ATTEMPT 7: DOES NOT WORK \end{tikzpicture} \end{document} Your help is greatly appreciated. Best regards,

  • Draw a unicorn in TikZ 🦄
    by Martin Thoma on March 31, 2023 at 2:42 pm

    I'm currently reading Sparks of Artificial General Intelligence: Early experiments with GPT-4. This paper by Microsoft employees experiments with the capabilities of GPT-4, a successor of ChatGPT. One task is to draw a unicorn with tikz.ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ They claim: GPT-4 produces impressive outputs that are [...] at least comparable (if not superior) to what a human would do. Who wants to prove them wrong? 😄🦄🌈 edit: Please don't include PNG / JPG / other pixel image formats. MS-SPO is the only one allowed to do that (as a grandfathering-rule) - kudos for finding the loophole in this question and for thinking outside of the box 😁👍 edit: We now have 200 fun questions! 🥂🥳

  • How to draw a chamfered triangle as a node in tikz?
    by Xiankai Pang on September 17, 2022 at 7:56 am

    There are a lot of node shapes provided in the shape library, but I didn't find any chamfered triangles, as the picture shows below. Are there any libraries that provide such shape? Or how to define a new node shape in tikz? Yes it's possible to draw it as pic rather than a node, but it seems that the pic is not as convenient as node in drawing diagrams using tikz.

  • Conditionally emphasise / highlight matrix entries
    by healyp on March 3, 2021 at 10:37 pm

    I would like to successively emphasise / highlight matrix entries as specified in a provided list. Conceptually I'm hoping that I can change the style of the provided matrix cells on the overlays specified. The code below draws a box around the specified entries on the appropriate overlays but I would like, instead, to change the cell's style (to color blue, or face bold, or whatever). Is it even possible to "dynamically" change a cell's style in this way? It is certainly possible to set a single cell's style on matrix setup. Many thanks. \begin{tikzpicture} % \tikzstyle{unseen} = [] \tikzstyle{seen} = [color=blue!70] \matrix (m) [matrix of math nodes, nodes in empty cells, minimum size=7mm, ampersand replacement=\&, every node/.style={font={\large\ttfamily\bfseries}}] { 1 \& 0 \& 0 \& 0 \& 0 \& 0 \& 0 \\ 0 \& 1 \& 1 \& 1 \& 0 \& 0 \& 0 \\ 0 \& 1 \& 1 \& 0 \& 1 \& 1 \& 0 \\ 0 \& 0 \& 0 \& 1 \& 1 \& 1 \& 0 \\ 0 \& 0 \& 0 \& 0 \& 0 \& 0 \& 1 \\ }; \foreach \o/\r/\c in {1/2/1,2/3/1} { \draw<\o->[seen] (m-\r-\c.north west) rectangle (m-\r-\c.south east); } \end{tikzpicture}

  • Tikz drawing objects/figures on Pythagorean diagrams
    by Jon on June 17, 2020 at 1:52 pm

    I am a mathematics teacher, and I have to make many tests using Pythagoras, kite in a tree, attached by string, a boat out to sea, etc. I would like to know the best ways of drawing these pictures do I need to learn another program? MWE. I have now tried inkscape obtained an SVG file, by using trace Bitmap, not a very good result, or I couldn't use it well. Tried Gimp 2.10.14 got a better result, was able to manipulate image. Would still like to know how these images are created.I have also got all the Tikz people, thank you Nils Fleischhacker. % !TeX spellcheck = en_GB \documentclass{article} \usepackage{graphicx} \usepackage{tikz} \usepackage{calc} \usetikzlibrary{shadows} \begin{document} \begin{figure} \sbox0{\includegraphics[width=0.5\textwidth]{Green_Tree}}% \begin{tikzpicture}[x=\wd0/400, y=\ht0/400] \node[anchor=south west,inner sep=0pt] {\usebox0}; \draw[blue, ultra thick, |-|] (275,0) -- (275,400); \draw[blue, ultra thick, |-|] (220,0) -- (-200,0); \draw[blue, ultra thick, |-|] (-210,30) -- (240,400); \node[below,font=\bfseries\LARGE] {$4m$}; \node[right,font=\bfseries\LARGE] at (300,150) {$13m$}; \node[left,font=\bfseries\LARGE] at (-25,220) {$x\,m$}; \end{tikzpicture} \end{figure} \end{document}

  • how to keep footline when we use \setbeamercovered{invisible} in beamer
    by Abdelhak Elfengour on April 15, 2019 at 10:49 am

    when i use \setbeamercovered{invisible} the footline disappear in the whole tikzpicture frames: \documentclass{beamer} \usetheme{warsaw} \usepackage{tikz} \usetikzlibrary{shapes.geometric, arrows} \usetikzlibrary{positioning} \begin{document} \begin{frame}{frame} \setbeamercovered{invisible}%transparent=0} \centering \begin{tikzpicture}[node distance=.5cm, auto] \tikzset{ mynode/.style={rectangle,rounded corners,draw=black, top color=green, bottom color=red!80,very thick, inner sep=1em, minimum size=3em, text centered}, myarrow/.style={->, >=latex', shorten >=.1pt},%, thick mylabel/.style={text width=7em, text centered} } \node [mynode](node) {1};\pause \node [below=of node,mynode](node1){2}; \draw [myarrow] (node.south) -- ++(0,0) -- ++(0,-.2) -| (node1.north);\pause \node [left=of node1,mynode](node2){2}; \draw [myarrow] (node.south) -- ++(0,0) -- ++(0,-.2) -| (node2.north);\pause \node [left=of node2,mynode](node3){4}; \draw[myarrow] (node.south) -- ++(0,0) -- ++(0,-.2) -| (node3.north);\pause \node [right=of node1,mynode](node4){5}; \draw[myarrow] (node.south) -- ++(0,0) -- ++(0,-.2) -| (node4.north);\pause \node [right=of node4,mynode](node5){6}; \draw[myarrow] (node.south) -- ++(0,0) -- ++(0,-.2) -| (node5.north); \end{tikzpicture} \end{frame} \end{document}

  • PGFplots - Imitate minimalistic style
    by pogo-otter on April 8, 2019 at 5:38 pm

    The style of plots, as shown in the example of a thesis I saw, can be found in literature of topics ranging from mechanical engineering to physics. I am primarily interested to know if this is a specific style option or package (like using colorbrewer sets for colours). (If it is none of this, I will try to re-imagine it myself.) So far, I have checked the TikZ Galery for any other examples of this and looked through math sans serif fonts, but it was not successful yet. Just as an addition, the reason I am searching for a package or something similar, is that this style of diagram is fairly widespread. And not only do the axes look differently than regular pgfplots (see the dimensions for the percentage on the y-axis), there's also the different fontand the arrows in the axis description. These characteristics are always the same when these diagrams can be found in books which makes me think that this is a fundamental design.

  • Effectively, how to do "Underbrace" under two "Underbraces"?
    by wonderich on December 20, 2018 at 5:36 pm

    Goal: I am trying to find a way to write an equation for: However, I fail, or at least so far could not find a way, to add the last layer in the bottom for "magnetic flux" using \underbrace. Here is what I have so far, $$ \overbrace{ \underbrace{S^1_A \times S^1_B}_{E} \times \underbrace{S^1_C \times \mathbb{R}}_{\mathbb{CP}^{N-1}} }^{\text{ABCDEFG}} $$ and my output is this: Could you find a better way to do it? Effectively, how to do "Underbrace" under two "Underbraces"? Or maybe we can also try to use TikZ instead? (i.e. I don't mind to try other methods) p.s. Another thing is that, in my case, the size of ABCDEFG is smaller than the S^1_A \times S^1_B \times S^1_C \times \mathbb{R} — is there a way to adjust the size of ABCDEFG and others? Thank you for your help!!!

  • Water inside a hemispherical bowl
    by Will Kim on September 10, 2018 at 9:58 am

    I am trying to draw the diagram below in latex I got this far with the following code: \documentclass[]{article} \usepackage[margin=0.5in]{geometry} \usepackage{pgfplots} \renewcommand{\thesection}{\arabic{section}} \usepackage{mathtools} \usepackage{cancel} \usepackage{pgfplots} \usepackage{amsmath} \newtheorem{theorem}{THEOREM} \newtheorem{proof}{PROOF} \usepackage{tikz} \usepackage{amssymb} \usetikzlibrary{patterns} \usepackage{fancyhdr} \usepackage{bigints} \usepackage{color} \usepackage{tcolorbox} \usepackage{color,xcolor} \usepackage{booktabs,array} \usepackage{hyperref} \usepackage{graphicx} \usetikzlibrary{arrows} \usepackage{polynom} \usepackage{flexisym} \usepackage{wallpaper} \usepackage{blkarray} \usetikzlibrary{shapes.geometric} \usetikzlibrary{decorations.markings} \newenvironment{tightcenter}{ \setlength\topsep{0pt} \setlength\parskip{0pt} \begin{center}}{\end{center}} \begin{document} A hemispherical bowl of radius $5.1$ cm contains water of depth $3.5$ cm, as shown below. \begin{center} \begin{tikzpicture}[scale=0.75] %\draw (-2.5,-1.65) arc (180:360:2.5 and 0.25); %BIG CIRCLE \draw[thick](-3.2,+0.04) arc (180:360:3.2 and 1.05); \draw[thick](-3.2,+0.04) arc (3.2:180:-3.2 and 1.05); %SMALL CIRLCE \draw[dashed](-2.85,-1.34) arc (180:360:2.85 and 0.8); \draw[dashed](-2.85,-1.34) arc (2.85:180:-2.85 and 1.05); %triangle %\draw[gray,dashed](0,0) -- (+2.84,-1.52); %\draw[gray,dashed](0,0) -- (0,-1.52); %\draw[gray,dashed](0,-1.52) --(+2.9,-1.52); % %\draw (0,0) ++(0:2.8) arc (0:-45:2.8); \draw [thick,domain=-180:0] plot ({3.2*cos(\x)}, {3.2*sin(\x)}) ; %\node[below] at (0,-1.52) {A}; %\node[right] at (2.84,-1.52) {B}; % %\draw [thick,fill=black] (0,-1.52) circle (0.04); \draw [thick,fill=black] (0,0) circle (0.04); %\draw [thick,fill=black] (2.81,-1.52) circle (0.04); \node[above] at (0,0.2) {O}; % %\draw[gray,dashed] (0,-1.52) -- (3.8,-1.52); %\draw[gray,dashed] (0,-3.22) -- (3.8,-3.22); %\draw[thick,<->](3.4,-1.52) to node[fill=white] {$3.5$ cm} (3.4,-3.22); \end{tikzpicture} \end{center} \end{document} Can someone suggest how to do the shading so I can complete this diagram? Thank you.

  • Draw lower (southern) hemisphere and great semicircle with "mathematician's" axes orientation
    by murray on August 23, 2018 at 7:25 pm

    With tikz and tikz-3dplot I want to draw: the unit lower (i.e., southern) hemisphere; and on that two great semicircles through the south pole, i.e., point $(x, y, z) = (0, 0, -1)$, the first joining the points $(\sqrt{2}, \sqrt{2}, 0)$ and $(\sqrt{2}, \sqrt{2}, 0)$ and the second joining the points $(-\sqrt{2}, \sqrt{2}, 0)$ and $(\sqrt{2}, -\sqrt{2}, 0)$; and points at the ends of each of those great semicircles (in my code, shown below, I could use dot, perhaps?) [Meta question: how does one enter LaTeX code here??] Moreover, I want the drawing to show the x-, y-, z-axes with the orientation and position that mathematicians so often use for sketches on paper or on a blackboard, namely: z-axis pointing straight up; y-axis pointing directly to the right, that is on the 2D paper, towards due east); and x-axis "outward" but, as drawn on paper, pointing to the southwest — as shown in this image from https://en.wikipedia.org/wiki/Three-dimensional_space: In particular, I do not want the southest-pointing" x-axis to be unduly foreshortened. Edit: rough version of what I want The following was drawn with Mathematica, but for consistency with my LaTeX document and other graphics there, I need a version done in TikZ. The positive z-axis in this version exends much further north than I actually want! Here's my incomplete start: \documentclass[tikz,border=0pt]{standalone} \usepackage{xcolor} \usepackage{tikz-3dplot} \usepackage{calc} \pgfmathsetmacro{\radius}{1} \begin{document} \tdplotsetmaincoords{60}{110} % theta, phi \begin{tikzpicture}[scale=5,tdplot_main_coords, dot/.style = {circle, fill, minimum size=#1, inner sep=0pt, outer sep=0pt}, dot/.default = 4pt, % size of the circle diameter ] \coordinate (O) at (0,0,0); \draw[thick,->] (0,0,0) -- (1.25*\radius,0,0) node[anchor=north east]{$X$}; \draw[thick,->] (0,0,0) -- (0,1.25*\radius,0) node[anchor=north west]{$Y$}; \draw[thick,->] (0,0,0) -- (0,0,1.25*\radius) node[anchor=south]{$Z$}; \tdplotdrawarc[thick,gray!90] {(O)}{\radius}{0}{360}{}{};% equator % shaded southern hemisphere: \shade[ball color=gray!20!white,opacity=0.3] (1cm,0) arc (0:180:1cm and 5mm) arc (-180:0:1cm and 1cm); \tdplotsetrotatedcoords{0}{270}{90}; % semicircle for lower hemishphere \tdplotdrawarc[tdplot_rotated_coords,thick,color=gray!90] {(O)}{\radius}{0}{180}{}{}; \end{tikzpicture} \end{document} Question: How accomplish this? Evidently it would suffice if I could find out how to draw one of those great semicircles and the points on the equator at its ends. My difficulty is in 3d visualization, i.e., "seeing" how to rotate everything, first to get the axes orientation right, second to move things into position to draw each great semicircle.

  • tikz diagram time line
    by José on June 29, 2017 at 11:09 am

    I am trying to make the following diagram with tikz but I have problems with the spikes. Any help would be appreciated. Thanks in advance!

  • Hard time in plotting a figure
    by L.K. on May 9, 2017 at 12:01 pm

    I have to plot the diagram shown in the following picture, but I couldn't find the way to do it in LaTeX. There should be three different types of networks (or step lines), green, blue and red. I need to write inside the diagram, as shown in the picture. I have to darken the places where they are very close. Code provided by @gernot: \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{calc} \newcommand\wireheight{2} % height of one segment \newcommand\wirewidth{1} % width of a segment \newcommand\wiredist{0.5} % distance between wires \pgfmathsetmacro\pairdist{2*(\wirewidth+\wiredist)} % distance between pairs of wires % \wire[options]{name}{start}{height}{width} \newcommand\wire[5][]% {\draw[#1] (#3) coordinate (#2-0) -- ++(0,#4) coordinate (#2-1) -- ++(#5,0) coordinate (#2-2) -- ++(0,#4) coordinate (#2-3) -- ++(-#5,0) coordinate (#2-4) -- ++(0,#4) coordinate (#2-5) -- ++(#5,0) coordinate (#2-6) -- ++(0,0.5*#4) coordinate (#2-7); } \begin{document} \begin{tikzpicture}[rounded corners,>=stealth,shorten >=1pt, shorten <=1pt] \foreach \i in {0,...,2}{ \wire[thick]{B-\i}{\i*\pairdist,0}{\wireheight}{\wirewidth} \wire[thick,green]{G-\i}{{(\i+1)*\pairdist-\wiredist},0}{\wireheight}{-\wirewidth} } \draw[<-] ($(B-0-2)!0.5!(B-0-3)$) -- +(-0.5,0); \draw[<-] ($(G-0-2)!0.5!(G-0-3)$) -- +(0.5,0) node[above]{5mm}; \draw[<-] ($(G-0-4)!0.5!(G-0-5)$) -- +(-0.5,0); \draw[<-] ($(B-1-4)!0.5!(B-1-5)$) -- +(0.5,0) node[above]{7mm}; \draw[<->] ($(B-1-0)!0.5!(B-1-1)$) -- node[above]{10mm} ($(G-1-0)!0.5!(G-1-1)$); \draw[<->] ($(G-1-2)!0.5!(G-1-3)$) -- node[above]{9mm} ($(B-2-2)!0.5!(B-2-3)$); \end{tikzpicture} \end{document} But this only gives two arrays. I don't know how to continue from there.

  • Recalling a specific overlay of a tikzpicture in beamer
    by Homotopy on July 7, 2014 at 2:54 pm

    I am making a presentation and I want to recall some pictures in my conclusion. The pictures are done using tikzpicture and are in separate files, with some overlay specifications. However, I want to recall only a specific overlay in the conclusion. File: picture.tex \begin{tikzpicture} \draw at (0,0) circle (1); \uncover<2->{ \draw at (2,0) circle (1);} \uncover<3->{ \draw at (1,1) circle (1);} \end{tikzpicture} Then in my main file, \documentclass{beamer} \usepackage{amsmath} \usepackage{tikz} \begin{document} \frame{\frametitle{The Picture} Some text \begin{center} \input{picture} \end{center} } \frame{\frametitle{Conclusion} \begin{center} \input{picture} \end{center} } I would like to display only the overlay <2> in the conclusion without recalling the whole frame (with \againframe). Is there any way of doing that or should I create another file with only what I want to display on the last frame?

  • Beamer overlay specifications for a tikzpicture
    by XZS on November 25, 2013 at 9:07 pm

    Overlay specifications can be added to the TikZ commands. \node<2> (a) {only visible on slide 2}; Is this also possible for the whole tikzpicture environment? \begin{tikzpicture}[<2>] \node (a) {only visible on slide 2}; \node (b) {also only visible on slide 2}; \end{tikzpicture} This can be emulated by enclosing the environment in \only<2>{ ... } but this is impossible when the tikzpicture is used in a \newenvironment.

  • Different background for section page in Beamer
    by marczellm on November 25, 2013 at 11:27 am

    On this picture you can see a titlepage, a section page and a content page done in Powerpoint: How to modify this code so that the section page has the background shown on the image? I can do the text positioning by myself later on. \documentclass{beamer} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{tikz, datetime, textpos} \yyyymmdddate \renewcommand{\dateseparator}{.} \definecolor{MedianBrown}{RGB}{119,95,85} \definecolor{MedianLightBrown}{RGB}{235,221,195} \definecolor{MedianLightBlue}{RGB}{148,182,210} \definecolor{MedianOrange}{RGB}{221,128,71} \setbeamercolor*{title page header}{fg=white} \setbeamercolor*{title}{fg=MedianLightBrown} \setbeamercolor*{author}{fg=white} \setbeamercolor*{date}{fg=white} \setbeamercolor*{item}{fg=MedianOrange} \setbeamercolor*{frametitle}{fg=MedianBrown} \setbeamertemplate{navigation symbols}{} \setbeamertemplate{blocks}[rounded][shadow=true] \setbeamertemplate{background}{ \begin{tikzpicture} \useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight); \ifnum\thepage>1\relax% Not the title page \fill[color=MedianOrange] (0,8) rectangle(0.8,8.3); \fill[color=MedianLightBlue] (0.9,8) rectangle(\the\paperwidth, 8.3); \else% Title page \fill[color=MedianBrown] (0,1.5) rectangle (\the\paperwidth,\the\paperheight); \fill[color=MedianOrange] (0,0.1) rectangle(3.45,1.4); \fill[color=MedianLightBlue] (3.55,0.1) rectangle(\the\paperwidth,1.4); \fi \end{tikzpicture} } \setbeamertemplate{title page} { \begin{textblock*}{12cm}(3cm,2.8cm) \begin{beamercolorbox}[wd=8cm]{title page header} \usebeamerfont{title}\usebeamercolor{title}\inserttitle% \end{beamercolorbox}% \end{textblock*} \begin{textblock*}{12cm}(-0.5cm,4.9cm) \begin{beamercolorbox}{date} \usebeamerfont{date}\insertdate% \end{beamercolorbox} \end{textblock*} \begin{textblock*}{9cm}(3cm,4.9cm) \begin{beamercolorbox}{author} \usebeamerfont{author}\insertauthor% \end{beamercolorbox} \end{textblock*} } \setbeamertemplate{frametitle} { \vskip0.3cm \begin{beamercolorbox}{frametitle} \insertframetitle \end{beamercolorbox} } \setbeamertemplate{items}[square] \setbeamertemplate{sections/subsections in toc}[square] \author{Author Name} \title{Quite A Long Title For A Simple Beamer Presentation} \date{\today} \begin{document} \frame{\maketitle} \section{Introduction} \frame{\sectionpage} \begin{frame}{My presentation is about\ldots} \begin{itemize} \item Some stuff \item And some other stuff \end{itemize} \end{frame} \end{document}