• Print service tells me the gradient I created with TikZ is longer than the Earth's circumference
    by flyx on June 15, 2026 at 8:08 am

    I am designing playing cards, and I use a print service (https://meinspiel.de if that's relevant). I create my cards with a heading styled with tikz, like so: \documentclass{article} \usepackage[paperwidth=65mm,paperheight=97mm, margin=7mm]{geometry} \pagestyle{empty} \RequirePackage[x-4]{pdfx} \setCMYKcolorprofile{coated_FOGRA39L_argl.icc} {Coated FOGRA39} {FOGRA39 (ISO Coated v2 300\% (ECI))} {http://www.argyllcms.com/} \usepackage[overprint]{colorspace} \RequirePackage{tikz} \usetikzlibrary{positioning,shapes,calc,backgrounds} \definecolor{blue1}{cmyk}{0.6818,0.3939,0,0.7412} \definecolor{blue2}{cmyk}{0.6339,0.2768,0,0.5608} \tikzset{ pics/heading/.style={code={ \node[anchor=north west] (heading) at ($(current page.north west) + (7, -7)$) {\textoverprint[0]{\textcolor{white}{\textsf{#1}}}}; \begin{scope}[on background layer] \fill[top color=blue1, bottom color=blue2] (current page.north west) -- (heading.south west-|current page.north west) -- (heading.south east) .. controls +(right:5) and +(left:5) .. +(10, 2) -| (current page.north east) -- cycle; \end{scope} }} } \begin{document} \begin{tikzpicture}[x=1mm, y=1mm, remember picture, overlay] \pic {heading={My Heading}}; \end{tikzpicture} \end{document} As you can see, I set the card's dimensions, specify PDF/X-4 output and the ISO Coated v2 300% (ECI) color profile just like the print service requires. Then I enable overprint (unsure whether this is relevant for my issue) for black text (but the heading is white, so I disable it there again). I define a tikz pic to use for drawing the heading of each card. Finally, I create a document with a single card that uses that pic as heading. The result looks like this: I gave that to the printing service, and they printed the heading as two areas split horizontally with different colors, instead of the gradient. When I asked them what the problem is, they answered this (translated from German): The data is set up in a strange way. The gradient consists of two parts, which lead to it being cut back during conversion. Also, the size of the gradient is extremely huge. I don't exaggerate. It has a width of 352777777777,425mm, i.e. 352.777,78km! While we do have meter scale from time to time, I've never seen kilometers. (The circumference of Earth at the equator is about 40.075 km to put that into context.) It may be that this is why there was an error during conversion. We suggest to embed the gradient as picture to avoid such errors. Also, when gradients are pictures, the print is cleaner and smoother. So, I guess my question is: How do I create the gradient so that the print service is happy? I don't feel like I have enough control over whatever tikz does here.

  • Cover page in LaTeX
    by Jos on June 14, 2026 at 7:38 pm

    How can I get this cover page using LaTeX? I have tried using this code, but I can´t get it. This is a cover page that I want for my dissertation. \documentclass{article} \usepackage{tikz} \usepackage{graphicx} \begin{document} \begin{titlepage} \begin{tikzpicture}[remember picture, overlay] % Your logo \node[anchor=north west] at (1.5in,-1.0625in) {% \includegraphics[width=1in,height=1.0625in]{example-image-duck} }; % Line 1: arriba (horizontal) \draw[line width=2pt] (3in, -1.5in) -- (7in, -1.5in); % Line 2: abajo (horizontal, más cerca) \draw[line width=1pt] (3in, -1.8in) -- (7in, -1.8in); % ===== TRES LÍNEAS VERTICALES ===== % La imagen termina en: -1.0625in - 1.0625in = -2.125in % Línea vertical 1 (desde abajo de la imagen hacia abajo) \draw[line width=1pt] (1.9in, -2.5in) -- (1.9in, -8in); % Línea vertical 2 (centro, espaciada 0.5in) \draw[line width=2pt] (2.1in, -2.5in) -- (2.1in, -8in); % Línea vertical 3 (derecha, espaciada 0.5in) \draw[line width=1pt] (2.3in, -2.5in) -- (2.3in, -8in); \end{tikzpicture} \begin{tikzpicture}[remember picture, overlay] \node[anchor=south west] at (1.5in,-8.8125 in) {% \includegraphics[width=1in,height=1.0625in]{example-image-duck} }; \end{tikzpicture} \end{titlepage} \end{document}

  • Symbol of cannon
    by Sebastiano on June 14, 2026 at 12:15 pm

    I want to reproduce a cannon considering in old style (one of these) considering that I have not seen a specific symbol. Does anyone know if there’s a symbol that resembles one of this image? I have not found anything.

  • TikZ snail's 🐌 outline rotation text layout
    by mathrm alpha on June 14, 2026 at 2:31 am

    Although this was mentioned last time: TeX chinese image poetry image text layout However, it seems no one has mentioned the layout of the snail's rotating circle text in the TeX code. Source: https://jedi.nehs.hc.edu.tw/newsletter/306/poem.html I wrote a LaTeX program that rotates text, but the result isn't quite like this image; it's just a reference to the circle rotation text format. Furthermore, the "比羚羊還要快。" part is missing display. \documentclass{article} \usepackage{tikz,xeCJK} \usepackage[margin=0.5in]{geometry} \setCJKmainfont{Noto Sans CJK TC} \usetikzlibrary{decorations.text} \begin{document} \centering \begin{tikzpicture} % Define colors based on the image \definecolor{snailbody}{RGB}{240, 200, 180} \definecolor{shellbase}{RGB}{220, 170, 150} % Body and Tail \fill[snailbody] (-3.5, 0.5) .. controls (-4, -1) and (-3.5, -3.5) .. (0, -3.5) -- (6, -2.5) -- (0, -2.8) .. controls (-2, -2.8) and (-3, -1) .. (-3.5, 0.5); % Head \fill[snailbody] (-3.5, 0.5) circle (0.9); % Antennae \draw[snailbody, line width=4pt] (-3.9, 1.2) -- (-4.3, 2.6); \fill[snailbody] (-4.3, 2.7) circle (0.2); \draw[snailbody, line width=4pt] (-3.1, 1.2) -- (-2.9, 2.6); \fill[snailbody] (-2.9, 2.7) circle (0.2); % Shell (large circle) \fill[shellbase] (0.5, 0) circle (3.7); %text parts \path [ decorate, decoration={ text along path, text={背著重重的家,上山下海,尋找食物,我總比別人慢一步,我想如果我拋棄沉重的家,我一定爬得比羚羊還要快。}, text align=center } ] (0.5, 0) ++(180:4.0) arc (180:0:4.0); \end{tikzpicture} \end{document} Although there are similar: How to fine tune rotation of text along circular path? However, There was no mention of a text rotation format resembling a snail's outline.

  • Coil decoration on curved path looks strange
    by nogrodrigo on June 13, 2026 at 3:52 pm

    I am trying to achieve something like this in TikZ: The black path should go straight up and the red one should go down bent to the right, both must look like a coil. I have tried to do this using bezier curves and arcs, but the coil decoration of the bent path looks very strange, it's pointy in some parts. What am I doing wrong? MWE: \documentclass{article} \usepackage{xcolor} \usepackage{tikz} \usetikzlibrary{decorations.pathmorphing} \begin{document} \begin{tikzpicture} \draw[-latex, decorate, decoration = {coil, aspect = 1.2}, color = red] (0,2) arc (90:-90:1); \draw[-latex, decorate, decoration = {coil, aspect = 1.2}] (0,0) -- (0,2); \draw[-latex, decorate, decoration = {coil, aspect = 1.2}] (3,0) -- (3,2); \draw[-latex, decorate, decoration = {coil, aspect = 1.2}, color = red] (3,2) .. controls (4,2) and (4,0) .. (3,0); \end{tikzpicture} \end{document}

  • TikZ customize in big operators symbols, can't display big TikZ operators
    by mathrm alpha on June 13, 2026 at 8:59 am

    I followed the LaTeX question reference below to adapt it to the tikz big operators version, but it didn't display in tikz "⅌" symbol. How can I define a big plus operator that works like \bigcup? ⅌ apply in tikz text symbols? % Source - https://tex.stackexchange.com/a/394912 % Posted by GuM, modified by community. See post 'Timeline' for change history % Retrieved 2026-06-13, License - CC BY-SA 3.0 \documentclass{article} \usepackage{tikz,iftex,amsmath} \usepackage{graphicx} \makeatletter \newcommand*\@bigper[1]{\vcenter{\hbox{#1$\m@th ⅌$}}} \newcommand*\bigper{% \DOTSB % omit this line if you are not using the amsmath package \mathop{% \mathchoice {\@bigper ⅌}% {\@bigper \LARGE}% {\@bigper {}}% {\@bigper \footnotesize}% }% \slimits@ % omit this line if you are not using the amsmath package } \makeatother \ifPDFTeX \usepackage[utf8]{inputenc} \else \usepackage{newunicodechar} \fi \DeclareRobustCommand{\TikZPerSign}{% \tikz[ baseline=-.25ex, x=.13em, y=.13em, line cap=round, line join=round ]{% % Fixed box: this is important for text-like behaviour. \path[use as bounding box] (-3.05,-3.35) rectangle (3.95,4.35); % 1. The horizontal ellipse \draw[line width=.05em] (0.4,0) ellipse[x radius=2.2,y radius=.7]; % 2. The main U shape \draw[line width=.05em] (-.6,1.5) .. controls (-.6,-3.2) and (.6,-3.2) .. (.6,1.5); % 3. The top-left flourish \draw[line width=.05em] (-.6,1.5) .. controls (-1.8,2.8) and (-3.0,1.5) .. (-2.2,1.2); \fill (-.5,1.9) circle[radius=.22]; % 4. The large right loop \draw[line width=.05em] (.6,1.5) .. controls (.6,4.2) and (3.5,3.2) .. (3.5,.5) .. controls (3.5,-.8) and (2.5,-1.2) .. (1.8,-1.0); }% } \ifPDFTeX \DeclareUnicodeCharacter{214C}{\TikZPerSign} \else \newunicodechar{⅌}{\TikZPerSign} \fi \begin{document} $$\sum^1_2 \bigper^3_4$$ \end{document}

  • TeX chinese image poetry image text layout
    by mathrm alpha on June 12, 2026 at 4:06 am

    Someone helped me figure out how to create LaTeX Chinese image poetry, The vertical CJK text was not arranged according to the size of the shape. Source: https://jedi.nehs.hc.edu.tw/newsletter/306/poem.html LaTeX code I've tried with tikz text typesetting: \documentclass{article} \usepackage{tikz} \usepackage[margin=0.5in]{geometry} \usepackage{xeCJK} \definecolor{carcolor}{RGB}{242, 186, 166} \begin{document} \centering \begin{tikzpicture} % Wheels (車輪) \fill[carcolor, rounded corners=6pt] (1.8, 0.7) rectangle (2.6, 1.5); \fill[carcolor, rounded corners=6pt] (3.4, 0.7) rectangle (4.2, 1.5); % Main body of the car (主車身) \fill[carcolor, rounded corners=10pt] (0, 1) rectangle (6, 2.3); % Top cabin part (車頂) \fill[carcolor, rounded corners=12pt] (1.6, 2.2) rectangle (4.4, 3.6); \linespread{0.8}\selectfont \scriptsize % 第 1 行:叭叭(最右側,車身內) \node[text width=0.35cm, align=center] at (5.2, 1.65) {叭\\叭}; % 第 2 行:我是(車身內) \node[text width=0.35cm, align=center] at (4.8, 1.65) {我\\是}; % 第 3 行:一輛車(進入車頂邊緣) \node[text width=0.35cm, align=center] at (4.3, 1.9) {一\\輛\\車}; % 第 4 行:我可以載人(深入車頂) \node[text width=0.35cm, align=center] at (3.8, 2.3) {我\\可\\以\\載\\人}; % 第 5 行:也可以載貨物(深入車頂) \node[text width=0.35cm, align=center] at (3.3, 2.45) {也\\可\\以\\載\\貨\\物}; % 第 6 行:雖然身不大(深入車頂) \node[text width=0.35cm, align=center] at (2.8, 2.45) {雖\\然\\身\\不\\大}; % 第 7 行:卻是大力士(深入車頂) \node[text width=0.35cm, align=center] at (2.3, 2.45) {卻\\是\\大\\力\\士}; % 第 8 行:不管是跑車(進入車頂邊緣) \node[text width=0.35cm, align=center] at (1.8, 2.3) {不\\管\\是\\跑\\車}; % 第 9 行:客車或是貨車(字數多,稍微往下靠在車身與車頂間) \node[text width=0.35cm, align=center] at (1.3, 1.9) {客\\車\\或\\是\\貨\\車}; % 第 10 行:全都是(左側,車身內) \node[text width=0.35cm, align=center] at (0.8, 1.65) {全\\都\\是}; % 第 11 行:神奇 車!(最左側,車身內) \node[text width=0.35cm, align=center] at (0.4, 1.65) {神\\奇\\車\\!}; \end{tikzpicture} \end{document} I only realized how strange the text position and height were when I used it. Advanced Extension: Tikz snail's outline rotation text layout

  • Drawing tikz five line style arrows in text display
    by mathrm alpha on June 11, 2026 at 12:15 pm

    Although a five-line arrow was unearthed, but: This is simply a very long, cramped five-line tikz arrows result, not the size of the blue arrow in the image. Furthermore, none of the arrows in the @Explorer answer (in the image) scaled down to the the same text size. This is example diagram text in: A \LLleftarrow B \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{nfold} \begin{document} \begin{tikzpicture} \draw[double equal sign distance, nfold=5, arrows=-Implies] (0,-0.7) -- (3,-0.7); \end{tikzpicture} \end{document} References: Drawing a quadruple arrow

  • PGFPlots / TikZ: Filtering data from a file when the x-axis contains string values
    by joseldsm on June 10, 2026 at 9:57 am

    I am generating a plot in PGFPlots/TikZ where the x-axis contains string values and the y-axis contains numerical data. The data is imported from a CSV file, and everything works correctly so far. However, when I use skip coordinates between index, the filtering is applied to the y-values and not to the x-axis categories. In this case, I want to draw only the data with the string value B. Is there a way to correctly apply this filtering to both x-axis ? Thanks! Here is the MWE. Keep in mind that in my case the data are extract from csv file. \documentclass{article} \usepackage{pgfplots} \usepackage{pgfplotstable} \pgfplotsset{compat=1.18} \pgfplotstableread{ String Value A 0 A 6 A 4 B 9 B 5 B 1 B 3 B 7 C 4 C 7 C 9 C 3 }\data \begin{document} \begin{tikzpicture} \begin{axis}[ ybar, ymin=0, xtick=data, xticklabels from table={\data}{String}, nodes near coords ] \addplot table[ x expr=\coordindex, y={Value}, skip coords between index={0}{3}, skip coords between index={8}{100} ]{\data}; \end{axis} \end{tikzpicture} \end{document}

  • Improved visualization of the domains of integration in ℝ³
    by Sebastiano on April 24, 2026 at 9:26 pm

    Before of this question, I would like to thank the authors of the answers and everyone who appreciated my question. I had previously created these two figures related to two triple integrals. Is there a better way to improve their presentation and make them clearer and more visually appealing? T={(x, y, z) ∈ ℝ³: (x²+y²)¹/² ≤ z ≤ 1} \documentclass[12pt]{article} \usepackage{tikz,tikz-3dplot} \begin{document} \begin{center} \tdplotsetmaincoords{60}{130} \begin{tikzpicture}[tdplot_main_coords,scale=3] \pgfmathsetmacro{\h}{0.6} \pgfmathsetmacro{\raggio}{\h} \draw[thick,->] (0,0,0) -- (1.5,0,0) node [below left] {\footnotesize$x$}; \draw[dashed] (0,0,0) -- (-1.5,0,0); \draw[thick,->] (0,0,0) -- (0,1.5,0) node [right] {\footnotesize$y$}; \draw[dashed] (0,0,0) -- (0,-1.5,0); \draw[thick,->] (0,0,1.0) -- (0,0,1.5) node [above] {\footnotesize$z$}; \draw[dashed] (0,0,0) -- (0,0,1.0); \foreach \altura in {0.01,0.02,...,1.0}{ \draw[cyan,opacity=0.5] plot[domain=0:2*pi,smooth,variable=\t] ({\altura*cos(\t r)},{\altura*sin(\t r)},{\altura}); } \draw[blue,thick,fill=brown!50,opacity=0.6] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},{\h}); \draw[dashed,fill=yellow,opacity=0.4] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},0); \foreach \t in {0,10,30,60,90,120,150,250,280,310}{ \draw[black,dashed,thin,opacity=0.7] ({\raggio*cos(\t)},{\raggio*sin(\t)},{\h}) -- ({\raggio*cos(\t)},{\raggio*sin(\t)},0); } \fill[gray,opacity=0.1] (-1.2,-1.2,\h) -- (1.2,-1.2,\h) -- (1.2,1.2,\h) -- (-1.2,1.2,\h) -- cycle; \draw[red,very thick] (0,0,\h) -- (0,\raggio,\h); \node at (0,1.5,\h) {\small $z=h$}; \node at (0,0.5,0.75) {\small $z$}; \node at (0,0.25,-0.35) {\small $T(z=0)$}; \node at (0,.75,1.3) {\small $T(z=h)=T(z)$}; \end{tikzpicture} \end{center} \end{document} C= {(x,y,z)∈ ℝ³: z∈ [0, 2], x²+ y²≤ z} \documentclass[12pt]{article} \usepackage{tikz,tikz-3dplot} \begin{document} \begin{center} \tdplotsetmaincoords{70}{130} \begin{tikzpicture}[tdplot_main_coords,scale=2.5] \pgfmathsetmacro{\h}{.6} \pgfmathsetmacro{\raggio}{sqrt(\h)} \draw[thick,->] (0,0,0) -- (1.5,0,0) node [below left] {$x$}; \draw[thick,->] (0,0,0) -- (0,1.5,0) node [right] {$y$}; \draw[thick,->] (0,0,0) -- (0,0,1.5) node [above] {$z$}; \draw[red,very thick] plot[domain=-1:1,smooth,variable=\t] (0,{\t},{\t*\t}); \draw[blue,fill=yellow,opacity=0.4] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},{\h}); \draw[fill=yellow,dashed,opacity=0.5] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},{0}) node [above] {\tiny $C(z)$}; \foreach \t in {0,10,...,350}{ \draw[gray, dashed, thin,opacity=0.4] ({\raggio*cos(\t)},{\raggio*sin(\t)},{\h}) -- ({\raggio*cos(\t)},{\raggio*sin(\t)},0); } \foreach \altura in {0.0125,0.025,...,1.0}{ \pgfmathsetmacro{\radio}{sqrt(\altura)} \draw[cyan,thick,opacity=0.5] plot[domain=0:2*pi,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } \fill[orange!30,opacity=0.4] (-1,-1,\h) -- (1,-1,\h) -- (1,1,\h) -- (-1,1,\h) -- cycle; \draw[blue,very thick] (0,0,\h) -- (0,{\raggio},\h); \node[black, above right] at (0,{\raggio/2},\h) {\tiny $\sqrt{z}$}; \draw[blue,fill=yellow,dotted,thick,opacity=0.4] plot[domain=0:360,smooth,variable=\t] ({\raggio*cos(\t)},{\raggio*sin(\t)},{\h}); \draw[blue!80,thick] plot[domain=0:2*pi,smooth,variable=\t] ({cos(\t r)},{sin(\t r)},{1.0}); \end{tikzpicture} \end{center} \end{document}

  • How to recreate a DuPont scheme
    by Dorian on November 22, 2025 at 1:30 pm

    I'd like to recreate a DuPont scheme as the image below. I’m not necessarily asking for the exact code used to recreate the graphic, but rather for the packages and commands that would allow me to do it myself. Is there anything more “accessible” than TikZ? Thank you in advance 😉

  • How to connect nodes in a flowchart
    by Fatma Belabed on January 31, 2025 at 11:56 am

    I wanted to draw this flowchart, but I couldn't connect the nodes correctly. this is my code: \tikzset{ arr/.style={thick,-stealth}} %%%%%%%%%%%%%%%%%%%%%%%% \usetikzlibrary{ arrows.meta, shapes, positioning, calc, decorations.markings} \tikzset{ block2/.style={ rectangle, draw, fill=white, rounded corners, text centered, text width = 14em, minimum height = 2em}, line/.style={draw, -Latex}} %%%%%%%%%%%%%%%%%%%%%%% \tikzset{ block/.style={ rectangle, draw, fill=blue!10, rounded corners, text centered, text width = 9em, minimum height = 2em}, line/.style={draw, -Latex}} \tikzset{ blockxx/.style={ rectangle, draw, fill=blue!10, text centered, text width = 9em, minimum height = 2em}, line/.style={draw, -Latex}} \tikzset{ blockx/.style={ rectangle, draw, fill=blue!10, rounded corners, text centered, text width = 6em, minimum height = 2em}, line/.style={draw, -Latex}} \tikzset{ block3/.style={ rectangle, draw, fill=blue!20, rounded corners, text centered, text width = 9em, minimum height = 2em}, line/.style={draw, -Latex}} \tikzset{ block4/.style={ rectangle, draw, fill=blue!50, rounded corners, text centered, text width = 9em, minimum height = 2em}, line/.style={draw, -Latex}} \tikzset{ block44/.style={ rectangle, draw, fill=blue!50, rounded corners, text centered, text width = 3em, minimum height = 2em}, line/.style={draw, -Latex}} \tikzset{ block444/.style={ rectangle, draw, fill=blue!50, rounded corners, text centered, text width = 8em, minimum height = 2em}, line/.style={draw, -Latex}} \begin{document} \begin{tikzpicture}[every node/.style={block}] \node [ block2, node distance=2cm] (second) {Security attacks}; \node[block3, below left=1cm and 1cm of second](case one) {Physical}; \node[block4, below = 1cm of second](case two) {Data Link}; \node[below right = 1cm and 1cm of second](case three) {Network}; \node[below right = 1cm and 5.5cm of second](case forr) {Transport}; \node[block3, below = 0.7cm of case forr](case forr1){Dos}; \node[block3, below = 0.7cm of case forr1](case forr2){Session hijacking}; \node[block3, below = 0.7cm of case forr2](case forr3){Exhaustion}; \node[below right = 1cm and 10cm of second](case five) {Application}; \node[block3, below = 0.7cm of case five](case five1){Dos}; \node[block3, below = 0.7cm of case five1](case five2){Repudiation}; \node[block3, below = 0.7cm of case five2](case five3){Deluge}; \node[block3, below = 0.7cm of case one](no info){Dos}; \node[block3, below = 0.7cm of no info](no info1){Eavesdropping}; \node[block3, below = 0.7cm of no info1](no info2){Jamming}; \node[block444, on grid,below = 1.7cm of case two](aa){Dos}; \node[block444, on grid, below = 1.5cm of aa](aa1){Collision}; \node[block444, on grid,below = 1.5cm of aa1](aa2){Unfairness}; \node[block444, on grid,below = 1.5cm of aa2](aa3){Exhaustion}; \node[block444, on grid,below = 1.5cm of aa3](aa4){Traffic monitoring}; \node[blockxx, on grid,below = 1.5cm of case three](a){Dos}; \node[blockxx, on grid,below = 1.5cm of a](a1){Hole}; \node[blockxx, on grid,below = 1.5cm of a1](a2){Selective forwarding}; \node[blockxx, on grid,below = 1.5cm of a2](a3){Sybil}; \node[blockxx, on grid,below = 1.5cm of a3](a4){Eavesdropping}; \node[blockxx, on grid,below = 1.5cm of a4](a5){Spoofing}; \node[blockxx, on grid,below = 1.5cm of a5](a6){Traffic analysis}; \draw[arr] (second.south) --++ (0,-5pt) -| (case one); % physique \draw[arr] (case one.west) --++ (0,-5pt) -- (no info.west); \draw[arr] (case one.west) --++ (0,-5pt) -- (no info1.west); \draw[arr] (case one.west) --++ (0,-5pt) -- (no info2.west); \draw[arr] (second.south) --++ (0,-5pt) -| (case two); % data \draw[arr] (case two.west) --++ (0,-5pt) |- (aa.west); \draw[arr] (case two.west) --++ (0,-5pt) |- (aa1.west); \draw[arr] (case two.west) --++ (0,-5pt) |- (aa2.west); \draw[arr] (case two.west) --++ (0,-5pt) |- (aa3.west); \draw[arr] (case two.west) --++ (0,-5pt) |- (aa4.west); \draw[arr] (second.south) --++ (0,-5pt) -| (case three); % network \draw[arr] (case three.west) --++ (0,-5pt) |- (a.west); \draw[arr] (case three.west) --++ (0,-5pt) |- (a1.west); \draw[arr] (case three.west) --++ (0,-5pt) |- (a2.west); \draw[arr] (case three.west) --++ (0,-5pt) |- (a3.west); \draw[arr] (case three.west) --++ (0,-5pt) |- (a4.west); \draw[arr] (case three.west) --++ (0,-5pt) |- (a5.west); \draw[arr] (case three.west) --++ (0,-5pt) |- (a6.west); \draw[arr] (second.south) --++ (0,-5pt) -| (case forr); % Transport \draw[arr] (case forr.west) --++ (0,-5pt) |- (case forr1.west); \draw[arr] (case forr.west) --++ (0,-5pt) |- (case forr2.west); \draw[arr] (case forr.west) --++ (0,-5pt) |- (case forr3.west); \draw[arr] (second.south) --++ (0,-5pt) -| (case five); % Application \draw[arr] (case five.west) --++ (0,-5pt) |- (case five1.west); \draw[arr] (case five.west) --++ (0,-5pt) |- (case five2.west); \draw[arr] (case five.west) --++ (0,-5pt) |- (case five3.west); \end{tikzpicture} \end{figure} \end{document} Thanks

  • tikz: specifying coordiantes system in 3d
    by climber on January 9, 2024 at 10:14 am

    currently I am working with TikZ program in latex to draw a 3d figure. I need to redefine a coordinates system in 3d. The following is a MWE I tried: \documentclass{scrreprt} \usepackage{tikz} \usetikzlibrary{3d} \begin{document} \begin{tikzpicture}[x={(0:1)},y={(60:1)},z={(30:1cm)}] \draw[->] (0,0,0) -- (1,0,0); \draw[->] (0,0,0) -- (0,1,0); \draw[->] (0,0,0) -- (0,0,1); \end{tikzpicture} \end{document} And it gives the followings figure: But when I tried to change the z coordinate as z={(30:1)} (without dimension), it gives another picture as follows: \documentclass{scrreprt} \usepackage{tikz} \usetikzlibrary{3d} \begin{document} \begin{tikzpicture}[x={(0:1)},y={(60:1)},z={(30:1)}] \draw[->] (0,0,0) -- (1,0,0); \draw[->] (0,0,0) -- (0,1,0); \draw[->] (0,0,0) -- (0,0,1); \end{tikzpicture} \end{document} So I wonder how the XYZ vectors are rotated? Are they all rotated based on the vector (1cm,0)? I didn't find the answer in the pgf manual and search for help here. Thank you for any help.

  • Interesting weird TikZ behaviour
    by vishalpaudel on September 4, 2023 at 7:30 am

    I was trying to draw a grid of points with the weights of the points as the average of x and y: \usepackage{tikz} ... \begin{center} \begin{tikzpicture} \foreach \x in {1,2,3,4,5,6} { \foreach \y in {1,2,3,4,5,6} { \fill (\x, \y) circle ({(\x + \y)/2}); } } \end{tikzpicture} \end{center} ... The output is unexpected(Screenshot attached)! Does anyone know what is happening? I am using Lualatex on overleaf. edit 1: Solved the original problem: but need an explanation of the earlier behaviour.

  • types of systems of linear equations and intersection of planes, with tikz
    by Juan Leal on July 22, 2023 at 2:57 pm

    Is there a simple way using tikz to graph a plane from its equation (like those of the systems on the right side, e.g. 2x +3y -z = 11), and that allows me to represent the intersection of two or three of them (even four)? If possible, I additionally need it to allow me to have flat colors in each of the planes involved and not to be represented by pieces as suggested by some of the solutions I have seen. I want to represent graphically to my students all the possibilities that can be presented with a system of linear equations with three unknowns, in a way similar to the one in the image I include. I have been reading the material related to this topic for three days and I have not found a completely satisfactory solution (or maybe there is one, but I have not appreciated it properly). I know a bit about tikz, pgfplots and tikz-3dplot (and I come from the old school of pstricks).

  • How to draw on any plane with 3dtools
    by rpapa on March 24, 2022 at 3:53 pm

    Salvation I am testing the 3Dtools library (https://github.com/marmotghost/tikz-3dtools). I find the idea interesting. It is possible to define a plane either by 3 points, or by a vector and a point, very well. on the other hand I did not find how to choose this plan to draw above. So I'm looking for an example of use.

  • Tikz in caption leads to error even with \protect [duplicate]
    by aiquita on January 27, 2022 at 4:35 pm

    According to Adding tikz figure in caption it suffices to add protect to make my program compile. Indeed, it compiles after adding the command, but TeX still throws an error message that the control sequence is undefined. What portion of the command definition of \circled leads to the problem? \documentclass[twoside,runningheads, oribibl, draft]{llncs} \usepackage{graphicx} \usepackage{tikz} \newcommand*\circled[1]{% \protect\tikz[baseline=(char.base)]{% \node[shape=circle, draw, inner sep=1.5pt, font=\small] (char) {#1}; }} \begin{document} \begin{figure}[h] Hello World \caption{Derivation of premise \circled{2}} \end{figure} \end{document}

  • Drawing arc with superimposed label in TikZ 3D
    by L Mascolo on November 21, 2021 at 11:40 am

    I would like to receive some help from you. I've been able to add the label for a vector in the middle of the arrow itself in tikz3d by using a command like: \tdplotsetcoord{Mp}{\rvm}{\phm}{\thm} \path (O) -- node[sloped] (text) {$\bv{r}_{kj}(t)$} (Mp); \draw[-latex,shorten >=3mm] (O) -- (text) -- (Mp); However I would like to obtain the same with arcs. Given that I'm using the command: \tdplotdrawarc[-latex]{(O)}{0.8}{0}{\thm}{anchor=north}{$\vth_k(t)$} I cannot find a way to include it. Here is a MWE: \documentclass[tikz,border=5pt]{standalone} \usepackage{graphicx} \usepackage{tkz-euclide} % \usetkzobj{all} % obselete \usetikzlibrary{arrows.meta,angles,quotes,positioning} \usepackage{tikz-3dplot} \tdplotsetmaincoords{75}{110} \begin{document} \begin{tikzpicture}[scale=4,tdplot_main_coords] \definecolor{earth}{RGB}{0,128,0} \definecolor{moon}{RGB}{119,136,153} \pgfmathsetmacro{\rvm}{1.2} \pgfmathsetmacro{\phm}{70} \pgfmathsetmacro{\thm}{150} \coordinate (O) at (0,0,0); \draw[thick,-latex] (0,0,0) -- (1.5,0,0) node[anchor=north east]{${ I}$}; \draw[thick,-latex] (0,0,0) -- (0,1.5,0) node[anchor=north west]{${ J}$}; \draw[thick,-latex] (0,0,0) -- (0,0,1.2) node[anchor=south]{${ K}$}; % Earth \tdplotsetcoord{Ep}{0}{0}{0} % draw Moon position, theta, phi, RTN CS \tdplotsetcoord{Mp}{\rvm}{\phm}{\thm} \path (O) -- node[sloped] (text) {${r}_{kj}(t)$} (Mp); \draw[-latex,shorten >=3mm] (O) -- (text) -- (Mp); \draw[dashed,shorten >=-20pt ] (O) -- (Mpxy); \tdplotdrawarc[-latex]{(O)}{0.8}{0}{\thm}{anchor=north}{$\vartheta_k(t)$} \shade[ball color = earth] {(Ep)} circle (2.5pt); \shade[ball color = moon] {(Mp)} circle (2pt); \end{tikzpicture} \end{document}

  • How to plot the 3D graph of the following three inequalities in latex (e.g., tikz/pgf)?
    by learner on July 9, 2021 at 9:27 am

    How to plot the 3D graph of the following three inequalities in latex (tikz/pgf) ? z <= x+y+1, z <= 4x, z <= 5y. My attempt: \documentclass[12pt,leqno]{amsart} \usepackage{pgfplots} \usepackage{tikz} \begin{document} \begin{tikzpicture} \begin{axis} \addplot3 [ domain=-5:20, domain y = -3:10, samples = 20, samples y = 8, surf] {x+y+1}; \addplot3[domain=-5:20, domain y = -3:10, samples = 20, samples y = 8, surf, opacity=0.25]{4*x}; \addplot3[domain=-5:20, domain y = -3:10, samples = 20, samples y = 8, surf, opacity=0.25]{5*y}; \end{axis} \end{tikzpicture} \end{document} The above Latex code produces the above figure: But the above graph is not clear, the intersecting line of the three half-planes are not clear. Any help to draw clear image with clear intersection. Any help both with the 3D graph of the given 3 inequalities. Thanks Edit: The 2D projection of the above 3 inequalities becomes: and this is justified by the answer of @Juan Castaño.

  • Drawing a circle graph with TIKZ with foreach placement and paths, yet the inbound for edges is off
    by Tenaka on December 1, 2020 at 5:01 pm

    I want to draw a circle using TIKZ and instead of manually placing the nodes and connecting the nodes I wanted to use loops as any sane person would. Now when I wrote these, the incoming edge seems to be going to some point slightly of the node instead of to its core. In the example, I included a version with the path manually written out. I am losing my sanity here 😀 Anyone got any idea as to what is happening here? Any style critique is also very welcome! \documentclass[margin=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{automata} \begin{document} \begin{tikzpicture}[nodes=state] \def \number {8} \def \radius {2cm} \def \degree {360/\number} \foreach \s in {1,...,\number} { \node at ({\degree * (\s -1)}:\radius) (\s) {$u_\s$}; } \foreach \s in {1,...,\number} { \pgfmathsetmacro\result{Mod( (\s), \number)+1} \path (\s) edge[bend right = 15] (\result); } \end{tikzpicture} \begin{tikzpicture}[nodes=state] \def \number {8} \def \radius {2cm} \def \degree {360/\number} \foreach \s in {1,...,\number} { \node at ({\degree * (\s -1)}:\radius) (\s) {$u_\s$}; } \path (1) edge[bend right = 15] (2) % edge (5) (2) edge[bend right = 15] (3) % edge (6) (3) edge[bend right = 15] (4) % edge (7) (4) edge[bend right = 15] (5) % edge (8) (5) edge[bend right = 15] (6) (6) edge[bend right = 15] (7) (7) edge[bend right = 15] (8) (8) edge[bend right = 15] (1) ; \end{tikzpicture} \end{document}

  • Plane intersecting sphere with tikz and tikz-3d
    by B. Dors on November 3, 2020 at 3:57 pm

    I'm really surprised that I couldn't find an answer to this question, but here it goes: how can I draw a plane intersecting a sphere using tikz and tikz-3dplots? I managed to do the following, using a mixture of this answer and this answer (code below): But what I really want is something like this (it's a shame and something I totally don't understand why Geogebra does not convert 3D figures to tikz): Clearly, I'm almost there. But the shading is wrong: the plane is being plotted as if it was covering the sphere, and not as if it is intersecting it. I found out here that apparently there is no way of doing the shading automatically, but I'm ok with doing it manually. The only problem is, I have no idea how to do it. I spent more than a day already trying to understand what was happening in the codes of the previous mentioned answers, as they were made for specific cases and I needed to transform them into a random sphere intersecting a random plane. I added some comments to the code with what I gathered. But I still am not sure how all of those commands work, so I can't properly identify where should I end and begin an arc to fill with some darker gray color on top of the plane plotting. I know that using an external programm to generate images would work (here is a nice example using Asymptote), but I have to add many different spheres intersecting different planes to my file, and I would prefer to be able to generate them directly in Latex with tikz, instead of having multiple figures. So my question reduces to: how to manually add the proper shading in my figure? (Notice that there is need for two shades: one for the cap of the sphere and a darker one for the back part of the sphere's cap.) Of course, an alternative code, which can be easily modified for different spheres and planes (specially planes not parallel to xy), is very welcome as well. What I have so far: \documentclass{article} \usepackage{tikz} \usepackage{tikz-3dplot} \usetikzlibrary{backgrounds, intersections} %I don't have a clear idea of what is happening here, but they are used for the plane construction \newcommand\pgfmathsinandcos[3]{% \pgfmathsetmacro#1{sin(#3)}% \pgfmathsetmacro#2{cos(#3)}% } \newcommand\LongitudePlane[3][current plane]{% \pgfmathsinandcos\sinEl\cosEl{#2} % elevation \pgfmathsinandcos\sint\cost{#3} % azimuth \tikzset{#1/.style={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}} } \newcommand\LatitudePlane[3][current plane]{% \pgfmathsinandcos\sinEl\cosEl{#2} % elevation \pgfmathsinandcos\sint\cost{#3} % latitude \pgfmathsetmacro\yshift{\cosEl*\sint} \tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} % } \newcommand\DrawLongitudeCircle[2][1]{ \LongitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=#1}} % angle of "visibility" \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} % \draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1); \draw[current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1); } \newcommand\DrawLatitudeCircle[2][1]{ \LatitudePlane{\angEl}{#2} \tikzset{current plane/.prefix style={scale=#1}} \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)} % angle of "visibility" \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))} \draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1); \draw[current plane,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1); } \begin{document} \begin{figure} \centering \tdplotsetmaincoords{60}{110} \begin{tikzpicture}[tdplot_main_coords, declare function={dicri(\t,\th,\ph,\R)=sin(\th)*sin(\ph)*(\R*cos(\t)) - sin(\th)*cos(\ph)*(\R*sin(\t))+ cos(\th)*(1);}] %dicri is defined according to a parametrization n+r*cos(t)*u+r*sen(t)*v, being u and v orthonormal vectors in the intersecting plane \pgfmathsetmacro{\R}{5}% \path coordinate (T) at (0,0,3) %center of circle defined by the intersection coordinate (I) at (0,0,0); \path[tdplot_screen_coords,shift={(I)},use as bounding box] (-1.2*\R,-1.2*\R)rectangle (1.2*\R,1.2*\R);%this limits the image position %draws dot+label for coordinates T and I \foreach \v/\position in {T/above,I/below} { \draw[fill=black] (\v) circle (0.7pt) node [\position=0.2mm] {$\v$}; } \begin{scope}[tdplot_screen_coords, on background layer] \fill[ball color=white, opacity=0.8] (I) circle (\R); % determine the zeros of dicri \path[overlay,name path=dicri] plot[variable=\x,domain=0:360,samples=73] ({\x*1pt},{dicri(\x,\tdplotmaintheta,\tdplotmainphi,4)}); \path[overlay,name path=zero] (0,0) -- (360pt,0); \path[name intersections={of=dicri and zero,total=\t}] let \p1=(intersection-1),\p2=(intersection-2) in \pgfextra{\xdef\tmin{\x1}\xdef\tmax{\x2}}; \end{scope} %this has to do with finding the equation of the intersection circle, I believe \pgfmathsetmacro{\SmallR}{4} %the radius of the intersection circle is supposed as known % Draw dashed part of intersecting circle \draw[dashed] plot[variable=\t,domain=\tmin:\tmax,samples=50,smooth] ({\SmallR*cos(\t)}, {\SmallR*sin(\t)}, {3}); % Draw continuous part of intersecting circle \draw[thick,save path=\pathA] plot[variable=\t,domain=\tmax:\tmin+360,samples=50,smooth] ({\SmallR*cos(\t)}, {\SmallR*sin(\t)}, {3}); %same parametrization used in dicri. %Plane construction %% some definitions \def\angEl{35} % elevation angle \def\angAz{-105} % azimuth angle \def\angPhi{-40} % longitude of point P \def\angBeta{19} % latitude of point P %% working planes \pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole \tikzset{xyplane/.style={ cm={cos(\angAz),sin(\angAz)*sin(\angEl),-sin(\angAz),cos(\angAz)*sin(\angEl),(0,-\H)} }, >=latex, % option for nice arrows inner sep=0pt,% outer sep=2pt,% mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt, fill=black,circle} } \LatitudePlane[equator]{\angEl}{0} %% draw xy shifted plane \filldraw[xyplane,shift={(0,0,3)},fill=gray!10,opacity=0.2] (-1.8*\R,-2.6*\R) rectangle (2.2*\R,2*\R); \end{tikzpicture} \end{figure} \end{document} EDIT: I managed to find the points where the continuous circle turns into a dashed circle using this: \path ({\SmallR*cos(\tmin)}, {\SmallR*sin(\tmin)}, {3}) coordinate (pmin) ({\SmallR*cos(\tmax)}, {\SmallR*sin(\tmax)}, {3}) coordinate (pmax); Those points are where the new shading should begin, now I'm only missing how to find the arcs of the dashed circle and of the upper sphere surface.

  • LaTeX Tikz: Compare two \def arguments
    by Erick Saldaña on March 11, 2020 at 4:41 pm

    I am writing a macro definition that draws dimensions in the style of technical drawing. I need to perform an inequality of two of the arguments to know which is coordinate is higher up, but the console doesn't understand the condition I used as the \ifthenelse argument. % (#1,#2): Starting coordinate % (#3,#4): Ending coordinate % #5: Vertical upwards distance from the body % #6: Dimension text \usetikzlibrary{calc} \def\DimensionTop(#1,#2)(#3,#4)[#5,#6]{ \ifthenelse{#2>#4} { % If point (#1,#2) is higher than (#3,#4) \coordinate (D1) at ($ (#1,#2) + (0,#5) $); \coordinate (D2) at ($ (#3,#4) + (0,#2-#4) + (0,#5) $); } { % If point (#3,#4) is higher than (#1,#2) \coordinate (D1) at ($ (#1,#2) + (0,#4-#2) + (0,#5) $); \coordinate (D2) at ($ (#3,#4) + (0,#5) $); } \draw (#1,#2) -- (D1) -- ++(0,0.2); \draw (#3,#4) -- (D2) -- ++(0,0.2); \draw[ <->, >=latex, thin ] (D1) -- (D2) node[ fill=white, midway ] {$\mathtt{#6}$}; } The function is used like this in the main document \documentclass[border=2pt,convert={outext=.png}]{standalone} \usepackage{tikz} \usetikzlibrary{patterns} \usetikzlibrary{arrows} \begin{document} \begin{tikzpicture} % Custom command for the background grid, ignore \GuideCartesian(-2,-2)(8,8); \draw[ very thick ] (0,4) -- (2,5); \DimensionTop(0,4)(2,5)[1,1.50]; \end{tikzpicture} \end{document} Since the console doesn't understand the condition, it goes directly to the else case, which works when the point on the right is higher than the point on the left as in the picture. What would be a correct way to express this condition?

  • Intersection of a sphere and a plane knowing equations
    by minhthien_2016 on March 25, 2019 at 1:27 am

    I am trying draw a circle is intersection of a plane has equation 2 x − 2 y + z − 15 = 0 and the equation of the sphere is ( x − 1)^2 + ( y + 1)^ 2 + ( z − 2)^ 2 − 25 = 0. The plane cut the sphere is a circle with centre (3,-3,3 and radius r = 4. I can't draw the circle. I tried \documentclass[12pt,border = 2 mm]{standalone} \usepackage{tikz} \usepackage{tikz-3dplot} \usetikzlibrary{arrows,calc,backgrounds} \begin{document} \tdplotsetmaincoords{60}{110} \begin{tikzpicture}[tdplot_main_coords] \path coordinate (T) at (3,-3,3) coordinate (I) at (1,-1,2); \foreach \v/\position in {T/above,I/below} { \draw[fill=black] (\v) circle (0.7pt) node [\position=0.2mm] {$\v$}; } \draw[dashed] (T) circle[radius={4}]; \begin{scope}[tdplot_screen_coords, on background layer] \pgfmathsetmacro{\R}{5}% \fill[ball color=purple, opacity=1.0] (I) circle (\R); \end{scope} \end{tikzpicture} \end{document} How can I draw the circle?

  • Matrix of bar charts
    by Jitendra on April 16, 2018 at 7:09 am

    I came across a post (https://peltiertech.com/stacked-bar-chart-alternatives/). I would like to draw a chart similar to last on mentioned in the post. The image of the chart is attached. Any help would be appreciated.

  • Pie chart size from Bordaigorl
    by Laura K on April 27, 2017 at 7:10 pm

    I have been using this great pie chart code: How to draw Bar & Pie Chart The code is from Bordaigorl. I was wondering if anyone can see how it is possible to have two pie charts in the same environment with different sizes. The part of the code that is responsible for this is "scale" when you call the function pie chart: \begin{tikzpicture} [ pie chart, slice type={g}{giallo}, slice type={A}{rosso}, slice type={B}{blu}, pie values/.style={font={\small}}, scale=2 ] \pie{t=1, A in power}{66/g,34/A} \pie[xshift=2.2cm]% {t=2, B in power}{33/g,33/B} \end{tikzpicture} My question is: does anyone see how to create two "types" of pies, one with scale=2 and another with scale=2.5, for example? For the purpose of understanding, I will post an MWE based on the whole code created by Bordaigorl here. What I would like is to have the left pie chart in one scale and the pie chart on the right in another scale. Please note that I am not the one who designed this code and credit must be given to Bordaigorl: \documentclass[border=10pt,multi,tikz]{standalone} \definecolor{rosso}{RGB}{220,57,18} \definecolor{giallo}{RGB}{255,153,0} \definecolor{blu}{RGB}{102,140,217} \definecolor{verde}{RGB}{16,150,24} \definecolor{viola}{RGB}{153,0,153} \makeatletter \tikzstyle{chart}=[ legend label/.style={font={\scriptsize},anchor=west,align=left}, legend box/.style={rectangle, draw, minimum size=5pt}, axis/.style={black,semithick,->}, axis label/.style={anchor=east,font={\tiny}}, ] \tikzstyle{bar chart}=[ chart, bar width/.code={ \pgfmathparse{##1/2} \global\let\bar@w\pgfmathresult }, bar/.style={very thick, draw=white}, bar label/.style={font={\bf\small},anchor=north}, bar value/.style={font={\footnotesize}}, bar width=.75, ] \tikzstyle{pie chart}=[ chart, slice/.style={line cap=round, line join=round, very thick,draw=white}, pie title/.style={font={\bf}}, slice type/.style 2 args={ ##1/.style={fill=##2}, values of ##1/.style={} } ] \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfsetlayers{background,main,foreground} \newcommand{\pie}[3][]{ \begin{scope}[#1] \pgfmathsetmacro{\curA}{90} \pgfmathsetmacro{\r}{1} \def\c{(0,0)} \node[pie title] at (90:1.3) {#2}; \foreach \v/\s in{#3}{ \pgfmathsetmacro{\deltaA}{\v/100*360} \pgfmathsetmacro{\nextA}{\curA + \deltaA} \pgfmathsetmacro{\midA}{(\curA+\nextA)/2} \path[slice,\s] \c -- +(\curA:\r) arc (\curA:\nextA:\r) -- cycle; \pgfmathsetmacro{\d}{max((\deltaA * -(.5/50) + 1) , .5)} \begin{pgfonlayer}{foreground} \path \c -- node[pos=\d,pie values,values of \s]{$\v\%$} +(\midA:\r); \end{pgfonlayer} \global\let\curA\nextA } \end{scope} } \newcommand{\legend}[2][]{ \begin{scope}[#1] \path \foreach \n/\s in {#2} { ++(0,-10pt) node[\s,legend box] {} +(5pt,0) node[legend label] {\n} } ; \end{scope} } \begin{document} \begin{tikzpicture} [ pie chart, slice type={g}{giallo}, slice type={A}{rosso}, slice type={B}{blu}, pie values/.style={font={\small}}, scale=2 ] \pie{1}{66/g,34/A} \pie[xshift=2.2cm]% {2}{33.3/g,33.3/B,33.3/A} \end{tikzpicture} \end{document} I apologize if that is an obvious question. I've tried in 2 differents ways and they were all not succesful: I've tried to remove the scale from the preamble on tikz and added scale=2 when was calling pie function: \pie[xshift=2.2cm, scale=2]{2}{33.3/g,33.3/B,33.3/A} I've also tried to create two functions in the preamble of the document, one pie1 and another pie2. The code doesn't compile Thank you!

  • How to draw a graph with ring in latex?
    by Scott Shao on September 8, 2015 at 1:02 am

    As the title tells, how to draw a graph with ring in latex? I have learned that I can use forest to draw a tree in latex. For example, using following code, I can have one simple binary tree.1->2, 1->3. \begin{forest} for tree={circle,draw} [1[2][3]] \end{forest} Then, Im wondering how to draw a graph with ring. For example, how can I add another edge between 1 and 2 so that there is ring between node 1 and 2. 1 -> 2, and 2->1. Also, I'm wondering how to draw a self ring. i.e., 1->1(an egde starting from node 1 and ending at node 1)

  • Draw Spiral Cone TikZ
    by Sebastian on September 13, 2013 at 3:50 pm

    Im trying to do a spiral cone in TikZ. I dont know what is the best way to do this.

  • TikZ: two ellipses in different planes
    by dustin on July 12, 2013 at 2:14 am

    How can show that two ellipses are in different planes? \documentclass[convert = false, border = 1cm]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \pgfmathsetmacro{\as}{2}; \pgfmathsetmacro{\bs}{1.95}; \pgfmathsetmacro{\cs}{sqrt(\as^2 - \bs^2)} \pgfmathsetmacro{\al}{3}; \pgfmathsetmacro{\bl}{2.25}; \pgfmathsetmacro{\cl}{sqrt(\al^2 - \bl^2)} \pgfmathsetmacro{\xs}{abs(\cs - \cl)} \draw (0, 0) ellipse [x radius = \as cm, y radius = \bs cm]; \draw (\xs, 0) ellipse [x radius = \al cm, y radius = \bl cm]; \filldraw[black] (-\cs, 0) circle [radius = .1cm]; \filldraw[black] (-\cl + \xs, 0) circle [radius = .1cm]; \end{tikzpicture} \end{document} From the image, we see that both ellipses are in the same plane. How can I rotate the small ellipse to make it appear as if the smaller ellipse is in a different plane? Using rotate around doesn't achieve that look. Edit 2: I am a little hesitant about using xslant and yslant since it appears that the ellipse is being shifted and stretched. Here is a poor picture(my phone camera flash refused to work) of two ellipse in different planes. If adjust my smaller ellipse, it stretches and appears to shift dramatically. From the image below, the focus appears to be in the center of smaller ellipse now and it has elongated. Edit: So I found this post Why isn't the arc drawn on the good plane using tikz-3dplot in Tait-Bryan convention but I don't fully understand the code. However, the poster was able to rotate ellipse and have a better visual appeal and the poster could define the plane it is in such as xy, yz, and xz. How could I adapt this code to my situation?

  • tikz-3dplot rotation around the x-axis
    by asm on March 23, 2013 at 10:27 pm

    I'm trying to create a simple spherical quadrant grid using the tikz-3dplot package. The longitudinal grid lines look fine but when I try to create the latitudinal lines I get really strange results that I don't understand. I was expecting to see a series of latitude arcs rotating around the x-axis (so they're not quite the same as latitude lines). Instead, it appears that my attempt to rotate around the x-axis is rotating around all three axes. I'm not sure what I'm doing wrong. \documentclass{article} \usepackage{tikz} \usepackage{tikz-3dplot} \begin{document} \tdplotsetmaincoords{60}{155} \usetikzlibrary{3d} \begin{tikzpicture}[scale=5,tdplot_main_coords] \tikzstyle{grid}=[thin,color=red,tdplot_rotated_coords] \draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$}; \draw[thick,->] (0,0,0) -- (-1,0,0); \draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$}; \draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$}; \foreach \rot in {0, 30, 60, 90} { \tdplotsetrotatedcoords{\rot}{0}{0}; \tdplotdrawarc[grid]{(0,0,0)}{1}{0}{180}{}{}; } \foreach \rot in {-90, -60, -30, 0, 30, 60, 90} { \tdplotsetrotatedcoords{\rot}{90}{0}; \tdplotdrawarc[grid]{(0,0,0)}{1}{90}{180}{}{}; } \end{tikzpicture} \end{document} Edit: After more investigation it appears that attempting to rotate around the x-axis actually rotates around the z-axis, as can be clearly seen in this image. Placing the \rot in the x- or z-position has the same effect.

  • Using TikZ inside a figure caption
    by Nico Schlömer on May 16, 2012 at 1:52 pm

    I have a PNG plot with a couple of black patches in it, and I'd like to refer to it in the \caption of the figure. According to the TikZ manual, I'd have to \tikz \fill[black] (1ex,1ex) circle (1ex); which works perfectly outside a \caption. Using this inside a \caption, though, leaves me with the compile error ! Use of \use@pgflibrary doesn't match its definition. \pgfutil@ifnextchar ...1\def \pgfutil@reserved@a { #2}\def \pgfutil@reserved@... l.375 ...blah blah.} ? The following produces the compile error \documentclass{article} \usepackage{tikz} \begin{document} \tikz \fill[orange] (1ex,1ex) circle (1ex); \begin{figure} \caption{\tikz \fill[orange] (1ex,1ex) circle (1ex);} \end{figure} \end{document} Any hints here?