• How to transform canvas with `grid` and not to affect the `node`'s content at the same time?
    by Explorer on February 1, 2026 at 5:24 pm

    Description As the successor of my prevoius not-supported l3draw attempt, I try with plain-tikz: \documentclass[tikz,border=5pt]{standalone} \usepackage{mathpazo} \usepackage{amsmath} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture}[line cap=round] \clip (-.5,-.5) rectangle (4.5,4.5); \begin{scope}[ x={(1.5cm,0.5cm)}, y={(0.5cm,2cm)}, ] \fill[orange!10] (-2,-2) rectangle (5,5); \draw[orange] (-2,-2) grid (5,5); \draw[orange,ultra thick,-Stealth] (0,0) -- +(1,0) node[below] {$\mathbf{b_1}$}; \draw[orange,ultra thick,-Stealth] (0,0) -- +(0,1) node[below left] {$\mathbf{b_2}$}; \draw[black,ultra thick,-Stealth] (0,0) -- +(1,1) node[right] {$\mathbf{x}$}; \end{scope} \end{tikzpicture} \begin{tikzpicture}[line cap=round] \clip (-.5,-.5) rectangle (4.5,4.5); \begin{scope}[x={(1.5cm,0.5cm)}, y={(0.5cm,2cm)}] \fill[orange!10] (-2,-2) rectangle (5,5); % \draw[orange] (-2,-2) grid (5,5); \foreach \i in {-2,-1,...,5} {\draw[orange] (\i,-2) -- ++(0,7) (-2,\i) -- ++(7,0);} \draw[orange,ultra thick,-Stealth] (0,0) -- +(1,0) node[below] {$\mathbf{b_1}$}; \draw[orange,ultra thick,-Stealth] (0,0) -- +(0,1) node[below left] {$\mathbf{b_2}$}; \draw[black,ultra thick,-Stealth] (0,0) -- +(1,1) node[right] {$\mathbf{x}$}; \end{scope} \end{tikzpicture} \begin{tikzpicture}[line cap=round] \clip (-.5,-.5) rectangle (4.5,4.5); \begin{scope}[ transform canvas={cm={1.5, 0.5, 0.5, 2, (0,0)}} ] \fill[orange!10] (-2,-2) rectangle (5,5); \draw[orange] (-2,-2) grid (5,5); \draw[orange,ultra thick,-Stealth] (0,0) -- +(1,0) node[below] {$\mathbf{b_1}$}; \draw[orange,ultra thick,-Stealth] (0,0) -- +(0,1) node[below left] {$\mathbf{b_2}$}; \draw[black,ultra thick,-Stealth] (0,0) -- +(1,1) node[right] {$\mathbf{x}$}; \end{scope} \end{tikzpicture} \end{document} Here, I have three proposals: FIRST: the grid doesn't transform by x={(1.5cm,0.5cm)}, y={(0.5cm,2cm)}. SECOND: the manual \foreach gives what I want, but I don't think manually mimic what feature grid do is the best practice. THIRD: with transform canvas, it affected the grid, but all on the canvas, the text and arrow are both sheared, that is not I want. Question: Is there better approach without manually plot the grid? I would make good use of feature grid in my case as possible.

  • Drawing a pulley system
    by Fatai Bakare on February 1, 2026 at 8:32 am

    I need to draw a pulley system as in the figure. How can I do that? Specific information about the figure: A block of mass Mo is on a horizontal surface and attached by a string to a hanging block, also of mass Mo , as shown in the figure. Friction between the block and the horizontal surface is negligible. The masses of the string and pulley are negligible, and the pulley can rotate with negligible friction around its axle.

  • Wrapping a circle on a torus
    by M. Al Jumaily on February 1, 2026 at 4:19 am

    I have used the sample code from latexdraw that draws a torus. I am trying to draw a filled circle and a dashed circle where they should be wrap around the torus instead of being drawn uniformly at z=0. I am looking for a TikZ solution. The closest I have seen is this solution but it is too difficult for me to decipher. Any help would be appreciated! \documentclass[margin=4pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepackage{tikz-3dplot} \usepgfplotslibrary{colormaps} \pgfplotsset{ compat=newest, colormap={manifoldmap}{color=(lightgray) color=(white) color=(lightgray)} } \begin{document} \begin{tikzpicture} \def\R{2.75} % Major radius (distance from torus centre to tube centre) \def\offset{0.5} % Radial displacement from the torus centre circle \def\thetaB{2.5} % Angular position (in radians) for highlighted point \begin{axis}[ width=12cm, axis equal image, hide axis, z buffer=sort, view={125}{35}, clip=false ] % Parametric torus equations: % x = (R + cos(x)) cos(y) % y = (R + cos(x)) sin(y) % z = sin(x) \addplot3[ surf, shader = faceted interp, samples = 30, samples y = 40, domain = 0:2*pi, domain y = 0:2*pi, colormap name = manifoldmap, thin, opacity=0.75 ] ( {(\R + cos(deg(x))) * cos(deg(y))}, {(\R + cos(deg(x))) * sin(deg(y))}, {sin(deg(x))} ); \begin{scope}[canvas is xy plane at z=0, transform shape] \coordinate (p) at ({(\R + \offset) * cos(deg(\thetaB))}, {(\R + \offset) * sin(deg(\thetaB))}); \draw[fill=red, draw=none] (p) circle (4pt); \draw[blue, dashed, thick] (p) circle (16pt); \end{scope} \end{axis} \end{tikzpicture} \end{document}

  • How to draw a figure (horizontal and diagonal ines) with numbers / variables within (easy) [closed]
    by Justin Eaves on January 31, 2026 at 6:56 pm

    I am looking to draw diagrams similar to this many times over the course of a document, and fill in all (6) of the negative spaces (top, bottom, top left, top right, bottom left, bottom right). The numbers in each diagram will vary. The center of the diagram need not be hollow as in the photo below, that was just sloppy line drawing. Just an "X" with a horizontal line through it, and a way to add numbers in each negative space. I'm sure this is easy, but I have zero experience with tikz. Anyone have an easy solution? Thanks in advance!

  • Putting two flowcharts on the same page side by side in Latex
    by Destr on January 31, 2026 at 12:27 pm

    So i have the following code in latex and i'm trying to put these two flowcharts side by side, for some reason i cant do that and instead one is on top of the other , i can't understand what i do wrong. Below is the code and here is the resulting image https://i.sstatic.net/kHcPDRb8.png \documentclass{article} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{arrows.meta, positioning, calc} \usepackage{xcolor} \usepackage{graphicx} \usetikzlibrary{shapes.geometric, arrows.meta, positioning,calc} \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{figure}[ht] \centering % ================= LEFT DIAGRAM ================= \begin{minipage}[t]{0.30\textwidth} \centering \begin{tikzpicture}[ scale=0.75, transform shape, node distance=1cm, every node/.style={font=\scriptsize}, block/.style={rectangle, draw, rounded corners, minimum width=2.6cm, minimum height=0.7cm, align=center}, adder/.style={circle, draw, minimum size=0.45cm, inner sep=0pt}, arrow/.style={->, thick} ] \tikzset{ inputoutput/.style={block, fill=cyan!40}, linear/.style={block, fill=green!40}, mixup/.style={block, fill=BrickRed!40}, penc/.style={block, fill=purple!40}, cmamba/.style={block, fill=red!40}, rms/.style={block, fill=yellow!40} } \node[inputoutput] (input) {Input}; \node[mixup, above=of input] (mixup) {Channel Mixup}; \node[linear, above=of mixup] (lin1) {Linear}; \node[penc, above=of lin1] (penc) {Positional Encoding}; \node[adder, above=of penc] (add) {$+$}; \node[cmamba, above=of add] (cmamba) {CMamba}; \node[rms, above=of cmamba] (rms) {RMS Norm}; \node[linear, above=of rms] (lin2) {Linear}; \node[inputoutput, above=of lin2] (output) {Output}; \draw[arrow] (input) -- (mixup); \draw[arrow] (mixup) -- (lin1); \draw[arrow] (lin1) -- (penc); \draw[arrow] (penc) -- (add); \draw[arrow] (add) -- (cmamba); \draw[arrow] (cmamba) -- (rms); \draw[arrow] (rms) -- (lin2); \draw[arrow] (lin2) -- (output); \draw[arrow] (input.east) -- ++(1.2,0) |- (add.east); \end{tikzpicture} \caption*{(a) Overall Architecture} \end{minipage} \hfill % ================= RIGHT DIAGRAM ================= \begin{minipage}[t]{0.30\textwidth} \centering \begin{tikzpicture}[ scale=0.7, transform shape, node distance=0.45cm, every node/.style={font=\scriptsize}, block/.style={rectangle, draw, rounded corners, minimum width=3.2cm, minimum height=0.7cm, align=center}, mult/.style={circle, draw, minimum size=0.45cm, inner sep=0pt}, arrow/.style={->, thick} ] \node[block, fill=green!40] (linL) {Linear}; \node[block, fill=RoyalBlue!40, above=of linL] (conv) {Conv1D}; \node[block, fill=magenta!40, above=of conv] (siluL) {SiLU}; \node[block, fill=red!40, above=of siluL] (ssm) {SSM}; \node[block, fill=green!40, right=0.8cm of linL] (linR) {Linear}; \node[block, fill=magenta!40, above=of linR] (siluR) {SiLU}; \node[mult] (mult) at ($(ssm.north)!0.5!(siluR.north) + (0,2cm)$) {$\times$}; \draw[arrow] (linL) -- (conv); \draw[arrow] (conv) -- (siluL); \draw[arrow] (siluL) -- (ssm); \draw[arrow] (linR) -- (siluR); \draw[arrow] (ssm.north) |- (mult.west); \draw[arrow] (siluR.north) |- (mult.east); \node[block, fill=yellow!40, above=0.4cm of mult] (rms2) {RMS Norm}; \draw[arrow] (mult) -- (rms2); \end{tikzpicture} \caption*{(b) CMamba Block (Expanded)} \end{minipage} \caption{Overview of the model architecture and the internal structure of the CMamba block.} \label{fig:cmamba_combined} \end{figure} \end{document}

  • Slanted document header (with tikz)
    by LeO on January 30, 2026 at 7:58 pm

    I want to have the following document header but all I get is the following result I tried different approaches with tikz but all failed. My current MWE \documentclass[12pt]{article} \usepackage[margin=2.5cm]{geometry} % for margins on a A4paper \usepackage[tracking=true,factor=1100,stretch=10,shrink=10,babel,final]{microtype} % have some better layout for \usepackage{xcolor} \definecolor{PrimaryColor}{HTML}{012A4A} % alternate navy \definecolor{ComplColor}{HTML}{FFCC99} \usepackage{tabularx} \usepackage{array} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \usetikzlibrary{calc} % Header settings \newcommand{\HeaderHeight}{3.6cm} % approx 3-4cm band height \usepackage{datetime} \pagestyle{empty} \begin{document} % ===== Header band (inserted) ===== \begin{tikzpicture}[remember picture,overlay] % Blue section on the left \fill[PrimaryColor] (current page.north west) rectangle ($(current page.north west)+(0.40\paperwidth,-\HeaderHeight)$); % White slanted gap as trapezium node \node[ trapezium, fill=white, minimum width=0.02\paperwidth, minimum height=\HeaderHeight, trapezium left angle=90, trapezium right angle=90, % Adjust this for slant angle anchor=north west, inner sep=0pt, outer sep=0pt ] at ($(current page.north west)+(0.42\paperwidth,0)$) {ab}; % Complementary color on the right \fill[ComplColor] ($(current page.north west)+(0.42\paperwidth,-5mm)$) -- ($(current page.north west)+(0.42\paperwidth,-\HeaderHeight)$) -- ($(current page.north east)+(0,-\HeaderHeight)$) -- ($(current page.north east)+(0,-5mm)$) -- cycle; % The Centered Name \node[ text=white, align=center ] at ($(current page.north west)+(0.2*\paperwidth,-0.5*\HeaderHeight)$) {\Huge \parbox{0.40\paperwidth}{\centering my \\ long-name}}; \end{tikzpicture} \end{document} I tried as well with different node (cycle) approach but didn't work out. I also didn't find a solution with the tiny blue line at the end. Likewise, I would have expected that the math would get rid of it... The final result should be that the left box starts in the left corner and the right 5mm below and everything shift down. As an additional issue, I've recognized how to properly align the box on the left side because it should be somehow perceived as centered. In the final solution, I would like to place as well text into the right box. In the final result, it would be nice to have at least the right box with some sort of shadow. But this would be just the toppings of the ice 😉

  • Using radians in polaraxis environment (PGFplots)
    by humanoferth on January 30, 2026 at 6:28 pm

    I've been trying to graph some polar functions using PGFplots and I've been refrencing this section of the manual: https://tikz.dev/pgfplots/libs-polar where in 5.10.2 it says that I should be using datacs=polarrad to convert to polar coordinates, but the graphs have come out wrong, so I've been using degrees to get accurate graphs, though I would rather be using radians. Any ideas of what I'm doing wrong / what I can do to fix it? I've put a couple of bare-bones examples of what I mean below. \documentclass{report} \usepackage{amsmath} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepgfplotslibrary{polar} \begin{document} \[\begin{tikzpicture}[baseline={(0,3)}] \begin{polaraxis} \addplot+ [domain=0:360] {cos(x)}; \end{polaraxis} \end{tikzpicture} \begin{tikzpicture}[baseline={(0,3)}] \begin{polaraxis} \addplot+ [domain=0:2*pi,data cs=polarrad] {cos(x)}; \end{polaraxis} \end{tikzpicture}\] \[\begin{tikzpicture}[baseline={(0,3)}] \begin{polaraxis} \addplot+ [domain=0:360] {cos(x)*sin(x)}; \end{polaraxis} \end{tikzpicture} \begin{tikzpicture}[baseline={(0,3)}] \begin{polaraxis} \addplot+ [domain=0:2*pi,data cs=polarrad] {cos(x)*sin(x)}; \end{polaraxis} \end{tikzpicture}\] \end{document} Also a bit of a side note, but is there an easy way to switch the axes from degrees to radians besides manually changing each one individually via the xticklabel command? Thanks!

  • Tikz size change
    by Nick B on January 30, 2026 at 3:07 pm

    With the help of AI I created the following: \documentclass{article} \usepackage[margin=1cm]{geometry} \usepackage{tikz} \usetikzlibrary{positioning} % Define colors extracted from the image \definecolor{headerblue}{RGB}{56, 84, 135} \definecolor{headerlight}{RGB}{218, 223, 232} \newcommand*{\Ex}[2]{ \begin{tikzpicture}[baseline=(label.base)] \node[boxstyle, fill=headerblue, text=white] (example) {Example #1\strut}; \node[boxstyle, fill=headerlight, text=black, right=0pt of example] (desc) {#2}; \draw[headerblue, thick] (example.north west) -- (desc.north east) -- (desc.south east) -- (example.south west) -- cycle; \end{tikzpicture} } \begin{document} \thispagestyle{empty} \begin{tikzpicture} % Define common style for the nodes \tikzset{ boxstyle/.style={ font=\sffamily\bfseries\Large, inner ysep=8pt, inner xsep=12pt, outer sep=0pt } } \node[boxstyle, fill=headerblue, text=white] (example) {Example 2\strut}; \node[boxstyle, fill=headerlight, text=black, right=0pt of example] (desc) {Two Distinct Linear Factors in the Denominator\strut}; \draw[headerblue, thick] (example.north west) -- (desc.north east) -- (desc.south east) -- (example.south west) -- cycle; \end{tikzpicture} \Ex{1}{I need some help} \end{document} I am trying use a newcommand so that I can type in the example number and the text without recopying the code. Here is what I have, which produces what I want but you can see that the color does not fill the box and also they are different heights. Any help is appreciated:

  • Fail to construct spiral gradually with beamer frames
    by D G on January 30, 2026 at 2:40 am

    Objective: The spiral construction is shown gradually. Each iteration is on a separate frame. \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{frame}{step by step spiral construction} \begin{tikzpicture} \draw (0,0) foreach \a in {1,...,120} { \only<\a->{ -- ++({10*\a}:{pow(0.99,\a)}) } }; \end{tikzpicture} \end{frame} \end{document} Error: No file test.nav. ! Package tikz Error: Giving up on this path. Did you forget a semicolon?. See the tikz package documentation for explanation. Type H <return> for immediate help. ... l.16 \end{frame} ?

  • Extend custom \IMG macro: add percentage-based overlay label (white box + letter) at (x%, y%) with separate scale
    by taiwan12 on January 28, 2026 at 10:12 pm

    I have a basic macro that inserts a figure with \includegraphics, caption, and label: \documentclass{report} \usepackage{graphicx} \usepackage{float} \newcommand{\IMG}[4]{ \begin{figure}[H] \centering \includegraphics[scale=#1]{#2} \caption{#3} \label{fig:#4} \end{figure} } \begin{document} \IMG{0.5}{example-image}{Caption}{figA} \IMG{0.6}{example-image}{Caption}{figB} \end{document} I want to extend it so I can overlay a letter inside a white square with a black border on top of the image, with the position given in percentages of the image size, and with a separate scale that affects only the overlay (box + letter), not the image. Desired call syntax: \IMG{imgscale}{filename}{caption}{label}{y}{x}{letter}{overlayscale} Where: imgscale is passed to \includegraphics[scale=...] (scales the image) y and x are relative coordinates inside the image (fractions / percentages of the image size): (y=0, x=0) corresponds to the top-left corner of the image y increases downward (south) x increases to the right (east) e.g. y=0.10 means 10% from the top, x=0.05 means 5% from the left letter is something like A, B, etc. (only one letter) overlayscale scales only the overlay (white square + letter), not the image the letter should be centered inside the square Example usage I want: \IMG{0.5}{example-image}{Caption}{figA}{0.10}{0.05}{A}{1.2} This should place a small white square (black border) near the top-left, at 5% from the left and 10% from the top, and put the letter A inside it. I’m open to tikz, overpic, etc., as long as the coordinates are relative to the image (not the page). Ideally the overlay moves correctly when the image scale changes. It should look like this:

  • tikz Wiener sausage [duplicate]
    by 20-sided-dice on January 28, 2026 at 1:41 pm

    Let's say I have a curve defined by y=f(x) with some explicit function f for x between 0 and 1. I define the sausage of that curve to be the set of points (x,y) at distance less than 1 from any point of the curve. How do I draw the sausage in TikZ without deriving mathematically the actual shape of the sausage ? Even with simple functions it's quickly painful to derive by hand. I would prefer if TikZ could directly draw it.

  • tikz diagram works in overleaf but fails in texworks [closed]
    by duality on January 28, 2026 at 6:01 am

    I am trying to get the following tikz diagram to work in texworks. It works fine in overleaf but fails in texworks. Any idea how to fix this? \documentclass[11pt]{article} \usepackage{tikz} \usepackage{float} \usetikzlibrary{calc} \usetikzlibrary{external,quotes,chains} \tikzset{vertex/.style={black,fill,draw,minimum size=6pt,inner sep=0pt,circle,thin},bold/.style={black,line width=0.6mm},plain/.style={black,thin},bold edges/.style=bold,plain edges/.style=plain,label distance=1mm,text node/.style={rectangle,fill=none,draw=none},every label/.style=text node,caption node/.style={text node,font=\Large}} \newcommand{\AR}[1]{\overrightarrow{#1}} \title{something} \author{someone} \begin{document} \maketitle \begin{figure}[H] \centering \begin{tikzpicture} [node distance=2cm, base node/.style={circle,draw,minimum size=15pt},scale=0.8] \node[base node, very thick] (5){5}; \node[base node, very thick][left of=5] (3){3}; \node[base node, very thick][above of=5] (1){1}; \node[base node, very thick][below of=5] (4){4}; \node[base node, very thick][right of=5] (2){2}; \path [->, very thick] (3) edge node[left] {} (5); \path [<-, very thick] (5) edge node[right] {} (2); \path [->, very thick](1) edge node[left] {} (3); \path [->, very thick](4) edge node[left] {} (3); \path [->, very thick](4) edge node[left] {} (2); \path [->, very thick](1) edge node[left] {} (2); \path [->, very thick] (5) edge node[left] {} (1); \path [->, very thick] (5) edge node[left] {} (4); % ------- First copy of the circulant ------- \node[base node, very thick] (w1) at ($(90:2) + (3,-4)$) {6}; \node[base node, very thick] (w2) at ($(30:2) + (3,-4)$) {7}; \node[base node, very thick] (w3) at ($(-30:2) + (3,-4)$) {10}; \node[base node, very thick] (w4) at ($(-90:2) + (3,-4)$) {9}; \node[base node, very thick] (w5) at ($(-150:2) + (3,-4)$) {8}; %\node[base node, very thick] (w6) at ($(150:2) + (3,-4)$) {5}; %repeated \path[->, very thick] (w1) edge [bend left=5] (5); \path[->, very thick] (w1) edge (w3); \path[->, very thick] (w2) edge (w1); \path[->, very thick] (w2) edge (w4); \path[->, very thick] (w3) edge (w2); \path[->, very thick] (w3) edge (w5); \path[->, very thick] (w4) edge (w3); \path[->, very thick] (w4) edge [bend right=10] (5); \path[->, very thick] (w5) edge (w4); \path[->, very thick] (w5) edge (w1); \path[->, very thick] (5) edge [bend left=5] (w5); \path[->, very thick] (5) edge [bend left=15] (w2); % ------- Second copy of the circulant ------- \node[base node, very thick] (z1) at ($(90:2) + (9,-4)$) {11}; %2 \node[base node, very thick] (z2) at ($(30:2) + (9,-4)$) {12}; %3 \node[base node, very thick] (z3) at ($(-30:2) + (9,-4)$) {15}; %6 \node[base node, very thick] (z4) at ($(-90:2) + (9,-4)$) {14}; %5 \node[base node, very thick] (z5) at ($(-150:2) + (9,-4)$) {13}; %4 %\node[base node, very thick] (z6) at ($(150:2) + (9,-4)$) {10}; %1 \path[->, very thick] (z1) edge[bend right=10] (w3); \path[->, very thick] (z1) edge (z3); \path[->, very thick] (z2) edge (z1); \path[->, very thick] (z2) edge (z4); \path[->, very thick] (z3) edge (z2); \path[->, very thick] (z3) edge (z5); \path[->, very thick] (z4) edge (z3); \path[->, very thick] (z4) edge[bend left=10] (w3); \path[->, very thick] (z5) edge (z4); \path[->, very thick] (z5) edge (z1); \path[->, very thick] (w3) edge (z5); \path[->, very thick] (w3) edge[bend left=10] (z2); \end{tikzpicture} \caption{A graph $\AR{R_5} \cdot R_6$} \label{fig:gluingToGetAllN} \end{figure} \end{document}

  • How to thicken the subpath's segment with specific position?
    by Explorer on January 27, 2026 at 12:37 pm

    This question is similar to this question, but not exactly the same. I have the following code: \documentclass[tikz,border=5pt]{standalone} \begin{document} \begin{tikzpicture} \draw[help lines] (-1,-1) grid (7,2); \draw[thick,magenta] (0,0) .. controls (3,3) and (4,-1) .. % coordinate[pos=.3] (A) %<- point start of thick line % coordinate[pos=.5] (B) %<- point end of thick line (6,0); \clip (2,0) rectangle (3,3); \draw[line width=3pt,cyan] (0,0) .. controls (3,3) and (4,-1) .. (6,0); \end{tikzpicture} \end{document} Noted that the GREEN cut is what I was after, the cut should along the path, but not the \clip-ed rectangle. What I saied is not the same as Paul Gaborit's solution, is that I want to control the proportion of (says 0.3 and 0.5, and coloe them thicker) the "subpath". The solution with: decoration={ show path construction, curveto code={ \addtocounter{pos}{1} \pgfmathtruncatemacro{\min}{#1 - 1} \ifthenelse{\thepos < #2 \AND \thepos > \min}{ \draw[#3] (\tikzinputsegmentfirst) .. controls (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb) .. (\tikzinputsegmentlast); }{} } } points here \tikzinputsegmentfirst, \tikzinputsegmentsupportX and \tikzinputsegmentlast looks not easy to control two points position as pos=0.3, is there any better solution? Any possible(plain-TikZ,tkz-elements,luadraw) are all welcome!

  • Showcase of beautiful 'electrical circuit diagrams' done in TeX & friends
    by cis on January 27, 2026 at 7:03 am

    When I saw this thread How to customize CircuiTikz ac - dc symbols or this one Showcase of beautiful typography done in TeX & friends, I had the idea to add a showcase for electrical circuit diagrams. The package would typically be circuitikz. Feel free to post your large, small, or elegant circuit diagrams here in the community wiki. (I will also add some examples occasionally.) Attach your codes (if possible); this would be a great opportunity to learn from your coding and your style. \documentclass[margin=5pt, multi=circuitikz]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[european resistors] \draw[] (0,0) to[R=$R_1$, a_=$1\Omega$, name=R1, invert] (3,0); \end{circuitikz} \end{document}

  • Simplifying an Asymptote figure for spherical coordinates
    by Sebastiano on January 26, 2026 at 12:58 pm

    I refer to the second code by the user Chris Chudzicki: % Source - https://tex.stackexchange.com/a/160528 % Posted by Chris Chudzicki, modified by community. See post 'Timeline' for change history % Retrieved 2026-01-26, License - CC BY-SA 3.0 \documentclass{article} \usepackage{asymptote} \begin{document} \begin{asy}[width=\textwidth] settings.render=6; settings.prc=false; import three; import graph3; import grid3; currentprojection=obliqueX; //Draw Axes pen thickblack = black+0.75; real axislength = 1.0; draw(L=Label("$x$", position=Relative(1.1), align=SW), O--axislength*X,thickblack, Arrow3); draw(L=Label("$y$", position=Relative(1.1), align=E), O--axislength*Y,thickblack, Arrow3); draw(L=Label("$z$", position=Relative(1.1), align=N), O--axislength*Z,thickblack, Arrow3); //Set parameters of start corner of polar volume element real r = 1; real q=0.25pi; //theta real f=0.3pi; //phi real dq=0.15; //dtheta real df=0.15; //dphi real dr=0.15; triple A = r*expi(q,f); triple Ar = (r+dr)*expi(q,f); triple Aq = r*expi(q+dq,f); triple Arq = (r+dr)*expi(q+dq,f); triple Af = r*expi(q,f+df); triple Arf = (r+dr)*expi(q,f+df); triple Aqf = r*expi(q+dq,f+df); triple Arqf = (r+dr)*expi(q+dq,f+df); pen thingray = gray+0.33; draw(A--Ar); draw(Aq--Arq); draw(Af--Arf); draw(Aqf--Arqf); draw( arc(O,A,Aq) ,thickblack ); draw( arc(O,Af,Aqf),thickblack ); draw( arc(O,Ar,Arq) ); draw( arc(O,Arf,Arqf) ); draw( arc(O,Ar,Arq) ); draw( arc(O,A,Af),thickblack ); draw( arc(O,Aq,Aqf),thickblack ); draw( arc(O,Ar,Arf) ); draw( arc(O,Arq,Arqf) ); pen thinblack = black+0.25; //phi arcs draw(O--expi(pi/2,f),thinblack); draw("$\varphi$", arc(O,0.5*X,0.5*expi(pi/2,f)),thinblack,Arrow3); draw(O--expi(pi/2,f+df),thinblack); draw( "$d\varphi$", arc(O,expi(pi/2,f),expi(pi/2,f+df) ),thinblack ); draw( A.z*Z -- A,thinblack); draw(L=Label("$r\sin{\theta}$",position=Relative(0.5),align=N), A.z*Z -- Af,thinblack); //cotheta arcs draw( arc(O,Aq,expi(pi/2,f)),thinblack ); draw( arc(O,Aqf,expi(pi/2,f+df) ),thinblack); //theta arcs draw(O--A,thinblack); draw(O--Aq,thinblack); draw("$\theta$", arc(O,0.25*length(A)*Z,0.25*A),thinblack,Arrow3); draw(L=Label("$d\theta$",position=Relative(0.5),align=NE) ,arc(O,0.66*A,0.66*Aq),thinblack ); // inner surface triple rin(pair t) { return r*expi(t.x,t.y);} surface inner=surface(rin,(q,f),(q+dq,f+df),16,16); draw(inner,emissive(gray+opacity(0.33))); //part of a nearly transparent sphere to help see perspective surface sphere=surface(rin,(0,0),(pi/2,pi/2),16,16); draw(sphere,emissive(gray+opacity(0.125))); // dr and rdtheta labels triple V= Af + 0.5*(Arf-Af); draw(L=Label("$dr$",position=Relative(1.1)), V--(1.5*V.x,1.5*V.y,V.z),dotted); triple U=expi(q+0.5*dq,f); draw(L=Label("$rd\theta$",position=Relative(1.1)), r*U ---r*(1.66*U.x,1.66*U.y,U.z),dotted ); \end{asy} \end{document} The code uses asymptote package to represent a volume element in spherical coordinates. Asymptote appears to be correctly installed in my MiKTeX distribution; however, the document does not compile and produces the following error: Package asymptote Warning: file `spy-1.pdf' not found on input line 15. (spy.aux)) No pages of output. Transcript written on spy.log. Sorry, but "MiKTeX Compiler Driver" did not succeed. I do not use Asymptote very often, so I am not sure about the cause of the problem. It is possible that the solution is related to what is discussed in the following TeX.StackExchange threads: 'filename-1.pdf' not found Asymptote Asymptote Code Generates .asy Files, But Asymptote Execution Fails In particular, I have not yet tried the solution proposed by the user user279206, and I do not know whether there is an alternative approach that would allow me to compile the document correctly with my MiKTeX distribution. In a previous question, I also asked whether it is possible to obtain the same arrow tip styles provided by Asymptote using TikZ: Arrows with spherical (conical) tips Since I do not understand Asymptote code, I kindly ask whether it would be possible to modify the original code by removing everything that is not strictly necessary, in order to obtain only the figure related to spherical coordinates, without the volume element and without additional unnecessary details to obtain this with the portion of a sphere. In TikZ there is a result: https://tikz.net/spherical_1/ This is my goal:

  • Tikz diagram barycentric label of a triangle
    by Maxim Wan on January 26, 2026 at 2:43 am

    I am still new to LaTeX and I am trying to label the areas of my economics diagram in LaTeX. To do this, I am trying to label the areas using barycentric coordinates, because I want the label to appear in the centre of the triangle. To do this I am calculating the intersections of the lines and using barycentric coordinates. However, I am getting the error message. What would be the correct way to do this? Package pgf Error: No shape known as `Q3` is known. Package pgf Error: No shape known as `A3` is known. Here is my code: \documentclass[tikz, border=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{calc, intersections, decorations.pathreplacing} \usepackage{eurosym} \begin{document} \begin{tikzpicture}[ scale=1.2, axis/.style={thick, ->, >=stealth}, curve/.style={thick}, dashed_line/.style={dashed, thin}, important_line/.style={dashed, thick} ] % --- Y INTERCEPTS --- \coordinate (A1) at (0,8); % Y-intercept of Demand \coordinate (A3) at (0,6); % Y-intercept of Pw+sub %AXES \draw[axis, name path=YAxis] (0,0) -- (0,9) node[left, align=center] {Price of Citrus\\(\euro)}; \draw[axis, name path=XAxis] (0,0) -- (9,0) node[below, align=center, xshift=-1cm] {Quantity of citrus\\(tonnes)}; % CURVES % Demand Curve \draw[curve, name path=Demand] (A1) -- (7,1) node[right] {$D_d$}; % Domestic Supply Curve \draw[curve, name path=SupplyDom] (0,0) -- (7,7) node[right] {$S_d$}; % Shifted Supply Curve \draw[curve, name path=SupplySub] (1.5,0) -- (8.5,7) node[right, align=left] {$S_d +$\\$sub$}; % PRICE LINES % World Price \draw[thick, name path=Pw] (0,4.5) -- (8,4.5) node[right] {$S_{world}$}; \node[left] at (0,4.5) {$P_w$}; % Subsidized Price \path[name path=PwSub] (A3) -- (8,6); \draw[important_line] (A3) -- (6,6); \node[left, align=center] at (A3) {$P_w+sub$}; % INTERSECTIONS \path [name intersections={of=Demand and Pw, by=Q1}]; \path [name intersections={of=SupplyDom and Pw, by=Q2}]; \path [name intersections={of=Demand and PwSub, by=Q3}]; \path [name intersections={of=SupplyDom and PwSub, by=Q4}]; \path [name intersections={of=SupplySub and Pw, by=Q4_projected}]; % DROP LINES \draw[dashed_line] (Q1) -- (Q1 |- 0,0) node[below] {$Q_1$}; \draw[dashed_line] (Q2) -- (Q2 |- 0,0) node[below] {$Q_2$}; \draw[dashed_line] (Q3) -- (Q3 |- 0,0) node[below] {$Q_3$}; \draw[dashed_line] (Q4) -- (Q4 |- 0,0) node[below] {$Q_4$}; % SUBSIDY SIZE \draw[<->, thick] (Q4) -- (Q4_projected) node[midway, right] {Size of Subsidy (90{\euro}/tonne)}; % BRACES \draw [decorate,decoration={brace,amplitude=5pt,mirror,raise=5pt}] (Q1 |- 0,-0.6) -- (Q2 |- 0,-0.6) node[midway,yshift=-2em, font=\small] {Exports under free trade}; \draw [decorate,decoration={brace,amplitude=5pt,mirror,raise=5pt}] (Q3 |- 0,-1.6) -- (Q4 |- 0,-1.6) node[midway,yshift=-2em, font=\small, align=center] {Exports under export\\subsidy}; % AREA LABELS \node at (barycentric cs:A1=1, Q3=1, A3=1) {a}; %.. More labels \end{tikzpicture} \end{document} This is the outputted diagram And I am trying to get the 'a' label to be:

  • circuitikz: position and adjust current and voltage arrows
    by cis on January 24, 2026 at 7:17 pm

    I'm trying to recreate this image on 5mm grid paper using the original dimensions. It's not a big problem; I'm just looking for some fine-tunings inside the circuitikz-package. I've tested a few keys, but I'm wondering: What is the correct method: to add a longer voltage arrow that's a bit further away from the source? to add a current arrow at the shown position in a package-like way (regular TikZ is clear)? PS: I would also like to reduce the (global setting!) size of the arrowheads and the control points ("poles", I haven't quite understood chapter 6.1 yet); but that might be too much for one thread. MWE: [I've only set a small excerpt here to address the problems. I can easily add the rest later by myself.] \documentclass[margin=5pt]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[font=\footnotesize\sffamily, european resistors, circuitikz/resistors/width=0.425,% default 0.8 circuitikz/bipoles/generic/height=0.165,% default 0.3 circuitikz/bipoles/thickness=1.0, % default 2 circuitikz/bipoles/vsource/width=0.35, circuitikz/bipoles/vsource/height=0.35, %circuitikz/bipole/is voltage=false, %circuitikz/voltage/distance from node=5.0875,% old: 0.8 %circuitikz/voltage shift sources adjust=4.525,% default: 0.5 %voltage shift=0.125,% optional ] \draw[gray!25, step=5mm] (-1.5,0.5) grid (4,-4); \draw[] (0,-2) to[vsource, v<=12V, mirror] (0,0) -- (1.5,0); \draw[] (0.5,0) to[R=15, *-*] (0.5,-1) to[R, a=25, -*] (0.5,-2); \end{circuitikz} \end{document}

  • Warning "Returning node center instead of a point on node border." when using TikZ in beamer onlyenv
    by schtandard on January 23, 2026 at 5:22 pm

    Consider the following MWE. \documentclass{beamer} \usepackage{tikz} \begin{document} \begin{frame} \begin{onlyenv}<2>% \tikz [remember picture, overlay] \node (A) {A};% \hskip 5em \tikz [remember picture, overlay] \node (B) {B};% \tikz [remember picture, overlay] \draw (A) -- (B);% \end{onlyenv}% \end{frame} \end{document} It produces the expected output (an empty page followed by one where A and B are connected by a line), but produces two unusual warnings. Package pgf Warning: Returning node center instead of a point on node border. D id you specify a point identical to the center of node ``B''? on input line 17. Package pgf Warning: Returning node center instead of a point on node border. D id you specify a point identical to the center of node ``A''? on input line 17. The warning is surprising because usually in TikZ, writing (A) is equivalent to writing (A.center). Indeed, the warnings only seem to appear in this rather particular case where the drawing is split over several tikzpictures (using remember picture), both points ((A) and (B)) have the same coordinates ((0,0) in this example) and there is an overlay where the picture is not drawn (here the first one). Why is there a warning here? Is this a bug? If so, in TikZ or in beamer? Is there an easy way to avoid it (without changing the drawings)?

  • How come when filling in TikZ, there is a visible gap between adjacent fills?
    by Jasper on November 12, 2025 at 1:00 am

    How come when filling in TikZ, there is a visible gap between adjacent fills? \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \fill (0,0) -- (1,1) -- (1,0) -- cycle; \fill (0,0) -- (1,1) -- (0,1) -- cycle; \end{tikzpicture} \end{document}

  • Fraction Operations (Graphically - Area Model)
    by UberMorlock80 on October 11, 2025 at 3:03 pm

    I'm trying to divide the rectangle horizontally and vertically into parts without rotating it to create something similar to the image below and graphically display the sum, product, and division of fractions. I also want to create a macro to do this mechanically. Do you have an idea?

  • Vertical spacing in beamer class
    by wrb98 on September 1, 2024 at 6:32 pm

    \documentclass{beamer} \usepackage{tikz} \setlength\lineskip{0pt} \setlength\baselineskip{0pt} \setlength\parskip{0pt} \setlength\parindent{0pt} \setlength{\vskip}{0pt} % This line ensures that vertical skips are removed \setlength{\abovedisplayshortskip}{0pt} \setlength{\belowdisplayshortskip}{0pt} \setlength{\abovedisplayskip}{0pt} \setlength{\belowdisplayskip}{0pt} \setbeamertemplate{navigation symbols}{} \begin{document} \begin{frame}[t] {\bf\color{blue}Title 1} {\bf\color{blue}Title 2} \makebox[\textwidth][c]{ \begin{tikzpicture}[remember picture,every node/.style={inner sep=0pt,outer sep=0pt}] % Faded rectangle \fill[blue] (0,0) rectangle (\paperwidth,3em); % Opaque text \node[anchor=west] at (1cm,1.5em) {\color{red}\bfseries\huge Title 3}; \end{tikzpicture} } \color{red}\Large\textbf{Title 4} \end{frame} I am working with the above code and would like to have more control over the vertical spacing between lines and objects in beamer. In particular, how would I reduce the vertical spacing between two lines (e.g. between Title 1 and Title 2) and between the blue banner and Title 4 to be 0? This seems to already be the case between Title 2 and the blue banner, but I haven't been able to get it consistent for the other lines. Any help is appreciated, as always.

  • Diagnosing Standalone and Gensymb conflict
    by Altissimo on January 9, 2024 at 5:52 pm

    Disclaimer: I am new-ish to LaTeX, and self-taught. I am trying to make a "Unit Circle" TikZ graphic, in which I would like to have the \degree symbol from the gensymb package in the label text of a node. My current workflow involves the standalone package, and uses the \include command to create a sort of "master file" containing each of my creations on its own page which I reference in other Overleaf projects using the 'output file from another project' and the graphicx package to reduce compile time. There is probably a better way to do this, but it keeps it simple enough for me and I like having everything in more or less the same place so I can make quick references between my images. It has worked so far, until now... My problem is, it is preferable if I don't have to update the preamble of my master document every time I add a new picture, especially since that's where I define things like colors which occasionally use identical names (e.g. gradient1). Hence, I load \usepackage[subpreambles]{standalone} to read the preamble of each standalone separately. Again, this has worked well enough so far that I have been able to solve any hiccups myself. I have failed to diagnose why exactly, but there is something going on with the [subpreambles] tag and loading the gensymb package. Here is my MWE: \documentclass[tikz]{standalone} \usepackage{textcomp,gensymb} % for degree symbol \begin{document} \begin{tikzpicture} \node at (0,0) {$0\degree$}; \end{tikzpicture} \end{document} which I have in Overleaf as degree-test.tex. When I try to reference this file in another: \documentclass[tikz]{standalone} \usepackage[subpreambles]{standalone} \begin{document} \include{degree-test} \end{document} I get the error: Package standalone Warning: Sub-preamble of file 'degree-test.tex' has changed. Content will be ignored. Please rerun LaTeX! on input line 4. I compile with LuaLaTeX, but other compilers produce similar results. Even removing \degree from the node label produces the error, despite not actually using the symbol. There must be some kind of conflict with commands which define certain things during the preamble, but I don't know how to read the error logs and they're very frightening on the surface. Is there a simple fix for this? EDIT: I have also disqualified \documentclass[tikz]{standalone} and \include vs \includestandalone as culprits.

  • Feynman diagram using TikZ-Feynman package
    by Bekaso on March 6, 2023 at 2:02 am

    I tried to use TikZ-Feynman package to plot Feynman diagram as shown in here. I used: \documentclass{article} \usepackage{tikz} \usepackage[compat=1.0.0]{tikz-feynman} \begin{document} \feynmandiagram [horizontal=a to b] { i1 -- [fermion] a -- [fermion] i2, a -- [photon] b, f1 -- [fermion] b -- [fermion] f2, }; \end{document} it should give me but I got: what is the problem?

  • How to get set the precision of the PGFPLOTS?
    by user266771 on March 20, 2022 at 1:56 pm

    I want to plot the a strange function which is the 'InterpolatingPolynomial' of the tanh(x): (40*x*tanh(1/2))/11-(698249*x^3*tanh(1/2))/87318+(2517135701*x^5*tanh(1/2))/392931000-(8990599279*x^7*tanh(1/2))/3536379000+(666523661*x^9*tanh(1/2))/1178793000-(87882491*x^11*tanh(1/2))/1178793000+(2616454*x^13*tanh(1/2))/442047375-(40708*x^15*tanh(1/2))/147349125+(1024*x^17*tanh(1/2))/147349125-(32*x^19*tanh(1/2))/442047375-(15*x*tanh(1))/11+(1650809*x^3*tanh(1))/232848-(7656977201*x^5*tanh(1))/1047816000+(15347344853*x^7*tanh(1))/4715172000-(269158459*x^9*tanh(1))/349272000+(82887751*x^11*tanh(1))/785862000-(2527141*x^13*tanh(1))/294698250+(6658*x^15*tanh(1))/16372125-(508*x^17*tanh(1))/49116375+(16*x^19*tanh(1))/147349125+(80*x*tanh(3/2))/143-(1827209*x^3*tanh(3/2))/567567+(11431199701*x^5*tanh(3/2))/2554051500-(5986965079*x^7*tanh(3/2))/2554051500+(39926233*x^9*tanh(3/2))/65488500-(17379821*x^11*tanh(3/2))/196465500+(4771412*x^13*tanh(3/2))/638512875-(77416*x^15*tanh(3/2))/212837625+(6016*x^17*tanh(3/2))/638512875-(64*x^19*tanh(3/2))/638512875-(30*x*tanh(2))/143+(1888949*x^3*tanh(2))/1513512-(3240137519*x^5*tanh(2))/1702701000+(17611561711*x^7*tanh(2))/15324309000-(130451323*x^9*tanh(2))/392931000+(1695689*x^11*tanh(2))/32744250-(8810596*x^13*tanh(2))/1915538625+(148112*x^15*tanh(2))/638512875-(1312*x^17*tanh(2))/212837625+(128*x^19*tanh(2))/1915538625+(48*x*tanh(5/2))/715-(9587629*x^3*tanh(5/2))/23648625+(109639993*x^5*tanh(5/2))/170270100-(3194891431*x^7*tanh(5/2))/7662154500+(5165621*x^9*tanh(5/2))/39293100-(1447093*x^11*tanh(5/2))/65488500+(796564*x^13*tanh(5/2))/383107725-(69928*x^15*tanh(5/2))/638512875+(128*x^17*tanh(5/2))/42567525-(64*x^19*tanh(5/2))/1915538625-(5*x*tanh(3))/286+(1933049*x^3*tanh(3))/18162144-(14119093201*x^5*tanh(3))/81729648000+(4749355073*x^7*tanh(3))/40864824000-(81091903*x^9*tanh(3))/2095632000+(10896041*x^11*tanh(3))/1571724000-(1767109*x^13*tanh(3))/2554051500+(8147*x^15*tanh(3))/212837625-(698*x^17*tanh(3))/638512875+(8*x^19*tanh(3))/638512875+(60*x*tanh(7/2))/17017-(5663*x^3*tanh(7/2))/262548+(2464771*x^5*tanh(7/2))/69498000-(106900847*x^7*tanh(7/2))/4378374000+(44989*x^9*tanh(7/2))/5346000-(25313*x^11*tanh(7/2))/16038000+(45439*x^13*tanh(7/2))/273648375-(14*x^15*tanh(7/2))/1447875+(64*x^17*tanh(7/2))/221524875-(16*x^19*tanh(7/2))/4652022375-(5*x*tanh(4))/9724+(487121*x^3*tanh(4))/154378224-(53447083*x^5*tanh(4))/10216206000+(336140003*x^7*tanh(4))/91945854000-(3039931*x^9*tanh(4))/2357586000+(147211*x^11*tanh(4))/589396500-(157426*x^13*tanh(4))/5746615875+(3208*x^15*tanh(4))/1915538625-(1712*x^17*tanh(4))/32564156625+(64*x^19*tanh(4))/97692469875+(20*x*tanh(9/2))/415701-(11419*x^3*tanh(9/2))/38594556+(5040143*x^5*tanh(9/2))/10216206000-(3558293*x^7*tanh(9/2))/10216206000+(32699*x^9*tanh(9/2))/261954000-(19447*x^11*tanh(9/2))/785862000+(1789*x^13*tanh(9/2))/638512875-(38*x^15*tanh(9/2))/212837625+(64*x^17*tanh(9/2))/10854718875-(16*x^19*tanh(9/2))/206239658625-(x*tanh(5))/461890+(514639*x^3*tanh(5))/38594556000-(364919*x^5*tanh(5))/16345929600+(5839219*x^7*tanh(5))/367783416000-(21713*x^9*tanh(5))/3772137600+(5473*x^11*tanh(5))/4715172000-(619*x^13*tanh(5))/4597292700+(17*x^15*tanh(5))/1915538625-(2*x^17*tanh(5))/6512831325+(8*x^19*tanh(5))/1856156927625 It's very scary lmao but, I try to trans it into 0.9979114*x-0.3195393*x^3+0.1056912*x^5-0.02658724*x^7+0.004606668*x^9-0.0005249908*x^11+0.00003808077*x^13-0.000001675943*x^15+0.0000000405108*x^17-0.000000000410371*x^19 and put it in 'PGFPLOTS': \documentclass{ctexart}\usepackage{tikz}\usepackage{pgfplots,xfp}\begin{figure}[h] \centering \pgfplotsset{width=12cm,height=7cm} \begin{tikzpicture} \begin{axis}[ title={The Runge phenomenon of the function $\tanh x$}, xlabel={$x$}, ylabel={$y$}, axis x line=center, axis y line=center, every inner x axis line/.append style={->}, every inner y axis line/.append style={->}, xmin=-6,xmax=6 ] \addplot[domain=-5:5, samples=800, color=gray,smooth,]{0.9979114*x-0.3195393*x^3+0.1056912*x^5-0.02658724*x^7+0.004606668*x^9-0.0005249908*x^11+0.00003808077*x^13-0.000001675943*x^15+0.0000000405108*x^17-0.000000000410371*x^19}; \addplot[domain=-5.2:5.2,color=black, samples=400,very thick]{tanh(x)}; \end{axis} \end{tikzpicture} \end{figure} and get the figure and this annoying 'saw' if I use the scary one: \documentclass{ctexart}\usepackage{tikz}\usepackage{pgfplots,xfp}\begin{figure}[h] \centering \pgfplotsset{width=12cm,height=7cm} \begin{tikzpicture} \begin{axis}[ title={The Runge phenomenon of the function $\tanh x$}, xlabel={$x$},legend pos = north west, ylabel={$y$}, axis x line=center, axis y line=center, every inner x axis line/.append style={->}, every inner y axis line/.append style={->}, xmin=-6,xmax=6 ] \addplot[domain=-5:5, samples=800, color=gray,smooth,]{(40*x*tanh(1/2))/11-(698249*x^3*tanh(1/2))/87318+(2517135701*x^5*tanh(1/2))/392931000-(8990599279*x^7*tanh(1/2))/3536379000+(666523661*x^9*tanh(1/2))/1178793000-(87882491*x^11*tanh(1/2))/1178793000+(2616454*x^13*tanh(1/2))/442047375-(40708*x^15*tanh(1/2))/147349125+(1024*x^17*tanh(1/2))/147349125-(32*x^19*tanh(1/2))/442047375-(15*x*tanh(1))/11+(1650809*x^3*tanh(1))/232848-(7656977201*x^5*tanh(1))/1047816000+(15347344853*x^7*tanh(1))/4715172000-(269158459*x^9*tanh(1))/349272000+(82887751*x^11*tanh(1))/785862000-(2527141*x^13*tanh(1))/294698250+(6658*x^15*tanh(1))/16372125-(508*x^17*tanh(1))/49116375+(16*x^19*tanh(1))/147349125+(80*x*tanh(3/2))/143-(1827209*x^3*tanh(3/2))/567567+(11431199701*x^5*tanh(3/2))/2554051500-(5986965079*x^7*tanh(3/2))/2554051500+(39926233*x^9*tanh(3/2))/65488500-(17379821*x^11*tanh(3/2))/196465500+(4771412*x^13*tanh(3/2))/638512875-(77416*x^15*tanh(3/2))/212837625+(6016*x^17*tanh(3/2))/638512875-(64*x^19*tanh(3/2))/638512875-(30*x*tanh(2))/143+(1888949*x^3*tanh(2))/1513512-(3240137519*x^5*tanh(2))/1702701000+(17611561711*x^7*tanh(2))/15324309000-(130451323*x^9*tanh(2))/392931000+(1695689*x^11*tanh(2))/32744250-(8810596*x^13*tanh(2))/1915538625+(148112*x^15*tanh(2))/638512875-(1312*x^17*tanh(2))/212837625+(128*x^19*tanh(2))/1915538625+(48*x*tanh(5/2))/715-(9587629*x^3*tanh(5/2))/23648625+(109639993*x^5*tanh(5/2))/170270100-(3194891431*x^7*tanh(5/2))/7662154500+(5165621*x^9*tanh(5/2))/39293100-(1447093*x^11*tanh(5/2))/65488500+(796564*x^13*tanh(5/2))/383107725-(69928*x^15*tanh(5/2))/638512875+(128*x^17*tanh(5/2))/42567525-(64*x^19*tanh(5/2))/1915538625-(5*x*tanh(3))/286+(1933049*x^3*tanh(3))/18162144-(14119093201*x^5*tanh(3))/81729648000+(4749355073*x^7*tanh(3))/40864824000-(81091903*x^9*tanh(3))/2095632000+(10896041*x^11*tanh(3))/1571724000-(1767109*x^13*tanh(3))/2554051500+(8147*x^15*tanh(3))/212837625-(698*x^17*tanh(3))/638512875+(8*x^19*tanh(3))/638512875+(60*x*tanh(7/2))/17017-(5663*x^3*tanh(7/2))/262548+(2464771*x^5*tanh(7/2))/69498000-(106900847*x^7*tanh(7/2))/4378374000+(44989*x^9*tanh(7/2))/5346000-(25313*x^11*tanh(7/2))/16038000+(45439*x^13*tanh(7/2))/273648375-(14*x^15*tanh(7/2))/1447875+(64*x^17*tanh(7/2))/221524875-(16*x^19*tanh(7/2))/4652022375-(5*x*tanh(4))/9724+(487121*x^3*tanh(4))/154378224-(53447083*x^5*tanh(4))/10216206000+(336140003*x^7*tanh(4))/91945854000-(3039931*x^9*tanh(4))/2357586000+(147211*x^11*tanh(4))/589396500-(157426*x^13*tanh(4))/5746615875+(3208*x^15*tanh(4))/1915538625-(1712*x^17*tanh(4))/32564156625+(64*x^19*tanh(4))/97692469875+(20*x*tanh(9/2))/415701-(11419*x^3*tanh(9/2))/38594556+(5040143*x^5*tanh(9/2))/10216206000-(3558293*x^7*tanh(9/2))/10216206000+(32699*x^9*tanh(9/2))/261954000-(19447*x^11*tanh(9/2))/785862000+(1789*x^13*tanh(9/2))/638512875-(38*x^15*tanh(9/2))/212837625+(64*x^17*tanh(9/2))/10854718875-(16*x^19*tanh(9/2))/206239658625-(x*tanh(5))/461890+(514639*x^3*tanh(5))/38594556000-(364919*x^5*tanh(5))/16345929600+(5839219*x^7*tanh(5))/367783416000-(21713*x^9*tanh(5))/3772137600+(5473*x^11*tanh(5))/4715172000-(619*x^13*tanh(5))/4597292700+(17*x^15*tanh(5))/1915538625-(2*x^17*tanh(5))/6512831325+(8*x^19*tanh(5))/1856156927625}; \addplot[domain=-5.2:5.2,color=black, samples=400,very thick]{tanh(x)}; \end{axis} \end{tikzpicture}\end{figure} I get I thaught that it's the precision of PGFPLOTS made this, and how to fix them?

  • Tikzpicture /pfgplots in list of figures:
    by Jules Lecoustre on April 21, 2018 at 9:46 am

    I'm a beginner with LaTeX and i have insert graph, with a csv file and pfgplots But how can i have the title of the graph in the list of figures. Thank you \begin{center} \begin{tikzpicture} \begin{axis}[% title={$U=E-R\cdot I$ représentation graphique}, no markers, xmin=0, xmax=10, ymin=12, ymax=14, ] \draw[<->,thin] (axis cs:9, 12.5625) -- (axis cs:9, 13); \draw[<->,thin] (axis cs:0, 13.125) -- (axis cs:9, 13.125); \node at (axis cs:9.5,12.784){$\Delta U$}; \node [above] at (axis cs:4.5,13.125){$\Delta I$}; \draw [-,semithick,red] (axis cs:0, 13) -- (axis cs:10, 13); \draw [<-,semithick] (axis cs: 4,12.8) -- (axis cs:4,12.75); \draw [->,semithick] (axis cs: 4,12.75) -- (axis cs:5,12.75); \node [below] at (axis cs:4.5,12.75){$\dfrac{dU(I)}{dI}=-R$}; \addplot table [x=I, y=U, col sep=comma] {test.csv}; \end{axis} \end{tikzpicture} \end{center}

  • Circular chemical reaction cascade
    by Dexter on March 9, 2017 at 7:03 am

    I am trying to use tikz-cd package to draw circular chemical reaction cascade. Here is what I have tried so far \documentclass{article} \usepackage{graphicx, tikz-cd} \begin{document} \begin{figure}[h] \centering \begin{tikzpicture}[node distance=3cm] % nodes \node (origin) at (0,0) {}; \node (a) at (4,0) {A}; \node (b) at (2.828,2.828) {B}; \node (c) at (0,4) {C}; \node (d) at (-2.828,2.828) {D}; \node (e) at (-4, 0) {E}; \node (f) at (-2.828,-2.828) {F}; \node (g) at (0,-4) {G}; \node (h) at (2.828, -2.828) {H}; \draw (0, 0) circle [radius = 4cm]; %This element for illustration \draw [->] (a) to[bend right=45] (b); \draw [->] (b) to[bend right=45] (c); \draw [->] (c) to[bend right=45] (d); \draw [->] (d) to[bend right=45] (e); \draw [->] (e) to[bend right=45] (f); \draw [->] (f) to[bend right=45] (g); \draw [->] (g) to[bend right=45] (h); \draw [->] (h) to[bend right=45] (a); \end{tikzpicture} \caption{Caption} \end{figure} \end{document} Which results into something like following, However, I want arrows to be in circular manner. (Aligned to circle which I have drawn for illustration purpose). Also finally I am trying to get reaction cascade like this, Any help will be appreciated ! I tried looking at this post but wasn't sure how to implement here.

  • How to incorporate and scale matplotlib plots in latex using the PGF backend?
    by Nils_M on September 20, 2013 at 3:09 pm

    I am using the pgf backend of matplotlib to generate pgf files which I want to put into my latex document using tikzscale to be able to resize them easily. Example python code: #!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib as mpl mpl.use('pgf') import numpy as np import matplotlib.pyplot as mplp mpl.rcParams['text.latex.unicode']=True mpl.rcParams['text.usetex']=True mpl.rcParams['pgf.texsystem'] = 'pdflatex' fig = mplp.figure() ax = fig.add_subplot(111) x = np.arange(0,2 * np.pi, .1) data = np.sin(x) fmt = {"lw" : 3, "c" : "r", "ls" : '-'} ax.plot(x, data, label=r"sample data with greek $\mu$", **fmt) ax.set_ylabel(r"sample", rotation=0) ax.legend() fig.set_size_inches(1.41,1.) # fig.savefig('./sample.pgf', dpi=500, bbox_inches='tight') fig.savefig('./sample.pgf', dpi=500) Example latex code: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usepackage{tikzscale} \usepackage{pgfplots} \pgfplotsset{compat=1.8} \newcommand{\includepgf}[4] { \begin{figure} \centering \includegraphics{#1} \includegraphics[width=#2\textwidth, height=#2*0.7071428571428572\textwidth]{#1} \includegraphics[width=#2\textwidth, axisratio=0.7071428571428572]{#1} \caption[]{#4} \label{#3} \end{figure} } \begin{document} \includepgf{sample.pgf}{.9}{fig:sample}{Sample Figure} \end{document} Unfortunately the following happens for the three different \includegraphics commands: Works as expected, includes plot in original size Compiles with Package tikzscale Warning: Scaling of sample.pgf's width was only (tikzscale) accurate to 208.59694pt on input line 27. Package tikzscale Warning: Scaling of sample.pgf's height was only (tikzscale) accurate to 147.29488pt on input line 27. no resizing in final pdf file. Does not compile, gives ! Package tikzscale Error: Requested to scale unscalable graphic.

  • Sieve of Eratosthenes in tikz
    by azetina on February 15, 2012 at 7:42 pm

    I am writing notes for my students under the topic of prime factorization and I needed to illustrate the Sieve of Eratosthenes and this is what I came up with in tikz: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=0.65] \draw[very thick,red] (3,9)--(4,10); \draw[very thick,red] (3,10)--(4,9); \draw[very thick,red] (5,9)--(6,10); \draw[very thick,red] (5,10)--(6,9); \draw[very thick,red] (7,9)--(8,10); \draw[very thick,red] (7,10)--(8,9); \draw[very thick,red] (8,9)--(9,10); \draw[very thick,red] (8,10)--(9,9); \draw[very thick,red] (9,9)--(10,10); \draw[very thick,red] (9,10)--(10,9); %------------------------------------ \draw[very thick,red] (1,8)--(2,9); \draw[very thick,red] (2,8)--(1,9); \draw[very thick,red] (3,8)--(4,9); \draw[very thick,red] (4,8)--(3,9); \draw[very thick,red] (4,8)--(5,9); \draw[very thick,red] (5,8)--(4,9); \draw[very thick,red] (5,8)--(6,9); \draw[very thick,red] (6,8)--(5,9); \draw[very thick,red] (7,8)--(8,9); \draw[very thick,red] (8,8)--(7,9); \draw[very thick,red] (9,8)--(10,9); \draw[very thick,red] (10,8)--(9,9); %------------------------------------ \draw[very thick,red] (0,7)--(1,8); \draw[very thick,red] (1,7)--(0,8); \draw[very thick,red] (1,7)--(2,8); \draw[very thick,red] (2,7)--(1,8); \draw[very thick,red] (3,7)--(4,8); \draw[very thick,red] (4,7)--(3,8); \draw[very thick,red] (4,7)--(5,8); \draw[very thick,red] (5,7)--(4,8); \draw[very thick,red] (5,7)--(6,8); \draw[very thick,red] (6,7)--(5,8); \draw[very thick,red] (6,7)--(7,8); \draw[very thick,red] (7,7)--(6,8); \draw[very thick,red] (7,7)--(8,8); \draw[very thick,red] (8,7)--(7,8); \draw[very thick,red] (9,7)--(10,8); \draw[very thick,red] (10,7)--(9,8); %------------------------------------ \draw[very thick,red] (1,6)--(2,7); \draw[very thick,red] (2,6)--(1,7); \draw[very thick,red] (2,6)--(3,7); \draw[very thick,red] (3,6)--(2,7); \draw[very thick,red] (3,6)--(4,7); \draw[very thick,red] (4,6)--(3,7); \draw[very thick,red] (4,6)--(5,7); \draw[very thick,red] (5,6)--(4,7); \draw[very thick,red] (5,6)--(6,7); \draw[very thick,red] (6,6)--(5,7); \draw[very thick,red] (7,6)--(8,7); \draw[very thick,red] (8,6)--(7,7); \draw[very thick,red] (8,6)--(9,7); \draw[very thick,red] (9,6)--(8,7); \draw[very thick,red] (9,6)--(10,7); \draw[very thick,red] (10,6)--(9,7); %------------------------------------ \draw[very thick,red] (1,5)--(2,6); \draw[very thick,red] (2,5)--(1,6); \draw[very thick,red] (3,5)--(4,6); \draw[very thick,red] (4,5)--(3,6); \draw[very thick,red] (4,5)--(5,6); \draw[very thick,red] (5,5)--(4,6); \draw[very thick,red] (5,5)--(6,6); \draw[very thick,red] (6,5)--(5,6); \draw[very thick,red] (7,5)--(8,6); \draw[very thick,red] (8,5)--(7,6); \draw[very thick,red] (8,5)--(9,6); \draw[very thick,red] (9,5)--(8,6); \draw[very thick,red] (9,5)--(10,6); \draw[very thick,red] (10,5)--(9,6); %------------------------------------ \draw[very thick,red] (0,4)--(1,5); \draw[very thick,red] (1,4)--(0,5); \draw[very thick,red] (1,4)--(2,5); \draw[very thick,red] (2,4)--(1,5); \draw[very thick,red] (3,4)--(4,5); \draw[very thick,red] (4,4)--(3,5); \draw[very thick,red] (4,4)--(5,5); \draw[very thick,red] (5,4)--(4,5); \draw[very thick,red] (5,4)--(6,5); \draw[very thick,red] (6,4)--(5,5); \draw[very thick,red] (6,4)--(7,5); \draw[very thick,red] (7,4)--(6,5); \draw[very thick,red] (7,4)--(8,5); \draw[very thick,red] (8,4)--(7,5); \draw[very thick,red] (9,4)--(10,5); \draw[very thick,red] (10,4)--(9,5); %------------------------------------ \draw[very thick,red] (1,3)--(2,4); \draw[very thick,red] (2,3)--(1,4); \draw[very thick,red] (2,3)--(3,4); \draw[very thick,red] (3,3)--(2,4); \draw[very thick,red] (3,3)--(4,4); \draw[very thick,red] (4,3)--(3,4); \draw[very thick,red] (4,3)--(5,4); \draw[very thick,red] (5,3)--(4,4); \draw[very thick,red] (5,3)--(6,4); \draw[very thick,red] (6,3)--(5,4); \draw[very thick,red] (7,3)--(8,4); \draw[very thick,red] (8,3)--(7,4); \draw[very thick,red] (8,3)--(9,4); \draw[very thick,red] (9,3)--(8,4); \draw[very thick,red] (9,3)--(10,4); \draw[very thick,red] (10,3)--(9,4); %------------------------------------ \draw[very thick,red] (1,2)--(2,3); \draw[very thick,red] (2,2)--(1,3); \draw[very thick,red] (3,2)--(4,3); \draw[very thick,red] (4,2)--(3,3); \draw[very thick,red] (4,2)--(5,3); \draw[very thick,red] (5,2)--(4,3); \draw[very thick,red] (5,2)--(6,3); \draw[very thick,red] (6,2)--(5,3); \draw[very thick,red] (6,2)--(7,3); \draw[very thick,red] (7,2)--(6,3); \draw[very thick,red] (7,2)--(8,3); \draw[very thick,red] (8,2)--(7,3); \draw[very thick,red] (9,2)--(10,3); \draw[very thick,red] (10,2)--(9,3); %------------------------------------ \draw[very thick,red] (0,1)--(1,2); \draw[very thick,red] (1,1)--(0,2); \draw[very thick,red] (1,1)--(2,2); \draw[very thick,red] (2,1)--(1,2); \draw[very thick,red] (3,1)--(4,2); \draw[very thick,red] (4,1)--(3,2); \draw[very thick,red] (4,1)--(5,2); \draw[very thick,red] (5,1)--(4,2); \draw[very thick,red] (5,1)--(6,2); \draw[very thick,red] (6,1)--(5,2); \draw[very thick,red] (6,1)--(7,2); \draw[very thick,red] (7,1)--(6,2); \draw[very thick,red] (7,1)--(8,2); \draw[very thick,red] (8,1)--(7,2); \draw[very thick,red] (9,1)--(10,2); \draw[very thick,red] (10,1)--(9,2); %------------------------------------ \draw[very thick,red] (0,0)--(1,1); \draw[very thick,red] (1,0)--(0,1); \draw[very thick,red] (1,0)--(2,1); \draw[very thick,red] (2,0)--(1,1); \draw[very thick,red] (2,0)--(3,1); \draw[very thick,red] (3,0)--(2,1); \draw[very thick,red] (3,0)--(4,1); \draw[very thick,red] (4,0)--(3,1); \draw[very thick,red] (4,0)--(5,1); \draw[very thick,red] (5,0)--(4,1); \draw[very thick,red] (5,0)--(6,1); \draw[very thick,red] (6,0)--(5,1); \draw[very thick,red] (7,0)--(8,1); \draw[very thick,red] (8,0)--(7,1); \draw[very thick,red] (8,0)--(9,1); \draw[very thick,red] (9,0)--(8,1); \draw[very thick,red] (9,0)--(10,1); \draw[very thick,red] (10,0)--(9,1); %------------------------------------ \draw (0,0) grid (10,10); \draw (0.5,9.5) node {}; \draw (1.5,9.5) node {2}; \draw (2.5,9.5) node {3}; \draw (3.5,9.5) node {4}; \draw (4.5,9.5) node {5}; \draw (5.5,9.5) node {6}; \draw (6.5,9.5) node {7}; \draw (7.5,9.5) node {8}; \draw (8.5,9.5) node {9}; \draw (9.5,9.5) node {10}; %-------------------------- \draw (0.5,8.5) node {11}; \draw (1.5,8.5) node {12}; \draw (2.5,8.5) node {13}; \draw (3.5,8.5) node {14}; \draw (4.5,8.5) node {15}; \draw (5.5,8.5) node {16}; \draw (6.5,8.5) node {17}; \draw (7.5,8.5) node {18}; \draw (8.5,8.5) node {19}; \draw (9.5,8.5) node {20}; %-------------------------- \draw (0.5,7.5) node {21}; \draw (1.5,7.5) node {22}; \draw (2.5,7.5) node {23}; \draw (3.5,7.5) node {24}; \draw (4.5,7.5) node {25}; \draw (5.5,7.5) node {26}; \draw (6.5,7.5) node {27}; \draw (7.5,7.5) node {28}; \draw (8.5,7.5) node {29}; \draw (9.5,7.5) node {30}; %-------------------------- \draw (0.5,6.5) node {31}; \draw (1.5,6.5) node {32}; \draw (2.5,6.5) node {33}; \draw (3.5,6.5) node {34}; \draw (4.5,6.5) node {35}; \draw (5.5,6.5) node {36}; \draw (6.5,6.5) node {37}; \draw (7.5,6.5) node {38}; \draw (8.5,6.5) node {39}; \draw (9.5,6.5) node {40}; %-------------------------- \draw (0.5,5.5) node {41}; \draw (1.5,5.5) node {42}; \draw (2.5,5.5) node {43}; \draw (3.5,5.5) node {44}; \draw (4.5,5.5) node {45}; \draw (5.5,5.5) node {46}; \draw (6.5,5.5) node {47}; \draw (7.5,5.5) node {48}; \draw (8.5,5.5) node {49}; \draw (9.5,5.5) node {50}; %-------------------------- \draw (0.5,4.5) node {51}; \draw (1.5,4.5) node {52}; \draw (2.5,4.5) node {53}; \draw (3.5,4.5) node {54}; \draw (4.5,4.5) node {55}; \draw (5.5,4.5) node {56}; \draw (6.5,4.5) node {57}; \draw (7.5,4.5) node {58}; \draw (8.5,4.5) node {59}; \draw (9.5,4.5) node {60}; %-------------------------- \draw (0.5,3.5) node {61}; \draw (1.5,3.5) node {62}; \draw (2.5,3.5) node {63}; \draw (3.5,3.5) node {64}; \draw (4.5,3.5) node {65}; \draw (5.5,3.5) node {66}; \draw (6.5,3.5) node {67}; \draw (7.5,3.5) node {68}; \draw (8.5,3.5) node {69}; \draw (9.5,3.5) node {60}; %-------------------------- \draw (0.5,2.5) node {71}; \draw (1.5,2.5) node {72}; \draw (2.5,2.5) node {73}; \draw (3.5,2.5) node {74}; \draw (4.5,2.5) node {75}; \draw (5.5,2.5) node {76}; \draw (6.5,2.5) node {77}; \draw (7.5,2.5) node {78}; \draw (8.5,2.5) node {79}; \draw (9.5,2.5) node {80}; %-------------------------- \draw (0.5,1.5) node {81}; \draw (1.5,1.5) node {82}; \draw (2.5,1.5) node {83}; \draw (3.5,1.5) node {84}; \draw (4.5,1.5) node {85}; \draw (5.5,1.5) node {86}; \draw (6.5,1.5) node {87}; \draw (7.5,1.5) node {88}; \draw (8.5,1.5) node {89}; \draw (9.5,1.5) node {90}; %-------------------------- \draw (0.5,0.5) node {91}; \draw (1.5,0.5) node {92}; \draw (2.5,0.5) node {93}; \draw (3.5,0.5) node {94}; \draw (4.5,0.5) node {95}; \draw (5.5,0.5) node {96}; \draw (6.5,0.5) node {97}; \draw (7.5,0.5) node {98}; \draw (8.5,0.5) node {99}; \draw (9.5,0.5) node {100}; \end{tikzpicture} \end{document} This is what results: Evidently it is not the most suitable way and it took me a while to get it right. I know there is a less tedious way of doing it but for the moment this is what I have to deal with. If anyone can assist me with the matter I would appreciate it. Something tells me that a \foreach would suffice but I still don't know its implementation.

  • How to use every plot with TikZ
    by Alain Matthes on January 2, 2012 at 6:15 pm

    In the paragraph about gnuplot in the pgfmanual, I read this : The following styles influence the plot: /tikz/every plot (style, initially empty) This style is installed in each plot, that is, as if you always said plot[every plot,...] This is most useful for globally setting a prefix for all plots by saying: \tikzset{every plot/.style={prefix=plots/}} I try this with no succes. \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[domain=0:4,every plot/.style={green,ultra thick}] \draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9); \draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$}; \draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$}; \draw plot[id=x] function{x} node[right] {$f(x) =x$}; \draw plot[id=sin] function{sin(x)} node[right] {$f(x) = \sin x$}; \draw plot[id=exp] function{0.05*exp(x)} node[right] {$f(x) = \frac{1}{20} \mathrm e^x$}; \end{tikzpicture} \end{document}

  • What You See is What You Get (WYSIWYG) for PGF/TikZ?
    by Amelio Vazquez-Reina on July 27, 2011 at 3:30 pm

    Are there any WYSIWYG editors for PGF/TikZ? Perhaps something similar to LyX but for PGF/TikZ? If there is no WYSIWYG editor for this tandem, is there one perhaps that allows the user to easily generate PGF/TikZ templates? Alternatively, how can I most easily generate PGF/TikZ code from a visual conception? Do people mostly code their PGF/TikZ graphics from scratch?