• 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}

  • How to position TikZ shapes directly centered under text labels in a table-like layout?
    by Oregon Math Tutor on January 23, 2026 at 7:13 pm

    I'm creating a geometry reference sheet with a table-like layout using TikZ. I need: the shape label horizontally centered in the cell each figure centered beneath the label As the image shows, I can't achieve this alignment. This image shows my desired output: This image (partial screen shot) shows what the current code renders: Current approach: Using \node for labels positioned with anchor=east Drawing shapes inside \begin{scope}[shift={...}] blocks Each row has a label on the left, shape in the middle-left, and properties on the right Thanks very much for taking time to assist me! mwe: \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{amssymb} \usetikzlibrary{calc, shapes.geometric, arrows.meta, decorations.markings} % Use Helvetica (similar to Arial) for a clean look since custom fonts caused errors \usepackage{helvet} \renewcommand{\familydefault}{\sfdefault} % Define colors to match the original image \definecolor{colSquare}{RGB}{156, 188, 156} % Muted Green \definecolor{colRect}{RGB}{128, 128, 128} % Greyish \definecolor{colPara}{RGB}{255, 105, 120} % Pink/Red \definecolor{colRhom}{RGB}{190, 140, 190} % Purple \definecolor{colKite}{RGB}{180, 230, 200} % Mint Green \definecolor{colTrap}{RGB}{245, 170, 60} % Orange \definecolor{colText}{RGB}{128, 0, 128} % Purple text for headers \definecolor{colLine}{RGB}{70, 130, 180} % Blue grid lines \begin{document} \begin{tikzpicture}[ thick, % Style for shape outlines myshape/.style={draw=black, line width=1pt}, % Custom tick marks for sides tick/.style={postaction={decorate, decoration={markings, mark=at position 0.5 with {\draw[black, line width=1pt] (-2.5pt,-2.5pt) -- (2.5pt,2.5pt);}}}}, dtick/.style={postaction={decorate, decoration={markings, mark=at position 0.5 with {\draw[black, line width=1pt] (-1.5pt,-2.5pt) -- (2.5pt,2.5pt) (-4.5pt,-2.5pt) -- (-0.5pt,2.5pt);}}}}, % Custom arrows for parallel lines parrow/.style={postaction={decorate, decoration={markings, mark=at position 0.55 with {\arrow[scale=1.5,black]{>}}}}} ] % --- Grid Layout --- % Horizontal lines \draw[colLine] (-4, 1.5) -- (12, 1.5); \draw[colLine] (-4, 0) -- (12, 0); \draw[colLine] (-4, -4) -- (12, -4); \draw[colLine] (-4, -8) -- (12, -8); \draw[colLine] (-4, -12) -- (12, -12); \draw[colLine] (-4, -16) -- (12, -16); \draw[colLine] (-4, -20) -- (12, -20); \draw[colLine] (-4, -24) -- (12, -24); % Vertical separator \draw[colLine] (3.5, 1.5) -- (3.5, -24); % Headers \node[text=colText, scale=2] at (-0.25, 0.75) {Shape}; \node[text=colText, scale=2] at (7.75, 0.75) {Properties}; % --- Row 1: Square --- \begin{scope}[shift={(0,-2)}] \node[text=colText, scale=1.5, anchor=east] at (2,0) {Square}; \coordinate (S1) at (2.5, -1.2); \coordinate (S2) at (4.9, -1.2); \coordinate (S3) at (4.9, 1.2); \coordinate (S4) at (2.5, 1.2); \fill[colSquare] (S1) -- (S2) -- (S3) -- (S4) -- cycle; % Ticks drawn manually to ensure rotation alignment looks just like the image \draw[myshape] (S1) -- (S2) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S2) -- (S3) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S3) -- (S4) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (S4) -- (S1) node[midway, sloped] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw (S1) -- (S3); \draw (S2) -- (S4); % Right angle at center \draw (3.7,0) ++(0.2,0.2) -- ++(-0.2,0.2) -- ++(-0.2,-0.2); % Corner right angles \draw (S1) ++(0.3,0) -- ++(0,0.3) -- ++(-0.3,0); \draw (S2) ++(-0.3,0) -- ++(0,0.3) -- ++(0.3,0); \draw (S3) ++(-0.3,0) -- ++(0,-0.3) -- ++(0.3,0); \draw (S4) ++(0.3,0) -- ++(0,-0.3) -- ++(-0.3,0); \node[anchor=west, align=left] at (4.2, 0) { \begin{minipage}{8cm} \begin{itemize} \setlength\itemsep{0.2em} \item All sides are equal. \item All angles are $90^\circ$. \item Diagonals are equal. \item Diagonals bisect at $90^\circ$. \end{itemize} \end{minipage} }; \end{scope} % --- Row 2: Rectangle --- \begin{scope}[shift={(0,-6)}] \node[text=colText, scale=1.5, anchor=east] at (2,0) {Rectangle}; \coordinate (R1) at (2.5, -0.9); \coordinate (R2) at (5.0, -0.9); \coordinate (R3) at (5.0, 0.9); \coordinate (R4) at (2.5, 0.9); \fill[colRect] (R1) -- (R2) -- (R3) -- (R4) -- cycle; % Sides ticks \draw[myshape] (R1) -- (R2) node[midway] {\tikz \draw[line width=1pt] (-1.5pt,-2.5pt)--(2.5pt,2.5pt) (-4.5pt,-2.5pt)--(-0.5pt,2.5pt);}; \draw[myshape] (R2) -- (R3) node[midway] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw[myshape] (R3) -- (R4) node[midway] {\tikz \draw[line width=1pt] (-1.5pt,-2.5pt)--(2.5pt,2.5pt) (-4.5pt,-2.5pt)--(-0.5pt,2.5pt);}; \draw[myshape] (R4) -- (R1) node[midway] {\tikz \draw[line width=1pt] (-2.5pt,-2.5pt)--(2.5pt,2.5pt);}; \draw (R1) -- (R3); \draw (R2) -- (R4); % Corners \draw (R1) ++(0.2,0) -- ++(0,0.2) -- ++(-0.2,0); \draw (R2) ++(-0.2,0) -- ++(0,0.2) -- ++(0.2,0); \draw (R3) ++(-0.2,0) -- ++(0,-0.2) -- ++(0.2,0); \draw (R4) ++(0.2,0) -- ++(0,-0.2) -- ++(-0.2,0); % Diagonal marks (triple tick) % Manually drawing triple ticks on diagonals \draw[line width=0.8pt] (3.2, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.3, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.4, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.1, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.2, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (4.3, 0.1) -- ++(0.1,0.2); \draw[line width=0.8pt] (3.2, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (3.3, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (3.4, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.1, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.2, -0.1) -- ++(0.1,-0.2); \draw[line width=0.8pt] (4.3, -0.1) -- ++(0.1,-0.2); \node[anchor=west, align=left] at (4.2, 0) { \begin{minipage}{8cm} \begin{itemize} \setlength\itemsep{0.2em} \item Opposite sides are equal. \item All angles are $90^\circ$. \item Diagonals are equal. \item Diagonals bisect each other. \end{itemize} \end{minipage} }; \end{scope} \end{tikzpicture} \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)?

  • circuitikz: 'muxdemux' with exact same dimensions as an 'european resistor (inductor)'
    by cis on January 23, 2026 at 3:01 pm

    Just out of interesst, I asked myself how to configure a muxdemux such that it has the exact same dimensions as an european resistor (european inductor), but with three muxdemux-pins on the underside. (Note: The exact target image is attached.) Here is my approach: \documentclass[border=5pt]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[european resistors, IPP/.style={muxdemux, muxdemux def={Lh=0.8, Rh=0.8, NL=1, NR=1, NB=3, NT=0, w=2}, %muxdemux label={B2=abc, BL1=1, BL2=2, BL3=3,}, %external pins width=0.4, circuitikz/muxdemuxes/fill=gray!25, }, ] \node [IPP, align=center](A) at (0,0) {}; \draw[] (-1,0.5) to[R, fill=gray!25] +(2,0); \end{circuitikz} \end{document}

  • TikZ Feynman W loop with Z radiation
    by Beth Long on January 23, 2026 at 12:55 pm

    I want to make the following diagram: But this: \documentclass[a4paper,12pt]{article} \usepackage[compat=1.1.0]{tikz-feynman} \usepackage{xcolor} \definecolor{uctgreen}{rgb}{0,0.45,0} \newcommand\uct[0]{{\color{uctgreen}{u}\color{red}{c}\color{blue}{t}}} \tikzfeynmanset{ every diagram={very thick}, } \begin{document} \resizebox{5cm}{5cm}{ \begin{tikzpicture}[yscale=0.7, xscale=1.4] \begin{feynman} % ~~~ defining the vertices ~~~~~~ \vertex (i1) ; \vertex[below right=of i1] (v1); \vertex[ right=of v1] (v2); \vertex[above right=of v2] (o1); % ~~~ Z-related ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \vertex at ($(v1)!.5!(v2) - (0,15mm)$) (v3); % middle, below \vertex[below=1cm of v3] (v4); % <<< Z "length" % ~~~ lower part ~~~~~~~~~~~~~~ \vertex[below left = 2cm of v4] (i2); % one way to modify \vertex[below right= 2cm of v4] (o2); % ~~~ drawing this diagram ~~~~~~~~~~~~~~~~~~~~~ \diagram*{ {[edges={fermion}](i1) --[edge label=s] (v1) --[edge label=\uct] (v2) --[edge label=d] (o1)}, (v1) --[photon, half right, edge label'=W] (v2), (v3) --[photon, edge label'=Z] (v4), {[edges={fermion}](i2) --[edge label'=$\nu$] (v4) --[edge label'=$\nu$] (o2)}, }; \end{feynman} \end{tikzpicture} } \end{document} produces this: How can I add labels to both sides of the W and make the W-Z vertex match up?

  • How to fill between decoratedpath to draw a rope in physics? I don't want those gray areas to be seen
    by Anastasios on January 23, 2026 at 9:36 am

    \documentclass[12pt,a4paper,twoside]{report} \usepackage[english,greek]{babel} \usepackage[iso-8859-7]{inputenc} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsxtra} \usepackage{mathtools} \usepackage{fix-cm} \usepackage{graphicx} \usepackage{braket} \usepackage{tikz} \usepackage{framed} \usepackage{mdframed} \usepackage{pgffor} \usepackage{xcolor} \usetikzlibrary{plotmarks} \usepackage{pgfplots} \usetikzlibrary{arrows,shapes,positioning} \colorlet{shadecolor}{gray!20} \usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,matrix} \usetikzlibrary{decorations.pathmorphing,patterns} \usetikzlibrary{calc,patterns,decorations.markings} \usetikzlibrary{positioning} \usepackage{tikz,tikz-3dplot} \usetikzlibrary{fadings} \usetikzlibrary{shapes.geometric} \usepackage[left=1cm, right=1.2cm, top=2.5cm, bottom=1.5cm, includefoot, headheight=14.5pt]{geometry} \begin{document} \begin{center}{\begin{tikzpicture} \tikzstyle{platform}=[fill,pattern=north east lines,draw=none,minimum width=4cm,minimum height=0.3cm] \shade[ball color=gray!20] (0,0) circle (1.5); \draw[thick,double](0,0) circle (1.5); \draw[decorate,decoration={markings, mark=between positions 1mm and \pgfdecoratedpathlength-1.5mm step 1.5mm with {\draw[thick,black,fill=white] (-2.5mm,-0.5mm) to[out=0,in=160] (-1.5mm,-0.5mm) to[out=-20,in=160] (1.5mm,0.5mm) to[out=-20,in=180] (2.5mm,0.5mm); }}] (0,0.75) -- (4,0.75); \draw[thick,double](0,0) circle (0.75); \node[circle,draw,black,scale=0.3,fill=white] (b) at (3.8,0.75) {}; \node at (3.8,1){A}; \shade[ball color=white] (0,0) circle (0.71); \draw[thick,white,-stealth'](0,0)--(1.05,-1.05)node[pos=0.8,above]{${\ R}$}; \draw[thick,-stealth'](0,0)--(-0.63,-0.33)node[pos=0.3,below]{${ r}$}; \node [platform,anchor=south] at (0,-1.85) {}; \draw[thick,-](-2,-1.55)--(2,-1.55); \node[circle,draw,black,scale=0.2,fill=white] (b) at (0,0) {}; \end{tikzpicture} }\end{center} \end{document}

  • Shuffle the puzzle pieces in TikZ interactive puzzle game (based on this TeX.SX project)
    by fsbmat on January 23, 2026 at 12:59 am

    I’ve been working on a variation of the interactive puzzle from this excellent post on TeX StackExchange: 🔗 The TikZ Game Package – a TeX.SX Project ❓Goal I'd like to shuffle the pieces of the puzzle at the start (instead of them being in order) and still keep the interactive movement functionality working (i.e. clicking tiles to move them like a sliding puzzle). ✅ What I have working The puzzle layout builds correctly using TikZ, ocgx2, and media9. I implemented a manual shuffle using a LaTeX macro (\ShuffleIndex) to define the tile order. The initial view of the puzzle shows the image shuffled correctly. ❌ What is broken The JavaScript interaction no longer works after applying the shuffle. Clicking on the tiles gives an error: ReferenceError: onButtonClick is not defined It seems the function is not visible globally or the OCGs are not properly indexed. 💡 What I'm asking Would anyone be able to: Help fix the JavaScript so it works with the shuffled layout? Or alternatively — provide a working example based on the original post, but with the puzzle pieces already shuffled at start? 📎 What I’ve tried Here’s my current version (almost working, but with JS errors): \documentclass[tikz,margin=1mm]{standalone} \usepackage{xsavebox} \usepackage[tikz]{ocgx2} \usepackage{media9} \usepackage{multido} \usepackage{xcolor}\pagecolor{gray} \usepackage{multido} \usepackage{ifluatex} \ifluatex\def\pdfpageattr{\pdfvariable pageattr}\fi \usepackage{tikzmarmots} % imagem base \begin{xlrbox}{Image} \begin{tikzpicture} \useasboundingbox (0,0) rectangle (4.4,4.4); \node at (2.2,2.2) {\tikz\marmot[scale=2.1];}; \end{tikzpicture} \end{xlrbox} % peças do puzzle \multido{\nX=0+1.1,\iI=0+1}{4}{% \multido{\nY=3.3+-1.1,\iJ=0+1}{4}{% \ifnum\numexpr\iI+\iJ\relax>0 \begin{xlrbox}{Image.\the\numexpr\iI+\iJ*4\relax} \begin{tikzpicture} \clip (\nX,\nY) rectangle ++(1.1,1.1); \node[anchor=south west,inner sep=0pt] at (0,0) {\theImage}; \end{tikzpicture} \end{xlrbox} \fi } } \newcommand\MyStatus[2]{\ifnum#1=#2 visible\else invisible\fi} % JavaScript \pdfpageattr{ /AA << /O << /S/JavaScript /JS ( var tile=[], oldTile=[]; for(var i=0;i<4;i++){ tile[i]=[]; oldTile[i]=[]; for(var j=0;j<4;j++){ tile[i][j]=[]; oldTile[i][j]=i+j*4-1; } } var ocg=this.getOCGs(this.pageNum); for(var k in ocg){ var n=ocg[k].name.split('.'); tile[n[0]][n[1]][n[2]-1]=ocg[k]; } var si=0,sj=0; function onButtonClick(i,j){ if(si==i && sj!=j){ for(var y=sj;y!=j;sj<j?y++:y--){ if(y!=sj) tile[i][y][oldTile[i][y]].state=false; oldTile[i][y]=oldTile[i][sj<j?y+1:y-1]; tile[i][y][oldTile[i][y]].state=true; } } else if(sj==j && si!=i){ for(var x=si;x!=i;si<i?x++:x--){ if(x!=si) tile[x][j][oldTile[x][j]].state=false; oldTile[x][j]=oldTile[si<i?x+1:x-1][j]; tile[x][j][oldTile[x][j]].state=true; } } if(si==i||sj==j){ if(oldTile[i][j]>-1) tile[i][j][oldTile[i][j]].state=false; oldTile[i][j]=-1; si=i; sj=j; } } ) >> >> } \def\ShuffleIndex#1{% \csname ShuffleValue#1\endcsname% } \expandafter\def\csname ShuffleValue0\endcsname{5} \expandafter\def\csname ShuffleValue1\endcsname{12} \expandafter\def\csname ShuffleValue2\endcsname{3} \expandafter\def\csname ShuffleValue3\endcsname{14} \expandafter\def\csname ShuffleValue4\endcsname{1} \expandafter\def\csname ShuffleValue5\endcsname{6} \expandafter\def\csname ShuffleValue6\endcsname{11} \expandafter\def\csname ShuffleValue7\endcsname{9} \expandafter\def\csname ShuffleValue8\endcsname{8} \expandafter\def\csname ShuffleValue9\endcsname{2} \expandafter\def\csname ShuffleValue10\endcsname{7} \expandafter\def\csname ShuffleValue11\endcsname{10} \expandafter\def\csname ShuffleValue12\endcsname{15} \expandafter\def\csname ShuffleValue13\endcsname{4} \expandafter\def\csname ShuffleValue14\endcsname{13} \expandafter\def\csname ShuffleValue15\endcsname{0} \begin{document} \newcount\shufcount \shufcount=0 \begin{tikzpicture} \multido{\nX=0+1.1,\iI=0+1}{4}{% \multido{\nY=3.3+-1.1,\iJ=0+1}{4}{% \edef\CellIndex{\the\numexpr\iI+\iJ*4\relax}% \edef\RandIndex{\ShuffleIndex{\CellIndex}}% \multido{\iK=1+1}{15}{% \begin{scope}[ocg={ref=\iI.\iJ.\iK,% status=\MyStatus{\ShuffleIndex{\the\numexpr\iI+\iJ*4\relax}}{\iK}}]% \node[anchor=south west,inner sep=0pt]% at (\nX,\nY) {\xusebox{Image.\iK}};% \end{scope}% }% \draw[line width=0,% postaction={% path picture={% \node[anchor=south west,inner sep=0pt]% at (path picture bounding box.south west)% {\mediabutton[jsaction={onButtonClick(\iI,\iJ);}]{% \tikz \useasboundingbox% (path picture bounding box.south west)% rectangle% (path picture bounding box.north east);}};% }% }]% (\nX,\nY) rectangle ++(1.1,1.1);% }% }% \end{tikzpicture} \end{document} I’d appreciate any tips or corrections. If I’m handling the OCG indexing or JavaScript scope wrong, please let me know how to fix it. Thanks in advance!

  • Speeding up compilation for the most complete Karnaugh maps package [closed]
    by Signor Pizza on January 22, 2026 at 12:59 pm

    I found this to be the most complete package, which is why I insist on using it. I compiled all available LaTeX packages from source last month so I'm also confident I have everything up to date and working. In the docs it recommends this program to produce .tex files: I definitely got a file to succeed, but it really did take very long (probably at least 10 minutes), and I noticed only 1 of my 8 CPU cores was being used. Does that mean I have to divide the file up, so at least every CPU core works on one piece? I heard LaTeX doesn't support multi-core operation. For reference, here is a .tex file I have just generated. This is where it typically gets stuck on in the CLI: yalihupokn@zoqu-endiman:~/Downloads$ latex fine.tex This is pdfTeX, Version 3.141592653-2.6-1.40.28 (TeX Live 2025) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./fine.tex LaTeX2e <2025-11-01> L3 programming layer <2025-12-29> (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/base/article.cl s Document Class: article 2025/01/22 v1.4n Standard LaTeX document class (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/base/size10.clo )) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/lm/lmodern.sty) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/base/fontenc.st y (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/lm/t1lmr.fd)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/base/inputenc.s ty) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/amsmath/amsmath .sty For additional information on amsmath, use the `?' option. (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/amsmath/amstext .sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/amsmath/amsgen. sty)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/amsmath/amsbsy. sty) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/amsmath/amsopn. sty)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/xcolor/xcolor.s ty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/graphics-cfg/co lor.cfg) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/graphics-def/dv ips.def) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/graphics/mathco lor.ltx)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/colortbl/colort bl.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/tools/array.sty )) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/pgf/frontendlay er/tikz.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/pgf/basiclayer/ pgf.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/pgf/utilities/p gfrcs.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/utilities /pgfutil-common.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/utilities /pgfutil-latex.def) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/utilities /pgfrcs.code.tex (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/pgf.revis ion.tex))) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/pgf/basiclayer/ pgfcore.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/graphics/graphi cx.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/graphics/keyval .sty) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/graphics/graphi cs.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/graphics/trig.s ty) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/graphics-cfg/gr aphics.cfg))) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/pgf/systemlayer /pgfsys.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/systemlay er/pgfsys.code.tex (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/utilities /pgfkeys.code.tex (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/utilities /pgfkeyslibraryfiltered.code.tex)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/systemlay er/pgf.cfg) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/systemlay er/pgfsys-dvips.def (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/systemlay er/pgfsys-common-postscript.def))) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/systemlay er/pgfsyssoftpath.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/systemlay er/pgfsysprotocol.code.tex)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcore.code.tex (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm ath.code.tex (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athutil.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athparser.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athfunctions.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athfunctions.basic.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athfunctions.trigonometric.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athfunctions.random.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athfunctions.comparison.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athfunctions.base.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athfunctions.round.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athfunctions.misc.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athfunctions.integerarithmetics.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athcalc.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm athfloat.code.tex)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfi nt.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcorepoints.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcorepathconstruct.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcorepathusage.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcorescopes.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcoregraphicstate.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcoretransformations.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcorequick.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcoreobjects.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcorepathprocessing.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcorearrows.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcoreshade.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcoreimage.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcoreexternal.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcorelayers.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcoretransparency.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcorepatterns.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcorerdf.code.tex))) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/modules/p gfmoduleshapes.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/modules/p gfmoduleplot.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/pgf/compatibili ty/pgfcomp-version-0-65.sty) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/pgf/compatibili ty/pgfcomp-version-1-18.sty)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/pgf/utilities/p gffor.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/pgf/utilities/p gfkeys.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/utilities /pgfkeys.code.tex)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/pgf/math/pgfmat h.sty (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/math/pgfm ath.code.tex)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/utilities /pgffor.code.tex)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/frontendl ayer/tikz/tikz.code.tex (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/libraries /pgflibraryplothandlers.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/modules/p gfmodulematrix.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/frontendl ayer/tikz/libraries/tikzlibrarytopaths.code.tex))) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/tikz-karnaugh/t ikzlibrarykarnaugh.code.tex Macros for typesetting Karnaugh maps Version 1.5 of 15 February 2022 by Luis Paulo Laus, laus@utfpr.edu.br ) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/tikz-ladder/tik zlibrarycircuits.plc.ladder.code.tex (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/frontendl ayer/tikz/libraries/circuits/tikzlibrarycircuits.code.tex (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/frontendl ayer/tikz/libraries/tikzlibrarycalc.code.tex) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/frontendl ayer/tikz/libraries/tikzlibrarydecorations.markings.code.tex (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/frontendl ayer/tikz/libraries/tikzlibrarydecorations.code.tex (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/modules/p gfmoduledecorations.code.tex)) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/libraries /decorations/pgflibrarydecorations.markings.code.tex)))) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/l3backend/l3bac kend-dvips.def) LaTeX Warning: Unused global option(s): [british]. (./fine.aux) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/lm/ot1lmr.fd) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/lm/omllmm.fd) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/lm/omslmsy.fd) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/latex/lm/omxlmex.fd) [1] There's also some extra info in the log file: yalihupokn@zoqu-endiman:/tmp/tmp.nsHFUeQUSU$ tail -f fine.log File: pgfcoreshade.code.tex 2025-08-29 v3.1.11a (3.1.11a) \pgf@max=\dimen198 \pgf@sys@shading@range@num=\count307 \pgf@shadingcount=\count308 ) (/home/yalihupokn/install-tl-20260102/2025/texmf-dist/tex/generic/pgf/basiclaye r/pgfcoreimage.code.tex File: pgfcoreimage.code.tex 2025-08-29 v3.1.11a (3.1.11a) ) (/home/yalihupokn/install-tl-2 This is what I see when I try to stop it: [1]^C ! Interruption. <argument> ...node [right] at (4.1,2) {\ifnum \mm =1 $A = {\color {blue}X\,\... l.92 } ? ^C^C^C^C^C^C^C^C^C^H^H^C^C^C^C^C^C

  • How to top-align a TikZ image node with a text node in Beamer
    by Marco Moldenhauer on January 21, 2026 at 9:41 pm

    I am using TikZ in a Beamer slide to create a two-column layout: the left column contains a justified text block the right column contains an image inside a framed node Both nodes should be top-aligned, so that the top of the image frame aligns exactly with the top of the text block. However, my current code aligns the image relative to the center or east anchor of the text node, which causes a vertical misalignment when the text height changes. I would like the image frame to be aligned with the top edge of the text block, regardless of the text height. Question How can I position the image node so that its top edge is aligned with the top edge of the text node, independent of the text height? Which anchors or positioning keys should be used in TikZ to achieve reliable top alignment in this situation? My Code % !TeX TS-program = lualatex \documentclass{beamer} \usetheme[progressbar=frametitle]{moloch} \usepackage{tikz} \usetikzlibrary{positioning} \usepackage{lipsum} \begin{document} \begin{frame}{Your Title} \begin{tikzpicture}[ TEXTBLOCK/.style={ rectangle, draw=blue!50, fill=blue!20, thick, text width=0.45\textwidth, align=justify, inner sep=0mm }, IMAGEFRAME/.style={ rectangle, draw=blue!50, thick, inner sep=3mm, text width=0.45\textwidth, align=center } ] % --- Text block --- \node[TEXTBLOCK, anchor=north west] (TB1) at (0,0){\lipsum[1][1-6]}; % --- Image frame --- \node[IMAGEFRAME, anchor=north west, inner sep=0mm, right=6mm of TB1.east] (IMG1) {\includegraphics[width=\linewidth]{example-image}}; \end{tikzpicture} \end{frame} \end{document} My Output Desired Output

  • Plotting a rational function in tikz
    by mf67 on January 21, 2026 at 9:17 pm

    I'm trying to plot a rational function, but I constantly get dimensions too large, even if the plot frame is within the page and the function is within limits. \documentclass{book} \usepackage{pgf,tikz,pgfplots} \pgfplotsset{compat=1.15} \begin{document} \begin{tikzpicture}[declare function={r(\x)=(-\x*\x*\x*\x+600*\x*\x*\x-135000*\x*\x+10125000*\x)/(2109375*(30000-200*\x));}] \begin{axis}[ x=0.05cm,y=1cm, xmin=0, xmax=160, ymin=0, ymax=1, xlabel={\(x\)}, ylabel={\(y\)} ] \draw[domain=0:160,smooth,samples=100] plot ({\x},{r(\x)}); \end{axis} \end{tikzpicture} \end{document} What could be wrong? TIA. This is how the graph looks in Mathematica

  • Include a pdf image 4"x4" on book front cover using \bookcovercomponent
    by josh on January 21, 2026 at 7:15 pm

    I am designing a book cover using bookcover documentclass and would like to add a 4"x4" pdf graphics file in the center of the cover. The cover format is: Title at top, Edition, the graphics image, author name. I've tried using tikzpicture to insert the pdf (lines commented below) but receive lots of error messages was wondering if someone could help me? Here is my code so far: \documentclass[12pt, coverwidth=9.444in, coverheight=12.5in, bleedwidth=17mm, foldingmargin=false, markthick=0.0pt, marklength=7mm,% Markierungen: for printing: set to 0mm spinewidth=20mm, %pagecolor=Beige, trimmed=false% trimmed=false for printing ]{bookcover} \usepackage[cmintegrals,cmbraces]{newtxmath} \usepackage{ebgaramond-maths} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{bbding} \usepackage[x11names,dvipsnames,svgnames]{xcolor} \usepackage[ngerman]{babel} % \usepackage{tikz} % It is loaded by bookcover % \usepackage{calc} % It is loaded by bookcover \usepackage{microtype} \setlength{\marklength}{0pt} \geometry{% paperwidth=\coverwidth, paperheight=\coverheight, left=-\bleedwidth-\coverwidth-\spinewidth, top=-\bleedwidth, } \begin{document} \begin{bookcover} \bookcovercomponent{color}{bg whole}{ % Use "bg whole" instead of "whole page" top color=LightBlue, bottom color=LightBlue} % % Title % \bookcovercomponent{normal}{front}[55mm,10mm,10mm,30mm]{ {\fontsize{48}{48}\selectfont \bfseries This is the title of } } \bookcovercomponent{normal}{front}[55mm,10mm,10mm,50mm]{ {\fontsize{48}{48}\selectfont \bfseries the book on multiple } } \bookcovercomponent{normal}{front}[55mm,10mm,10mm,70mm]{ {\fontsize{48}{48}\selectfont \bfseries lines } } % % Edition % \bookcovercomponent{normal}{front}[100mm,10mm,10mm,90mm]{ {\fontsize{30}{30}\selectfont \bfseries First Edition } } % % place 4"x4" graphics image here % %\bookcovercomponent{normal}{front}{ % \begin{tikzpicture} % % Center of the panel is (\width/2, \height/2) % \node[anchor=center] at ({\width/2},{\height/2}) { % \includegraphics[width=0.8\width]{aBookFrontCoverGraphics.pdf} % }; % \end{tikzpicture} %} % % Author's name % \bookcovercomponent{normal}{front}[100mm,10mm,10mm,280mm]{ {\fontsize{24}{24}\selectfont \bfseries Author's Name } } % % spine % \bookcovercomponent{normal}{spine}[2mm,2mm,2mm,2mm]{% \vspace*{30mm}\centering\rotatebox{90}{\huge\textcolor{NavyBlue}{Authors Name} \qquad Title}} % % back cover % \bookcovercomponent{normal}{back}[15mm,10mm,15mm,10mm]{Some back cover text...} \end{bookcover} \end{document}

  • Positioning of ellipsis between nodes
    by Mohan Radhakrishnan on January 21, 2026 at 9:46 am

    I am trying to add ellipsis between b4 and bn and also between the 4th and last boxes at the end(child pointers). Hope I have included all libraries so that the MWE doesn't break. This is part of a larger document. The bn doesn't have a background properly. The dots are not there as there is no space between b4 and bn and similarly between the last and previous child pointer boxes. I am using this code design based on some examples as it seems to suit the requirement. \usetikzlibrary{fit,positioning,calc,arrows} \usepackage{pgfplots} \usetikzlibrary{backgrounds} \usetikzlibrary{calc, shapes.geometric} \tikzset{ my/.style={ draw=gray,thick,fill=gray!40,minimum height=1.5cm,minimum width=1.5cm,font={\Huge\bfseries} }, >=latex } \begin{tikzpicture}[font=\sffamily, node distance=0.2cm and 0.2cm] \node[my] (b111) {$b_1$}; \node[my,right=of b111] (b112) {$b_2$}; \node[my,right=of b112] (b113) {$b_3$}; \node[my,right=of b113] (b114) {$b_4$}; \node[draw=none,right=of b114] (ellipsis1) {$\cdots$}; \node[my,right=1cm of b114] (bn) {$b_n$}; \node[my,right= 1cm of bn] (b115) {}; \node[my,right=of b115] (b116) {}; \node[my,right=of b116] (b117) {}; \node[my,right=of b117] (b118) {}; \node[draw=none,right=of b118] (ellipsis1) {$\cdots$}; \node[my,right=1cm of b118] (bn) {}; \begin{pgfonlayer}{background} \node[draw=black,thick,fill=gray!30,fit=(b111)] {}; \node[draw=black,thick,fill=gray!30,fit=(b112)] {}; \node[my,anchor=west] at (0,3) (pk1){Partial Keys\strut}; \node[draw=black,thick,fill=gray!30,fit=(b113)] {}; \node[draw=black,thick,fill=gray!30,fit=(b114)] {}; \node[draw=black,thick,fill=gray!30,fit=(bn)] {}; \node[draw=black,thick,fit=(b115)] {}; \node[draw=black,thick,fit=(b116)] {}; \node[draw=black,thick,fit=(b117)] {}; \node[draw=black,thick,fit=(b118)] {}; \node[draw=black,thick,fit=(bn)] {}; \draw[->, black,thick] (b115) -- ++(0,-3); \draw[->, black,thick] (b116) -- ++(0,-3); \draw[->, black,thick] (b117) -- ++(0,-3); \node[my,anchor=west] at (6,3) {Child Pointers\strut}; \draw[->, black,thick] (b118) -- ++(0,-3); \draw[->, black,thick] (bn) -- ++(0,-3); \end{pgfonlayer} \begin{scope}[xshift=6cm] \begin{pgfonlayer}{background} \end{pgfonlayer} \end{scope} \node [font = {\Huge\bfseries\sffamily}, above right=of pk1] (t1) {Node\_16}; \end{tikzpicture} Update : I managed it like this but it is invisible.

  • tikz, in some cases use of "node contents" doesn't work
    by Zarko on January 21, 2026 at 9:36 am

    I'm curious, why second example in the following MWE doesn't works. Well, I can leave with first example, but anyway ... I'd rather prefer to use the second one. \documentclass[border=3mm, 11pt]{standalone} \usepackage{tikz} %---------------------------------------------------------------% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture}[ Jvmes/.style args = {#1/#2}{double,double distance=#1, thick,draw=#2}, Npin/.style args = {#1/#2}{minimum size=#1, inner sep=0pt, pin=#2, node contents={} }, ] % first example: works fine \draw[Jvmes=4mm/teal] (0,0) -- node (aux) [Npin=4mm/left:some long one line text] {} (0,2); % second example: gives error "Cannot parse this coordinate." \draw[Jvmes=4mm/teal] (0,0) -- node (aux) [Npin=4mm/left:some text] (0,2); \draw[Jvmes=4mm/teal] (0,0) -- node (aux) [Npin=4mm/left:some text] {} (0,2); \end{tikzpicture} \end{document} Result of the first example is: Addendum: However, if I move inserting of node after drawing a path: \documentclass[border=3mm, 11pt]{standalone} \usepackage{tikz} %---------------------------------------------------------------% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture}[ Jvmes/.style args = {#1/#2}{double,double distance=#1, thick,draw=#2}, Npin/.style args = {#1/#2}{minimum size=#1, inner sep=0pt, pin=#2, color=blue, node contents={} }, every pin/.add style = {}{blue}, ] \draw[Jvmes=4mm/red] (0,0) -- (0,2) node [Npin=4mm/left:some text, pos=0.5]; \end{tikzpicture} \end{document} than it works as expected: I hope that Henri Menke will extend his comment (which help me understand what is going on at my examples) to an answer.

  • Drawing a thick arrow with different fill and outline colors
    by aaragon on January 20, 2026 at 11:46 am

    Drawing this type of arrow turned out to be quite complex. I looked at the macro in this post and modified accordingly so that I get the shape I want. However, that macro only prints a single color arrow and it looks painfully difficult to modify to get what I want. Therefore, I thought that I would "emulate" the result by printing two superposed arrows, an original one and one scaled slightly so as to mimic that I have a different border color. This is what I have so far: \documentclass{standalone} \usepackage{amsmath} \usepackage{tikz} \usetikzlibrary{calc, arrows.meta, bending} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \makeatletter \tikzset{ ararrow/.default={open}{open}, ararrow/.code 2 args={% \tikz@addoption{% \pgfset{tips=true}% draw tips even if the path isn't. \pgfgetpath\currentpath \pgfprocessround{\currentpath}{\currentpath}% \pgf@decorate@parsesoftpath{\currentpath}{\currentpath}% \pgfsetarrowsstart{% Triangle[bend, length=1.*(\pgf@decorate@totalpathlength), width =0.08*(\pgf@decorate@totalpathlength), % <-- added line join=round,#1] } \pgfsetarrowsend{% Stealth[ angle'=60, length=0.22*(\pgf@decorate@totalpathlength), width =0.26*(\pgf@decorate@totalpathlength), line join=round,#2]}% \tikz@mode@drawfalse % disable drawing of path } }, ararrow **/.style={ararrow={}{}}, ararrow oo/.style={ararrow={open}{open}}, ararrow *o/.style={ararrow={}{open}}, ararrow o*/.style={ararrow={open}{}}, } \makeatother \begin{document} \begin{tikzpicture} \coordinate (P) at (0,0); \coordinate (Q) at (1,1); \coordinate (C) at ($(P)!0.5!(Q)$); % outer arrow \draw[blue, ararrow **] (P) to[bend left=45] (Q); % inner arrow: same curve, scaled about C \begin{scope}[ shift={(C)}, scale=0.9, shift={($-1*(C)$)} ] \draw[yellow, ararrow **] (P) to[bend left=45] (Q); \end{scope} \end{tikzpicture} \end{document} which produces the image you see. Ideally, it would be great if the macro can be modified to get what I need so the user can simply type: \draw[draw=blue, fill=yellow, ararrow **] (P) to[bend left=45] (Q);

  • How to return array from a command?
    by karu on January 18, 2026 at 10:07 am

    How to return an array from a command? or rather How to expand a command to some generated array? The code below generates the correct array into \OutArray inside \Transmogrifier, but I don't know how to return it to calling \ResultArray. I know one option to access the values is to define an empty array, give the array as an argument to the command, have the command generate the elements to that array and access them when the command is finished. This is not what I am looking for. My question is more to expand my understanding and increase the tools I have in my disposal. \documentclass[tikz]{standalone} \begin{document} \newcommand*{\SomeOperation}[2]{% \fpeval{#1*#2}% }% \newcommand*{\Transmogrifier}[2]{% \pgfmathparse{dim(#1)}% or \pgfmathdim{#1}% \edef\ArrayLength{\pgfmathresult}% \xdef\OutArray{{}}% \foreach \i in {0,...,\fpeval{\ArrayLength-1}}% {% \pgfmathparse{array({#1},\i)}% or \pgfmatharray{{#1}}{\i}% \ifnum \i=0% \xdef\OutArray{\SomeOperation{\pgfmathresult}{#2}}% \else% \xdef\OutArray{\OutArray,\SomeOperation{\pgfmathresult}{#2}}% \fi% }% \xdef\OutArray{{\OutArray}}% How to "return" \OutArray? %\typeout{OutArray: \OutArray}% }% \begin{tikzpicture} \def\TestArray{{1,2,3}}% \typeout{TestArray: \TestArray}% \newcommand*{\ResultArray}{% \Transmogrifier{\TestArray}{2}% }% %\ResultArray% Temp for testing \typeout{ResultArray: \ResultArray}% \end{tikzpicture} \end{document} Desired outcome in the log file: TestArray: {1,2,3} ResultArray: {2,4,6}

  • 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.

  • Replicate a LSTM Cell
    by Murilo on August 19, 2024 at 11:52 am

    Consider the following code: \documentclass{article} \usepackage{graphicx} \usepackage{float} \usepackage{tikz} \usetikzlibrary{matrix,chains,decorations.pathreplacing,arrows,calc, shapes,positioning,shadows,arrows.meta,calligraphy,ext.paths.ortho} \begin{document} \begin{figure}[H] \centering \caption{LSTM Cell.} \fbox{ \begin{tikzpicture}[ font=\scriptsize, >=LaTeX, cell/.style={% For the main box rectangle, rounded corners=5mm, draw, very thick, }, operator/.style={%For operators like + and x circle, draw, inner sep=-0.5pt, minimum width =.3cm, minimum height =.3cm, }, function/.style={%For functions ellipse, draw, inner sep=1pt }, ct/.style={% For external inputs and outputs circle, draw, line width = .75pt, minimum width=1cm, inner sep=1pt, }, gt1/.style={% For internal inputs rectangle, draw, fill=green, minimum width=4mm, minimum height=3mm, inner sep=1pt }, gt2/.style={% For internal inputs rectangle, draw, fill=red, minimum width=4mm, minimum height=3mm, inner sep=1pt }, gt3/.style={% For internal inputs rectangle, draw, fill=yellow, minimum width=4mm, minimum height=3mm, inner sep=1pt }, ArrowC1/.style={% Arrows with rounded corners rounded corners=.25cm, thick, }, ArrowC2/.style={% Arrows with big rounded corners rounded corners=.5cm, thick, }, ] %Start drawing the thing\dots % Draw the cell: \node [cell, minimum height =4cm, minimum width=6cm] at (0,0){} ; % Draw inputs named ibox# \node [gt1] (ibox1) at (-2,-0.75) {$\sigma$}; \node [gt2] (ibox2) at (-1.5,-0.75) {$\sigma$}; \node [gt2, minimum width=1cm] (ibox3) at (-0.5,-0.75) {Tanh}; \node [gt3] (ibox4) at (0.5,-0.75) {$\sigma$}; % Draw opérators named mux# , add# and func# \node [operator] (mux1) at (-2,1.5) {$\times$}; \node [operator] (add1) at (-0.5,1.5) {+}; \node [operator] (mux2) at (-0.5,0) {$\times$}; \node [gt3] (mux3) at (1.5,0) {$\times$}; \node [gt3] (func1) at (1.5,0.75) {Tanh}; % Draw External inputs? named as basis c,h,x \node[] (c) at (-4,1.5) {$C_{t-1}$}; \node[] (h) at (-4,-1.5) {$y_{t-1}$}; \node[] (x) at (-2.5,-3) {$x_{t}$}; % Draw External outputs? named as basis c2,h2,x2 \node[] (c2) at (4,1.5) {$C_{t}$}; \node[] (h2) at (4,-1.5) {$y_{t}$}; \node[] (x2) at (2.5,3) {$y_{t}$}; % Start connecting all. %Intersections and displacements are used. % Drawing arrows %\draw[->, ArrowC1] (c) -- (ct); \draw [->, ArrowC1] (c) -- (mux1) -- (add1) -- (c2); % Inputs \draw [ArrowC2] (h) -| (ibox4); \draw [ArrowC1] (h -| ibox1)++(-0.5,0) -| (ibox1); \draw [ArrowC1] (h -| ibox2)++(-0.5,0) -| (ibox2); \draw [ArrowC1] (h -| ibox3)++(-0.5,0) -| (ibox3); \draw [ArrowC1] (x) -- (x |- h)-| (ibox3); % Internal \draw [->, ArrowC2] (ibox1) -- (mux1); \draw [->, ArrowC2] (ibox2) |- (mux2); \draw [->, ArrowC2] (ibox3) -- (mux2); \draw [->, ArrowC2] (ibox4) |- (mux3); \draw [->, ArrowC2] (mux2) -- (add1); \draw [->, ArrowC1] (add1 -| func1)++(-0.5,0) -| (func1); \draw [->, ArrowC2] (func1) -- (mux3); %Outputs \draw [->, ArrowC2] (mux3) |- (h2); \draw (c2 -| x2) ++(0,-0.1) coordinate (i1); \draw [-, ArrowC2] (h2 -| x2)++(-0.5,0) -| (i1); \draw [->, ArrowC2] (i1)++(0,0.2) -- (x2); \end{tikzpicture} } \\ \label{lstm_cell} \end{figure} \end{document} That generates this output: Any ideas in how can i replicate it like the figure found here? Instead of using A in left and right cells, we should write $t-1$ and $t+1$. EDIT: Using @hpekristiansen answer, i made this: \begin{figure}[H] \centering \fbox{ \resizebox{0.95\textwidth}{!}{ \begin{tikzpicture}[ font=\large, >=LaTeX, cell/.style={% For the main box rectangle, rounded corners=5mm, draw, very thick, }, operator/.style={ circle, draw, inner sep=-0.5pt, minimum width =.3cm, minimum height =.3cm, }, function/.style={ ellipse, draw, inner sep=1pt }, ct/.style={ circle, draw, line width = .75pt, minimum width=1cm, inner sep=1pt, }, gt1/.style={ rectangle, draw, fill=green, minimum width=4mm, minimum height=3mm, inner sep=1pt }, gt2/.style={ rectangle, draw, fill=red, minimum width=4mm, minimum height=3mm, inner sep=1pt }, gt3/.style={ rectangle, draw, fill=yellow, minimum width=4mm, minimum height=3mm, inner sep=1pt }, ArrowC1/.style={% Arrows with rounded corners rounded corners=.25cm, thick, }, ArrowC2/.style={% Arrows with big rounded corners rounded corners=.5cm, thick, }, cella/.pic={ \node [cell, minimum height =4cm, minimum width=6cm] at (0,0){}; \node [gt1] (ibox1a) at (-2,-0.75) {$\sigma$}; \node [gt2] (ibox2a) at (-1.5,-0.75) {$\sigma$}; \node [gt2, minimum width=1cm] (ibox3a) at (-0.5,-0.75) {Tanh}; \node [gt3] (ibox4a) at (0.5,-0.75) {$\sigma$}; \node [operator] (mux1a) at (-2,1.5) {$\times$}; \node [operator] (adda) at (-0.5,1.5) {+}; \node [operator] (mux2a) at (-0.5,0) {$\times$}; \node [gt3] (mux3a) at (1.5,0) {$\times$}; \node [gt3] (funca) at (1.5,0.75) {Tanh}; \node[] (ca) at (-4,1.5) {$C_{t-2}$}; \node[] (ha) at (-4,-1.5) {$y_{t-2}$}; \node[] (xa) at (-2.5,-3) {$x_{t-1}$}; \node[] (c2a) at (4,1.5) {}; \node[] () at (3.5, 2) {$C_{t-1}$}; \node[] (h2a) at (4,-1.5) {}; \node[] (x2a) at (2.5,3) {$y_{t-1}$}; \node[] () at (3.5, -2) {$y_{t-1}$}; % \draw [->, ArrowC1] (c) -- (mux1) -- (add1) -- (c2); \draw [->, ArrowC1] (ca) -- (mux1a); \draw [->, ArrowC1] (mux1a) -- (adda); \draw [->, ArrowC1] (adda) -- (c2a); \draw [ArrowC2] (ha) -| (ibox4a); \draw [ArrowC1] (ha -| ibox1a)++(-0.5,0) -| (ibox1a); \draw [ArrowC1] (ha -| ibox2a)++(-0.5,0) -| (ibox2a); \draw [ArrowC1] (ha -| ibox3a)++(-0.5,0) -| (ibox3a); \draw [ArrowC1] (xa) -- (xa |- ha)-| (ibox3a); \draw [->, ArrowC2] (ibox1a) -- (mux1a); \draw [->, ArrowC2] (ibox2a) |- (mux2a); \draw [->, ArrowC2] (ibox3a) -- (mux2a); \draw [->, ArrowC2] (ibox4a) |- (mux3a); \draw [->, ArrowC2] (mux2a) -- (adda); \draw [->, ArrowC1] (adda -| funca)++(-0.5,0) -| (funca); \draw [->, ArrowC2] (funca) -- (mux3a); \draw [->, ArrowC2] (mux3a) |- (h2a); \draw (c2a -| x2a) ++(0,-0.1) coordinate (i1a); \draw [-, ArrowC2] (h2a -| x2a)++(-0.5,0) -| (i1a); \draw [->, ArrowC2] (i1a)++(0,0.2) -- (x2a); }, cellb/.pic={ \node [cell, minimum height =4cm, minimum width=6cm] at (0,0){}; \node [gt1] (ibox1b) at (-2,-0.75) {$\sigma$}; \node [gt2] (ibox2b) at (-1.5,-0.75) {$\sigma$}; \node [gt2, minimum width=1cm] (ibox3b) at (-0.5,-0.75) {Tanh}; \node [gt3] (ibox4b) at (0.5,-0.75) {$\sigma$}; \node [operator] (mux1b) at (-2,1.5) {$\times$}; \node [operator] (add1b) at (-0.5,1.5) {+}; \node [operator] (mux2b) at (-0.5,0) {$\times$}; \node [gt3] (mux3b) at (1.5,0) {$\times$}; \node [gt3] (func1b) at (1.5,0.75) {Tanh}; \node[] (cb) at (-4,1.5) {}; \node[] (hb) at (-4,-1.5) {}; \node[] (xb) at (-2.5,-3) {$x_{t}$}; \node[] (c2b) at (4,1.5) {}; \node[] () at (3.5,2) {$C_{t}$}; \node[] (h2b) at (4,-1.5) {}; \node[] (x2b) at (2.5,3) {$y_{t}$}; \node[] () at (3.5, -2) {$y_{t}$}; % \draw [->, ArrowC1] (c) -- (mux1) -- (add1) -- (c2); \draw [->, ArrowC1] (cb) -- (mux1b); \draw [->, ArrowC1] (mux1b) -- (add1b); \draw [->, ArrowC1] (add1b) -- (c2b); \draw [ArrowC2] (hb) -| (ibox4b); \draw [ArrowC1] (hb -| ibox1b)++(-0.5,0) -| (ibox1b); \draw [ArrowC1] (hb -| ibox2b)++(-0.5,0) -| (ibox2b); % \draw [ArrowC1] (h -| ibox3)++(-0.5,0) -| (ibox3); \draw [ArrowC1] (xb) -- (xb |- hb)-| (ibox3b); \draw [->, ArrowC2] (ibox1b) -- (mux1b); \draw [->, ArrowC2] (ibox2b) |- (mux2b); \draw [->, ArrowC2] (ibox3b) -- (mux2b); \draw [->, ArrowC2] (ibox4b) |- (mux3b); \draw [->, ArrowC2] (mux2b) -- (add1b); \draw [->, ArrowC1] (add1b -| func1b)++(-0.5,0) -| (func1b); \draw [->, ArrowC2] (func1b) -- (mux3b); \draw [->, ArrowC2] (mux3b) |- (h2b); \draw (c2b -| x2b) ++(0,-0.1) coordinate (i1b); \draw [-, ArrowC2] (h2b -| x2b)++(-0.5,0) -| (i1b); \draw [->, ArrowC2] (i1b)++(0,0.2) -- (x2b); }, cellc/.pic={ \node [cell, minimum height =4cm, minimum width=6cm] at (0,0){}; \node [gt1] (ibox1c) at (-2,-0.75) {$\sigma$}; \node [gt2] (ibox2c) at (-1.5,-0.75) {$\sigma$}; \node [gt2, minimum width=1cm] (ibox3c) at (-0.5,-0.75) {Tanh}; \node [gt3] (ibox4c) at (0.5,-0.75) {$\sigma$}; \node [operator] (mux1c) at (-2,1.5) {$\times$}; \node [operator] (add1c) at (-0.5,1.5) {+}; \node [operator] (mux2c) at (-0.5,0) {$\times$}; \node [gt3] (mux3c) at (1.5,0) {$\times$}; \node [gt3] (func1c) at (1.5,0.75) {Tanh}; \node[] (cc) at (-4,1.5) {}; \node[] (hc) at (-4,-1.5) {}; \node[] (xc) at (-2.5,-3) {$x_{t+1}$}; \node[] (c2c) at (4,1.5) {}; \node[] () at (3.5,2) {$C_{t+1}$}; \node[] (h2c) at (4,-1.5) {}; \node[] (x2c) at (2.5,3) {$y_{t+1}$}; \node[] () at (3.5, -2) {$y_{t+1}$}; % \draw [->, ArrowC1] (c) -- (mux1) -- (add1) -- (c2); \draw [->, ArrowC1] (cc) -- (mux1c); \draw [->, ArrowC1] (mux1c) -- (add1c); \draw [->, ArrowC1] (add1c) -- (c2c); \draw [ArrowC2] (hc) -| (ibox4c); \draw [ArrowC1] (hc -| ibox1c)++(-0.5,0) -| (ibox1c); \draw [ArrowC1] (hc -| ibox2c)++(-0.5,0) -| (ibox2c); \draw [ArrowC1] (hc -| ibox3c)++(-0.5,0) -| (ibox3c); \draw [ArrowC1] (xc) -- (xc |- hc)-| (ibox3c); \draw [->, ArrowC2] (ibox1c) -- (mux1c); \draw [->, ArrowC2] (ibox2c) |- (mux2c); \draw [->, ArrowC2] (ibox3c) -- (mux2c); \draw [->, ArrowC2] (ibox4c) |- (mux3c); \draw [->, ArrowC2] (mux2c) -- (add1c); \draw [->, ArrowC1] (add1c -| func1c)++(-0.5,0) -| (func1c); \draw [->, ArrowC2] (func1c) -- (mux3c); \draw [->, ArrowC2] (mux3c) |- (h2c); \draw (c2c -| x2c) ++(0,-0.1) coordinate (i1c); \draw [-, ArrowC2] (h2c -| x2c)++(-0.5,0) -| (i1c); \draw [->, ArrowC2] (i1c)++(0,0.2) -- (x2c); }, very thick, ] \begin{scope}[xshift=-7cm] \pic {cella}; \draw[rounded corners=0.5cm, fill=green!40, opacity=0.8] (-3,-2) rectangle +(6,4); \node[scale=3] {$t-1$}; \end{scope} \begin{scope}[xshift=0cm] \draw[rounded corners=0.5cm, fill=green!40, opacity=0.8] (-3,-2) rectangle +(6,4); \pic {cellb}; \end{scope} \begin{scope}[xshift=7cm] \pic {cellc}; \draw[rounded corners=0.5cm, fill=green!40, opacity=0.8] (-3,-2) rectangle +(6,4); \node[scale=3] {$t+1$}; \end{scope} \end{tikzpicture} } } \end{figure}

  • How derive the projection of the curve intersection with specific x-axis notation in pgfplots?
    by Explorer on June 11, 2024 at 4:42 pm

    I encounter a confusing problem when deal with the projection of the function figure as below. I wonder how to modify my tex code's definition of \newcommand{\ShowIntersectionsAndVerticalLine} with 4 arguments: name path global1 name path global2 the color of the intersection the notation of the x-axis (as in the figure x_1 x'_1 etc.). I found similar brilliant answer as below, but they didn't fit my case. Intersection -| of a named and a calculated coordinate TiKz-pgf: Project intersection points in the abscissa axis What I want to get is shown below: Here below is my MWE of the problem. \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{intersections} \usetikzlibrary{math} \usepackage{amsmath} \tikzset{elegant/.style={smooth,thick,samples=50}} % Define this as a command to ensure that it is same in both cases \newcommand*{\ShowIntersection}[3]{ \fill [name intersections={of=#1 and #2, name=i, total=\t}] [#3, opacity=1, every node/.style={above left, black, opacity=1}] \foreach \s in {1,...,\t}{(i-\s) circle (1pt)}; } \begin{document} \begin{tikzpicture} \begin{axis}[ axis x line = middle, axis y line = middle, xmin = -1, xmax = 4, ymin = -1, ymax = 3 ] \addplot[elegant,domain=-4:4,name path global=A]{(x-1)*ln(x)-x+1} node [left=2pt] {$f(x)$}; \addplot[blue,mark=*,mark size=1pt] coordinates {(1,0)}; \addplot[blue,mark=*,mark size=1pt] coordinates {(e,0)}; \addplot[blue,thick,name path global=B]{-x+1}; \addplot[blue,thick,name path global=C]{(1-1/e)*x-e+1}; \addplot[orange,thick,name path global=D] coordinates {(-1,0.5) (4,0.5)}; \ShowIntersection{A}{D}{orange} \ShowIntersection{B}{D}{blue} \ShowIntersection{C}{D}{blue} %% TBC \end{axis} \end{tikzpicture} \end{document}

  • 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?

  • Drawing ribbon graphs in latex
    by QGM on March 6, 2022 at 7:29 pm

    I am writing some notes about ribbon categories and ribbon graphs and I would need to reproduce some diagrams like the ones on the figures. Does anyone know an efficient way to do it ? I have no idea so I would have to learn from scratch. Maybe an external software allowing me to export images would also be a good idea. Thanks in advance.

  • Print basic calculations step by step
    by projetmbc on March 4, 2021 at 7:19 pm

    I would like to achieve two goals with the code below. Change the width of the red rectangle. Draw the arrows added by hand in the following screenshot. Any clue or advice will be appreciated. \documentclass{article} \usepackage{nicematrix} \usepackage{tikz} \begin{document} $\begin{NiceArray}{rcl}[name=test] 2 x + 3 & = & 5 x - 4 \\[-.5em] \\ \Block[draw=red]{1-3}{- 3} \\ \\[-.5em] 2 x & = & 5 x - 7 \\[-.5em] \\ \Block[draw=red]{1-3}{- 5x} \\ \\[-.5em] -3 x & = & - 7 \end{NiceArray}$ \end{document}

  • 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}

  • Issues with node labels using quotes on referenced nodes in graphs
    by clocktown on December 18, 2017 at 8:46 pm

    The following: \documentclass[12pt]{article} \usepackage{tikz} \usetikzlibrary{graphs, graphs.standard, quotes} \begin{document} \begin{tikzpicture} \graph[grid placement, n = 4, chain shift = {(2,0)}, group shift = {(0,-2)}, math nodes, nodes = {circle, draw, thick}, edges={very thick}] { %subgraph I_n[V={s_1, s_2, s_3, s_4}], s_1["$P,Q$" left], s_2["$P, \neg Q$" right], s_3["$\neg P, Q$" left], s_4["$\neg P, \neg Q$" right], s_1 -> s_3, s_4 -> s_2, s_3 -> {s_3[>loop below], s_4}, s_2 -> {s_2[>loop above], s_1} }; \end{tikzpicture} \end{document} Works and does what it is supposed to do. However, if I uncomment the subgraph I_n, I end up with numerous errors like this: Missing \endcsname inserted. } While the same visual output is produced anyways. So, for whatever reason, specifying node labels using quotes on referenced nodes causes issues. I could however trace down the cause further. The following: \graph[grid placement, n = 4, chain shift = {(2,0)}, group shift = {(0,-2)}, math nodes, nodes = {circle, draw, thick}, edges={very thick}] { subgraph I_n[V={s_1, s_2, s_3, s_4}], s_1["$P,Q$" left], s_2["Some Label" right], s_3["Label" left], s_4["$0^0$" right], s_1 -> s_3, s_4 -> s_2, s_3 -> {s_3[>loop below], s_4}, s_2 -> {s_2[>loop above], s_1} }; Does work. The problem seems to only occur when commands are used inside quotes labels on referenced nodes. And yes, even with non-math commands, I checked that, too. After further reading of the documentation, I realised that what I am doing shouldn't even be working, as I have , in the quotes, which would have to be surrounded by {}. And, it does not work if used in a normal \node like this. This is weird in itself, as what is clearly wrong is working, at least partially. However, this: \graph[grid placement, n = 4, chain shift = {(2,0)}, group shift = {(0,-2)}, math nodes, nodes = {circle, draw, thick}, edges={very thick}] { subgraph I_n[V={s_1, s_2, s_3, s_4}], s_1["{$P,Q$}" left], s_2["{$P, \neg Q$}" right], s_3["{$\neg P, Q$}" left], s_4["{$\neg P, \neg Q$}" right], s_1 -> s_3, s_4 -> s_2, s_3 -> {s_3[>loop below], s_4}, s_2 -> {s_2[>loop above], s_1} }; Will still not work. You might be wondering why this is a problem, as my first example shows the solution. However, this is no real solution. Imagine you are creating a large graph, and then you might want to use something like subgraph I_n for this, and then label just one of these nodes. But you can't do that, because it won't work. An actual solution would be something like this: \node["{$P, \neg Q$}" right] at (s_2) {}; or \node[circle, "{$P, \neg Q$}" right] at (s_2) {}; But for this example, in both cases, the label will be too close. So something like this: \node[anchor=west, xshift=12pt] at (s_2) {$P, \neg Q$}; Is the better way it seems. Now I talked a lot around the bush. My question is: Can anybody explain why this weird behaviour happens? I imagine that the reason will be related to the graph parsing. And: Can it actually be solved somehow, without any of the workarounds (so, with actually using the quotes label syntax inside the graph and on referenced nodes)? Edit: \graph[grid placement, n = 4, chain shift = {(2,0)}, group shift = {(0,-2)}, math nodes, nodes = {circle, draw, thick}, edges={very thick}] { s_1["{$P,Q$}" left], s_2["{$P, \neg Q$}" right], s_3["{$\neg P, Q$}" left], s_4["{$\neg P, \neg Q$}" right], subgraph I_n[V={s_1, s_2, s_3, s_4}], s_1 -> s_3, s_4 -> s_2, s_3 -> {s_3[>loop below], s_4}, s_2 -> {s_2[>loop above], s_1} }; This is another way of solving the issue, but my question concerning referenced nodes still remains.

  • 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.

  • Label above node in TikZ
    by matkapluku on December 10, 2014 at 8:50 pm

    I wish to add a label above a node that already contains a label. \begin{tikzpicture}[scale=0.8,every node/.style={draw=black,circle}] \node (a) at (0,0) {a}; \node (b) at (2,0) {b}; \draw[->] (a) to (b); \end{tikzpicture} The markup above will give me this: But I want something like this: Is there any easy way to solve this? I am not looking for solutions using \tikzlibrary{background}

  • 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?