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

    I don't quite understand why the first node is no longer pointing toward $C_0$. I always don't know how to make $C_0$ to be on the far right side, still level with the first node (kind of looking like a trapezoid). \begin{center} \scalebox{1.2}{ \tikz \graph [grow right sep]{ x1 [as =$\displaystyle \int_a^b{f(x)dx}$] -> {x2[as=$C_0$, red], x3[as=$F(t)$] -> x4[as=$F^\prime(t)$] -> x5[as=$\displaystyle \int{F^\prime(t)dt}$] -> x6[as=$C(t) + C_{1}$, red]->x2}; }; } \end{center} Any help or a push toward some sort of useful resource is much appreciated.

  • How to colorized any line drawed with draw (nor with plot expression)?
    by Mika Ike on April 1, 2026 at 1:44 pm

    How to colorized any line drawed with draw (nor with plot expression)? \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines = middle, %title={Cor baseada no valor de $y$}, title={Color depending on $y$ coordinate}, colormap/hot % Podes usar 'hot', 'cool', 'jet', etc. ] \addplot[ mesh, % Divide o trazo en segmentos para aplicar cores thick, domain=-3:3, samples=100, point meta=y % Indica que a cor depende do valor de y ] {x^2}; % A función matemática \draw[thick, xshift=0.5,rounded corners] (-2,0.5) .. controls (0,-1) and (0,7) .. (1,7.8) .. controls (2,1) and (2,4) .. (3,3) node[anchor=east,pos=0.95] {How to colorize black line with colormap?} node[anchor=north east,pos=0.95] {depending on $y$ coordinate}; \end{axis} \end{tikzpicture} \end{document}

  • Retrieve coordinates of self-intersections of a curve
    by Ventrikle on April 1, 2026 at 11:06 am

    I am trying to extract the intersection points of a closed curve using the spath3 package. Currently, I have managed to find these points by splitting the path at self-intersections and then using the spath cs (coordinate system) on the resulting components. However, I noticed that the spath3 documentation doesn't seem to provide a direct command for "finding intersections" and returning them as coordinates. My current workaround involves a somewhat manual process: splitting the path, identifying components, and then grabbing the coordinates at the end of specific segments. Here is my MWE. \documentclass[tikz, border=10pt]{standalone} \usetikzlibrary{spath3, knots, hobby, intersections} \begin{document} \begin{tikzpicture}[ use Hobby shortcut, ] \path[spath/save=trefoil] ([closed]90:2) foreach \k in {1,...,3} {.. (-30+\k*240:.5) .. (90+\k*240:2) } (90:2); \tikzset{ spath/.cd, split at self intersections=trefoil, remove empty components=trefoil, get components of={trefoil}\pathcomponents, } % Label each component at its midpoint for reference \foreach[count=\k] \cpt in \pathcomponents { \node[] at (spath cs:{\cpt} 0.5) {\tiny \k}; } % Extracting coordinates before inserting gaps \foreach[count=\k] \i in {1, 3, 5} { \coordinate (A\k) at (spath cs:\getComponentOf{\pathcomponents}{\i} 1); } \tikzset{ % Gaps are inserted after coordinate retrieval. % If inserted earlier, spath cs would only capture positions within the fragmented arcs. spath/insert gaps after components={trefoil}{10pt}{1,3,5}, } \draw[spath/use=trefoil]; % Mark the original intersection points \foreach \k in {1,2,3} { \fill[red, opacity=0.5] (A\k) circle[radius=2pt] node[above, black, opacity=1] {\color{red}\(\k\)}; } \end{tikzpicture} \end{document} While this code works, it feels like a "workaround." Is there a more concise or idiomatic way to retrieve these intersection coordinates directly using spath3 or its integration with the intersections library?

  • Setting node style on specific slide, in a deferred manner
    by ysalmon on March 30, 2026 at 7:43 pm

    I want to animate a DFS in an example graph. I know I can use keys like onslide to activate specific styling on a given slide, but this requires to give the instruction at the place where the node is defined. I would like to be able to just specify the order in which DFS visits the nodes, eg. \foreach \val[count=\slide from 2] in {0,1,2,3,4,5,11,16,15,14,20,19,25,18,24,,31,30,,36,42,43,38,39,46,47,40,35,34,27} {set node l\val to be red-filled starting on slide \slide} I got the idea to use a expl3 proplist to store, on a given slide, which nodes should have which style (full code below). Then I can define a custom tikz style with some code to retrieve from the proplist and do a \pgfkeysalso. Presently, this works if I set the style to eg. fill. However, setting it to eg. fill=red gives an error Package pgfkeys Error: I do not know the key '/tikz/fill=red' and I am going to ignore it. Perhaps you misspelled it. I presume this is a catcode issue, but I am not able to solve it (I tried converting from tokenlist to expl3 string, to no avail). I know I can avoid the need for an = sign by defining a custom style with the appropriate colour (and this is better code style anyway). But still, this limitation is annoying. MWE : \documentclass{beamer} \usepackage{tikz} \ExplSyntaxOn \NewDocumentCommand{\DeferPropInit}{m} { \prop_gclear_new:c {__DeferPropList#1} } \NewDocumentCommand{\DeferPropReplace}{D<>{.-}mmm} { \only<#1>{\prop_gput:cee {__DeferPropList#2} {#3} {#4}} } % not used here, might be useful in other circumstances \NewDocumentCommand{\DeferPropAppend}{D<>{.-}mmm} { \only<#1>{\prop_get:ceNTF {__DeferPropList#2} {#3} \l_tmpa_tl {\prop_gput:cee {__DeferPropList#2} {#3} {\l_tmpa_tl, #4}} % #3 present in list {\prop_gput:cee {__DeferPropList#2} {#3} {#4}} % #3 not present in list } } \tikzset{DeferPropGet/.code~2~args = { \prop_get:ceNT {__DeferPropList#1} {#2} \l_tmpa_tl {\pgfkeysalso {\l_tmpa_tl}} }} % for debug \NewDocumentCommand{\DeferPropLog}{m}{\prop_log:c {__DeferPropList#1}} \ExplSyntaxOff \begin{document} \begin{frame} \begin{center} \begin{tikzpicture} \DeferPropInit{DFS} \foreach \val[count=\slide from 2] in {0,1,2,3,4,5,11,16,15,14,20,19,25,18,24,,31,30,,36,42,43,38,39,46,47,40,35,34,27} {\DeferPropReplace<\slide->{DFS}{l\val}{fill}} % breaks with {fill=red} %\DeferPropLog{DFS} % for debug \foreach \i in {0,...,5}{ \foreach \j in {0,...,7}{ \pgfmathtruncatemacro\eti{\i+\j*6} \draw(\j,-\i) node[DeferPropGet={DFS}{l\eti}] (l\eti) {\eti}; } } % graph edges omitted for brievety \end{tikzpicture} \end{center} \end{frame} \end{document}

  • Why is "every [shape] node" applied after node options?
    by karlh on March 29, 2026 at 3:35 pm

    As a sort of follow-up to a previous question, why is "every [shape] node" applied after node options? For example, \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}[every rectangle node/.style={draw=black, minimum width=1cm,minimum height=1cm}] \node [rectangle] {hello!}; \node [rectangle] at (2.5,0) {hello again!}; \node [rectangle,minimum height=2cm] at (0,-2) {Hello, world!}; \bgroup \tikzset{every rectangle node/.style={draw=black,minimum width=1cm, minimum height=2cm}} \node [rectangle] at (2.5,-2) {Hello, world!}; \egroup \node [rectangle] at (0,-3.75) {goodbye!}; \end{tikzpicture} \end{document} which produces The two "Hello, world!" boxes should look the same, but because of the order in which things are applied, they do not. Creating a group with "every rectangle node" fixes it, as in the example, but is cumbersome. (The bgroup...egroup guards prevent the \tikzset settings from propagating to the rest of the picture, too.) My main question: Why is "every [shape] node" applied after the node options, overriding what is (presumably) the user's choice for that particular object, and is there interest from TikZ developers in changing that default to restore what seems to me to be the more intuitive behavior, that is, applying the "every [shape] node" settings just before the node's optional arguments, so the optional arguments override anything that is applied "globally"? If it would be helpful for me to raise this as an issue on Github, I can do that.

  • What is a better approach to plot the double path style as a subpath?
    by Explorer on March 29, 2026 at 3:03 am

    I want to replicate something as below: Now is my code, but good with the conjunction (the double path's start and end, and the glitch of double), even with line join=round: \documentclass[tikz,border=5pt]{standalone} \begin{document} \begin{tikzpicture}[line join=round] \coordinate (start) at (0,1.5); \coordinate (end) at (0,0); \draw[magenta] (start) -- ++(3,0) coordinate (doublestart) ++(-.5,-1.5) coordinate (doubleend) -- (end); \draw[cyan,double,double distance=2.5pt] (doublestart) .. controls ++(.25,-.75) and ++(-.3,1) .. (doubleend) ; \end{tikzpicture} \end{document}

  • A follow-up question on the scale behavior of different approaches of `\pic`?
    by Explorer on March 28, 2026 at 2:48 pm

    My question is arisen from my previous one, and more specific: As Sammy contributed the excellent solution, says: I find nodes to be an unreliable way to draw circles as the size of the circle depends on it's contents and the value of inner sep. I therefore set inner sep=0pt and specified minimum size. I have the following test example further more: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{calc} \begin{document} \tikzset{ methodA/.pic={ \draw (0,0) arc[start angle=180,end angle=0,radius=1cm] node[circle,pos=0.75,fill=cyan,inner sep=3pt] {}; }, methodB/.pic={ \draw (0,0) arc[start angle=180,end angle=0,radius=1cm] node[circle,pos=0.75,fill=magenta,inner sep=0pt,minimum size=.35cm] {}; }, methodC/.pic={ \draw (0,0) arc[start angle=180,end angle=0,radius=1cm]; % manual decide the "pos-0.75" \fill[violet] ($(1,0)+(45:1cm)$) circle[radius=3pt]; % but I dislike this method, which need two paths, I would always prefer only one command, if possible.And not always easy to control the "pos" instead of angle... }, } \begin{tikzpicture} \draw[gray] (-2,-2) grid (6,3); \pic {methodA}; \pic [scale=1.5] {methodA}; \draw[thick] (-2,-1) -- pic[pos=.25,scale=1.5] {methodA} (6,-1); \node[font=\ttfamily,anchor=north west] at (-2,3) {(1)inner sep+scale}; \end{tikzpicture} \begin{tikzpicture} \draw[gray] (-2,-2) grid (6,3); \pic {methodB}; \pic [scale=1.5] {methodB}; \draw[thick] (-2,-1) -- pic[pos=.25,scale=1.5] {methodB} (6,-1); \node[font=\ttfamily,anchor=north west] at (-2,3) {(2)minimum size+scale}; \end{tikzpicture} \begin{tikzpicture} \draw[gray] (-2,-2) grid (6,3); \pic {methodC}; \pic [scale=1.5] {methodC}; \draw[thick] (-2,-1) -- pic[pos=.25,scale=1.5] {methodC} (6,-1); \node[font=\ttfamily,anchor=north west] at (-2,3) {(3)path+scale}; \end{tikzpicture} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture} \draw[gray] (-2,-2) grid (6,3); \pic {methodA}; \pic [transform shape,scale=1.5] {methodA}; \draw[thick] (-2,-1) -- pic[pos=.25,transform shape,scale=1.5] {methodA} (6,-1); \node[font=\ttfamily,anchor=north west] at (-2,3) {(4)inner sep+transform shape,scale}; \end{tikzpicture} \begin{tikzpicture} \draw[gray] (-2,-2) grid (6,3); \pic {methodB}; \pic [transform shape,scale=1.5] {methodB}; \draw[thick] (-2,-1) -- pic[pos=.25,transform shape,scale=1.5] {methodB} (6,-1); \node[font=\ttfamily,anchor=north west] at (-2,3) {(5)minimum size+transform shape,scale}; \end{tikzpicture} \begin{tikzpicture} \draw[gray] (-2,-2) grid (6,3); \pic {methodC}; \pic [transform shape,scale=1.5] {methodC}; \draw[thick] (-2,-1) -- pic[pos=.25,transform shape,scale=1.5] {methodC} (6,-1); \node[font=\ttfamily,anchor=north west] at (-2,3) {(6)path,scale}; \end{tikzpicture} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{tikzpicture} \draw[gray] (-2,-2) grid (6,3); \pic {methodA}; \pic [transform shape,scale=1.5] {methodA}; \draw[thick] (-2,-1) -- pic[pos=.25,transform canvas={scale=1.5}] {methodA} (6,-1); \node[font=\ttfamily,anchor=north west] at (-2,3) {(7)inner sep+transform canvas,scale}; \end{tikzpicture} \begin{tikzpicture} \draw[gray] (-2,-2) grid (6,3); \pic {methodB}; \pic [transform shape,scale=1.5] {methodB}; \draw[thick] (-2,-1) -- pic[pos=.25,transform canvas={scale=1.5}] {methodB} (6,-1); \node[font=\ttfamily,anchor=north west] at (-2,3) {(8)minimum size+transform canvas,scale}; \end{tikzpicture} \begin{tikzpicture} \draw[gray] (-2,-2) grid (6,3); \pic {methodC}; \pic [transform shape,scale=1.5] {methodC}; \draw[thick] (-2,-1) -- pic[pos=.25,transform canvas={scale=1.5}] {methodC} (6,-1); \node[font=\ttfamily,anchor=north west] at (-2,3) {(9)path+transform canvas,scale}; \end{tikzpicture} \end{document} which gives: Now let's consider in such case, I want to \pic the following figure: That is actually a logo, which I want to be \pic[scale](or rotate) at other positions for multiple times. Just to plot the figure as \pic, there are at least three methods, I think: \tikzset{ methodA/.pic={ \draw (0,0) arc[start angle=180,end angle=0,radius=1cm] node[circle,pos=0.75,fill=cyan,inner sep=3pt] {}; }, methodB/.pic={ \draw (0,0) arc[start angle=180,end angle=0,radius=1cm] node[circle,pos=0.75,fill=magenta,inner sep=0pt,minimum size=.35cm] {}; }, methodC/.pic={ \draw (0,0) arc[start angle=180,end angle=0,radius=1cm]; % manual decide the "pos-0.75" \fill[violet] ($(1,0)+(45:1cm)$) circle[radius=3pt]; % but I dislike this method, which need two paths, I would always prefer only one command, if possible.And not always easy to control the "pos" instead of angle... }, } In the test result above, their behaviour varied with: simply scale=... transform canvas={scale=...} transform shape,scale=... My question is: I wonder why these scale setting on three approach of \pic are different? (A quite natural follow-up question. IMHO, that is the same one, not asking multiple questions at the same time), when I know "That is actually a logo, which I want to \pic[scale](or rotate) at other positions for multiple times." in advance, how could I select the proper drawing method, to avoid further issues later? Edit My simple opinion on the three approaches without considering that it would be \pic and scale: I would prevent two \path method(method C), which I think that is not elegant syntax enough compared with the others With node on the path and control the radius, just with one command, I prefer these two(method A and B) As for trade-off between inner sep=0pt,minimum size=10pt and inner sep=1cm, I think the first one is better, for the sake of better semantics of a circle node...

  • Ignoring the tail of the letter "g" in setting the baseline of text in nodes of a tikz diagram
    by user143462 on March 27, 2026 at 4:22 pm

    I would like the baseline of "with nitrogen" to be aligned with the bottom edge of the square shaded gray. The bottom of the tail (descender) in the "g" is currently setting the baseline for the phrase. I tried using \makebox[0pt]. Same edit for the other node. \documentclass[10pt]{amsart} \usepackage{tikz} \begin{document} \begin{tikzpicture}[x=1cm,y=1.5cm] %The key is drawn. The keys in other bar graphs have sample regions that are squares with edge length 0.25 centimeters. As the vertical dimension is scaled by 150%, the heights of the sample squares must be scaled by 2/3. \path[fill=gray] (6, {2 + (2/3)*0.125}) -- (6.25, {2 + (2/3)*0.125}) -- (6.25, {2 + (2/3)*0.375}) -- (6, {2 + (2/3)*0.375}) -- cycle; \draw (6, {2 +(2/3)*0.125}) -- (6.25, {2 +(2/3)*0.125}) -- (6.25, {2+(2/3)*0.375}) -- (6, {2+(2/3)*0.375}) -- cycle; \node[anchor=south west, inner sep=0, font=\small] at (6.375, {2 + (2/3)*0.125}){\makebox[0pt][l]{with nitrogen}}; \path[fill=black] (6, {2 - (2/3)*0.125}) -- (6.25, {2 - (2/3)*0.125}) -- (6.25, {2 - (2/3)*0.375}) -- (6, {2 - (2/3)*0.375}) -- cycle; \draw (6, {2 - (2/3)*0.125}) -- (6.25, {2 - (2/3)*0.125}) -- (6.25, {2 - (2/3)*0.375}) -- (6, {2 - (2/3)*0.375}) -- cycle; \node[anchor=south west, inner sep=0, font=\small] at (6.375, {2 - (2/3)*0.375}){without nitrogen}; \draw (5.875, {2 - (2/3)*0.5}) -- (5.875, {2 + (2/3)*0.5}) -- (8.85, {2 + (2/3)*0.5}) -- (8.85, {2 - (2/3)*0.5}) -- cycle; \end{tikzpicture} \end{document}

  • Scale the \pic failed even with transform canvas?
    by Explorer on March 27, 2026 at 3:13 pm

    I have the following tikzpicture with \pic: \documentclass[tikz,border=5pt]{standalone} \begin{document} \begin{tikzpicture}[ orbit/.pic={ \draw[ultra thick,gray] (0,2) arc[start angle=90,delta angle=360,x radius=.85cm, y radius=2cm] node[pos=.6,circle,fill=white,minimum size=15pt] {} node[pos=.6,circle,fill=gray] {} ; }, atom/.pic={\fill[#1] circle[radius=8pt];}, nuclear/.pic={ \pic{orbit};\pic[rotate=120] {orbit};\pic[rotate=-120] {orbit}; \foreach \i in {30,150,270}{ \pic at (\i:.45) {atom=gray};} \foreach \i in {90,210,330}{ \pic at (\i:.45) {atom=cyan};} \pic {atom=gray}; } ] % \pic{orbit};\pic[rotate=120] {orbit};\pic[rotate=-120] {orbit}; % \foreach \i in {30,150,270}{ \pic at (\i:.45) {atom=gray};} % \foreach \i in {90,210,330}{ \pic at (\i:.45) {atom=cyan};} % \pic {atom=gray}; \pic {nuclear}; \end{tikzpicture} \end{document} That is what I was after! Then I want to add this the the chapter, noted that it need lualatex with ctexbook: \documentclass[fontset=fandol]{ctexbook} \usepackage[ a4paper, hmargin=1.5cm, vmargin=2.5cm, ]{geometry} \usepackage{zhlipsum} \usepackage{tikz} \newcommand\chaptertitleformat[1]{% \begin{tikzpicture}[ orbit/.pic={ \draw[ultra thick,gray] (0,2) arc[start angle=90,delta angle=360,x radius=.85cm, y radius=2cm] node[pos=.6,circle,fill=white,minimum size=15pt] {} node[pos=.6,circle,fill=gray] {} ; }, atom/.pic={\fill[##1] circle[radius=8pt];}, nuclear/.pic={ \pic{orbit};\pic[rotate=120] {orbit};\pic[rotate=-120] {orbit}; \foreach \i in {30,150,270}{ \pic at (\i:.45) {atom=gray};} \foreach \i in {90,210,330}{ \pic at (\i:.45) {atom=cyan};} \pic {atom=gray}; } ] \draw[thick,magenta] (1.25,-.2) node[circle,draw,fill=gray!75,inner sep=1.5pt,anchor=west] {} -- node[pos=.15,above,anchor=south] {#1} % pic[pos=0.9,above=1cm,transform canvas={scale=0.5}] {nuclear} %<-!! here pic[pos=0.9,above=1cm=scale=0.5] {nuclear} %<-!! here ++(.85\textwidth,0) node[circle,draw,fill=gray!75,inner sep=1.5pt,anchor=west] {} ; \end{tikzpicture}% } \ctexset{ chapter = { name = {}, numbering = false, titleformat = \chaptertitleformat } } \begin{document} \chapter{AAAA} \section{aaaa} \zhlipsum[1-3] \end{document} I was after something as below: However, I have tried scale=0.5 or transform canvas={scale=0.5}, but all failed, it didn't scale all the \pic! I was not sure that caused by nested \pic? If possible, I don't want to modifiy the tikzpicture code too much, how to scale all the \pic in this specific case?

  • Banded Multicolored Outlined With Copy Paste And Arbitrary Colors LuaLaTeX
    by keymasta on March 27, 2026 at 5:02 am

    The spec: Any number of (arbitrary) color bands that we specify filling text Stroked outline Same positioning as normal text No extra text in the pdf stream (for copy-paste behavior you would expect) Ok and we're back to it! Previous versions have led here. None of the solutions so far have checked every box. We got as far as implementing 1-3. This is why this question is not a duplicate of the linked questions. None of the linked solutions implement 4 which is important to me. They all draw the text multiple times which unfortunately shows up in the pdf stream. I think that it is because for each \node the text is written again, This final version should have completely normal text-selection behavior, i.e, only ONE copy of the text. I have a new macro that attempts to use \accsupp to hide the extra copies of the text, but it does not work when I test it on Sumatra. I think that it does fix it for screen readers though which is why I kept it. It will however work when I try it in random other pdf readers like chrome. What I really want here is something that somehow only writes the text once, while looking exactly as this does, so that it should work in almost all pdf viewers. % !TEX TS-program = lualatex \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{pgfplots} \usepackage{accsupp} \usepackage{pdfrender} \newcommand{\TextShadeContour}[3]{% \begin{tikzpicture}[baseline] % Define reference node invisibly — needed for clip coordinates \node[anchor=base, inner xsep=0pt, inner ysep=.5pt, outer sep=0pt, opacity=0] (n) at (0,0) {#3}; % Scope contains all the cumulative clips from the loop \BeginAccSupp{method=plain,ActualText={}}% \begin{scope}% \foreach \c in {1,2,...,#1}{% \pgfplotscolormapaccess[1:#1]{\c}{ShadingColor}% \definecolor{colortemp}{rgb}{\pgfmathresult}% \pgfmathparse{1-(\c-1)/#1}% \clip let \p1=(n.south west), \p2=(n.north east), in% (n.south west) rectangle (\x2, \y1+\pgfmathresult*\y2-\pgfmathresult*\y1);% \node[colortemp, anchor=base, inner xsep=0pt, inner ysep=.5pt, outer sep=0pt]% {#3};% }% \end{scope}% \EndAccSupp{}% % Stroke is now outside the scope, so clipping is fully reset \node[anchor=base, inner xsep=0pt, inner ysep=.5pt, outer sep=0pt] at (0,0) {\textpdfrender{ TextRenderingMode=Stroke, LineWidth=0.5pt, StrokeColor=#2, MiterLimit=0.5, LineJoinStyle=Round }{#3}}; \end{tikzpicture}% }% \begin{document} \pgfplotsset{colormap={ShadingColor}{rgb255=(112,128,144) rgb255=(255,159,101)}}\TextShadeContour{3}{black}{13}\\ \end{document} The question is (maybe) how to use pdf literal commands to do it. My own knowledge of pdf internals is non-existent. Or it's about drawing the path of the text from within tikz vs. the actual text. Hopefully we don't have to use ghostscript or anything funky. Ideally this will just work in a way where we define the macro once and then use it. I know a pdf file can contain this. I can prove it with this typst MWE. If you run it and copy paste the whole line, it will do it just as we want (stuff and other stuff): #let multicolor_outline(content, colors) = { let grad = gradient.linear(..colors, angle:270deg) set text(stroke: 0.3pt, fill: grad.sharp(colors.len())) box(content) } #multicolor_outline([stuff], (red, orange, yellow, green, blue, purple)) and #multicolor_outline([other stuff], (purple, blue)) Previous discussion (which does not involve functional copy-pasting): Question 1 Question 2

  • tikz, drawing edge with option "double"
    by Zarko on March 26, 2026 at 4:13 pm

    I'm just curious why drawing a line with edge doesn't consider option double. For example: \documentclass[margin=1pt, 11pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[auto=right, Jvmes/.style args = {#1/#2}{very thick, double distance=#1, draw=#2, double=#2!30}, Jvmes/.default = 2mm/orange, ] \draw[Jvmes] (0,0) -- ++ (0,1); % works as expected \draw[Jvmes] (1,0) edge ++ (0,1); % doesn't works \end{tikzpicture} \end{document}

  • How to refer the total chapter number and current chapter number in `shipout/background`?
    by Explorer on March 26, 2026 at 9:13 am

    I want something decorative layout like this, where the magenta node indicated the current chapter(just for example): I have the following code now: \documentclass[12pt,oneside,openany]{book} \usepackage{libertine} \usepackage{lipsum} \usepackage{tikz,tikzpagenodes} \usetikzlibrary{matrix} \pagestyle{empty} \usepackage[showframe]{geometry} \usepackage{totcount} \regtotcounter{chapter} \ExplSyntaxOn \tl_new:N \l_matrix_content_tl \int_step_inline:nn {10} { \ifnum #1=4\relax%<-just for example \tl_put_right:Nn \l_matrix_content_tl {|[fill=magenta]|} \fi \tl_put_right:Nn \l_matrix_content_tl {#1\\} } % I want something like this.. but not work % \int_step_inline:nn {\total{chapter}} { % \ifnum #1=\thechapter\relax % \tl_put_right:Nn \l_matrix_content_tl {|[fill=magenta]|} % \fi % \tl_put_right:Nn \l_matrix_content_tl {#1\\} % } \AddToHook{shipout/background}{ \put (0pt,-\paperheight) {% \begin{tikzpicture}[% overlay,remember~picture, ]% % \node[draw,anchor=west,font=\sffamily\bfseries\Huge] at (current page marginpar area.west) {\thechapter/\total{chapter}}; \matrix[ anchor=east, matrix~of~nodes, nodes={draw, align=center,fill=cyan, minimum~size=1.2cm,font=\sffamily\bfseries\Huge}, row~sep=.75cm, column~sep=0mm, inner~sep=0pt, outer~sep=0pt, ] (m) at (current~page.east){% \l_matrix_content_tl }; \end{tikzpicture}% }% } \ExplSyntaxOff \begin{document} \chapter{First Chapter} \lipsum[1-10] \chapter{Second Chapter} \lipsum[1-10] \chapter{Third Chapter} \lipsum[1-10] \end{document} I want to construct the \l_matrix_content_tl with: \int_step_inline:nn {\total{chapter}} { \ifnum #1=\thechapter\relax \tl_put_right:Nn \l_matrix_content_tl {|[fill=magenta]|} \fi \tl_put_right:Nn \l_matrix_content_tl {#1\\} } which complain that: ! Missing number, treated as zero. <to be read again> \def l.24 } ? I guess that \total{chapter} could be empty within the first run, but I have no idea of when and where(or how to delay) to construct the token list?

  • How to make good use of `tikz-ext.paths.ortho` library to make four-segmented arrow?
    by Explorer on March 26, 2026 at 6:06 am

    The code used the powerful tikz-ext package from Qrrbrbirlbel: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{ext.paths.ortho} \begin{document} \begin{tikzpicture} \node[draw,fill=cyan] (Root) {Root}; \node[draw,fill=magenta] at (-1,-1) (nodeA) {NodeA}; \node[draw,fill=magenta] at (1,-1) (nodeB) {NodeB}; \node[draw,fill=teal] at (3,-1) (nodeC) {NodeC}; \draw[-latex] (Root) |-| (nodeA); \draw[-latex] (Root) |-| (nodeB); \coordinate (aux) at (2,-.75);% I don't want the aux here, `-0.75' is not always easy to determine \draw[-latex,magenta,thick] (Root) |-| (aux) |- (nodeC); \end{tikzpicture} \end{document} which gives: The actual desired result is something like: My code's problem is that, in the actual case, that is not always easy to know exactly the coordinate of aux, says (2,-.75). I wonder whether some extension or patch to plot the FOUR segmented arrow what I want elegantly? Edited: Claim: The difficulity here is that the nodes' position are not always on grid, says (0.123,2.324) for some outer effects, and determine the aux point with absolute distance is not always accurate. Thus, I prefer a "non-absolute-coordinate" solution here, without \coordinate (aux) at (2,-.75).

  • Nesting decorations in TikZ disconnects subpath
    by Sandy G on March 25, 2026 at 9:49 pm

    The decorations in the decorations.fractals library can be used to create fractal lines by applying the decoration repeatedly to an originally straight path. (This can be done with decorations from other libraries as well.) For example, the code \begin{tikzpicture}[decoration=Koch snowflake] \draw decorate{decorate{decorate{(0,0)--(3,0)}}}; \end{tikzpicture} produces the expected result. When a decoration is applied to a subpath however, nesting the decoration produces a result I did not expect. Namely, the decorated subpath appears to be disconnected from the path as a whole. Consider the following image: which is produced by the code below. A single iteration of the decoration produces a closed path (orange) as expected. But when the decoration is nested (blue) the --cycle does not close the whole path, only the portion beginning with the decoration. If you look closely, you can see that the first segment of the path is not connected to the decorated portion. What is the reason for this behavior? Note the partial fix in purple does not solve the problem (unless one only wanted to fill the path without drawing it) but it does show that the --cycle is not the problem—the issue is the missing connection between the initial segment and the decorated segment. \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.fractals} \begin{document} \begin{tikzpicture}[decoration=Koch snowflake] \draw[help lines] (0,0) grid (5,3); \draw[orange, very thick] (1,0)--(0,0) decorate{--(0,3)}--cycle; \draw[blue, very thick] (3,0)--(2,0) decorate{decorate{--(2,3)}}--cycle; \draw[purple, very thick] (5,0)coordinate(A)--(4,0) decorate{decorate{--(4,3)}}--(A); \end{tikzpicture} \end{document}

  • Gray vector appears with fading in TikZ
    by Sebastiano on March 25, 2026 at 8:33 pm

    In TikZ, for my previous answer here: Circular Motion when I use the fading library to create a vector with a fading effect, a smaller gray vector appears inside the main vector. Why does this happen, and is there a way to prevent the inner gray vector from being visible? \documentclass{article} \usepackage[margin=0.5in]{geometry} \usepackage{tikz} \usetikzlibrary{arrows.meta, decorations.markings} \usetikzlibrary{fadings} \usepackage{newtxmath} \definecolor{myblue}{RGB}{0, 119, 200} \definecolor{mygreen}{RGB}{27, 175, 78} \definecolor{myorange}{RGB}{245, 130, 32} \begin{document} \begin{center} \begin{tikzpicture}[ vvec/.style={mygreen, line width=2.5pt, -{Latex[length=5mm, width=4mm]}}, avec/.style={myorange, line width=2.5pt, -{Latex[length=5mm, width=4mm]}}, dot/.style={circle, fill=black, inner sep=0pt, minimum size=7pt} ] \def\R{2.5} \draw[gray!20, line width=4mm, -{Latex[length=7mm, width=8mm]}, path fading=north] (155:\R+0.8) arc (155:205:\R+0.8); \node at (180:\R+1.5) {\Large $\boldsymbol{\omega}$}; \end{tikzpicture} \end{center} \end{document}

  • The order of \pgfkeys always mattered in tikz's option?
    by Explorer on March 25, 2026 at 12:11 pm

    I have the following code example: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture} \draw[->,>=latex] (0,0) -- (1,1); \end{tikzpicture} \begin{tikzpicture} \draw[>=latex,->] (0,0) -- (1,1); \end{tikzpicture} \begin{tikzpicture} \node[draw,fill=magenta] (tmp) {node}; \node[draw,fill=cyan,below=of tmp,node distance=.5cm] {below}; \end{tikzpicture} \begin{tikzpicture} \node[draw,fill=magenta] (tmp) {node}; \node[draw,fill=cyan,node distance=.5cm,below=of tmp] {below}; \end{tikzpicture} \end{document} Which gives the following: What I get confused is that: ->,>=latex and >=latex,-> behaves the same below=of tmp,node distance=.5cm honer the default value node distance=1cm, and node distance=.5cm,below=of tmp honer the previous node distance=.5cm Why caused the difference between >= and node distance? How to know whether an option's order is important with \pgfkeys? Edited: As jps commented: Keys are generally ordered as key code is executed in the order given. Whether the order of keys then matters strongly depends on the key code. The way to know whether an option's order matters is to either know the implementation by heart, or trial and error and Jasper Habicht supplemented that: Some keys only store a value in a macro that is later retrieved (which is true for the arrow settings, for example). The values stored in the macros are only retrieved when the arrows is drawn, that is at the end of the path. But other keys actually use values that are stored in macros and if these values are set my other keys, the order is relevant. But as was said above: You really need to know how the implementation is exactly to know whether the first or the second holds in a specific case. Here below is my follow-up doubt: In my understanding, "TikZ keys are applied in the order they are given", so is the following always safer (avoid the unexpected behavior of below=of tmp,node distance=.5cm)? >=latex,->: define the arrow style at first, then set the arrow node distance=.5cm,below=of tmp: set the distance at first, then apply the position

  • TikZ externalization fails with precompiled header (.fmt) and "Incomplete \iffalse" error
    by dp21 on March 23, 2026 at 12:26 pm

    I am trying to speed up the compilation of a complex project using a format file and tikz externalize. In particular I tried a setup like shown in the follwing MWE: preamble-min.tex \documentclass[a4paper,12pt]{article} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{external} \dump main-min.tex: \tikzset{ external/system call={% pdflatex -shell-escape -fmt=preamble-min \ -interaction=nonstopmode -jobname "\image" "\def\tikzexternalrealjob{\texsource}\input{\texsource}"% } } \tikzexternalize[prefix=tikz-cache/] \begin{document} \begin{tikzpicture} \begin{axis} \addplot+[raw gnuplot, mark=none] gnuplot { plot [-5:5] sin(x); }; \end{axis} \end{tikzpicture} \end{document} Compilation Steps: mkdir -p tikz-cache pdflatex -ini -shell-escape -jobname=preamble-min "&pdflatex preamble-min.tex" pdflatex -shell-escape -fmt=preamble-min main-min.tex The compilation stops with: ! Incomplete \iffalse; all text was ignored after line 19. <inserted text> \fi <*> main-min.tex Any ideas how to make this work well and robust? I am using texlive-2025.

  • tikz, scaling widths of lines
    by Zarko on March 17, 2026 at 2:39 pm

    It seems (or is apparently) that thickness of lines is hard coded. Consequently when drawing a line, the use for example of scale=2 only makes the line longer and its thickness is not changed, see MWE below: \documentclass[margin=3mm, varwidth]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta} \tikzset{LA/.style = {-Straight Barb, line width=1mm}} \begin{document} \begin{tikzpicture} \draw[LA] (0,0) -- ++ (2,0); \end{tikzpicture} \begin{tikzpicture}[scale=2] \draw[LA] (0,0) -- ++ (2,0); \end{tikzpicture} \end{document} Is there some trick by which the thickness of the line will also be scaled? The best way would be as option of the line style, which will have effect just on this particular line. My quick search on this site so far didn't give me any suggestion ...

  • Combining Colums in two column paper layout
    by Lion Frangoulis on June 28, 2024 at 12:50 pm

    I am currently working on a paper, using the two column layout by the aps journal layout. For most of the 3d diagrams, I am using tikz to generate the diagrams directly in the document, using the equation environment. However, some of those diagrams get pretty bulky, and would need both colums of the paper. I have tried to find a way to achieve this, and found one for Figures, but could not find anything for equations. The preamble: \documentclass[% reprint, %superscriptaddress, %groupedaddress, %unsortedaddress, %runinaddress, %frontmatterverbose, %preprint, %preprintnumbers, %nofootinbib, %nobibnotes, %bibnotes, amsmath,amssymb, aps, %pra, %prb, %rmp, %prstab, %prstper, %floatfix, ]{revtex4-2} \usepackage{graphicx}% Include figure files \usepackage{dcolumn}% Align table columns on decimal point \usepackage{bm}% bold math \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[sc]{mathpazo} \usepackage[ngerman,american]{babel} \usepackage[autostyle]{csquotes} \usepackage{graphicx} \usepackage{scrhack} % necessary for listings package \usepackage{listings} \usepackage{lstautogobble} \usepackage{tikz} \usepackage{pgfplots} \usepackage{pgfplotstable} \usepackage{booktabs} \usepackage[final]{microtype} \usepackage{caption} \usepackage[printonlyused]{acronym} \usepackage{float} %\usepackage{wasysym} \usepackage{xstring} \usepackage{tikz} \usepackage{mathtools} \usepackage{braket} \usepackage{wasysym} \usepackage{caption} \usepackage{amsthm} \usepackage{subcaption} \usepackage[ruled, lined, linesnumbered, commentsnumbered, longend]{algorithm2e} \usetikzlibrary{3d,patterns,decorations.pathmorphing,decorations.shapes, decorations.pathreplacing, shapes.geometric} \usepackage[hidelinks,pdfusetitle]{hyperref} % hidelinks removes colored boxes around references and links For the individual tikz pictures: \begin{equation} \begin{tikzpicture}[>=stealth, scale=0.65] \pgfsetxvec{\pgfpoint{1cm}{0cm}} \pgfsetyvec{\pgfpoint{0.4cm}{0.3cm}} \pgfsetzvec{\pgfpoint{0cm}{1cm}} ... \end{tikzpicture} \end{equation} The goal would be to have a two columned layout, but have individual tikz graphics go across both of them, and blocking that space of for the main text to continue below. Edit: Minimum viable example of the current problem, with the figure crossing into the second colums text: \documentclass[% reprint, %superscriptaddress, %groupedaddress, %unsortedaddress, %runinaddress, %frontmatterverbose, %preprint, %preprintnumbers, %nofootinbib, %nobibnotes, %bibnotes, amsmath,amssymb, aps, %pra, %prb, %rmp, %prstab, %prstper, %floatfix, ]{revtex4-2} \usepackage{graphicx}% Include figure files \usepackage{dcolumn}% Align table columns on decimal point \usepackage{bm}% bold math \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[sc]{mathpazo} \usepackage[ngerman,american]{babel} \usepackage[autostyle]{csquotes} \usepackage{graphicx} \usepackage{scrhack} % necessary for listings package \usepackage{listings} \usepackage{lstautogobble} \usepackage{tikz} \usepackage{pgfplots} \usepackage{pgfplotstable} \usepackage{booktabs} \usepackage[final]{microtype} \usepackage{caption} \usepackage[printonlyused]{acronym} \usepackage{float} %\usepackage{wasysym} \usepackage{xstring} \usepackage{tikz} \usepackage{mathtools} \usepackage{braket} \usepackage{wasysym} \usepackage{caption} \usepackage{amsthm} \usepackage{lipsum} \usepackage{subcaption} \usepackage[ruled, lined, linesnumbered, commentsnumbered, longend]{algorithm2e} \usetikzlibrary{3d,patterns,decorations.pathmorphing,decorations.shapes, decorations.pathreplacing, shapes.geometric} \usepackage[hidelinks,pdfusetitle]{hyperref} % hidelinks removes colored boxes around references and links \begin{document} \section{Test Area} \lipsum[1-2] \begin{equation} \begin{tikzpicture}[>=stealth, scale=0.75] \pgfsetxvec{\pgfpoint{1cm}{0cm}} \pgfsetyvec{\pgfpoint{0.4cm}{0.3cm}} \pgfsetzvec{\pgfpoint{0cm}{1cm}} \draw (-10, 0,0) -- (10,0,0) -- (10,0,-5) -- (-10,0,-5) -- (-10,0,0); \end{tikzpicture} \end{equation} \lipsum[6-10] \end{document}

  • Procedural matrices in TikZ
    by pelegs on May 19, 2022 at 9:46 am

    Is there a way to typeset a TikZ matrix procedurally instead of manually? i.e. here's a MWE of a 4x4 identity matrix: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture} \matrix[matrix of nodes] { 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\\ }; \end{tikzpicture} \end{document} What I'm trying to do is to create a macro/command that will automatically generate this but for any dimension n. The above case would be of course for n=4. Is this possible? I thought about using the physics package's \imat command, but this gives the following error: ! Undefined control sequence. <argument> \pgf@matrix@last@nextcell@options l.9 \imat{4} ? ! Emergency stop.

  • Beamer class: text height too large for height of footline and headline with tikz pictures
    by Daniel Stich on March 9, 2022 at 11:39 pm

    I tried to recreate my university powerpoint template which includes images as headline and footline banner (beamer class, no predefined theme, xelatex). It seemed easier to place image plus text with tikz. When placing text in frames, text starts within the headline and violates the footline (positioning t or b). My MWE draws a box with \textheightto illustrate the problem. I found this code snippet which should somehow increase the height of the footline but it didn't solve the problem. I hope someone can help me out. Thanks! \makeatletter \patchcmd{\beamer@calculateheadfoot}{\advance\footheight by 4pt}{\advance\footheight by 20pt}{}{} \makeatother MWE: \documentclass[ presentation, %handout, 11pt, aspectratio=43, % 4:3, 128mm:96mm table, usepdftitle=false, ]{beamer} % Packages \usepackage{tikz} \usetikzlibrary{arrows, shapes.arrows, arrows.meta, positioning, fit, calc, backgrounds, patterns, 3d} % Lengths \newlength{\myLeftMargin} \newlength{\myLeftMarginText} \newlength{\myRightMargin} \newlength{\myRightMarginText} \setlength{\myLeftMargin}{0.019685\paperwidth} \setlength{\myLeftMarginText}{0.0909\paperwidth} \setlength{\myRightMargin}{\myLeftMargin} \setlength{\myRightMarginText}{\myLeftMarginText} \setbeamersize{text margin left=\myLeftMarginText} \setbeamersize{text margin right=\myRightMarginText} \setbeamersize{sidebar width left=0pt} % Headline \makeatletter \patchcmd{\beamer@calculateheadfoot}{\advance\footheight by 4pt}{\advance\footheight by 20pt}{}{} \makeatother \setbeamertemplate{headline}{% \begin{tikzpicture}[overlay, remember picture] \node[anchor=north west, inner sep=0pt] at ($(current page.north west)+(0,0)$) (nodeHeadlineBar){ \includegraphics[width=\paperwidth, height=0.15\paperheight]{example-image} }; \end{tikzpicture}% } \setbeamertemplate{frametitle}{% \begin{tikzpicture}[overlay, remember picture] \node[anchor=west, inner sep=0pt] at ($(nodeHeadlineBar.west)+(\myLeftMargin,0)$){ \insertframetitle }; \end{tikzpicture}% } \setbeamertemplate{footline}{% \begin{tikzpicture}[overlay, remember picture] \node[anchor=south west, inner sep=0pt] at ($(current page.south west)+(0,0)$) (nodeFootlineBar){ \includegraphics[width=\paperwidth, height=0.05\paperheight]{example-image} }; \node[anchor=east, inner sep=0pt] at ($(nodeFootlineBar.east)+(-\myRightMargin,0)$){ \insertframenumber\,/\,\inserttotalframenumber }; \end{tikzpicture}% } \begin{document} \section{Example 1} \begin{frame}[b]{\secname} \begin{tikzpicture} \draw[red] (0,0) rectangle (\textwidth,\textheight); \draw[red] (0,\textheight) -- (\textwidth,0) (0,0) -- (\textwidth, \textheight); \end{tikzpicture} \end{frame} \section{Example 2} \begin{frame}[t]{\secname} \begin{tikzpicture} \draw[red] (0,0) rectangle (\textwidth,\textheight); \draw[red] (0,\textheight) -- (\textwidth,0) (0,0) -- (\textwidth, \textheight); \end{tikzpicture} \end{frame} \end{document}

  • TikZ sharp vs flat angles
    by Tomasz23 on December 26, 2021 at 1:08 pm

    With \draw (??,??)--(??,??)--(??,??) syntax TikZ sometimes makes "sharp" joint, while sometimes leaves the joint "flat" - see the picture. It seems that the treshold angle is about arctan(0.2)=11.3 degree (for larger angles joint will be sharp). Can one force TikZ to draw sharp joints for very small angles and flat joints for large angles? MWE: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (.2,0)--(0,0)--(.2,0.04); \node[font=\tiny] at (.8,0) {flat joint}; \scope[shift={(0,-.5)}] \draw (.2,0)--(0,0)--(.2,0.041); \node[font=\tiny] at (.8,0) {sharp joint}; \endscope \end{tikzpicture} \end{document}

  • Is there a bug in the `arrows.meta` or `bending` library with the `double` option in TikZ 3.1.5b?
    by AndréC on July 10, 2020 at 4:56 pm

    When the bending library is loaded, the double arrows are no longer attached to the line. \documentclass[tikz,border=5mm]{standalone} \usetikzlibrary{bending} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture}[] % Old arrows library prior to Tikz 3.0 \begin{scope}[>=latex] \draw (90:1.5)--(0,0)--(0:1.5); \draw [blue,,->] (0:5mm)arc[start angle=0,delta angle=90,radius=5mm]; \draw [red,double,->] (0:10mm)arc[start angle=0,delta angle=90,radius=10mm]; \node[align=left,anchor=west] at (0,-1){With old library\\ arrows no bug}; \end{scope} % New arrows.meta library introduced with Tikz 3.0 \begin{scope}[>={Triangle[]},xshift=4cm] \draw (90:1.5)--(0,0)--(0:1.5); \draw [blue,,->] (0:5mm)arc[start angle=0,delta angle=90,radius=5mm]; \draw [red,double,->] (0:10mm)arc[start angle=0,delta angle=90,radius=10mm]; \end{scope} \begin{scope}[>=Stealth,xshift=6cm] \draw (90:1.5)--(0,0)--(0:1.5); \draw [blue,,->] (0:5mm)arc[start angle=0,delta angle=90,radius=5mm]; \draw [red,double,->] (0:10mm)arc[start angle=0,delta angle=90,radius=10mm]; \node[align=left,anchor=center] at (0,-1){With new library\\ arrows.meta: bug}; \end{scope} \end{tikzpicture} \end{document}

  • Tikz background image moves text
    by Peter Baintner on March 14, 2018 at 10:11 pm

    I've got the issue, that if I put in a background image with Tikz, my text get's moved and I'm having a hard time getting the right result. This is the way I put the image in the Awesome CV: \begin{tikzpicture}[remember picture,overlay] \node (letter) at (18,-9) {\includegraphics[width=0.2\paperwidth,height=0.2\paperwidth]{./icons/skills.pdf}}; \end{tikzpicture} If it's unclear what I'm doing, I can provide a minimal example. Edit1: I cannot reproduce the issue in a minimal example, but the weird thing is, that it in this example the pictures aren't in a column under each other: \documentclass[11pt, a4paper]{scrreprt} \usepackage[ngerman]{babel} \usepackage{blindtext} \usepackage{tikz} \begin{document} \blindtext \begin{tikzpicture}[remember picture,overlay] \node (letter) at (2,2) {\includegraphics[width=0.2\paperwidth,height=0.2\paperwidth]{./icons/ausbildung.pdf}}; \end{tikzpicture} \\ \blindtext \begin{tikzpicture}[remember picture,overlay] \node (letter) at (2,1) {\includegraphics[width=0.2\paperwidth,height=0.2\paperwidth]{./icons/skills.pdf}}; \end{tikzpicture} \blindtext \begin{tikzpicture}[remember picture,overlay] \node (letter) at (2,0) {\includegraphics[width=0.2\paperwidth,height=0.2\paperwidth]{./icons/work.pdf}}; \end{tikzpicture} \end{document}

  • pdflatex not working anymore after updating pdflatex.ini and initexmf --dump=pdflatex
    by user140574 on August 3, 2017 at 10:36 am

    I tried to overcome the well known tex capacity exceed problem, when using large Surf-plot with many datapoints. I tried this by typing into the cmd (Windows 7, MikTex 2.9): initexmf --edit-config-file=pdflatex main_memory=5000000 extra_mem_bot=5000000 font_mem_size=5000000 pool_size=5000000 buf_size=5000000 **initexmf --dump=pdflatex** Now, pdflatex does not work anymore, a dvi is built, but no output. The log also says that the system maybe just failed. pdflatex is broke... Any Ideas? (I cannot think of a proper MWE.)

  • Circular Motion
    by oo2t on October 2, 2016 at 2:27 pm

    I'm trying to draw three vectors that are tangent to the circle, as shown below. Is it possible to use \foreach to duplicate one vector around the circle? If so, can someone help me to draw this picture?

  • How to draw a coffee cup
    by Benjamin McKay on November 15, 2013 at 6:17 pm

    Topologists need to explain that coffee cups are homeomorphic to donuts. There are nice ways to draw donuts. So far, my best attempt is \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shadings} \begin{document} \begin{tikzpicture} \shade[ball color=gray!10] (-2,0) arc (180:360:2cm); \shade[left color=gray!10, right color=gray!80] (-2,0) arc (180:540:2cm and 1cm); \fill[top color=gray!50,bottom color=gray!80] (1.8,-.45) arc (135:225:.35cm) arc (45:-150:.35cm) arc (90:270:.25cm) arc (-90:45:.85cm) -- cycle; \end{tikzpicture} \end{document}

  • How can I draw a vertical line in a table cell?
    by kloop on November 30, 2012 at 1:06 am

    I hope the explanation will be clear: I have a table with 4 rows, and one of the columns there is a value that is identical in all rows. I want instead of copying it 4 times for each row, just put it in the middle (between the 2nd and 3rd row) and have two vertical lines stretching above and below it up to to the 1st row and 4th row. I managed to put the number using multirow in the middle, but I don't know how to draw the two vertical lines. Any ideas? EDIT: I want the vertical lines to stretch from the middle above the number -- up and one from the middle below the number down.

  • Big block matrix with tikz
    by c.p. on September 18, 2012 at 8:23 pm

    I know this is very similar to plenty of questions. The matrix below s actually bigger, so I realized that I had to use tikz. In this array, A, A',…,L', T are square matrices, and I filled with zeros the right half, although the original matrix doesn't have these trivial entries, so I cannot remove them (don't try to fix the entries in the right side, because the spacing is ok when I introduce their actual values) Is there a less ugly way to write this block matrix? I'm sure there is a better way to display this tensor product in the non-zero block below, because, as it is displayed, it is not readable. I mean, it seems that \otimes T is multiplying only the matrix L! \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{arrows,chains,matrix,positioning,scopes} \begin{document} \begin{tikzpicture}[node distance=-1ex] \matrix (mymatrix) [matrix of math nodes,left delimiter={(},right delimiter={)}] { 0 & 0 & A& A' & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0&0 &\!\!\!\!\! \\ 0 & 0 & B' & B\,\, & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0&\!\!\!\!\!\\ C & C' & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0&\!\!\!\!\!\\ D' & D & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0&\!\!\!\!\!\\ 0 & 0 & 0 & 0 & 0 & 0 & K & K' & & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0&\!\!\!\!\!\\ 0 & 0 & 0 & 0 & 0 & 0 & L' & L & \!\!\!\otimes T & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &0&\!\!\!\!\!\\ 0 & 0 & 0 & 0 & M & M' & 0 &0 & & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0&0&\!\!\!\!\!\\ 0 & 0 & 0 & 0 & N' & N & 0 & 0 & & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0&0&\!\!\!\!\!\\ }; \draw[blue,dashed] (mymatrix-4-1.south west) -- (mymatrix-4-4.south east); \draw[blue,dashed] (mymatrix-1-4.north east) -- (mymatrix-4-4.south east); \draw[red,dashed] (mymatrix-4-4.south east) -- (mymatrix-4-10.south west); \draw[red,dashed] (mymatrix-5-4.north east) -- (mymatrix-8-4.south east); \draw[red,dashed] (mymatrix-4-10.south west) -- (mymatrix-8-10.south west); \draw[red,dashed] (mymatrix-8-4.south east) -- (mymatrix-8-10.south west); \end{tikzpicture} \end{document}

  • Draw mechanical springs in TikZ
    by student on January 19, 2012 at 4:14 pm

    Currently I am using the following path style to draw springs in TikZ \tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.1cm,post length=0.1cm,segment length=6}] for example \draw[spring] (0,0) -- (0,1); However is it possible to make the springs look like in the following picture: Is there any nice way to incorporate the possibility of drawing the spring stretched or compressed like in the picture above?