TikZ
- Fail to replicate a sloped node with label nodeby D G on March 10, 2026 at 8:13 am
I want to replicate the black label with the red label created with label node. \documentclass[tikz,border=1cm,12pt]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \draw (0,0) -- ++ ({sqrt(3)},{sqrt(11)}) node[pos=1/3,circle,fill,inner sep=1pt]{} % dot node[pos=1/3,label={[red,rotate={atan(sqrt(11/3))}]above:above}]{} % how can we make this label node[pos=1/3,above,sloped]{above}; % coincide with this label? \end{tikzpicture} \end{document} What am I missing here?
- How to include standalone Tikz figure ready to move around in the main document without moving macros to the Main Document?by user516076 on March 10, 2026 at 12:27 am
What I meant to ask is currently I have this Tikz: \documentclass[tikz,border=6pt]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}[line join=round, line cap=round] \newcommand{\singletick}[4]{% \path (#1) -- (#2) coordinate[pos=#3] (tickpos); \pgfmathanglebetweenpoints {\pgfpointanchor{#1}{center}} {\pgfpointanchor{#2}{center}} \let\ang\pgfmathresult \begin{scope}[shift={(tickpos)}, rotate=\ang+90] \draw[line width=0.8pt] (-#4,0) -- (#4,0); \end{scope} } \newcommand{\doubletick}[5]{% \path (#1) -- (#2) coordinate[pos=#3] (tickpos); \pgfmathanglebetweenpoints {\pgfpointanchor{#1}{center}} {\pgfpointanchor{#2}{center}} \let\ang\pgfmathresult \begin{scope}[shift={(tickpos)}, rotate=\ang+90] \draw[line width=0.8pt] (-#5,-#4) -- (#5,-#4); \draw[line width=0.8pt] (-#5, #4) -- (#5, #4); \end{scope} } \coordinate (A1) at (0,2.2); \coordinate (B1) at (3.2,5.7); \coordinate (C1) at (6.2,2.2); \coordinate (D1) at (3.2,-2.8); \fill[cyan!60] (A1)--(B1)--(C1)--(D1)--cycle; \draw[line width=1pt] (A1)--(B1)--(C1)--(D1)--cycle; \draw[line width=1pt] (B1)--(D1); \doubletick{A1}{B1}{0.47}{0.08}{0.12} \doubletick{B1}{C1}{0.47}{0.08}{0.12} \singletick{A1}{D1}{0.52}{0.12} \singletick{D1}{C1}{0.52}{0.12} \node[left,font=\LARGE] at (A1) {$A$}; \node[above,font=\LARGE] at (B1) {$B$}; \node[right,font=\LARGE] at (C1) {$C$}; \node[below,font=\LARGE] at (D1) {$D$}; \node[left,font=\LARGE] at (1.2,4.1) {$4\ \mathrm{cm}$}; \node[left,font=\LARGE] at (1,0.2) {$6\ \mathrm{cm}$}; \node[right,font=\LARGE] at (3.2,1.5) {$10\ \mathrm{cm}$}; \begin{scope}[shift={(-1.2cm,0)}] \coordinate (A2) at (8.8,1.4); \coordinate (B2) at (10.7,3.7); \coordinate (C2) at (12.5,1.4); \coordinate (D2) at (10.7,-1.8); \fill[cyan!60] (A2)--(B2)--(C2)--(D2)--cycle; \draw[line width=1pt] (A2)--(B2)--(C2)--(D2)--cycle; \draw[line width=1pt] (B2)--(D2); \doubletick{A2}{B2}{0.50}{0.07}{0.10} \doubletick{B2}{C2}{0.50}{0.07}{0.10} \singletick{A2}{D2}{0.53}{0.10} \singletick{D2}{C2}{0.53}{0.10} \node[left,font=\LARGE] at (A2) {$A$}; \node[above,font=\LARGE] at (B2) {$B$}; \node[right,font=\LARGE] at (C2) {$C$}; \node[below,font=\LARGE] at (D2) {$D$}; \node[font=\LARGE] at (10.9,1.0) {$b\ \mathrm{cm}$}; \node[right,font=\LARGE] at (12.0,2.8) {$2\ \mathrm{cm}$}; \node[right,font=\LARGE] at (11.5,-0.7) {$a\ \mathrm{cm}$}; \end{scope} \end{tikzpicture} \end{document} Suppose this is the main document: \documentclass[twoside]{article} \begin{document} \section{Introduction} Hello LaTeX %I want to add the figure here \end{document} I wish the figure within the article would be moveable by coordinate and any built-ins like h, t, b, p (Please teach me both, as to how to use them). By coordinate, if it's possible, I want something like (a, b). Or perhaps you have a better way to move the figure freely, please add it to your answer. I don't know where to start and what package I would need, if I need one. Also to make the main document to be cleaner, I don't want any macros from the Tikz. So just leave it there, but include them all. How to do that? T.I.A.
- Fail to produce an octagon by repeating -- ([turn]45:{sqrt(2)}) 8 times with foreach [duplicate]by D G on March 9, 2026 at 3:58 pm
The expected output is shown in the first two. \documentclass[tikz,border=1cm]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \draw (0,0) foreach \a in {0,1,...,6}{-- ++({45*\a}:{sqrt(2)})} -- cycle; \end{tikzpicture} \begin{tikzpicture} \draw (0,0) -- ([turn]45:{sqrt(2)}) -- ([turn]45:{sqrt(2)}) -- ([turn]45:{sqrt(2)}) -- ([turn]45:{sqrt(2)}) -- ([turn]45:{sqrt(2)}) -- ([turn]45:{sqrt(2)}) -- ([turn]45:{sqrt(2)}) -- cycle; \end{tikzpicture} \begin{tikzpicture} \draw (0,0) foreach \i in {0,...,6} {-- ([turn]45:{sqrt(2)})} -- cycle; \end{tikzpicture} \end{document} Why doesn't the last one produce the expected output?
- Porting aligncolsatbottom.sty to TeX Live 2022+by ke. on March 9, 2026 at 1:22 pm
I'm using this template to produce posters with columns that are aligned at the bottom. It seems to be based on this solution by Chris Le Sueur. My problem is that it works with Tex Live 2021, but not with 2022 and up. Here is a minimal example: simple-poster.tex \documentclass[a0paper,portrait,margin=0pt, colspace=24pt,subcolspace=0pt,blockverticalspace=36pt,innermargin=50pt]{tikzposter} \usepackage{lipsum} % Random Text \usepackage[colalign]{aligncolsatbottom} %To align columns at bottom (!! please run 2 times) \title{The Best Title Ever} \author{First Author\textsuperscript{1}, \underline{Presenting Author}\textsuperscript{1,2}, Second Author\textsuperscript{2}} \institute{ \textsuperscript{1}Your primary affiliation, City, Country.\\ \textsuperscript{2}Another affiliation, City, Country.} %.............................................................................................................................................................................................. \begin{document} % % % HEAD % %.................................................................................... % % Title % \maketitle[width=0.96\linewidth,titletoblockverticalspace=36pt,linewidth=0,roundedcorners=10] %.............................................................................................................................................................................................. % % LEFT COLUMN % \begin{columns} \column{0.5} %.................................................................................... % % Block % \block[titleleft,roundedcorners=16]{Introduction}{ \raggedright \lipsum[4] } %.............................................................................................................................................................................................. % % RIGHT COLUMN % \column{0.5} %.................................................................................... % % Block % \block[titleleft,roundedcorners=16]{Another Block}{ \raggedright \lipsum[13] } \end{columns} \end{document} aligncolsatbottom.sty \usepackage{letltxmacro} \usepackage{ifthen} \newif\ifmy@colalign \my@colalignfalse \DeclareOption{colalign}{ \my@colaligntrue } \ProcessOptions\relax \ifmy@colalign % Align the bottoms of columns % Declarations \newcounter{my@column} \newcounter{my@column@loop} \newcounter{my@block} \newdimen\my@columnextraspace \newdimen\my@maxcolheight \newdimen\my@colheight \newdimen\my@blocktopstart \newdimen\my@rounded % Store the natural height and number of blocks of the current column in the aux file \gdef\my@storecolheight{ \ifnum\value{my@column} > 0 % \expandafter\newdimen\csname my@colheight\alph{my@column}\endcsname \expandafter\setlength\csname my@colheight\alph{my@column}\endcsname{\my@colheight} \immediate\write\@auxout{\noexpand\newlabel{my@colheight\alph{my@column}}{{\the\my@colheight}{}}} \immediate\write\@auxout{\noexpand\newlabel{my@numblocks\alph{my@column}}{{\the\c@my@block}}} \fi } \LetLtxMacro{\orig@block}{\block} % Replace the \block command with a version that pads each block by \my@columnextraspace \renewcommand{\block}[3][]{% \ifTP@columnEnvironment \my@blocktopstart=0pt\relax \advance\my@blocktopstart-\TP@blocktop \fi \orig@block[{#1}]{#2}{\vspace*{-0.5\my@columnextraspace}#3\vspace*{-0.5\my@columnextraspace}} \ifTP@columnEnvironment % count number of blocks \stepcounter{my@block} % keep track of the height of the current column \advance\my@blocktopstart\TP@blocktop \advance\my@colheight\my@blocktopstart % don't add the padding to the height \advance\my@colheight-\my@columnextraspace \fi } % Store the maximum natural height of any column in the aux file \gdef\my@storemaxcolheight{ \ifnum\value{my@column} > 0 % \newdimen\my@maxcolheight \newdimen\my@colheight@loop \setcounter{my@column@loop}{0} \loop\ifnum\value{my@column@loop}<\value{my@column} \stepcounter{my@column@loop} \my@colheight@loop\csname my@colheight\alph{my@column@loop}\endcsname \ifnum\my@colheight@loop<\my@maxcolheight \my@maxcolheight\my@colheight@loop \fi \repeat \immediate\write\@auxout{\noexpand\newlabel{my@maxcolheight}{{\the\my@maxcolheight}{}}} \fi } % Read the column height information and calculate how much extra space the current column needs per block \gdef\my@calcextraspace{ \@ifundefined{r@my@maxcolheight}{% \my@columnextraspace=0pt\relax }{% \expandafter\my@maxcolheight\ref{my@maxcolheight} \expandafter\my@colheight\ref{my@colheight\alph{my@column}} \setcounter{my@block}{\ref{my@numblocks\alph{my@column}}} \my@columnextraspace\my@maxcolheight \advance\my@columnextraspace-\my@colheight \divide\my@columnextraspace by \value{my@block} } } % Replace \column command by a version which stores the height (of the previous column) and calls \my@calcextraspace \gdef\column#1{ % #1: relative width \ifTP@columnEnvironment \my@storecolheight \stepcounter{my@column} \my@calcextraspace \setcounter{my@block}{0} \my@blocktopstart0pt \my@colheight0pt % Now the normal \column command \normalsize \setlength{\TP@blocktop}{\TP@coltop} \setlength{\TP@colcenter}{\TP@colcenter+0.5\colwidth+\TP@colspace} \setlength{\colwidth}{#1\TP@visibletextwidth+#1\TP@colspace-\TP@colspace-\blocklinewidth} \setlength{\TP@colcenter}{\TP@colcenter+0.5\colwidth+\blocklinewidth} \fi } % Replace the columns environment with a version which stores the height of the final column and the max column \renewenvironment{columns}{ \TP@columnEnvironmenttrue \setlength{\TP@colcenter}{-0.5\TP@visibletextwidth-\TP@colspace-0.5\blocklinewidth} \global\TP@colcenter=\TP@colcenter \global\TP@coltop=\TP@blocktop \global\TP@colbottom=\TP@blocktop \colwidth=0pt }{ \my@storecolheight \my@storemaxcolheight \TP@columnEnvironmentfalse \global\TP@blocktop=\TP@colbottom } \fi With TeX Live 2021, this works and aligns the columns. With TeX Live 2022 and up, on the second run of pdflatex, I get this error: ! Missing number, treated as zero. <to be read again> \xparse function is not expandable l.29 \column{0.5} I don't understand what this means, but maybe something in the redefinition of \column in aligncolsatbottom.sty needs to be adjusted? I quote it here: % Replace \column command by a version which stores the height (of the previous column) and calls \my@calcextraspace \gdef\column#1{ % #1: relative width \ifTP@columnEnvironment \my@storecolheight \stepcounter{my@column} \my@calcextraspace \setcounter{my@block}{0} \my@blocktopstart0pt \my@colheight0pt % Now the normal \column command \normalsize \setlength{\TP@blocktop}{\TP@coltop} \setlength{\TP@colcenter}{\TP@colcenter+0.5\colwidth+\TP@colspace} \setlength{\colwidth}{#1\TP@visibletextwidth+#1\TP@colspace-\TP@colspace-\blocklinewidth} \setlength{\TP@colcenter}{\TP@colcenter+0.5\colwidth+\blocklinewidth} \fi } If I comment out this part: \my@storecolheight \stepcounter{my@column} \my@calcextraspace \setcounter{my@block}{0} \my@blocktopstart0pt \my@colheight0pt then it compiles - but doesn't align the columns, obviously.
- Producing an Elliptical Ring of Imagesby DDS on March 8, 2026 at 8:34 pm
Consider the code: \documentclass{book} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \thispagestyle{empty} \begin{center} \begin{tikzpicture} \fill[red] rectangle (8,6); \foreach \k in {0,30,...,360} \node at ($(4,3)+(\k:2)$) {\includegraphics[width=1.7em]{example-image-a}}; \end{tikzpicture} \end{center} \end{document} which produces: QUESTION: How may I modify this code in order produce an ellipse (instead of circle) of images? Thank you.
- How to correct for LaTeX and/or package changes affecting parsing of text in TikZ decoration for TL2020 vs TL2021 vs TL2022/3 vs TL2024 vs TL2025/6?by cfr on March 8, 2026 at 7:31 pm
Consider the following code: \documentclass{article} \usepackage{tikz} \usetikzlibrary{% decorations.text,% mindmap,% } \begin{document} \begin{tikzpicture} \path[ adddecrev/.style={% postaction={decorate, decoration={text along path, text={##1}, raise=3pt, }}}, small mindmap, ] node (norm) [root concept, concept, adddecrev={AAA AAA|\hskip 7.5pt| ||AAAAA AAA{\kern10ptA}A AA AA}] {AAAAAAAAA} [counterclockwise from=120] % removing this child eliminates the warnings child { node [concept, adddecrev={X{\kern-2ptX}{\kern-1ptX}{\kern4ptX}{\kern0ptX}X|\hskip8pt| ||X{\kern-2ptX}X{\kern-1ptX}{\kern-1ptX} X{\kern-3ptX}{\kern-1ptX}l{\kern-1ptX}|\hskip-2pt|X||{\kern-1ptX}|\hskip4pt|X||{\kern-2ptX}|\hskip-2pt|X|| }] {MMMMMMMM} } ; \end{tikzpicture} \end{document} In TL2020, this compiles without complaint for either pdfLaTeX or LuaLaTeX. In TL2025 or 2026, it complains Missing character: There is no A in font nullfont! In TL2024, the complaint is Missing character: There is no @ in font nullfont! In TL2022 and TL2023, the complaint is Missing character: There is no ? in font nullfont! In TL2021, the complaint is Missing character: There is no > in font nullfont! What causes these differences? Usually the nullfont warnings relate directly to problematic characters in the source. The A suggests that might be the case, except that removing the X line makes the problem disappear. Moreover, for earlier installations, the characters complained of bear no obvious relation to the input and I'm not sure where they are coming from or what the problem is. I also can't see anything obviously wrong with the code specifying the text for the decoration, despite rereading the relevant part of the manual. What is happening here? Is my code erroneous? If so, how can I correct it? In any case, is there a way to avoid the problem with a current TeX Live?
- Drawing a topological surface of genus threeby InsideOut on March 8, 2026 at 12:56 pm
I would need your help to draw a surface of genus three like in the picture I attached. More specifically, I aim to draw a torus (surface of genus one) and below the surface of genus three realised by mean of some surgeries on the surface. I already drawn the torus by myself and I need help with the genus 3 surface. As you can see, the torus I drew is not exactly as on paper. Could help me? I also added some notes about colours of curves. Moreover, I'd like the surface is filled with the pattern [pattern=north west lines, pattern color=pallido], where pallido is just a colour I defined in RGB (it's already in the code). In the picture I do not need the names of colours, that's only for you. Thank you in advance! \documentclass[11pt,a4wide]{article} \usepackage[latin1]{inputenc} \usepackage{fancyhdr} \usepackage{indentfirst} \usepackage{graphicx} \usepackage{newlfont} \usepackage{amssymb} \usepackage{amsmath} \usepackage{latexsym} \usepackage{lscape} \usepackage{booktabs} \usepackage{amsthm} \usepackage{lscape} \usepackage{tikz} \usetikzlibrary{patterns,hobby} \usepackage{pgfplots} \pgfplotsset{compat=1.6} \usepackage{faktor} %\faktor{A}{B} %\usepackage{pictexwd,dcpic} \usepackage{pgf,tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{arrows.meta} \usetikzlibrary{decorations.markings} \usetikzlibrary{bending} \usetikzlibrary{patterns} \usetikzlibrary{intersections, calc} \usetikzlibrary{decorations.pathmorphing} \usepackage{soul} \usepackage{rotating} \usepackage[margin=3cm]{geometry} \usepackage{enumitem} \usepackage{color} \usepackage{hyperref} \definecolor{smoked}{RGB}{216, 212, 204} \definecolor{mauve}{RGB}{200, 55, 171} \definecolor{apricot}{RGB}{250, 144, 4} \definecolor{sky}{RGB}{66, 169, 244} \definecolor{plum}{RGB}{76, 0, 102} \definecolor{forest}{RGB}{90,145,120} \definecolor{sand}{RGB}{180,160,120} \begin{document} \begin{figure}[h!] \centering \begin{tikzpicture}[scale=2, every node/.style={scale=0.875}] \definecolor{pallido}{RGB}{221,227,227} \pattern [pattern=north west lines, pattern color=pallido] (0,0) ellipse (3cm and 2cm); \fill [white] (0,0) ellipse (1cm and 0.66cm); \draw[thin, black] (0,0) ellipse (3cm and 2cm) (0,0) ellipse (1cm and 0.66cm); \draw[orange] (0,0) ellipse (2cm and 1.25cm); %\draw[blue] (0,0) arc (030:060:2.5cm and 1.5cm); \draw[blue] (0,0) +(30:2.4 and 1.6) arc [start angle=30, end angle=60, x radius=2.4, y radius=1.6]; \draw[blue] (0,0) +(210:2.4 and 1.6) arc [start angle=210, end angle=240, x radius=2.4, y radius=1.6]; \draw[violet] (0,0) +(120:1.2 and 0.8) arc [start angle=120, end angle=150, x radius=1.2, y radius=0.8]; \draw[violet] (0,0) +(300:1.2 and 0.8) arc [start angle=300, end angle=330, x radius=1.2, y radius=0.8]; \draw[red ] (0 ,-0.66) to[bend left ] (0,-2); \draw[sky ] (0 , 0.66) to[bend left ] (0, 2); \draw[thin, red, dashed] (0 ,-0.66) to[bend right] (0,-2); \draw[thin, sky, dashed] (0 , 0.66) to[bend right] (0, 2); \fill ( 0.2,-1.25) circle (1pt); \fill (-0.2, 1.25) circle (1pt); \fill[violet] (0,0) +(120:1.2 and 0.8) circle (0.5pt); \fill[violet] (0,0) +(150:1.2 and 0.8) circle (0.5pt); \fill[violet] (0,0) +(300:1.2 and 0.8) circle (0.5pt); \fill[violet] (0,0) +(330:1.2 and 0.8) circle (0.5pt); \fill[blue] (0,0) +(030:2.4 and 1.6) circle (0.5pt); \fill[blue] (0,0) +(060:2.4 and 1.6) circle (0.5pt); \fill[blue] (0,0) +(210:2.4 and 1.6) circle (0.5pt); \fill[blue] (0,0) +(240:2.4 and 1.6) circle (0.5pt); \draw[black, thin] (0,0) +(030:2.4 and 1.6) circle (1pt); \draw[black, thin] (0,0) +(060:2.4 and 1.6) circle (1pt); \draw[black, thin] (0,0) +(210:2.4 and 1.6) circle (1pt); \draw[black, thin] (0,0) +(240:2.4 and 1.6) circle (1pt); \draw[violet] (0,0) +(120:1.2 and 0.8) circle (1pt); \draw[violet] (0,0) +(150:1.2 and 0.8) circle (1pt); \draw[violet] (0,0) +(300:1.2 and 0.8) circle (1pt); \draw[violet] (0,0) +(330:1.2 and 0.8) circle (1pt); \node at ( 1.75 , 1.25 ) {\(e_{1,1}\)}; \node at (-1.75 ,-1.25 ) {\(e_{1,2}\)}; \node at (-1.0625, 0.625) {\(e_{2,1}\)}; \node at ( 1.0625,-0.625) {\(e_{2,2}\)}; \end{tikzpicture} \caption{} \label{fig:hypermin} \end{figure} \end{document} My current result The picture I wish to draw:
- Italian Parliament: semicircle and colored dotsby Sebastiano on March 6, 2026 at 8:39 pm
I am preparing a project that involves representing the Italian Parliament using a semicircle made of colored dots, as shown in the following image: I have tried to create something using the wheelchart package (page 19 of the manual), which allows generating similar charts. However, I am unable to automatically increase the number of dots per row. For example, in the figure there are 12 dots per row, but I would like a more customizable (for example 7 balls for every radius) and automatic solution to control this. I prefer big dots and not balls. \documentclass{article} \usepackage{tikz} \usepackage{wheelchart} \begin{document} \begin{tikzpicture} \pgfkeys{ /wheelchart, discrete, discrete pic={\shade[ball color=\WCvarB] (0,0) circle[radius=2pt];}, discrete sort=angle, discrete space at borders=false, start angle=180, total angle=180, value=\WCvarA } \wheelchart{ 120/blue/, 45/green/, 40/red/, 25/orange/, 10/purple/, 5/teal/ } \end{tikzpicture} \end{document}
- Use a pattern in TikZ multipart nodeby Tobard on March 6, 2026 at 4:56 pm
I would like to apply a pattern decoration in one part of a split node, in TikZ. See the following code: \documentclass[tikz]{standalone} \usetikzlibrary{shapes.multipart, patterns.meta} \begin{document} \begin{tikzpicture}[text width=3cm, draw, rounded corners] \node[draw, fill=yellow, postaction={pattern color=orange, pattern={Lines[distance=10mm,angle=45,line width=5mm]}} ] at (0,0) {Example}; \node[draw, rectangle split, rectangle split parts=2, rectangle split part fill={yellow,white}] at (0,-1) {Title\nodepart{second}Element content}; \end{tikzpicture} \end{document} I would like the "Title" part to look like the "Example" node. I have tried to replace the yellow,white instruction by {yellow, postaction={pattern color=orange, pattern={Lines[distance=10mm,angle=45,line width=5mm]}} },white But it dosn't work. Can you help me? Thanks.
- TikZ: Projecting letter with a cm-matrix onto a 3D rectangular areaby cis on March 6, 2026 at 2:44 pm
I'm drawing a 3D rectangle (which should be a plane, represented by the letter "H"). At the top left corner, at 'C', I want to project a $H$ in mathematical font onto the plane. I've used a cm matrix for this. The position is correct, but I've noticed that the serifs of the 'H' are parallel, despite using $H$, so it doesn't look like mathematical font. What do I need to do? PS: I think, the $H$ should look something like this here: Unfortunately, I can't present it any better. \documentclass[margin=5pt, tikz]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}[ x={(-4.85mm,-4.85mm)}, y={(10mm,0mm)}, z={(0,10mm)}, font=\footnotesize, ] %\coordinate[label=below:$O$](O) at (0,0,0); \coordinate[label=right:A](A) at (0,2,0); \coordinate[label=B](B) at (0,2,2); \coordinate[label={[anchor=south west, inner sep=1pt]{C $H$ (as it should be)}}](C) at (-2.5,-1.5,2); \coordinate[label=left:D](D) at (-2.5,-1.5,0); \draw[] (A) -- (B) -- (C) -- (D) --cycle; \path let \p1 = ($(B)-(C)$), \p2 = ($(C)-(D)$), \n{len1} = {veclen(\x1,\y1)}, \n{len2} = {veclen(\x2,\y2)}, \n1 = {\x1/\n{len1}}, \n2 = {\y1/\n{len1}}, \n3 = {\x2/\n{len2}}, \n4 = {\y2/\n{len2}} in node[cm={\n1, \n2, \n3, \n4, (C)}, anchor=north west, inner sep=1pt, %transform shape, % no effect ]{H $H$ \mbox{$H$}}; % CoSy \begin{scope}[-latex, thick, shift={(0,-2,2)}] \foreach \P/\s/\Pos in {(1,0,0)/x/above, (0,1,0)/y/right, (0,0,1)/z/right} \draw[] (0,0,0) -- \P node[\Pos, pos=0.9,inner sep=3pt]{$\s$}; \end{scope} \end{tikzpicture} \end{document}
- Fadings beyond the edge of the scopeby karlh on March 5, 2026 at 10:51 pm
As a follow-up to a previous question, how can I prevent TikZ from cutting off the edge of the path if the edge of the object goes beyond the edge of the fading pattern? Here is a minimal working example: \documentclass{article} \usepackage[svgnames]{xcolor} \usepackage{tikz} \usetikzlibrary{fadings} \begin{document} \begin{tikzpicture} \begin{scope} \path [scope fading=east] (1,1) rectangle (3,3); \draw [FireBrick,very thick] (0,0) rectangle (2,2); \end{scope} \draw [dotted] (1,1) rectangle (3,3); \begin{scope}[yshift=-4cm] \path [scope fading=east] (1,1) rectangle (3,3); \draw [Gray,very thick] (-1,-1) rectangle (2,2); \end{scope} \draw [yshift=-4cm,dotted] (1,1) rectangle (3,3); \begin{scope}[yshift=-4cm,xshift=5cm] \path [scope fading=east] (1,-1) rectangle (3,3); \draw [Gray,very thick] (-1,-1) rectangle (2,2); \end{scope} \draw [Gray,very thick,yshift=-4cm,xshift=5cm] (0,2) -- (-1,2) -- (-1,-1) -- (0,-1); \end{tikzpicture} \end{document} which produces, in XPDF, Note that the red one works fine, because the edge of the fading (which extends about 25% beyond the edge of the object) is still 100% transparent there, but the gray one does not work because it extends past the edge of the fading. It should look like the one on the lower right, at least on the left-hand side of the square. Note that it would also be an issue for fadings that don't fade all the way out going off the right of the fading, or for very large radial fadings that fade to transparent well before the edge of the object being faded. If the paths were filled, I could simply fill the left part of the pattern with the solid color and clip without having to re-draw it, but if it's just a draw shading, part of it gets cut off and I don't know how to get it back short of drawing it again. Note: some PDF viewers (including my usual ones, Evince and Papers), do not display any of these images correctly, because they don't handle faded drawn paths correctly. This is a viewer problem, but XPDF seems to do better.
- aerospace test questions [closed]by destine-lee destine-lee on March 5, 2026 at 3:13 pm
\begin{array}{|c|} \hline \begin{minipage}{0.45\textwidth} \begin{center} \begin{tikzpicture}[scale=0.7] \draw (0,0) circle (1.5cm); \draw[thick, blue] (-1.5,0) -- (1.5,0); \fill[brown] (0,-1.5) arc (-90:-270:1.5cm and 0.6cm) -- cycle; \fill[blue] (0,1.5) arc (90:270:1.5cm and 0.6cm) -- cycle; \draw[yellow, very thick] (-0.3,0) -- (0.3,0); \draw[yellow, very thick] (0,-0.1) -- (0,0.1); \node at (0,0.6) {$10^\circ$}; \draw[yellow, very thick] (-0.1,0.6) -- (0.1,0.6); \node at (0,1.2) {$20^\circ$}; \draw[yellow, very thick] (-0.1,1.2) -- (0.1,1.2); \draw[<->, very thick] (2, -0.2) -- (2, 0.2); \node at (2.5, 0) {Bank}; \end{tikzpicture} \end{center} \end{minipage} \\ \hline \text{Attitude Indicator} \\ \hline \end{array}
- Tikz error on a not-so-old file (once working)by user126154 on March 5, 2026 at 9:00 am
I have an old latex file that in 2019 was perfectly ok. Today (in 2026) I try to compile the source and I get an error ERROR: Package tikz Error: Cannot parse this coordinate. The point in the file where it seems to be an error (according to emacs) is the following scope environment: \foreach\a in{(-30.5,4),(-13,9),(-16.5,-7.5),(34,0),(53,0),(72,0)} { \begin{scope}[shift={\a}] \draw (0,0) to[out=30, in=150] (4,0); \draw (-1,.5) to[out=-30, in=-150] (5,.5); \end{scope} } The weird thing is that file was completely fine and compiling some years ago! I isolated the problem creating a test file \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach\a in{(10,2), (5,-3)} { \begin{scope}[shift={\a}] \draw (0,0) to (2,2); \end{scope} } \end{tikzpicture} \end{document} and I get the same error. So, my question is What's wrong now, and how I can fix it in the current version of tikz?
- Fadings and shadings with shifted origins for strokes in TikZby karlh on March 4, 2026 at 11:59 pm
I have been working with fadings a lot recently, and I encountered a fading in Inkscape that I'm having trouble translating to an equivalent TikZ implementation. The situation is a faded stroke for which the fading boundaries do not coincide with the outline of the shape, and the "center" of the fading is not the center of the object. I have worked out a method that works for filled paths, such as: \begin{tikzpicture} \path [fill=orange,path fading=fade right] (0,0) rectangle (2,2); \draw [very thin,->] (0,1) -- (2,1); \begin{scope} \clip (0,-3) rectangle (2,-1); \fill [orange] (-1,-4) rectangle (1.02,0); \path [fill=orange,path fading=fade right] (1,-3) rectangle (2.5,0); \end{scope} \draw [overlay,very thin,->] (1,-2) -- (3,-2); \end{tikzpicture} where the arrow indicates the start and end points of the shading (equivalent to what you would see with Inkscape's node tool). Similarly, the shading can be rotated with a similar shift in origin like so: \begin{tikzpicture} \path [fill=orange,path fading=fade right,fading angle=30] (0,0) rectangle (2,2); \draw [very thin,->] (0.133974,0.5) -- ++(30:2); \begin{scope} \clip (0,-3) rectangle (2,-1); \begin{scope}[transform canvas={rotate around={30:(1,-2)}}] \fill [orange] (-3,-4) rectangle (1.02,0); \path [fill=orange,path fading=fade right] (1,-4) rectangle (2,0); \end{scope} \end{scope} \draw [overlay,very thin,->] (1,-2) -- ++(30:2); \end{tikzpicture} This works fine for filled regions that are to be shaded or faded. However, the same trick—filling a larger object and then clipping—will not work with strokes that are to be shaded or faded. Is there a way to tell TikZ that the origin of the shading should be different than the bounding box of the object? It would also be desirable for the resulting line to be solid even if it goes off the "edge" of the square that defines the fading. I have also had trouble with faded strokes (without origin translation) not appearing in the PDF, but from a post I found while researching this, the issue is a PDF viewer issue (i.e., Evince and Papers display faded strokes incorrectly, but they show up correctly in MuPDF, say); if there is a way to avoid that problem, great, but otherwise I will chalk that up to "not a TikZ problem." The result should look something like this: Here's the whole thing, with headers: \documentclass{article} \usepackage{tikz} \usetikzlibrary{fadings} \tikzfading[name=fade right,left color=transparent!0,right color=transparent] \begin{document} I have been working with fadings a lot recently, and I encountered a fading in Inkscape that I'm having trouble translating to an equivalent Ti*k*Z implementation. The situation is a faded *stroke* for which the fading boundaries do not coincide with the outline of the shape. I have worked out a method that works for *filled* paths, such as: \begin{center} \begin{tikzpicture} \path [fill=orange,path fading=fade right] (0,0) rectangle (2,2); \draw [very thin,->] (0,1) -- (2,1); \begin{scope} \clip (0,-3) rectangle (2,-1); \fill [orange] (-1,-4) rectangle (1.02,0); \path [fill=orange,path fading=fade right] (1,-3) rectangle (2.5,0); \end{scope} \draw [overlay,very thin,->] (1,-2) -- (3,-2); \end{tikzpicture} \end{center} where the arrow indicates the start and end points of the shading (equivalent to what you would see with Inkscape's node tool). Similarly, the shading can be *rotated* with a similar shift in origin like so: \begin{center} \begin{tikzpicture} \path [fill=orange,path fading=fade right,fading angle=30] (0,0) rectangle (2,2); \draw [very thin,->] (0.133974,0.5) -- ++(30:2); \begin{scope} \clip (0,-3) rectangle (2,-1); \begin{scope}[transform canvas={rotate around={30:(1,-2)}}] \fill [orange] (-3,-4) rectangle (1.02,0); \path [fill=orange,path fading=fade right] (1,-4) rectangle (2,0); \end{scope} \end{scope} \draw [overlay,very thin,->] (1,-2) -- ++(30:2); \end{tikzpicture} \end{center} \end{document}
- Drawing a tank consisting of a cylinder topped with a hemisphere of the same radiusby Dimitrios ANAGNOSTOU on March 4, 2026 at 2:25 pm
I’m working on a visualization to accompany a math problem: "A water tank consists of a cylindrical part with radius r and height h, topped with a hemispherical dome. The tank must be built to hold 600 m³ when full. (...)" After a lot of searching and experimenting, here is my current TikZ attempt: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{shapes.geometric} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \node (a) [cylinder, shape border rotate=90, draw, minimum height=15mm, minimum width=7.5mm] {}; \draw [<->] ([xshift=5pt]a.before bottom) -- ([xshift=5pt]a.after top) node [midway, right] {$h$}; \draw [<->] ([yshift=-5pt]a.bottom) -- ([yshift=-5pt]a.bottom -| a.before bottom) node [midway, below] {$r$}; % Define origin \coordinate (O) at (a.center); % Define h and r \def\h{15mm} \def\r{3.75mm} % Move to center (0,h/2,0) \coordinate (C) at ($(O)+(0,\h/2)$); % Hemicircle (upper half) \draw (C) ++(-\r,0) arc (180:0:\r); %% Coordinate system (centered at node center) %\draw[-latex, dashed] (a.center) -- ++(1.8,0) node[right] {$x$}; %\draw[-latex, dashed] (a.center) -- ++(0,1.8) node[above] {$y$}; %\draw[-latex, dashed] (a.center) -- ++(-1.2,-1.2) node[below left] {$z$}; % %\node[left] at (O) {$O$}; \end{tikzpicture} \end{document} My questions: How can I make the back part of the hemisphere (as indicated by the red arrow above) a dashed curve, like a true 3D effect? Is it possible to add some shading or filling to better suggest depth, without complicating my code?
- How can I put content into cells outside of the days of the month using tikz calendar?by Robert on March 3, 2026 at 9:25 pm
How can I create a calendar with content in the "empty" boxes, like in the photo below? In particular, how can I: combine days like May 24/31 so that one month's calendar always fits on 5 rows, and put items (e.g. mini calendar for previous and successive months, photo, or lunar phases) into the boxes that aren't days
- TikZ: How to add a node where a path gets clippedby Edoardo Serra on March 3, 2026 at 3:07 pm
I am designing a square (or “squarish” actually) map protractor in TikZ. So far, I have managed to draw the degree ticks along the four sides by clipping radial lines between two closed paths using the even odd rule like I saw in this answer. The ticks are generated in a \foreach loop. To avoid drawing long ticks on top of short ones, I separated them into two loops using a conditional test. I am not sure whether this separation is actually necessary for correct SVG export/printing, but that is how I implemented it. Below is a MWE: \documentclass[tikz]{standalone} %,convert={outfile=\main.svg} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{intersections, pgfplots.fillbetween} \pgfdeclarelayer{pre main} \pgfdeclarelayer{main} \pgfsetlayers{pre main, main} \usetikzlibrary{shapes} \begin{document} %all of this is needed to easily clip between two closed paths using even odd rule \makeatletter \def\@appendnamedsoftpath#1{% \pgfsyssoftpath@getcurrentpath\@temppatha \expandafter\let\expandafter\@temppathb\csname tikz@intersect@path@name@#1\endcsname \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\@temppatha\expandafter\expandafter\expandafter{\expandafter\@temppatha\@temppathb}% \pgfsyssoftpath@setcurrentpath\@temppatha } \def\@appendnamedpathforactions#1{% \pgfsyssoftpath@getcurrentpath\@temppatha \expandafter\let\expandafter\@temppathb\csname tikz@intersect@path@name@#1\endcsname \expandafter\def\expandafter\@temppatha\expandafter{\csname @temppatha\expandafter\endcsname\@temppathb}% \let\tikz@actions@path\@temppatha } \tikzset{ use path for main/.code={% \tikz@addmode{% \expandafter\pgfsyssoftpath@setcurrentpath\csname tikz@intersect@path@name@#1\endcsname }% }, append path for main/.code={% \tikz@addmode{% \@appendnamedsoftpath{#1}% }% }, use path for actions/.code={% \expandafter\def\expandafter\tikz@preactions\expandafter{\tikz@preactions\expandafter\let\expandafter\tikz@actions@path\csname tikz@intersect@path@name@#1\endcsname}% }, append path for actions/.code={% \expandafter\def\expandafter\tikz@preactions\expandafter{\tikz@preactions \@appendnamedpathforactions{#1}}% }, use path/.style={% use path for main=#1, use path for actions=#1, }, append path/.style={% append path for main=#1, append path for actions=#1 } } \makeatother \begin{tikzpicture} \pgfmathsetmacro\bigside{7} \pgfmathsetmacro\smallsidedelta{0.5} %cuts \draw[rounded corners=12pt, name path=outside] (0,0) rectangle (\bigside,\bigside); \draw[dotted, rounded corners=12pt, name path=inside] (\smallsidedelta,\smallsidedelta) rectangle (\bigside-\smallsidedelta,\bigside-\smallsidedelta); %remove before cutting or printign. Just as reference grid %backside print \tikzfillbetween[of=inside and outside] {white}; %print on transparent plastic so this is needed for better readability %frontside print \pgfmathsetmacro\degreesmallticksize{0.2} \pgfmathsetmacro\degreemidticksize{0.35} \pgfmathsetmacro\outerradius{sqrt(2*\bigside/2*\bigside/2)} \path[rounded corners=12pt, name path=degrees short] (\degreesmallticksize,\degreesmallticksize) rectangle (\bigside-\degreesmallticksize,\bigside-\degreesmallticksize); \path[rounded corners=12pt, name path=degrees mid] (\degreemidticksize,\degreemidticksize) rectangle (\bigside-\degreemidticksize,\bigside-\degreemidticksize); \begin{scope} [even odd rule] %small ticks \clip[use path=outside, append path=degrees short]; \foreach \deg in {0, ..., 359} { \pgfmathsetmacro\degmod{mod(\deg,5)} \pgfmathtruncatemacro{\itest}{ifthenelse(\degmod==0,1,0)} \ifnum\itest=0 \draw[thin] (\bigside/2,\bigside/2) -- ({\bigside/2+\outerradius*cos(\deg)},{\bigside/2+\outerradius*sin(\deg)}); \fi } \end{scope} %had to add a second scope and for loop since the clipped area is different \begin{scope} [even odd rule] %mid ticks \clip[use path=outside, append path=degrees mid]; \foreach \deg in {0, ..., 359} { \pgfmathsetmacro\degmod{mod(\deg,5)} \pgfmathtruncatemacro{\itest}{ifthenelse(\degmod==0,1,0)} \ifnum\itest=1 \draw[thick] (\bigside/2,\bigside/2) -- ({\bigside/2+\outerradius*cos(\deg)},{\bigside/2+\outerradius*sin(\deg)}); \fi } \end{scope} \end{tikzpicture} \end{document} And the output is the following: I would now like to add a label at the inner end of each thick (5°) tick, displaying the corresponding degree value (0–355), like this: Now a few nuances: The numbers must always face towards the inside, with the exception, if possible, of the bottom row of numbers from 135° to 225°. When numbers get big, they don't have enough space to fit unless the labels become too small to read (actual printing size of the protractor will be something like 7x7 or 8x8cm). So they need to be shifted in such a way that they fit. 355 in the provided image is a clear example of what I mean. I can consider shifting them radially as well, but they need to stay to the outside of the dotted line, which I can make a little smaller. I really don't know where to start and didn't manage to find anything online. Thank you for your time!
- How to label axes, points, and curves in a 3D plot using luadraw?by Octavius on March 3, 2026 at 2:00 pm
The question arised from the previous link and the luadraw solution. I am using luadraw to visualize the surface z = x^2 + y^2 together with the intersection curve corresponding to the direction u = (1,0). I would like to know whether it is possible to: Label the coordinate axes $x$, $y$, and $z$, Label the point $c = (0,0)$, Indicate the direction $u = (1,0)$, And label the function $F(t) = t^2$ corresponding to the intersection curve. When I try to use Dtext3d, the document compiles but the output appears blank in Overleaf. Is there a reliable way to add these labels when using luadraw? \documentclass[border=5pt]{standalone} \usepackage[svgnames]{xcolor} \usepackage[3d]{luadraw} \usepackage{fourier-otf} \usepackage{tikz} \begin{document} \begin{luadraw}{name=paraboloid} local g = graph3d:new{ window3d = {-2,2,-2,2,0,8}, window = {-4.5,4,-3,9.5}, size = {10,10,0}, viewdir = perspective("central",30,50,20) } -- Surface local S = cartesian3d(function(x,y) return x^2+y^2 end, 2,-2,-2,2) -- Direction local c = Origin local u = M(1,0,0) local N = pt3d.prod(u, vecK) -- Intersection curve local Curve = g:Intersection3d(S, {c,N}) -- Draw surface g:Dfacet(S, {usepalette={palGasFlame,"z"}, edgecolor="gray", clip=true}) -- Draw curve g:Dedges(Curve, {hidden=true, color="Navy", width=12}) -- Axes g:Dline3d({Origin, M(2,0,0)}, {color="black", width=1, dash="dotted"}) g:Dline3d({Origin, M(0,2,0)}, {color="black", width=1, dash="dotted"}) g:Dline3d({Origin, M(0,0,6)}, {color="black", width=1, dash="dotted"}) g:Show() \end{luadraw} % ---- 2D overlay labels (safe in Overleaf) ---- \begin{tikzpicture}[overlay] \node at (3.7,4.2) {$x$}; \node at (1.1,4.8) {$y$}; \node at (2.5,7.3) {$z$}; \end{tikzpicture} \end{document}
- TiKZ: possibility of "average" blend mode?by putianyi888 on February 4, 2026 at 8:40 am
I get that the screen mode basically adds the RGB values. Is it possible to take the average of the values instead, so that colors don't get lighter? Opacity trick doesn't seem to work because I want full opacity where the images don't overlap.
- How to recreate a DuPont schemeby Dorian on November 22, 2025 at 1:30 pm
I'd like to recreate a DuPont scheme as the image below. I’m not necessarily asking for the exact code used to recreate the graphic, but rather for the packages and commands that would allow me to do it myself. Is there anything more “accessible” than TikZ? Thank you in advance 😉
- Segmented cake symbolby Sebastiano on October 26, 2025 at 9:50 pm
Let's take as an example an old request of mine, where I asked to create small symbols (eyes) to indicate the difficulty of an exercise. TikZ or symbol eyes for difficulty of examples/exercises Since I can't find a symbol, among those available in the symbol manual, that represents 1/4 of a cake to indicate time (and that can be associated with 1/2, 3/4, and 4/4), I wonder if it's possible to adapt the Marsupilam code to use a symbol that can be found in an Italian national newspaper. I think that is an image and not a symbol. \documentclass[12pt]{standalone} \usepackage{tikz} \newcommand\straightEye[1][1.2ex] {% \begin{tikzpicture}[scale=#1/1cm] \draw (0,0) circle (.5); \fill (0,0) circle (.25); \end{tikzpicture}% } \newcommand\downwardsEye[1][1.2ex] {% \begin{tikzpicture}[scale=#1/1cm] \draw (0,0) circle (.5); \fill (0,-.25) circle (.25); \end{tikzpicture}% } \newcommand\rightEye[1][1.2ex] {% \begin{tikzpicture}[scale=#1/1cm] \draw (0,0) circle (.5); \fill (.25,0) circle (.25); \end{tikzpicture}% } \begin{document} \straightEye \downwardsEye \ look at me \rightEye\rightEye \end{document}
- How to avoid duplicate chapter title and absolutely position chapter title with TikZby Chen Mortenfeld on June 12, 2025 at 7:50 pm
I'm customizing chapter titles in my book using the titlesec and tikz packages. For special chapters like the "Preface", I want to: Show a custom TikZ-styled title box that is positioned exactly \TitleBoxOffset below the top of the page (absolute positioning, not relative). Avoid having the chapter title (e.g., "Preface") appear twice on the page — once inside my TikZ box and once from LaTeX's default chapter title mechanism. So basically "Preface" appears twice, and the location is set manually. Here's my code in the .sty file: \usepackage[explicit]{titlesec} \usepackage{tikz} \usepackage{xcolor} \usepackage{etoolbox} % for \IfStrEq \newcommand{\CurrentChapterTitle}{} \newlength{\ChapterTopSkip} \newcommand{\ChapterHook}[1]{% \renewcommand{\CurrentChapterTitle}{#1}% \IfStrEq{#1}{Preface}{% \titleformat{\chapter} [block] {\centering} {} % no label {0pt} {% \begin{tikzpicture} \node[ draw=lightblue, line width=1pt, rounded corners=10pt, minimum width=0.8\linewidth, minimum height=2cm, align=center, fill=white, fill opacity=1, text opacity=1 ] {\scalebox{1.4}{\textcolor{lightblue}{\Huge{#1}}}}; \end{tikzpicture} } % \titlespacing*{\chapter}{0pt}{-\topskip}{20pt} \titlespacing*{\chapter}{0pt}{-95pt}{20pt} } {% \titleformat{\chapter}[block] {\normalfont\scshape\Huge\centering} {\fontsize{140pt}{140pt}\selectfont\thechapter\\} {0pt} {\normalfont\scshape\Huge\centering #1} }% } % % Patch \chapter to call ChapterHook \let\oldchapter\chapter \renewcommand{\chapter}[1]{% \ChapterHook{#1}% \oldchapter{#1}% } % Suppress LaTeX’s default \@makechapterhead \makeatletter \renewcommand{\@makechapterhead}[1]{} \makeatother Update: I updated the code block to include the packages. Thanks to the comments, I managed to make the word "Preface" appear only once, by using: \usepackage[explicit]{titlesec} see the update code. Now my only issue is the position of the title that I define manually — I want it to be at position 0 relative to the page boundaries, and then I’ll subtract a fixed predefined offset from it. Thank you!
- pgfplot: Fill between while including decoration functionby otiuuaugusto on January 11, 2023 at 10:43 pm
I am trying to fill between area for a specific plot within a groupplot environment. I have already tried to follow the pgfplot manual which is pretty clear with respect to the name path abd \path[] ... but I just always get the same weird outcome (see picture below). Since I was using the x-axis as the delimitation for the fill between, I started trying to use something else to check if something would change. Below is my MWE: \usepackage{tikz} \usepackage{pgfplots} \usepgfplotslibrary{fillbetween} \usepackage{textcomp} \pgfplotsset{compat=1.18} \usepackage{siunitx} \usepackage{tikzscale} \usetikzlibrary{pgfplots.groupplots} \usetikzlibrary{decorations.markings} \begin{document} \begin{tikzpicture} \begin{groupplot}[ group style={ group name = 4L_keywaveform_sim_S6currentstress, group size = 1 by 1, vertical sep = 15pt }, clip=true, enlargelimits=false, height = 0.75\textwidth, width = \textwidth, axis x line = bottom, axis y line = left, xlabel={$t$}, xlabel style={align=right, anchor=west, xshift=5.8cm, yshift=0.6cm}, x axis line style={shorten >=-15pt}, xmin=0, xmax=12.5, ymajorgrids=true, yminorgrids = true, xmajorgrids=true, grid style={dashed}, set layers,cell picture=true, ] \nextgroupplot[ymin=0, %Position colunm 1 by row 1 ymax=15, ytick align = outside, ytick pos = left, axis y line = left, ylabel = {$y$}, legend columns=1, ] \addplot[color=blue, name path global = teste1, domain=0:15, postaction={decorate},% ------ decoration={markings, % ------ mark=between positions 0.05 and 1 step (1/10)*\pgfdecoratedpathlength with {\arrow{Latex}}, }, ] {x}; \label{test}; \addlegendentry{$x$}; \addplot[color=red, name path global = teste2, domain=0:15] {-3 + x^2}; \path[name path global = teste3] (axis cs:0,5) -- (axis cs:12.5,5); \addplot[blue, fill=blue, fill opacity=0.4] fill between[of= teste1 and teste3]; \end{groupplot} \end{tikzpicture} \end{document} The MWE consists of only 1by1 groupplot for simplificativo purpose. But the issue persists for n by m groupplot. EDIT/UPDATE: By investigating a bit further, it seems that the decoration arguments are messing up with the fill between. I do not know the reason for that, though. Thanks,
- Subheadings for Pie chartsby Waseem on June 15, 2021 at 8:03 am
Can anyone help me for writing subheading on top each Pi chart with the following code. Please see the example picture \documentclass[border=5mm]{standalone} \usepackage{pgf-pie} % version: https://github.com/pgf-tikz/pgf-pie Dec 26, 2020 \usepackage{etoolbox} \makeatletter \pretocmd{\pgfpie@slice}{% define label text with percentages for small values \pgfmathparse{#3 > 5}% \ifnum\pgfmathresult=1 % \def\txtlabel{#4}% original label for large values \else% \def\txtlabel{#4 (#3\%)}% label with percentage for small values \fi% }{\message{define label patch ok}}{\message{define label patch failed}} \patchcmd{\pgfpie@slice}% use label text instead of original argument #4 {\pgfpie@text={\pgfpie@midangle:#4}}% {\pgfpie@text={\pgfpie@midangle:\txtlabel}}% {\message{add pct patch ok}}% {\message{add pct patch failed}}% \def\pgfpie@numbertext#1{% don't print percentage in slice for small values \pgfpie@ifhidenumber{}{% \pgfmathparse{#1 > 5}% \ifnum\pgfmathresult=1 % \pgfpie@beforenumber#1\pgfpie@afternumber% \fi }% } \makeatother \begin{document} \begin{subfigure} \footnotesize \begin{tikzpicture} %\begin{scope}[scale=0.7] \pie[before number =, after number = {\%},text=pin, ]{ 18.9/1-20 Employees, 29.2/21-100 Employees, 22.6/101-500 Employees, 7.5/501-1000 Employees, 21.7/Over 1000 Employees } %\end{scope} \end{tikzpicture} \end{subfigure} %\begin{tikzpicture} %\pie[before number =, after number = {\%},text=pin, ]{ %42.3/ Combination of DDD and business capability, %29.8/ Only business capability, %27.9/ only DDD %} %\end{tikzpicture} \begin{subfigure} \footnotesize \begin{tikzpicture} %\begin{scope}[scale=0.7] \pie[before number =, after number = {\%},text=pin, ]{ 5.7/1 Practitioners, 43.4/2-3 Practitioners, 27.4/4-5 Practitioners, 9.4/6-7 Practitioners, 6/8-10 Practitioners, 8.5/Over 10 Practitioners } %\end{scope} \end{tikzpicture} \end{subfigure} \end{document}
- TikZ: Incorrect arrow heads with edge nodeby LarrySnyder610 on September 28, 2019 at 12:56 am
Why is the left arrowhead wrong, and how can I fix it? \documentclass[border=5pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[auto] \draw[<->] (0,0) edge node {$a$} (1,0); \end{tikzpicture} \end{document} It works fine if there is no edge node: ... \draw[<->] (0,0) -- (1,0); ...
- Beamer + TikZ-foreach: Every step a new frame on handoutby synthax on June 21, 2018 at 10:08 pm
I'm preparing a presentation with Beamer and TikZ to explain Dijkstra. The following graph is explored step by step and for each step there's a new frame. \tikzstyle{vertex}=[circle,fill=black!25,minimum size=20pt,inner sep=0pt] \tikzstyle{selected vertex} = [vertex, fill=red!24] \tikzstyle{edge} = [draw,thick,-] \tikzstyle{weight} = [font=\small] \tikzstyle{selected edge} = [draw,line width=5pt,-,red!50] \tikzstyle{ignored edge} = [draw,line width=5pt,-,black!20] \begin{figure} \begin{tikzpicture}[scale=1.8, auto,swap] \foreach \pos/\name in {{(0,2)/A}, {(2,1)/B}, {(4,1)/C}, {(0,0)/D}, {(3,0)/E}, {(2,-1)/F}, {(4,-1)/G}} \node[vertex] (\name) at \pos {$\name$}; \foreach \source/ \dest /\weight in {B/A/7, C/B/8,D/A/5,D/B/9, E/B/7, E/C/5,E/D/15, F/D/6,F/E/8, G/E/9,G/F/11} \path[edge] (\source) -- node[weight] {$\weight$} (\dest); \foreach \vertex / \fr in {A/2,D/3,B/4,F/5,E/6,C/7,G/8} \path<\fr-> node[selected vertex] at (\vertex) {$\vertex$}; \end{tikzpicture} \end{figure} Now I'm looking for the same behavior for particularly this part of the presentation with the handout-option turned on. Does anybody have an idea? Thanks a lot!
- Drawing gamma function in LaTeXby Ivica Smolić on January 20, 2015 at 9:29 pm
Is there an elegant way to plot gamma function (or some similar non-elementary function), http://en.wikipedia.org/wiki/Gamma_function via TikZ or pgfplots? The graph I have in mind is something similar to the following one, http://intmath.com/blog/wp-content/images/2010/05/gamma-4.gif The only solution that falls to my mind is the calculation of a list of coordinates (x,\Gamma(x)) with some other (non-TeX) software and then plotting those, but I would like to know if it is possible to avoid this path.
- Adding vertical hierarchy lines to a category column of a tableby badroit on August 8, 2014 at 8:15 pm
I often need to represent hierarchies within tables but I've yet to find an elegant way to do this. Oftentimes I do a variation on the following theme, with nested whitespace in the category column: \documentclass{article} \usepackage{booktabs} \newcommand{\lvl}{~~~} \begin{document} \begin{tabular}{lr} \toprule \textbf{Category} & \textbf{\%}\\ \midrule Animal & 100 \\ \lvl Human & 50 \\ \lvl\lvl Man & 20 \\ \lvl\lvl Woman & 30 \\ \lvl Fox & 30 \\ \lvl\lvl Vixen & 16 \\ \lvl\lvl Dog & 14 \\ \lvl Chicken & 20 \\ \lvl\lvl Cock & 8 \\ \lvl\lvl Hen & 12 \\ \bottomrule \end{tabular} \end{document} I might mix that up with midrules between categories and different fonts for different levels and so on. But the result can sometimes be very "busy", especially if there's a bunch of levels. Instead, I was playing around with the idea of adding lines to more elegantly represent the hierarchy, sketched as follows in red (a similar effect in the same spirit would also suffice): But I'm not sure how to realise this in LaTeX in an elegant way. I'm guessing I could somehow decorate a table with TikZ but I'd only know how to specify manual points (e.g., I'm not sure how to anchor rows in a table). Thus I'm looking for any suggestions of elegant solutions to achieve the above effect. (An ideal answer would avoid explicit coordinates/distances and would be "highly reusable".)
- How to add newline within node using TikZ?by roxrook on July 28, 2011 at 10:17 pm
I want to break the input of a path in order to draw pushdown automaton, so I tried to use the break line symbol \\ and even $$ $$, but it still doesn't break the lines. For example, the input should be 0, 1, 2 3, 4, 5 Any idea? Thank you. Code sample: \documentclass[10pt,letterpaper]{article} \usepackage[latin1]{inputenc} \usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{tikz} \usetikzlibrary{automata,positioning} \begin{document} \setlength{\parindent}{0pt} \setlength{\parskip}{1ex} \textbf{PDA:}\\ \begin{tikzpicture}[shorten >=1pt,node distance=5cm,on grid,auto] \node[state,initial] (q_0) {$q_0$}; \node[state,accepting] (q_1) [right=of q_0] {$q_1$}; \node[state] (q_2) [right=of q_1] {$q_2$}; \node[state] (q_3) [below=of q_1] {$q_3$}; \path[->] (q_0) edge node {0,1} (q_1) edge [loop above] node {0,1,2,3,4,5} (q_0) (q_1) edge node {0,1} (q_2) (q_2) edge [loop right] node {1} (q_2) ; %end path \end{tikzpicture} \\ \end{document}
- Materials for learning TikZby Tim on April 14, 2011 at 1:06 am
I feel intimidated in learning TikZ. I was wondering if there are some nice materials (or just your replies) at different level: for providing big picture, which is important to beginners to not lose direction during learning. for comprehensive reference. Examples are important, but only examples are not always clear for understanding the big picture and organization.