TikZ
- Any better suggestions on the arrow on the arc of these kinds of contour figure with tikz?by Explorer on February 13, 2026 at 12:25 pm
This question is similar to this link, but not exactly the same focues. What I want, is something like: But I want a better looking and better syntax of the arrow: The figure above is produced by: \documentclass[tikz,border=5pt]{standalone} % https://tex.stackexchange.com/a/656167/322482 \usetikzlibrary{bending,decorations.markings,arrows.meta,calc,spath3} \usepackage{amsmath} \begin{document} \begin{tikzpicture}[ >={Kite[inset=0pt,length=.32cm,bend]}, baz/.style={spath/save=curve}, foo/.style={ draw,tips=true,->, spath/remove empty components={curve}, spath/split at keep start={curve}{#1}, spath/use=curve }, foo/.default=0.5, ] \filldraw[thick,fill=gray!40] (4,0) node[below]{$R$} arc (0:180:4) node[below]{$-R$} -- (-3,0) arc(180:0:1) -- (1,0) arc(180:0:1) -- cycle; \path[baz] (4,0) arc (0:90:4);\path[foo=.4]; \path[baz] (0,4) arc (90:180:4);\path[foo]; \path[baz] (-3,0) arc (180:0:1);\path[foo=.55]; \path[baz] (1,0) arc (180:0:1);\path[foo=.55]; \draw[-Stealth] (-5,0) -- (5,0) node[below]{$\Re$}; \draw[-Stealth] (0,0) -- (0,5) node[right]{$\Im$}; \path node[below] {$O$} (60:4) node[above=3pt] {$C_{R}$}; \end{tikzpicture} \end{document} which learning from Andrew Stacey's elegant solution (off-topic: I seemed to find some out-of-my-intuition features with spath3 and reported at here). I have two questions(actually could be regards only one) here, the best practice to typeset these kinds of contour figure: What kind of bending arrow on the arc in there cases could be more acceptable and beautiful?(maybe that is option-based, but I was still wonder how would you choose)? I don't think spath3 library is the only approach to do this, and IMHO, that is such a common requirement to add arrows on the curve, why there looks no too much tikz solution in this post? Any possible better practice to show the arrow shape with neater syntax?
- Find the intersections of circles using pgfmathby Jasper on February 13, 2026 at 11:45 am
Find the intersections of circles automatically using pgfmath: \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \pgfmathsetmacro{\circleonex}{0} \pgfmathsetmacro{\circleoney}{0} \pgfmathsetmacro{\circleoner}{2} \draw (\circleonex,\circleoney) circle[radius=\circleoner]; \pgfmathsetmacro{\circletwox}{1} \pgfmathsetmacro{\circletwoy}{1} \pgfmathsetmacro{\circletwor}{1.5} \draw (\circletwox,\circletwoy) circle[radius=\circletwor]; % Goal: use a sequence of \pgfmathsetmacro to find both % intersections automatically, if they exist. % It should cleanly degenerate when they no longer coincide. \end{tikzpicture} \end{document}
- Table with pgfplots and title boxes across the entire textwidthby cis on February 13, 2026 at 10:16 am
I want to use the entire \textwidth at a table, so I chosed tabularx. The table contains plots (all the same size) and boxes with titles that contain varying amounts of text or lines. The "title boxes" should all be top-aligned, all have the same width and for each row (!) the same height. This means that the "title boxes" in row 1 have the same height, and those in row 3 also have the same height; but possibly a different height than in row 1. What's the best way to configure this? I've put the "title boxes" also into tabularx tables; but perhaps multirow would be more suitable here (?). I often have problems with overfull / underfull hbox warnings here. I don't know what the ideal solution for this. Note: I plan to disable the main table's rules later; I've set \setlength\arrayrulewidth{2pt} here to better visualize the dimensions. \documentclass[paper=a5]{scrarticle} \usepackage[margin=14mm, showframe]{geometry} \usepackage{tabularx} % \usepackage{multirow}% needed? \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepackage{lipsum}% dummy text \newcommand\mytitle[1]{% {\begin{tabularx}{\linewidth}{|X|} \hline #1 \\ \hline \end{tabularx}} } \newcommand\myplot[1]{% \begin{tikzpicture}[baseline] \begin{axis}[width=\linewidth, height=30mm] \addplot[#1, mark=*]{x^4}; \end{axis} \end{tikzpicture}} \newcolumntype{Y}{% hspaces should be as small as possible @{\hspace{1.5pt}}X@{\hspace{1.5pt}}} \setlength\arrayrulewidth{2pt}% to see the effects \begin{document} \noindent\begin{tabularx}{\textwidth}{| Y | Y |} % Title 1 (row 1, column 1) ================== \mytitle{Title 1: \lipsum[1][1-2]} % Title 2 (row 1, column 2) ================== & \mytitle{Title 2: \lipsum[1][1]} \\ % Plot 1 (row 2, column 1) ================== \myplot{brown} % Plot 2 (row 2, column 2) ================== & \myplot{red} \\ \hline % Title 3 (row 3, column 1) ================== \mytitle{Title 3: \lipsum[1][2]} % Title 4 (row 3, column 2) ================== & \mytitle{Title 4: \lipsum[1][1-4]} \\ % Plot 3 (row 4, column 1) ================== \myplot{blue} % Plot 4 (row 4, column 2) ================== & \myplot{orange} \\ \end{tabularx} \end{document}
- Styled read out example for a value from a pgfplotstable (TikZ-spy?)by cis on February 12, 2026 at 4:04 pm
I have a pgfplotstable: I would like to create a reading out example for a value, with the red lines and the framed cell. This could look like this then: How could I do that best way? My immediate idea would be a TikZ-spy. But maybe there's a completely different/easier way. %\documentclass[paper=a5]{scrarticle} %\usepackage[margin=14mm, showframe]{geometry} \documentclass[margin=5pt, varwidth]{standalone} \usepackage{diagbox} \usepackage{colortbl} \usepackage{pgfplotstable} \pgfplotsset{compat=1.18} \usetikzlibrary{spy} \pgfplotstableread[col sep=comma]{ n, k, 0.1, 0.2, 0.3, 0.4 1, 0, 1.1, 1.2, 1.3, 1.4 1, 1, 2.1, 2.2, 2.3, 2.4 2, 0, 2.1, 2.2, 2.3, 2.4 2, 1, 3.1, 3.2, 3.3, 3.4 2, 2, 4.1, 4.2, 4.3, 4.4 3, 0, 3.1, 3.2, 3.3, 3.4 3, 1, 4.1, 4.2, 4.3, 4.4 3, 2, 5.1, 5.2, 5.3, 5.4 3, 3, 6.1, 6.2, 6.3, 6.4 }{\mytable} \begin{document} \pgfplotstabletypeset[ every head row/.style={before row=\hline, after row=\hline}, columns/k/.style = {% k column column name={\diagbox{$k$}{$p$}}, column type={|>{\cellcolor{pink}}c|}, },% ]{\mytable} \begin{tikzpicture}[ spy using outlines={rectangle, magnification=1, connect spies} ] \spy [blue, width=2cm, height=1cm] on (0,1) in node [fill=white] at (3,0.5); \end{tikzpicture} \end{document}
- Crossed branches in tikz [closed]by Uri Lifshitz on February 12, 2026 at 11:11 am
I am having trouble figuring out how to have a drawed line crossed out and a dotted line in tikzpicture to have a desired result which will look something like thanks!
- How can I geometrically translate a line segment on a line?by Jasper on February 12, 2026 at 4:17 am
How can I geometrically translate a line segment on a line? I want to move the pink segment so that it starts at three and goes to four. I don't just want to teleport it. I want a geometric construction for this - Euclidean style. \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \draw[thick,->] (-1,0) -- (5,0) node[below left] {\(x\)}; \draw[ preaction = { draw = black, line width = 4pt }, postaction = { draw = pink, line width = 2pt } ] (0,0) -- (1,0); \fill (0,0) circle[radius = 3pt] node[below=3pt] {\(0\)}; \fill (1,0) circle[radius = 3pt] node[below=3pt] {\(1\)}; \fill (3,0) circle[radius = 3pt] node[below=3pt] {\(3\)}; \end{tikzpicture} \end{document}
- pgfplots: Adjust groupplot to text widthby cis on February 11, 2026 at 9:28 am
I have a 2×2 groupplot (where the first plot should be replaced by a title "Supertitle") with titles in boxes. These "title boxes" should all have the same width, and boxes in the same row should have the same height. I achieved this using \vphantom{} because I didn't find a better method. How can I configure the settings such that the entire groupplot has a width of \textwidth? And a horizontal space between the columns like \tabcolsep (or something similar)? Is there a elegant way to do this by package keys? (resizebox etc. would certainly work, but that would be less elegant.) Ideally, it should stay a groupplot. PS: I'm using DIN A5 format here, but that shouldn't matter if the keys are set correctly. \documentclass[paper=a5]{scrartcl} \usepackage[margin=14mm, showframe]{geometry} \usepackage{pgfplots} \usepgfplotslibrary{groupplots} \pgfplotsset{compat=1.18} \begin{document} \section{Plots with Titles and Supertitle} \pgfmathsetlengthmacro\plotwidth{0.5*\textwidth-\the\arraycolsep} \begin{tikzpicture}[font=\footnotesize] \begin{groupplot}[ % Grouupplot settings ================== group style={ group size=2 by 2, % 2 columns, 2 rows vertical sep=25mm, horizontal sep=15mm, }, % Styles applied to all subplots ============== width=\plotwidth, height=30mm, % Title Styles ========================== title style={% at={(0,1)}, xshift=-3ex, align=left, anchor=south west, inner xsep=2pt, draw, fill=none, text width=0.925*\pgfkeysvalueof{/pgfplots/width}, },% ] % Title (Row 1, Col 1) \nextgroupplot[ % I don't know how to get this box to the same height without this trick: title={\vphantom{Plot 0} \\ \vphantom{000} \\ \vphantom{000}}, title style={name=super}, hide axis, ] \addplot[draw=none, samples={0}]{x}; % Plot 0 (Row 1, Col 2) \nextgroupplot[title={Title 0 \\ 000 \\ 000}] \addplot{x}; % Plot 1 (Row 2, Col 1) \nextgroupplot[title={Title 1 \\ 2-111 \\ 3-111 \\ 4-111}] \addplot{x^2}; % Plot 2 (Row 2, Col 2) \nextgroupplot[title={Title 2 \\ 2-222 \\ 3-222 \\ \vphantom{4-111}}] \addplot{x^3}; \end{groupplot} %% Supertitle \node[font=\bfseries\Large] at (super){Supertitle}; \node[anchor=north west, draw=none, align=left,] at (super.south west){ Some notes \\ below Supertitle}; \draw[cyan, very thick, |-|] (group c1r2.west) -- +(\plotwidth,0) node[midway, below, fill=yellow]{plotwidth =\plotwidth}; %% This gives a 'Overfull \hbox ' warning ================== \draw[red, thick, |-|, ] ([yshift=5mm]group c1r2.west) -- +(2*\plotwidth,0) node[midway, above, fill=yellow]{2*plotwidth =\plotwidth}; \end{tikzpicture} \end{document}
- Creating Circular Domains with TikZ [closed]by Assuério Cavalcante on February 10, 2026 at 3:45 pm
First, apologies if this question has been asked before. I'm trying to create an image of a particular circular domain, but my limited TikZ knowledge has made this quite challenging. I've searched for similar examples online without success. Any guidance would be greatly appreciated!
- MetaPost, TikZ and their 3D librariesby Sebastiano on February 10, 2026 at 11:55 am
I am referring to this Italian lecture notes by Prof. R. Tauraso, edited by a student/lecturer Massimiliano Pompegnani (link https://moodle2.units.it/pluginfile.php/767967/mod_resource/content/1/intdoppi.pdf) My question concerns which specific libraries are needed to draw in 3D (I’m not very familiar with 3D) what to me seems drawn in MetaPost and peraphs, for the their complexity, with IPE drawing https://ipe.otfried.org/ (?), WinFIG (?). From the axes arrows it appears to be MetaPost and also the fills. ecc. I’m not asking for any code but want to be informed. There are many 3D libraries for TikZ but I have never previously been interested in 3D. Are there any similar libraries that TikZ can use to reproduce Metapost drawings?
- TikZ curved arrow bisecting text - how to increase arc height to clear obstacle?by Oregon Math Tutor on February 9, 2026 at 8:19 pm
I'm annotating a fraction with TikZ arrows pointing to specific parts. The blue arrow works fine, but the red curved arrow is bisecting the "3" in the denominator instead of arcing over it. Current behavior: The red arrow cuts straight through the middle of "3" Desired behavior: The red arrow should arc upward and over the "3" with clear space. I initially tried adjusting the out angle from 160° to 120° to make it launch upward, but this still results in the arrow bisecting the number. How do I increase the arc height to make the curve clear the "3" completely as shown in the 2nd image? Note: I'm still learning TikZ best practices. If you spot any obvious improvements to the code structure, please mention them. MWE \usepackage{mathtools} \usetikzlibrary{calc, arrows.meta} \definecolor{textBlue}{RGB}{50, 50, 255} \definecolor{deepRed}{RGB}{200, 40, 40} \begin{document} \begin{tikzpicture} % Math fraction \node (fraction) at (0,0) { \scalebox{1.8}{% $\displaystyle \frac{2x^3 - 5x^2 - x + 3}{x + 3}$ } }; % Blue annotation (works fine) \node[ellipse, draw=textBlue, dashed, minimum width=0.3cm, minimum height=0.6cm, xshift=-0.4cm, yshift=0.4cm] (blueCircle) at ($(fraction.south) + (-0.65, 0.28)$) {}; \node[draw=textBlue, text=textBlue, align=center, anchor=north] (blueLabel) at ($(blueCircle.south) + (0, -0.6)$) {coefficient\\must be 1}; \draw[textBlue, ->, >=latex] (blueLabel.north) -- (blueCircle.south); % Red annotation (PROBLEM: arrow bisects the "3") \node[circle, draw=deepRed, dashed, minimum size=0.2cm, xshift=-0.2cm, yshift=0.3cm] (redCircle) at ($(fraction.south) + (-0.2, 0.55)$) {}; \node[draw=deepRed, text=deepRed, align=left, anchor=west] (redLabel) at ($(fraction.south) + (0.8, 0.3)$) {exponent\\must be 1}; % This arrow bisects "3" - how to make it arc higher? \draw[deepRed, ->, >=latex] (redLabel.west) to[out=120, in=0] (redCircle.east); \end{tikzpicture} \end{document}``` [1]: https://i.sstatic.net/zirlpD5n.png [2]: https://i.sstatic.net/BOIovYSz.png
- Watermark misplacement with standalone classby Erwann on February 9, 2026 at 3:51 pm
When using the standalone document class with a shipout hook to add a watermark, it fails to display. Output using article class is OK. \documentclass{standalone} %\documentclass{article} \usepackage{tikz} \AddToHook{shipout/background}{ \begin{tikzpicture}[remember picture, overlay, text=red] \node[ rotate=45, scale=1, opacity=0.5, anchor=center, font=\large] at (current page.center) {WATERMARK}; \end{tikzpicture} } \begin{document} % Uncomment for class article %\vspace*{\fill} %\begin{center} \begin{tikzpicture} \draw[thick] (0,0) rectangle (5,3); \node at (2.5,1.5) {Content}; \end{tikzpicture} %\end{center} % article %\vspace{\fill} % article \end{document} P.S. This requires two compilation passes.
- pgfplots: align legend entries at a groupplotby cis on February 9, 2026 at 2:09 pm
I have a groupplot where I want to use the legend as the title in the \nextgroupplots. And then I have a "Supertitel" that I would like to put in place of the first groupplot. How do I set it such that the text, like the small box, is aligned to the top edge? \documentclass[margin=5pt, varwidth]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepgfplotslibrary{groupplots} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture}[font=\footnotesize, mypattern/.style={% postaction={pattern=north east lines}, },% ] \begin{groupplot}[ group style={% group size=2 by 3, vertical sep=15mm, },% height=30mm,width=55mm, group/every plot/.style={%% ybar=0pt, bar width=1, bar shift=0pt, xmin=-0.5,% to see the bar at x=0 correctly ymin=0, xtick=data, },%% end of group/every plot/.style %% every axis plot/.style={ fill=lightgray, area legend,% legend as title 1/2 }, legend style={% legend as title 2/2 at={(0,1)}, yshift=6pt, anchor=south west, draw=none, fill=none, inner sep=0pt, cells={anchor=north, align=left},% PROBLEM HERE ..... },% ] \nextgroupplot[hide axis=true, title={Supertitle}, title style={at={(0.5,0.5)}, anchor=center, yshift=-6pt,% kill pgfplots's default draw=none, font=\bfseries\Large} ] \addplot[draw=none, fill=none]{x};% to avoid warning; don't know how to make this else \nextgroupplot[] \addplot[samples at={0,...,8}, forget plot]{x}; \addplot[mypattern, samples at={3,...,6}]{x}; \addlegendentry{plot 0: \\ plot good, \\ legend bad :(} \end{groupplot} \end{tikzpicture} \end{document}
- Using xint in pgfplots (example: binomial distribution)by cis on February 9, 2026 at 9:26 am
If I have a function with xint, say % \bdceval{<n>}{<p>}{<k>} \xintNewFloatExpr{\bdeval}[3]{% %B(n,p,k) = binomial(n,k)*p^k*(1-p)^(n-k) % formula binomial(#1,#3)*#2^#3*(1-#2)^(#1-#3)} this works well in text (e.g. \bdeval{13}{0.4}{5}); but how can I use that in pgfplots? In the following MWE I have drawn an example using pgfplots; the same curve should result with xint. \documentclass[margin=5pt, varwidth]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepackage{xintexpr} %\usepackage{xinttools}% needed? % \bdceval{<n>}{<p>}{<k>} \xintNewFloatExpr{\bdeval}[3]{% %B(n,p,k) = binomial(n,k)*p^k*(1-p)^(n-k) % formula binomial(#1,#3)*#2^#3*(1-#2)^(#1-#3)} % \bd[<digits, default: 4>]{<n>}{<p>}{<k>} \NewExpandableDocumentCommand{\bd}{O{4} mmm}{% %\xinteval{round(#2+#3+#4,2)}% for tests \xintRound{#1}{\bdeval{#2}{#3}{#4}}% rounded bd-values } \begin{document} \section{xint in Text (works)} $B(13,0.4,5) =\bdeval{13}{0.4}{5} \approx \bd{13}{0.4}{5}$ \par $B(1000,0.4,50) =\bdeval{1000}{0.4}{50} \approx \bd{1000}{0.4}{50}$ \section{xint in pgfplots (works not)} \begin{tikzpicture}[font=\footnotesize, declare function={ binom(\n,\p,\k)=\n!/(\k!*(\n-\k)!)*\p^\k*(1-\p)^(\n-\k);% works %xbinom(\n,\p,\k)=\bdeval{\n}{\p}{\k};% works not } ] \begin{axis}[ title={\texttt{xint} in pgfplots?}, title style={fill=blue!25}, xlabel={$k$}, ylabel={$P(X=k)$}, yticklabel style={ /pgf/number format/fixed, /pgf/number format/fixed zerofill, /pgf/number format/precision=2 }, xtick=data, variable=\k, only marks, ] \addplot+[samples at={0,...,13}] {binom(13, 0.4, k)}; % DOES NOT WORK %\addplot [samples at={0,...,13}] {\bd{13}{0.4}{\k} }; \end{axis} \end{tikzpicture} \end{document}
- How can I horizontally align two math labels by their baseline in TikZ?by Jasper on February 9, 2026 at 2:27 am
How can I horizontally align two math labels by their baseline in TikZ? \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \node[below] at (0,0) {\(\frac{1}{1}\)}; \node[below] at (1,0) {\(1\)}; \end{tikzpicture} \end{document}
- Standard practices in label decluttering: overcoming overlapping label linesby Jasper on February 8, 2026 at 11:59 pm
I have a situation where I want to lable the sample points of a line segment, and also label the smaller line segments connecting those sample points. My labels are really cluttered right now. How can I make this more proper? \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \draw[thick,->] (-1,0) -- (5,0) node[below left] {\(x\)}; \fill (0.5,0) circle[radius = 3pt] node[above] {point}; \fill[gray] (0.5,0) circle[radius = 1.5pt]; \draw[] (0.5,0) -- (0.5,-2) -- (5,-2) node[right] {individual sample point}; \draw[line width = 6pt] (2,0) -- (3.5,0) node[above,pos=0.5]{line segment}; \foreach[count = \c from 1] \x in {2,2.5,...,3.5} { \fill[gray] (\x,0) circle[radius = 1.5pt]; \draw[] (\x,0) -- (4,-1); \ifnum\c=4\else\draw[thick,gray] (\x,0) -- ++(0.5,0);\fi } \draw[](4,-1) -- (5,-1) node[right] {multiple sample points}; \foreach[count = \c from 1] \x in {2.25,2.75,...,3.25} { \draw[] (\x,0) -- (4,-1.5); } \draw[](4,-1.5) -- (5,-1.5) node[right] {one or more line segments}; \end{tikzpicture} \end{document}
- pgfplots: axis-enlargement at a ybar plot (example: binomial distribution)by cis on February 8, 2026 at 4:34 pm
I wanted to adapt this nice solution for my purposes. • I want to extend the x- and y-axes a bit. But, when I set enlarge y limits={upper, abs=0.125} it creates a strange gap (ymin=0 is no longer respected, and restrict y to domain=0:1 seems to have no effect). • Secondly, what's the best way to configure it so that bars with very small y-values are also visible here? • Unfortunately, I saw this too late: I would also like to eliminate this x-gap between the first bar and the y-axis! \documentclass[margin=5pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture}[font=\footnotesize, declare function={ binom(\n,\p,\k)=\n!/(\k!*(\n-\k)!)*\p^\k*(1-\p)^(\n-\k); } ] \begin{axis}[%y=8mm, no effect ymin=0, xmin=0, axis lines=left, axis line style={-latex}, xlabel={$k$}, ylabel={$P(X=k)$}, x label style={at={(axis description cs:1,0)}, anchor=south east, inner xsep=0pt }, y label style={at={(axis description cs:0,1)}, rotate = -90, anchor=north west, inner ysep=0pt, }, yticklabel style={ /pgf/number format/fixed, /pgf/number format/fixed zerofill, /pgf/number format/precision=2 }, ybar=0pt, bar width=1, bar shift=0pt, samples at={0,...,13}, variable=\k, enlarge x limits={upper, abs=0.785}, enlarge y limits={upper, abs=0.125}, %restrict y to domain=0:1,% no effect.... ] \addplot [fill=gray!25] {binom(13, 0.4, k)}; %\addplot [fill=orange, samples at={0,...,4}] {binom(12,0.4,k)}; %\addplot [fill=cyan, samples at={7}] {binom(12,0.4,k)}; \end{axis} \end{tikzpicture} \end{document}
- How can I draw a coloured factorization diagram?by Bayaraa Surenjav on February 8, 2026 at 4:11 pm
My code is: \documentclass[tikz,border=10pt]{standalone} \usepackage[utf8]{inputenc} \usepackage[mongolian]{babel} \usepackage{amsmath} \usetikzlibrary{calc, positioning, arrows.meta, backgrounds, shapes.geometric} \begin{document} \begin{tikzpicture}[ num node/.style={ font=\Large\bfseries\rmfamily, % Serif font, Bold anchor=east, inner sep=3pt, minimum height=0.65cm }, div node/.style={ font=\Large\rmfamily, anchor=east, inner sep=3pt }, arrow style/.style={ ->, >=latex, draw=cyan!80!blue, line width=0.8pt }, label text/.style={ text=cyan!80!blue, font=\itshape, align=right }, % Үйлдлийн тэмдэг (div 2) op label/.style={ text=cyan!80!blue, font=\large, anchor=west, xshift=2pt } ] \def\rowh{0.9} \node[div node] (d1) at (0,0) {2)}; \node[num node] (n1) at (1.8,0) {120}; \draw[thick] (d1.south east) -- (n1.south east); \node[div node] (d2) at (0,-\rowh) {2)}; \node[num node] (n2) at (1.8,-\rowh) {60}; \draw[thick] (d2.south east) -- (n2.south east); \node[div node] (d3) at (0,-2*\rowh) {2)}; \node[fill=cyan!25, inner sep=2pt, minimum height=0.6cm, minimum width=0.8cm, anchor=east] at (1.85,-2*\rowh) {}; \node[num node, text=magenta] (n3) at (1.8,-2*\rowh) {30}; \draw[thick] (d3.south east) -- (n3.south east); \node[div node] (d4) at (0,-3*\rowh) {3)}; \node[num node] (n4) at (1.8,-3*\rowh) {15}; \draw[thick] (d4.south east) -- (n4.south east); \node[num node] (n5) at (1.8,-4*\rowh) {5}; \begin{scope}[on background layer] % Зүүн талын босоо багана (Хуваагчдыг хамарсан) \fill[cyan!15] (-0.8, 0.4) rectangle (0.2, -4.5*\rowh); \fill[cyan!15] (-0.8, -3.65*\rowh) rectangle (2.2, -4.5*\rowh); \end{scope} \def\arm{0.5} \draw[arrow style] (n1.east) -- ++(\arm,0) |- node[pos=0.25, op label] {$\div 2$} (n2.east); \draw[arrow style] (n2.east) -- ++(\arm,0) |- node[pos=0.25, op label] {$\div 2$} (n3.east); \draw[arrow style] (n3.east) -- ++(\arm,0) |- node[pos=0.25, op label] {$\div 2$} (n4.east); \draw[arrow style] (n4.east) -- ++(\arm,0) |- node[pos=0.25, op label] {$\div 3$} (n5.east); \node[label text] (txt1) at (-3.5, 0) {анхны тоогоор хуваах}; \draw[arrow style] (txt1) -- (d1.west); \node[label text] (txt2) at (-4, -4*\rowh) {анхны тоо гартал үргэлжлүүлнэ}; \draw[arrow style] (txt2) -- (n5.west); \end{tikzpicture} \end{document} Current: Intended:
- tikz euclides draw circle hungby Vuvi Numa on February 8, 2026 at 1:49 pm
The MWE below freezes on the commented out line, until it is killed with Ctrl-C. This is a part of an old manuscript that was published, several years in the past, so at some point it did work. \documentclass{standalone} \usepackage{tikz} \usepackage{tkz-euclide} \begin{document} \begin{tikzpicture} \draw(-1,-1) rectangle(1,1); \tkzDefPoint(3,-1){A}; \tkzDefPoint(6,-1){B}; \tkzDefPoint(3,1){C}; %\tkzDrawCircle[in](A,B,C); \end{tikzpicture} \end{document} The last few lines of pdflatex output are: (/usr/share/texlive/texmf-dist/tex/latex/tkz-euclide/tkz-draw-eu-protractor.tex 2023/02/03 5.02c tkz-obj-eu-protractor.tex )) No file test.aux. (/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] ) (/usr/share/texlive/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)) Missing character: There is no ; in font nullfont! Missing character: There is no ; in font nullfont! Missing character: There is no ; in font nullfont! ^C! Interruption. \pgfkeys@parse ...uturelet \pgfkeys@possiblerelax \pgfkeys@parse@main l.12 \tkzDrawCircle[in](A,B,C) ; How can I fix the freeze and allow the arch to be drawn?
- tikz / xint: Read out (and calc with) fractions from list (or array) with xint or pgfmathby cis on February 6, 2026 at 8:45 am
How can I read out numbers from a list, say \def\pList{0.1, 1/6, 0.25, 0.4} (or array, say \def\pListArray{{\pList}}), with xint? Background: I want to keep fractions, like 1/6 in it's original form (not decimal value 0.1666 here). On the other hand, I need to calc 1-<value> too, and I want, in the case of 1/6 the value 5/6 (=1 - 1/6). I have a main document with a lot of xint content and calculations; therefore, for consistency reasons, it should be done with xint (it's clear that there are other packages or methods for this); and: There must be a method in the xint-package that I can't find in the manual. Does anybody know? \documentclass[margin=5pt, varwidth]{standalone} \usepackage{tikz} \usepackage{xintexpr} \begin{document} \def\pList{0.1, 1/6, 0.25, 0.4}% List \def\pListArray{{\pList}} \section{The pList} \pList \section{pgfmath-test for fraction-readout (bad)} p=\pgfmathprint{\pListArray[0]}, q=\pgfmathprint{1-\pListArray[0]} good. But p=\pgfmathprint{\pListArray[1]}, q=\pgfmathprint{1-\pListArray[1]} bad. \section{xint-test for fractions (good), but how to readout?} p=\xinteval{1/6}, q=\xinteval{1-1/6} \end{document}
- Tikzcd's "crossing over" option and transparent backgroundsby Ben Steffan on February 5, 2026 at 8:55 pm
I currently have the following simple setup for producing commutative diagrams using tikzcd and exporting them to .svg's, following the two most popular answers on this question: Put the code for the diagram in a standalone tex file. Compile. Convert to .svg using dvisvgm. This... works, mostly (better ideas are warmly welcome), but I'm running into one issue in particular that is slightly annoying. Consider the following example: \documentclass[crop,tikz]{standalone} \usetikzlibrary{cd} \begin{document} \begin{tikzcd} & & & \{1\} \ar[dd] \ar[dl] \\ \{0\} \ar[rr] \ar[dd] & & \{0, 1\} \\ & \{2\} \ar[dl] \ar[rr] & & \{1, 2\} \ar[dl] \\ \{0, 2\} \ar[rr] & & \{0, 1, 2\} \ar[from=uu, crossing over] \end{tikzcd} \end{document} If you compile this, the resulting pdf looks like this: Great, that looks fantastic. But if you now go and run dvisvgm yourfilenamehere.dvi and drop the resulting svg into something with a non-white background, you get this: This is bad for two obvious reasons: Text and background color are way too similar, and the crossing over arrow now lives on top of a white box. This box is an artifact of the way crossing over works, which simply adds a preaction to the arrow path that draws a background color colored rectangle. Consequently, both problems can be avoided by setting color and background color to something that works, see e.g. this answer. Suppose now, however, that I don't know what color the background of the document/website/etc. the svg will be embedded in has. Perhaps I know that it's going to be a dark background, so that setting the text color to white will take care of the first issue, but unless I know the precise shade of the background I can't set the crossing over box' color to perfectly match. My question, thus, is whether there is a (nice) way to solve this second issue when the final background color is not precisely known (if you have a way to dynamically alter the text color, I'd be happy to hear about it as well). (By "nice" here I mean that e.g. it's obviously possible to draw the two "pieces" of the arrow being crossed over separately and avoid crossing over entirely, but this seems to annoying to do in general unless there is some way to package it up into a flexible macro/tikz key).
- Make perfect circular diagramsby Fran on February 5, 2026 at 12:23 pm
I know that I can make circular diagrams with the nice smartdiagram package, but arrows do not fit perfectly in a imaginary circle. In fact, the diagram is far from a circle when there are only two or three nodes: \documentclass{standalone} \usepackage{smartdiagram} \begin{document} \smartdiagramset{ connection color=red, module shape= circle, circular distance=2cm, uniform color list=white for 6 items, uniform arrow color=true, arrow color=black} \smartdiagram[circular diagram:clockwise]{foo, bar} \end{document} I know also that there are several examples in this site about making circular diagrams without this package, but translating these examples to diagrams with a different numbers of nodes is complex, so I tried an automated solution with tikz (without really knowing what I was doing, I have to admit) so that I only have to modify a list of nodes in \mylist and little more to obtain the result: \documentclass[border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture}[ > = Stealth, every node/.style = {circle, draw, thick, minimum width=1cm, align=center} ] \def\mylist{foo, bar, baz} % play with this \foreach \x [count=\i from 1] in \mylist {\xdef\n{\i}} \def\radio{2cm} % and this if needed \foreach \texto [count=\i from 0] in \mylist{ \pgfmathsetmacro\ang{-\i*360/\n} \node (n\i) at (\ang:\radio) {\texto}; } \foreach \dummy [count=\i from 0] in \mylist{ \pgfmathsetmacro\j{int(mod(\i+1,\n))} \pgfmathsetmacro\angini{-\i*360/\n} \pgfmathsetmacro\angfin{-\j*360/\n} \pgfmathsetmacro\outang{mod(\angini - 90 + 720, 360)} \pgfmathsetmacro\inang {mod(\angfin + 90 + 720, 360)} \draw[->, thick, line width=1.4pt] (n\i) to[out=\outang, in=\inang, looseness=.9] (n\j); % and with the looseness } \end{tikzpicture} \end{document} Mainly it works. The problem is that like in smartdiagram, the arrows don't perfectly follow an imaginary circle, that was the idea behind getting involved in this business. Playing with looseness is possible to correct a bit the curvature of the arrows, but it's tedious and the result is never perfect. So, the result should be ideally near to the image below (that I modified manually in Inkscape) and still require minimal settings to adapt the code to diagrams of n nodes. Fixes of the MWE as well as alternative approaches are welcome. Edit Thank you all for the excellent suggestions. This time, I am truly sorry I can only accept one.
- Incorrect spath3 "split at" method with a continued line?by Explorer on September 19, 2025 at 7:10 am
Learning from this link: I have the following code: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{spath3} \begin{document} \begin{tikzpicture} \draw[spath/save=path,ultra thick,blue!30] (0,0) -- (4,2); \draw[spath/split at keep start={path}{1/3},spath/use=path]; \draw[spath/split at keep end={path}{2/3},spath/use=path]; \draw[spath/split at keep middle={path}{1/3}{2/3},spath/use=path,densely dashed]; \end{tikzpicture} \begin{tikzpicture} \draw[spath/save=path,ultra thick, red!30] (0,0) -- (1,1) -- (2,-1) -- (3,4) -- (4,0); \draw[spath/split at keep start={path}{1/3},spath/use=path]; \draw[spath/split at keep end={path}{2/3},spath/use=path]; \draw[spath/split at keep middle={path}{1/3}{2/3},spath/use=path,densely dashed]; \end{tikzpicture} \end{document} In the first figure, the "dashed" line shown exactly at 1/3 and 2/3. However, in the second, if the path is longer, it seemed not dealing right? Is that possible to fix that: for the whole path, only the middle "1/3" length's path is "dashed"?
- Issue: Unable to Display Text Below TikZ Code in LyX"by Evya1 on January 20, 2024 at 10:35 am
I am currently facing a challenge in LyX where, after typing several lines of text, I insert TikZ code either inside a TeX box or directly into the apex preamble. However, I have observed that the text following the TikZ code is not visible. In the case of placing the code in the preamble, none of the text I have written in the document is visible. I am seeking assistance in resolving this issue and understanding how to ensure the proper display of text below inserted TikZ code in LyX. Any guidance or solutions would be greatly appreciated. LyX file: #LyX 2.3 created this file. For more info see http://www.lyx.org/ \lyxformat 544 \begin_document \begin_header ... \end_header \begin_body \begin_layout Standard Text here. 1 Algorithms - question 1 1 . ~~~Trying to show the figure here ~~~ ~~~ Text of the solution that isn't shown in rendered pdf~~~ \end_layout \end_body \end_document LaTeX preamble: \usepackage{autobreak} \usepackage{fontspec} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{autobreak} \usepackage{xcolor} \usepackage{amssymb} \usepackage{polyglossia} \usepackage{tikz} \setmainlanguage{hebrew} \setotherlanguage{english} \spaceskip=1\fontdimen2\font plus 1\fontdimen3\font minus 1.5\fontdimen4\font \everymath{\, } \usepackage{xcolor} \definecolor{blue}{RGB}{14,107,217} \definecolor{green}{RGB}{0,158,40} \definecolor{red}{RGB}{235,16,16} \definecolor{brown}{RGB}{164,66,0} \definecolor{orange}{RGB}{231,135,26} \definecolor{purple}{RGB}{94,53,177} \usepackage{amssymb} \renewcommand{\qedsymbol}{$\blacksquare$} \pagestyle{empty} \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{arrows} \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{arrows} \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{arrows} \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{arrows, positioning} \usepackage{tikz} \usetikzlibrary{arrows, positioning} \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{arrows, positioning} \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{arrows, positioning} \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{arrows, positioning} \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{arrows, positioning} \begin{document} \begin{tikzpicture}[->,>=stealth',auto,node distance=2.5cm, thick,main node/.style={circle,draw,font=\sffamily\Large\bfseries, minimum size=1cm}, align=center] \node[main node] (s) {$s$}; \node[main node] (v1) [below right=0.8cm and 1.8cm of s] {$v_1$}; \node[main node] (v2) [above right=0.8cm and 1.8cm of s] {$v_2$}; \node[main node] (vn-3) [right=1.2cm of v1] {$v_{n-3}$}; \node[main node] (vn-2) [right=1.2cm of v2] {$v_{n-2}$}; \node[main node] (t) [below right=0.8cm and 1.8cm of vn-2] {$t$}; \draw [->] (s) -- (v1); \draw [->] (s) -- (v2); \draw [->] (vn-3) -- (t); \draw [->] (vn-2) -- (t); \draw [dashed] [->,blue] (v1) -- (vn-2); \draw [dashed] [->,blue] (v2) -- (vn-3); \draw [dashed, ->, bend right] (v1.north) to (v2.south); \draw [dashed, ->, bend] (v2.south) to (v1.north); \draw [dashed, ->, bend right] (vn-3.north) to (vn-2.south); \draw [dashed, ->, bend] (vn-2.south) to (vn-3.north); % Add dashed lines to represent the cutted paths \draw [dashed] (s) -- (v1); \draw [dashed] (s) -- (v2); \draw [dashed] (v1) -- (vn-3); \draw [dashed] (v2) -- (vn-2); \draw [dashed] (vn-3) -- (t); \draw [dashed] (vn-2) -- (t); \end{tikzpicture} \end{document}
- Grid in LaTeX helpby Amagoo on February 8, 2023 at 11:26 am
Hi am new to latex and trying to recreate the grid as shown in the image, any help at all would be greatly appreciated
- Improve Tikz code of the complex conjugateby Hibou on July 23, 2020 at 1:23 pm
I needed to draw a graph on LaTex, I'm quite new to Tikz environment so I used the following code. My question is how to improve my code because I'm sure I can have a better result with fewer lines. PS : is it possible to add a legend for s1 and z1 ? \documentclass[12pt,a4paper]{report} \usepackage[utf8]{inputenc} \usepackage[margin=1in]{geometry} \usepackage{graphicx} \usepackage{tikz} \usepackage{xcolor} \begin{document} \begin{center} \begin{tikzpicture}[thick, >=stealth] %axe des x \draw [->] (-2.5,0) -- (1,0); \node at (1.5,0) {\small \textbf{Re(s)}}; %axe des y \draw [->] (0,-2.5) -- (0,2.5); \node at (0.5,2.6) {\small \textbf{Im(s)}}; %demi cerle \draw (0,1.5) arc (90:270:1.5cm); %partie réelle omega n \draw [ultra thick] (-1.5,-0.1) -- (-1.5,0.1); \node at (-1.8,-0.2) {\small \textbf{$\omega_n$}}; %moins alpha \draw [ultra thick] (-0.85,-0.1) -- (-0.85,0.1); \node at (-1.2,-0.2) {\small \textbf{-$\alpha$}}; %dots \draw [dotted, thick] (0,-1.25) -- (-0.85,-1.25) -- (-0.85,1.25) -- (0,1.25); %s1 \node at (-0.85,1.25) {\tiny \textbf{+}}; \node at (-1.1,1.3) {\scriptsize \textbf{$s_1$}}; %s2 \node at (-0.85,-1.25) {\tiny \textbf{+}}; \node at (-1.1,-1.3) {\scriptsize \textbf{$s_2$}}; % omega d \draw [very thick] (-0.1,1.25) -- (0.1,1.25); \node at (0.4,1.26) {\scriptsize \textbf{$\omega_d$}}; %-omega d \draw [very thick] (-0.1,-1.25) -- (0.1,-1.25); \node at (0.4,-1.26) {\scriptsize \textbf{-$\omega_d$}}; %segment \draw [thick] (-0.85,1.25) -- (0,0) -- (-0.85,-1.25); %Phi \draw [ultra thin, ->] (-0.298,0.4) arc (140:90:0.4cm); \node at (-0.2,0.65) {\scriptsize $\phi$}; %zéro 1 \draw (-.7,0.625) circle (0.7mm); \node at (-.7,0.4) {\scriptsize $z_1$}; %zéro 2 \draw (-.7,-0.625) circle (0.7mm); \node at (-.7,-0.4) {\scriptsize $z_2$}; \end{tikzpicture} \end{center} \end{document}
- 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!!!
- Draw a PhotoGate apparatusby Jorge on November 15, 2017 at 2:54 pm
Is there a way to improve a schematic representation of PhotoGate apparatus? These instruments are widely used in Physics, so it would be interesting to get a good representation of it. I would like to ask for a Tikz solution and, if possible, for improvements in the artistic eye. My first code: \startMPcode path left_cell, right_cell, p, ball, texas; numeric u,v; u := 1cm; v:=.5cm; picture photogate, photogate_inactive; photogate := image ( texas := unitsquare xscaled 2v yscaled 2u shifted(4u,v); ball := fullcircle scaled 1.5cm; left_cell := unitsquare xscaled v yscaled u; right_cell := left_cell shifted (2.5u, .5v); p := (center left_cell) -- (center right_cell); draw left_cell; draw right_cell; draw p dashed evenly withcolor red; draw texas; draw urcorner left_cell .. urcorner left_cell + (0,2v) .. urcorner right_cell + (0,1.5v) .. center texas; draw urcorner right_cell .. center texas + (0,-.1u); fill ball shifted (center p + (0,3v)) withcolor red; draw ball shifted (center p + (0,3v)); ); photogate_inactive := image ( texas := unitsquare xscaled 2v yscaled 2u shifted(4u,v); ball := fullcircle scaled 1.5cm; left_cell := unitsquare xscaled v yscaled u; right_cell := left_cell shifted (2.5u, .5v); p := (center left_cell) -- (center right_cell); draw left_cell; draw right_cell; %draw p dashed evenly withcolor red; fill ball shifted center p withcolor red; draw ball shifted (center p); draw texas; draw urcorner left_cell .. urcorner left_cell + (0,2v) .. urcorner right_cell + (0,1.5v) .. center texas; draw urcorner right_cell .. center texas + (0,-.1u); ); draw photogate; draw photogate_inactive shifted (7cm , 0); \stopMPcode UPDATE (after Thurston suggestions) My new code: \startMPcode numeric u,v; u := 1cm; v:=.5cm; vardef photogate_base (expr ative) = path left_cell, right_cell, p, ball, texas; texas := unitsquare xscaled 2v yscaled 2u shifted(4u,v); ball := fullcircle scaled 1.5cm; left_cell := unitsquare xscaled v yscaled u; right_cell := left_cell shifted (2.5u, .5v); p := (center left_cell) -- (center right_cell); image ( draw left_cell; draw right_cell; draw urcorner left_cell .. urcorner left_cell + (-1u,3v) .. urcorner right_cell + (0,2v) .. center texas + (0,.6u) cutafter texas; draw urcorner right_cell .. urcorner right_cell + (0,.001v) .. center texas cutafter texas; if ative == 1: draw ball shifted (center p + (0,2.5v)); fill ball shifted (center p + (0,2.5v)) withcolor red; draw p dashed evenly withcolor red; else: fill ball shifted (center p + (0,.5v)) withcolor red; draw ball shifted (center p + (0,.5v)); fi; draw texas;) enddef; draw photogate_base(1); draw photogate_base(0) shifted (7cm , 0); \stopMPcode
- Drawing an irregular shape for hypothesis space representationby Metamatics on November 13, 2016 at 1:35 pm
Is there any way to reproduce the picture below with tikz? I am relatively unfamiliar with tikz and failed to reproduce anything that looks at least partly like the following representation. This is were I've got until now: \documentclass{article} \usepackage{tikz} \usetikzlibrary{hobby} \begin{document} \begin{tikzpicture}[use Hobby shortcut,closed=true] \draw (-3.5,0.5) .. (-3,2.5) .. (-1,3.5).. (1.5,3).. (4,3.5); \draw (-1,1.5) ellipse (57pt and 33pt); \draw [fill=black] (-0.5,1.5) circle (1.5pt); \draw[color=black] (-0.5,1.2) node {$f$}; \draw [fill=gray] (0,1.2) circle (1.5pt); \draw[color=gray] (0,0.9) node {$h_1$}; \draw [fill=gray] (-1.2,2) circle (1.5pt); \draw[color=gray] (-1.2,2.3) node {$h_2$}; \draw [fill=gray] (-1,1.35) circle (1.5pt); \draw[color=gray] (-1.3,1.35) node {$h_3$}; \end{tikzpicture} \end{document} The two most challenging tasks are to reproduce this irregular shape in the same form and to draw these irregular arrows.
- improvement of a complex contourby user5590 on April 30, 2016 at 12:26 am
By adapting the codes in an answer to the question How to draw these (closed contours) diagrams using TikZ or PSTricks?, I get the following picture. Would anybody help me to make the following improvement? How can I have arrows in the line segment (-R,0) and also the smaller arc? (And only one arrow in the bigger arc.) How can I make the sizes of 1-\epsilon, 1+\epsilon smaller? \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.markings} \begin{document} \begin{tikzpicture}[decoration={markings, mark=at position 0.5cm with {\arrow[line width=1pt]{>}}, mark=at position 2cm with {\arrow[line width=1pt]{>}}, mark=at position 7.85cm with {\arrow[line width=1pt]{>}}, mark=at position 9cm with {\arrow[line width=1pt]{>}} } ] % The axes \draw[help lines,->] (-4,0) -- (4,0) coordinate (xaxis); \draw[help lines,->] (0,-1) -- (0,4) coordinate (yaxis); \node at (0,2) {$\times$}; \node at (-.5,2) {$2i$}; \node at (1,0) {$\times$}; % The path %\path[draw,line width=0.8pt,postaction=decorate] (1,0) node[below] {$\epsilon$} -- (2,0) node[below] {$r$} arc (0:180:2) -- (-1,0) arc (180:0:1); \path[draw,line width=0.8pt,postaction=decorate] (1.5,0) node[below] {$1+\epsilon$} -- (3,0) node[below] {$R$} arc (0:180:3) node[below] {$-R$} -- (.5,0) node[below]{$1-\epsilon$} arc (180:0:.5); % The labels \node[below] at (xaxis) {$x$}; \node[left] at (yaxis) {$y$}; \node[below left] {$O$}; \node at (1,.8) {$C_{\varepsilon}$}; \node at (2,3) {$\Gamma_{R}$}; \end{tikzpicture} \end{document}
- How to draw random simple closed smooth curves but with the same perimeter?by kiss my armpit on December 8, 2014 at 2:59 am
I want to draw some random simple smooth closed curves. Each smooth curve must have the same perimeter but different area. See the following figure to illustrate what I meant clearly. Each smooth curve is assumed to have the same perimeter. How to do this with PSTricks (preferred) or TikZ or Metapost or Asymptote? The following template is provided to save your time. \documentclass{pstricks,border=12pt,12pt} \begin{document} \psLoop{10}{% \begin{pspicture}(-5,-5)(5,5) \end{pspicture}} \end{document}