TikZ
- How to tweak the exact positon in the normal direction of the path by `anchor`?by Explorer on April 28, 2026 at 6:28 am
As the follow-up of my previous question, the code below comes from cfr's solution: % Source - https://tex.stackexchange.com/a/762315 % Posted by cfr % Retrieved 2026-04-28, License - CC BY-SA 4.0 \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \makeatletter \newcommand\dualharpoon{} \newcommand\dualharpoon@aux{} \newcommand\dualharpoon@noaux{} \protected\def\dualharpoon{% \@ifnextchar[\dualharpoon@aux\dualharpoon@noaux } \protected\def\dualharpoon@noaux{% \dualharpoon@aux[]% } \long\protected\def\dualharpoon@aux[#1]#2#3#4#5{% \path (#4.center); \pgfgetlastxy{\temp@ax}{\temp@ay} \path (#5.center); \pgfgetlastxy{\temp@bx}{\temp@by} \pgfmathsetmacro\temp@angle{atan2(\temp@by-\temp@ay,\temp@bx-\temp@ax)} \draw[-foo,mystyle] (#4.{\temp@angle - 10}) -- % node[ % draw=blue, % % anchor={90+\temp@angle}, % sloped,inner sep=0pt,#1 % ] {#2} node[ draw, % draw=red, anchor={90+\temp@angle},%<- sloped,inner sep=0pt,#1 ] {#2} (#5.{190 + \temp@angle}); %%%%%%%%%%%%%%%%%%%% \draw[foo-,mystyle] (#4.{\temp@angle + 10}) -- node[ draw, anchor={270+\temp@angle},%<- sloped,inner sep=0pt,#1 ] {#3} (#5.{170 + \temp@angle}); } \makeatother \begin{document} \begin{tikzpicture}[ foo/.tip={Stealth[harpoon,swap]},scale=1.5, mystyle/.style={thick, shorten >=2pt,shorten <=2pt}, ] \foreach \i in {0,20,...,340}{ \node[draw,circle,fill=teal] (In-\i) at (\i:3) {}; \node[draw,circle,fill=magenta] (Out-\i) at (\i:5) {}; \dualharpoon[scale=.8]{$\Delta$}{$\nabla$}{In-\i}{Out-\i} } \end{tikzpicture} \end{document} And I tweaked some label arguments, but I found that the label position is not exactly what I want with anchor={90+\temp@angle}, I want every angles gives the alignment with the normal direction: To show the anchor's behavior more clearly: % Source - https://tex.stackexchange.com/a/762315 % Posted by cfr % Retrieved 2026-04-28, License - CC BY-SA 4.0 \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \makeatletter \newcommand\dualharpoon{} \newcommand\dualharpoon@aux{} \newcommand\dualharpoon@noaux{} \protected\def\dualharpoon{% \@ifnextchar[\dualharpoon@aux\dualharpoon@noaux } \protected\def\dualharpoon@noaux{% \dualharpoon@aux[]% } \long\protected\def\dualharpoon@aux[#1]#2#3#4#5{% \path (#4.center); \pgfgetlastxy{\temp@ax}{\temp@ay} \path (#5.center); \pgfgetlastxy{\temp@bx}{\temp@by} \pgfmathsetmacro\temp@angle{atan2(\temp@by-\temp@ay,\temp@bx-\temp@ax)} \draw[-foo,mystyle] (#4.{\temp@angle - 10}) -- node[ draw=blue, % anchor={90+\temp@angle}, sloped,inner sep=0pt,#1 ] {#2} node[ draw=red, anchor={90+\temp@angle},%<- sloped,inner sep=0pt,#1 ] {#2} (#5.{190 + \temp@angle}); %%%%%%%%%%%%%%%%%%%% % \draw[foo-,mystyle] (#4.{\temp@angle + 10}) -- node[ % draw, % anchor={270+\temp@angle},%<- % sloped,inner sep=0pt,#1 % ] {#3} (#5.{170 + \temp@angle}); } \makeatother \begin{document} \begin{tikzpicture}[ foo/.tip={Stealth[harpoon,swap]},scale=1.5, mystyle/.style={thick, shorten >=2pt,shorten <=2pt}, ] \foreach \i in {0,20,...,340}{ \node[draw,circle,fill=teal] (In-\i) at (\i:3) {}; \node[draw,circle,fill=magenta] (Out-\i) at (\i:5) {}; \dualharpoon[scale=.8]{$\Delta$}{$\nabla$}{In-\i}{Out-\i} } \end{tikzpicture} \end{document} It also reminded me of Jasper Habicht's another solution, but..., I found it not quite easy to decide the position of the midpoint of path from A to B... Any suggestions on this?
- How to add two-sided harpoon arrows with proper label position elegantly?by Explorer on April 27, 2026 at 5:14 pm
Learning from the link here and here, I have the following code: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture}[ foo/.tip={Stealth[harpoon,swap]}, mystyle/.style={thick, shorten >=2pt,shorten <=2pt}, ] \node[draw,circle,fill=teal] (A) at (0,1) {A}; \node[draw,circle,fill=magenta] (B) at (0,-1) {B}; \node[draw,circle,fill=cyan] (C) at (2.5,.5) {C}; \draw[-foo,mystyle,transform canvas={xshift=-0.3ex}] (A) -- node[left] {$\Delta$} (B); \draw[foo-,mystyle,transform canvas={xshift=+0.3ex}] (A) -- node[right] {$\nabla$} (B); % \draw[dualharpoon={$\Delta$}{$\nabla$}] (A) -- (B); % ? \draw[-foo,mystyle,transform canvas={yshift=-0.3ex}] (B) -- node[below right=-3pt] {$f(x)$} (C); \draw[foo-,mystyle,transform canvas={yshift=+0.3ex}] (B) -- node[above left=-3pt] {$g(x)$} (C); % \draw[dualharpoon={$f(x)$}{$g(x)$}] (B) -- (C); % ? \end{tikzpicture} \end{document} I want more smartly syntax like: \draw[dualharpoon={$\Delta$}{$\nabla$}] (A) -- (B); \draw[dualharpoon={$f(x)$}{$g(x)$}] (B) -- (C); which control exactly how much to xshift/yshift moved towards in the direction perpendicular to the connection between the two nodes, in addition, I also don't want to decide the node's position by above left=-3pt manually. Any suggestions on how to support such two-sided harpoon arrow with label? Edited after cfr's answer(first edition): % Source - https://tex.stackexchange.com/a/762315 % Posted by cfr % Retrieved 2026-04-28, License - CC BY-SA 4.0 \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \makeatletter \newcommand\dualharpoon{} \newcommand\dualharpoon@aux{} \newcommand\dualharpoon@noaux{} \protected\def\dualharpoon{% \@ifnextchar[\dualharpoon@aux\dualharpoon@noaux } \protected\def\dualharpoon@noaux{% \dualharpoon@aux[]% } \long\protected\def\dualharpoon@aux[#1]#2#3#4#5{% \path (#4.center); \pgfgetlastxy{\temp@ax}{\temp@ay} \path (#5.center); \pgfgetlastxy{\temp@bx}{\temp@by} \edef\temp@angle{\fpeval{(atan((\temp@by-\temp@ay)/(\temp@bx-\temp@ax)))*(180/pi)}} \draw[-foo,mystyle] (#4.{\temp@angle - 5}) -- coordinate (temp@1) (#5.{185 + \temp@angle}); \node[anchor={90+\temp@angle}] at (temp@1) {#2} ; \draw[foo-,mystyle] (#4.{\temp@angle + 5}) -- coordinate (temp@2) (#5.{175 + \temp@angle}); \node[anchor={270+\temp@angle}] at (temp@2) {#3}; } \makeatother \begin{document} \begin{tikzpicture}[ foo/.tip={Stealth[harpoon,swap]}, mystyle/.style={thick, shorten >=2pt,shorten <=2pt}, ] \node[draw,circle,fill=teal] (A) at (0,1) {A}; \node[draw,circle,fill=magenta] (B) at (0,-1) {B}; \node[draw,circle,fill=cyan] (C) at (2.5,.5) {C}; \node[draw,circle,fill=olive] (D) at (-3,1) {D}; \dualharpoon{$\Delta$}{$\nabla$}{A}{B} \dualharpoon{$g(x)$}{$f(x)$}{B}{C} \dualharpoon{$p$}{$q$}{B}{D} \end{tikzpicture} \end{document}
- Table header text dropped when including pgfplotstable inside tikzpicture graphby Kevin Zembower on April 26, 2026 at 4:52 pm
I notice a strange phenomenon when trying to create a data table side-by-side with its graph. The header text of the table next to the graph disappears, while a stand-alone table is fine. Here's my MWE: \documentclass[]{article} \usepackage{pgfplots} \pgfplotsset{ scale only axis, compat=1.18, } \usepackage{pgfplotstable} %To read data files once \pgfplotstableset{ %Setting for data table appearance every head row/.style={before row=\hline,after row=\hline}, every last row/.style={after row=\hline} } \begin{document} \pgfplotstableread{ x y 1 2 2 4 3 6 4 8 }\datatable Table standing alone: \pgfplotstabletypeset{\datatable} Table and graph side by side (pfgtabletypeset inside tikzpicture): \begin{figure}[h] \begin{tikzpicture} \begin{axis} \addplot table {\datatable}; \end{axis} \hskip 10cm \pgfplotstabletypeset{\datatable} \end{tikzpicture} \caption{Graph and datatable side-by=side} \end{figure} \end{document} Here's what I see: My two questions are: How to restore the table header text? How to position the table vertically so it's centered on the graph? Thanks so much for your suggestions and advice. -Kevin
- Conflict between "siunitx" package and TikZ library "math"by pejsek on April 26, 2026 at 8:46 am
I am using the code from this answer in my project. My project also uses the package siunitx. The code no longer works when siunitx is loaded. I am just a regular user with no knowledge of internals of siunitx or TikZ. What can I do to use the code and siunitx at the same time? In the code below, all I did was add \usepackage{siunitx}. % Source - https://tex.stackexchange.com/a/586432 % Posted by loved.by.Jesus, modified by community. See post 'Timeline' for change history % Retrieved 2026-04-26, License - CC BY-SA 4.0 \documentclass{article} \usepackage{siunitx} % if removed, the code works just fine \usepackage{tikz} \usetikzlibrary{math} \begin{document} \begin{tikzpicture} %Two points (A) and (B) \coordinate (A) at (0,0); \coordinate (B) at (2,2); %--Computing the distance between (A) and (B) %Creating a math coordinate \tikzmath{coordinate \C; %Storing coordinates difference \C = (B)-(A); %Computing the length of C = (Cx,Cy) from its components Cx and Cy %Note the length \distAB is in points (pt) \distAB = sqrt((\Cx)^2+(\Cy)^2); } %--Drawing %line A -- B \draw (A) node [above] {A} -- (B) node[above] {B} node[midway]{\distAB pt}; %Circle with center in (A) and radius \distAB points \draw (A) circle (\distAB pt); \end{tikzpicture} \end{document} Thank you for any help.
- why \begin{align*}..\end{align*} spacing is different inside tikz Matrix node than outside?by Nasser on April 26, 2026 at 4:33 am
I am learning how to use tikz Matrix to layout few things. Notice that inside tikz matrix node, the alignment is not the same as outside tikz using standard &= for align math environment. I had to to put align environment inside a minipage to make it work inside tikz matrix node. It will not let me just use align directly since not paragraph mode. But the issue is the spacing between left side of &= and right side is different than outside tikz. \documentclass[12pt,varwidth]{standalone} %need varwidth to use align inside standalon \usepackage{amsmath} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \fbox{\begin{minipage}{1.5in} \vspace{0pt} % Fixes top spacing issues \noindent % Ensures no paragraph indentation {\small All plots used the same initial conditions \begin{align*} x(0) &=1\\ x'(0) &=1\\ \end{align*} } \end{minipage} } \begin{tikzpicture} \matrix (m) [matrix of math nodes, nodes={anchor=center}, row sep=3.5em, column sep=2.5em, nodes in empty cells, draw] { 1& 2& \begin{minipage}{1.5in} \vspace{0pt} % Fixes top spacing issues \noindent % Ensures no paragraph indentation {\small All plots used the same initial conditions \begin{align*} x(0) &=1\\ x'(0) &=1\\ \end{align*} } \end{minipage} &4 \\ 5& 6 & 7 & 8 \\ }; \foreach \i in {1,2,3,4} \foreach \j in {1,2} \draw [help lines] (m-\j-\i.south west) rectangle (m-\j-\i.north east); \end{tikzpicture} \end{document} Compiled with lualatex gives lualatex, TL 2026
- How to fully center text inside tikz Matrix node, which spans multiple columns?by Nasser on April 26, 2026 at 3:02 am
I need to make a node in tikz matrix which spans multiple columns. After much struggle and trial and error, this is the result \documentclass[12pt]{standalone} \usepackage{tikz} \usetikzlibrary{positioning,arrows,chains,matrix,scopes,fit} \usetikzlibrary{backgrounds} \begin{document} \begin{tikzpicture} \matrix (m) [matrix of math nodes, nodes={anchor=center}, row sep=3.5em, column sep=2.5em, nodes in empty cells, draw] {1 & 2 & 3 & 4 \\ 5 & & & \\ 9 & 10 & 11 & 12\\ }; \node[fit=(m-2-2)(m-2-4),align=center,text centered,draw,fill=yellow]{spans cols 2 to 4}; \end{tikzpicture} \end{document} Compiled using lualatex gives Which is what I want, except I do not know how to make the text "spans cols 2 to 4" to be fully centered inside the node that spans the columns. I tried adding align=center and text centered as you see, but this had no effect on vertical centering inside the node. What is correct way to do this? Now the baseline as you see of the text inside, is not aligned with the baseline of the other nodes in the tikz matrix. TL 2026
- pgf-PeriodicTable: usage of 'cell width' / 'cell height' ruins the layoutby cis on April 25, 2026 at 8:55 am
I want a full-page periodic table - in height and width! (Because I want to add external graphics as an overlay to the cells. That means a simple/artificial enlargement using scalebox or something similar is not useful.) As a test, I tried: cell width=40pt, cell height=50pt, but it ruins the layout (icons and text overlap or shift). What do I have to do? \documentclass[]{article} \usepackage[ showframe=true, a4paper, landscape, margin=10mm, ]{geometry} \usepackage{pgf-PeriodicTable} \begin{document} \noindent\pgfPT[ cell width=40pt,% example from manual, p. 22 cell height=50pt,% example from manual, p. 22 name font=\normalfont, show title=false, show legend=false, ] \end{document}
- Improved visualization of the domains of integration in ℝ³by Sebastiano on April 24, 2026 at 9:26 pm
Before of this question, I would like to thank the authors of the answers and everyone who appreciated my question. I had previously created these two figures related to two triple integrals. Is there a better way to improve their presentation and make them clearer and more visually appealing? T={(x, y, z) ∈ ℝ³: (x²+y²)¹/² ≤ z ≤ 1}. \documentclass[12pt]{article} \usepackage{tikz,tikz-3dplot} \begin{document} \begin{center} \tdplotsetmaincoords{60}{130} \begin{tikzpicture}[tdplot_main_coords,scale=3] \pgfmathsetmacro{\h}{0.6} \pgfmathsetmacro{\raggio}{\h} \draw[thick,->] (0,0,0) -- (1.5,0,0) node [below left] {\footnotesize$x$}; \draw[dashed] (0,0,0) -- (-1.5,0,0); \draw[thick,->] (0,0,0) -- (0,1.5,0) node [right] {\footnotesize$y$}; \draw[dashed] (0,0,0) -- (0,-1.5,0); \draw[thick,->] (0,0,1.0) -- (0,0,1.5) node [above] {\footnotesize$z$}; \draw[dashed] (0,0,0) -- (0,0,1.0); \foreach \altura in {0.01,0.02,...,1.0}{ \draw[cyan,opacity=0.5] plot[domain=0:2*pi,smooth,variable=\t] ({\altura*cos(\t r)},{\altura*sin(\t r)},{\altura}); } \draw[blue,thick,fill=brown!50,opacity=0.6] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},{\h}); \draw[dashed,fill=yellow,opacity=0.4] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},0); \foreach \t in {0,10,30,60,90,120,150,250,280,310}{ \draw[black,dashed,thin,opacity=0.7] ({\raggio*cos(\t)},{\raggio*sin(\t)},{\h}) -- ({\raggio*cos(\t)},{\raggio*sin(\t)},0); } \fill[gray,opacity=0.1] (-1.2,-1.2,\h) -- (1.2,-1.2,\h) -- (1.2,1.2,\h) -- (-1.2,1.2,\h) -- cycle; \draw[red,very thick] (0,0,\h) -- (0,\raggio,\h); \node at (0,1.5,\h) {\small $z=h$}; \node at (0,0.5,0.75) {\small $z$}; \node at (0,0.25,-0.35) {\small $T(z=0)$}; \node at (0,.75,1.3) {\small $T(z=h)=T(z)$}; \end{tikzpicture} \end{center} \end{document} C= {(x,y,z)∈ ℝ³: z∈ [0, 2], x²+ y²≤ z} \documentclass[12pt]{article} \usepackage{tikz,tikz-3dplot} \begin{document} \begin{center} \tdplotsetmaincoords{70}{130} \begin{tikzpicture}[tdplot_main_coords,scale=2.5] \pgfmathsetmacro{\h}{.6} \pgfmathsetmacro{\raggio}{sqrt(\h)} \draw[thick,->] (0,0,0) -- (1.5,0,0) node [below left] {$x$}; \draw[thick,->] (0,0,0) -- (0,1.5,0) node [right] {$y$}; \draw[thick,->] (0,0,0) -- (0,0,1.5) node [above] {$z$}; \draw[red,very thick] plot[domain=-1:1,smooth,variable=\t] (0,{\t},{\t*\t}); \draw[blue,fill=yellow,opacity=0.4] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},{\h}); \draw[fill=yellow,dashed,opacity=0.5] plot[domain=0:2*pi,smooth,variable=\t] ({\raggio*cos(\t r)},{\raggio*sin(\t r)},{0}) node [above] {\tiny $C(z)$}; \foreach \t in {0,10,...,350}{ \draw[gray, dashed, thin,opacity=0.4] ({\raggio*cos(\t)},{\raggio*sin(\t)},{\h}) -- ({\raggio*cos(\t)},{\raggio*sin(\t)},0); } \foreach \altura in {0.0125,0.025,...,1.0}{ \pgfmathsetmacro{\radio}{sqrt(\altura)} \draw[cyan,thick,opacity=0.5] plot[domain=0:2*pi,smooth,variable=\t] ({\radio*cos(\t r)},{\radio*sin(\t r)},{\altura}); } \fill[orange!30,opacity=0.4] (-1,-1,\h) -- (1,-1,\h) -- (1,1,\h) -- (-1,1,\h) -- cycle; \draw[blue,very thick] (0,0,\h) -- (0,{\raggio},\h); \node[black, above right] at (0,{\raggio/2},\h) {\tiny $\sqrt{z}$}; \draw[blue,fill=yellow,dotted,thick,opacity=0.4] plot[domain=0:360,smooth,variable=\t] ({\raggio*cos(\t)},{\raggio*sin(\t)},{\h}); \draw[blue!80,thick] plot[domain=0:2*pi,smooth,variable=\t] ({cos(\t r)},{sin(\t r)},{1.0}); \end{tikzpicture} \end{center} \end{document}
- Tikz pie chart with unitsby Thomas on April 24, 2026 at 1:07 pm
I have a pie chart representing a distribution of hours, and I'm using the option sum=auto to display the chat by these values. But I'd like to add the unit of the values inside the plot. If I type 12~h/Maths it raises error because LaTeX tries to compute the percentages. How could I achieve it ? \documentclass{article} \usepackage{pgf-pie} \begin{document} \begin{tikzpicture} \pie[sum = auto]{ 12/Maths, 9/Physique-Chimie, 2/Informatique, 2/TIPE, 2/Français } \end{tikzpicture} \end{document}
- pgf-PeriodicTable: produce a gap at La and Acby cis on April 24, 2026 at 1:36 am
How could I create a gap here (as seen sometimes)? \documentclass[landscape]{article} \usepackage[margin=11mm]{geometry} \usepackage{pgf-PeriodicTable} \tikzset{every picture/.append style={remember picture}} \begin{document} \pgfPT[ show title=false, show legend=false, IUPAC=false,% puts La and Ac above ] % Test \begin{tikzpicture}[remember picture, overlay] \node[fill, inner sep=0pt, minimum size=2mm, cyan, text=red] at (3.center) {UL}; \end{tikzpicture} \end{document}
- LaTeX economics draft for test [closed]by Evaggelia Lanaridy on April 23, 2026 at 3:07 pm
\begin{tikzpicture} % Άξονες \draw[->, thick] (0,0) -- (5,0) node[right] {Q (Ποσότητα)}; \draw[->, thick] (0,0) -- (0,5) node[above] {P (Τιμή)}; % Αρχική Καμπύλη Ζήτησης D1 \draw[thick, blue] (0.5,4) -- (4,0.5) node[right] {$D$}; % Νέα Καμπύλη Ζήτησης D2 (Μετατόπιση δεξιά) \draw[thick, red] (1.5,4.5) -- (5,1) node[right] {$D_1$}; % Σταθερή Τιμή P1 \draw[dashed] (0,2.5) node[left] {$P_1$} -- (3.75,2.5); % Σημεία και Ποσότητες \draw[dashed] (2,2.5) -- (2,0) node[below] {$Q_1$}; \draw[dashed] (3.75,2.5) -- (3.75,0) node[below] {$Q_2$}; % Βέλος μετατόπισης \draw[->, bend left, thick] (2.2,3) -- (3.3,3.4) node[midway, above] {$\Delta\epsilon\xi\iota\alpha$}; \end{tikzpicture}
- Aligning TikZ grids between tcolorbox overlays and page backgroundby Christopher Madec on April 21, 2026 at 9:13 pm
I am working on a layout where I draw a grid in two different contexts: Inside tcolorbox environments (using an overlay) In the page margin using \AddToShipoutPicture Here is a minimal example: \documentclass[11pt,a4paper,svgnames]{book} \RequirePackage[top=2cm, bottom=2cm, left=3.9cm, right=1cm]{geometry} \usepackage[most]{tcolorbox} \newcommand{\myoverlay}{ \begin{tcbclipinterior}%[remember picture,overlay] \draw[%shift=(current page.north west), step=0.524cm,white!70!gray,very thin] (interior.north west) grid (interior.south east); \end{tcbclipinterior} } \newtcolorbox{Box4}[1][ bicolor, colback=white!05,grow to left by=2.5cm,colbacklower=black, boxrule=0.5pt,overlay=\myoverlay]{#1} \newtcolorbox{Box4bis}[1][ bicolor,colback=white,colbacklower=black, grow to left by=0cm,grow to right by=0cm, boxrule=0pt, overlay=\myoverlay] {#1} \usepackage{lipsum} \usepackage[]{eso-pic} \begin{document} \AddToShipoutPicture{% \begin{tikzpicture} \draw[shift=(current page.north west),step=5.24mm, lightgray, very thin, opacity=0.5] ([xshift=0cm,yshift=0cm]current page.south west) grid ([xshift=3.7cm,yshift=0cm]current page.north west); \draw[black, very thick, opacity=0.3] ([xshift=3.7cm]current page.south west) -- ([xshift=3.7cm]current page.north west); \end{tikzpicture}% } \begin{Box4bis} \lipsum[1] \end{Box4bis} \begin{Box4} \lipsum[2] \end{Box4} \lipsum[3] \begin{Box4} \lipsum[4] \end{Box4} \begin{Box4bis} \lipsum[5] \end{Box4bis} \end{document} The code gives this: Goal I would like the grids drawn: inside the tcolorbox environments in the page margin (via shipout) to be perfectly aligned, so that the grid appears continuous across the whole page. What I have tried Using current page coordinates inside the tcolorbox overlay Adding remember picture, overlay and current page.north page and retrieve absolute positions (see tikz: How can I find the value of `current page.north west`?) Trying to manually shift grids to match visually (impossible) However, I could not find a reliable way to make both grids share the same reference system.
- Plot a domain in 3D with TikZ for a triple integralby Sebastiano on April 20, 2026 at 9:59 pm
I have to solve this triple integral ∭ x y|z|³/(1+ (x²+y²)⁴) dx dy dz, with a domain T={(x, y, z) ∈ ℝ³: x ≤ 0, y ≥ 0, z² ≤ x²+y² ≤ 1}. Plotting with DESMOS 3D I see this: Actually I am not able to visualise this domain in my mind. It should be a cylinder enclosed by a double-sloped cone, but I can’t quite get the x ≤ 0, y ≥ 0 parameters right. I’ve created something but I would like my drawing (or a new one) to be intuitive with TikZ3D so that I can correctly draw this integral. My MWE: \documentclass[12pt]{article} \usepackage{tikz} \usepackage{tikz-3dplot} \tdplotsetmaincoords{60}{130} \begin{document} \begin{tikzpicture}[tdplot_main_coords, scale=3] % assi \draw[->] (0,0,0) -- (1.3,0,0) node[right]{$x$}; \draw[->] (0,0,0) -- (0,1.3,0) node[left]{$y$}; \draw[->] (0,0,0) -- (0,0,1.3) node[above]{$z$}; \foreach \t in {0,1,...,359}{ \pgfmathsetmacro{\ct}{cos(\t)} \pgfmathsetmacro{\st}{sin(\t)} \draw[blue!60, opacity=0.75] (0,0,0) -- plot[domain=0:1, samples=40] ({\x*\ct},{\x*\st},{\x}); \draw[red!60, opacity=0.75] (0,0,0) -- plot[domain=0:1, samples=40] ({\x*\ct},{\x*\st},{-\x}); } \draw[thick] plot[domain=0:360, samples=200] ({cos(\x)},{sin(\x)},1); \draw[thick] plot[domain=0:360, samples=200] ({cos(\x)},{sin(\x)},-1); \end{tikzpicture} \end{document}
- Using `annotate-equations` library to annotate matrix row and column labelsby Tianjian Qin on April 20, 2026 at 7:20 pm
The annotate-equations library looks nice. I wanted to use the library to annotate matrix row and column labels, but it didn't work out. Below is a minimal standalone example where the first tikzpicture is simply the matrix with row and column labels. The second tikzpicture is my attempt to add annotations: \documentclass[tikz,border=6pt]{standalone} \usepackage{amsmath} \usepackage{tikz} \usepackage{annotate-equations} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \node[ anchor=center, inner sep=0pt, outer sep=0pt ] (nodematrix) at (0,0) {% {\scriptsize \renewcommand{\arraystretch}{0.88}% $\left[ \begin{array}{@{}c|ccc@{}} & \mathbf{X} & \mathbf{Y} & \mathbf{Z} \\ \mathbf{A} & 1 & 0 & 0 \\ \mathbf{B} & 0 & 1 & 0 \\ \mathbf{C} & 0 & 1 & 0 \\ \mathbf{D} & 0 & 1 & 1 \\ \mathbf{E} & 1 & 0 & 0 \\ \mathbf{F} & 0 & 0 & 1 \end{array} \right]$}% }; \end{tikzpicture} \begin{tikzpicture}[remember picture] \node[ anchor=center, inner sep=0pt, outer sep=0pt ] (nodematrix) at (0,0) {% {\scriptsize \renewcommand{\arraystretch}{0.88}% $\left[ \begin{array}{@{}c|ccc@{}} & \tikzmarknode{md-colX}{\mathbf{X}} & \tikzmarknode{md-colY}{\mathbf{Y}} & \tikzmarknode{md-colZ}{\mathbf{Z}} \\ \tikzmarknode{md-rowA}{\mathbf{A}} & 1 & 0 & 0 \\ \tikzmarknode{md-rowB}{\mathbf{B}} & 0 & 1 & 0 \\ \tikzmarknode{md-rowC}{\mathbf{C}} & 0 & 1 & 0 \\ \tikzmarknode{md-rowD}{\mathbf{D}} & 0 & 1 & 1 \\ \tikzmarknode{md-rowE}{\mathbf{E}} & 1 & 0 & 0 \\ \tikzmarknode{md-rowF}{\mathbf{F}} & 0 & 0 & 1 \end{array} \right]$}% }; \end{tikzpicture} \annotate[ xshift=-2.8em, yshift=-4.5ex ]{below}{md-rowF}{data nodes $V$} \annotate[ xshift=1.2em, yshift=1.0em ]{above}{md-colX,md-colY,md-colZ}{metadata nodes $U$} \end{document} Here is the compile pdf output: The original matrix: The annotated matrix (where I see two additional empty patches, and no annotation showed up): I cannot figure out what happened here.
- add a grid background only inside a tabular columnby Christopher Madec on April 19, 2026 at 5:19 pm
I am trying to create a worksheet layout in LaTeX where one column of a table contains a writing area with a grid (like squared paper), while the other column contains several questions (Here is an example with just one question). \documentclass{article} \usepackage{array} \usepackage{xcolor} \usepackage{geometry} % \usepackage{arydshln} \usepackage{lipsum} \geometry{a4paper, left=0.35in, right=-0.1in, top=0.6in, bottom=0.4in} \definecolor{burgundy}{HTML}{8B2252} \usepackage{scrlayer-scrpage} \usepackage{tikz} \newcommand*\Circled[1]{\tikz[baseline=(char.base)]{\textcolor{burgundy}{\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}} \usepackage{tikzducks} \usetikzlibrary{calc} \newcommand{\pageframe}{% \begin{tikzpicture}[remember picture, overlay] \fill [burgundy!80!white] (current page.north west) rectangle (current page.south east); \fill [white, rounded corners=1cm] ($(current page.north west)+(0.5cm,-1cm)$) rectangle ($(current page.south east)+(-0.5cm,1cm)$); \node [align=center] at ($(current page.north)+(0,-0.6cm)$) {$\color{white}\mathrm{Chapitre \ 2 - Diffusion \ thermique}$}; \node [align=center] at ($(current page.south)+(0,1.9cm)$) {\centering\begin{tikzpicture}[scale=0.5] \shuffleducks \duck[\randomhead,\randomaccessories, /tikz/nodes={scale/.evaluated={\value{page}>99?0.4:0.6},font=\bfseries}, signpost=\scalebox{1.6}{ \parbox{6cm}{\hspace{-0.4em}\color{black} \centering\thepage}}, signback =white] \end{tikzpicture}}; %%% Background grid \draw[step=5mm, gray!30, very thin] ($(current page.north west)+(7cm,-1.5cm)$) grid ($(current page.south east)+(-1cm,5cm)$); \end{tikzpicture} } \cehead[\pageframe]{\pageframe} \cohead[\pageframe]{\pageframe} \pagestyle{scrheadings} % Another try \usepackage{makecell} \newcommand{\gridcell}[1][4cm]{% \begin{tikzpicture} \draw[step=5mm, gray!40, very thin] (0,-0.2) grid (\linewidth, #1); \end{tikzpicture}% } \begin{document} \renewcommand{\arraystretch}{6} \begin{tabular}{>{\centering\raggedright}m{0.25\textwidth}||>{\centering\arraybackslash}m{0.60\textwidth}} \Circled{1} \'Enoncer le théorème de Green-Ostrograski & \\ \hline \end{tabular} \end{document} Goal I would like the second column of the table to contain a grid background (like graph paper) so that students can write their answers. I want to find the best way to create a grid (squared background) that is confined to a specific table column, and that does not overflow outside the table. What I tried so far Using a page-wide background grid, but it overflows outside the table and does not align with the table structure \draw[step=5mm, gray!30, very thin] ($(current page.north west)+(7cm,-1.5cm)$) grid ($(current page.south east)+(-1cm,5cm)$); \end{tikzpicture} The code looks like this: Drawing a grid with TikZ inside a cell → does not scale correctly with row height \newcommand{\gridcell}[1][4cm]{% \begin{tikzpicture} \draw[step=5mm, gray!40, very thin] (0,-0.2) grid (\linewidth, #1); \end{tikzpicture}% }
- Additive color mixing in set diagramsby Alma Arjuna on December 13, 2025 at 3:19 pm
I've made a pretty set diagram! I'm not happy with how the colors are interacting on the set intersections, though. Because of the order the sets are built, each one is visibly 'above' or 'below' each other, breaking the symmetry of the figure. Of course, this behavior is expected. Can we make so that the colors interact additively instead? I know I can go intersection-by-intersection changing the colors to whatever I want, but this seems very inefficient and I wouldn't know how to manually combine the colors anyway... Here is the code. \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{calc} \tikzstyle{vertex}=[circle,fill=black,inner sep=2.2pt] \begin{document} \begin{tikzpicture}[scale=1] \coordinate (A) at (18:{sqrt(5)}); \coordinate (B) at (90:{sqrt(5)}); \coordinate (C) at (162:{sqrt(5)}); \coordinate (D) at (234:{sqrt(5)}); \coordinate (E) at (306:{sqrt(5)}); \def\set{ellipse (2.618cm and 0.382cm)} \fill[magenta, opacity=.36] ($(A)!0.5!(C)$) \set; \fill[cyan, opacity=.36, rotate=72] ($(B)!0.5!(D)$) \set; \fill[yellow, opacity=.36, rotate=144] ($(C)!0.5!(E)$) \set; \fill[violet, opacity=.36, rotate=216] ($(D)!0.5!(A)$) \set; \fill[green, opacity=.36, rotate=288] ($(E)!0.5!(B)$) \set; \node[vertex] at (A) {}; \node[vertex] at (B) {}; \node[vertex] at (C) {}; \node[vertex] at (D) {}; \node[vertex] at (E) {}; \coordinate[vertex] (F) at ($(A)!0.382!(C)$); \coordinate[vertex] (G) at ($(B)!0.382!(D)$); \coordinate[vertex] (H) at ($(C)!0.382!(E)$); \coordinate[vertex] (I) at ($(D)!0.382!(A)$); \coordinate[vertex] (J) at ($(E)!0.382!(B)$); \end{tikzpicture} \end{document}
- How come when filling in TikZ, there is a visible gap between adjacent fills?by Jasper on November 12, 2025 at 1:00 am
How come when filling in TikZ, there is a visible gap between adjacent fills? \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \fill (0,0) -- (1,1) -- (1,0) -- cycle; \fill (0,0) -- (1,1) -- (0,1) -- cycle; \end{tikzpicture} \end{document}
- How to draw a picture like this in tikz?by Sunshine on August 26, 2025 at 8:34 pm
I don't know how to draw it, is there any method?
- Schematic representation of emittersby Антон on December 7, 2023 at 5:00 am
I started drawing emitters, but I ran into difficulties. \documentclass[10pt,border=3mm,tikz]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} % arc \draw (-0.15,0.3) % Coordinates of the arc center (x, y) arc (30:150:1); % Starting angle: 30 degrees, Ending angle: 150 degrees, Radius: 1 % Vertical line \draw (-1,2) % Initial coordinates (x, y) -- % Operator for drawing a line (-1,0.1); % Final coordinates (x, y) % Horizontal line \draw (-1.4,0.1) % Initial coordinates (x, y) -- % Оператор для рисования линии (-0.6,0.1); % Final coordinates (x, y) % Axes \draw[->] (-1.5,0) -- (1.5,0) node[right] {$x$}; \draw[->] (0,-1.5) -- (0,1.5) node[above] {$y$}; \end{tikzpicture} \end{document} it is required to draw a complete picture, but so far I have just started the emitter and do not know how to set the coordinates correctly and how to make it more similar. A few hours later, I received such a drawing. Of course, it looks too little like the original: \documentclass[10pt,border=3mm,tikz]{standalone} \begin{document} \tikzset{ mylabel/.style={font=\scriptsize} } \begin{tikzpicture}[ antenna/.pic={ % Antenna drawing \draw (-0.57,.15) arc(50:130:0.7); \draw (-1,1) -- (-1,.1); \draw (-1.2,.1) -- (-0.8,.1); }, Pattern/.pic={ % Radiation pattern drawing \draw[thick] (0,0) ellipse (0.1 and 0.5); \draw[dashed] (0,\R) -- (0,0); } ] % Positions of emitters and axis labels \def\positionOne{-1} \def\positionZero{0} \def\positionTwo{1} \def\R{2} % R \def\alpha{18} % Angle % Placement of emitters and radiation pattern \pic at (\positionOne+1,0.3) {antenna}; \node[below, mylabel] at (\positionOne+0.5,1.2) {№ 1}; \pic at (\positionTwo+1,0.3) {antenna}; \node[below, mylabel] at (\positionTwo+0.5,1.2) {№ 2}; \pic[rotate=-\alpha,scale=1, red!100] at (\positionZero,-\R) {Pattern}; \draw[dashed] (\positionZero,-\R) -- (\positionZero,0); \node[below, mylabel] at (\positionZero-0.25,-\R/3) {R}; \draw[dashed] (\positionZero,-\R) -- (\positionTwo,0); % Axes \draw[->] (\positionOne-0.5,0) -- (\positionTwo+0.5,0) node[right] {$X$}; % Labels on the axis \node[below, mylabel] at (\positionOne,0) {$\positionOne$}; \node[below, mylabel] at (\positionZero,0) {$\positionZero$}; \node[below, mylabel] at (\positionTwo,0) {$\positionTwo$}; % Ticks on the axis \foreach \x in {\positionOne,\positionZero,\positionTwo} \draw (\x,0.1) -- (\x,-0.1); \end{tikzpicture} \end{document}
- TikZ text node and edge position in TikZitby Qohelet on November 27, 2023 at 5:46 pm
I am using the TikZit application to construct a diagram containing nodes that "contain" or "consist of" only text (formatted with color, etc.) and that are connected by various edges. When inputing the text as the label argument, the connecting edge encroaches into the middle of the text, like this: Here is the source code generated by TikZit: \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=none] (0) at (-2.5, 7) {Hello world!}; \node [style=green dot] (1) at (1.75, 5) {}; \node [style=red dot] (2) at (2.25, -0.75) {}; \node [style=none] (3) at (-3, -2) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0.center) to (1); \draw [in=30, out=45, looseness=2.25] (1) to (2); \draw (3.center) to (2); \end{pgfonlayer} \end{tikzpicture} I was able to use the label={POSITION:TEXT} option to modify the default behavior \node [style=none, label={above=Hello \textcolor{blue}{World!}}] (0) at (-2.5, 7) {}; which renders which is what I am wanting. The problem is that I do not want to manually input the position parameter for each node and I do not know how to set up a node style that will automatically position the edge connection relative to the text node without having to specify the position in each case. To put it in question form: Is there a way to set up a node style that will automatically position the connecting edge on the "outside" of the node relative to the text like the second image above? Any help is appreciated.
- Draw a unicorn in TikZ 🦄by Martin Thoma on March 31, 2023 at 2:42 pm
I'm currently reading Sparks of Artificial General Intelligence: Early experiments with GPT-4. This paper by Microsoft employees experiments with the capabilities of GPT-4, a successor of ChatGPT. One task is to draw a unicorn with tikz.ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ They claim: GPT-4 produces impressive outputs that are [...] at least comparable (if not superior) to what a human would do. Who wants to prove them wrong? 😄🦄🌈 edit: Please don't include PNG / JPG / other pixel image formats. MS-SPO is the only one allowed to do that (as a grandfathering-rule) - kudos for finding the loophole in this question and for thinking outside of the box 😁👍 edit: We now have 200 fun questions! 🥂🥳
- Border lines not meeting in one cornerby anne on March 5, 2019 at 3:25 pm
I am trying to create a table with horizontal and vertical lines, but the lines are not meeting in the upper right hand corner. Can anyone figure out where I'm going wrong? \documentclass{article} \usepackage{tikz} \usepackage{multirow} \usepackage{array} \usetikzlibrary{calc,shadings,patterns,tikzmark} \newcommand\HatchedCell[5][0pt]{% \begin{tikzpicture}[overlay,remember picture]% \path ($(pic cs:#2)!0.5!(pic cs:#3)$) coordinate (aux1) (pic cs:#4) coordinate (aux2); \fill[#5] ( $ (aux1) + (-0.67*0.097\textwidth,1.9ex) $ ) rectangle ($ (aux1 |- aux2) + (0.7*0.097\textwidth,-#1*\baselineskip-.8ex) $ ); \end{tikzpicture}% }% \begin{document} %\arrayrulecolor{black} \setlength\arrayrulewidth{1.0pt} \newcolumntype{P}{>{\centering\arraybackslash}p{0.097\textwidth}} \newcolumntype{G}{>{\centering\arraybackslash}p{0.235\textwidth}} \begin{tabular}{P P P P P P} & & & \multicolumn{2}{G}{\textbf{Player 2}} \\ [1.5ex] \end{tabular} \begin{tabular}{ P P P P P P} & & A & B & C & D\\[1.5ex] \cline{3-6} \end{tabular} \begin{tabular}{ P P|P|P|P|P|} & A& \tikzmark{start0} \small \textbf{10,10} \tikzmark{middle0}\tikzmark{end0} & \small 10,0 & \small 0,-10 & \small -40,-10\\ \cline{3-6} \end{tabular} \HatchedCell{start0}{middle0}{end0}{pattern color=black!70,pattern=north east lines} \begin{tabular}{P P|P|P|P|P|} \textbf{Player 1}& B& \small 0,10 & \tikzmark{start1} \small \textbf{10,10} \tikzmark{middle1}\tikzmark{end1} & \small 0,0 & \small 0,0\\ [-2.65ex] \cline{3-6} \end{tabular} \HatchedCell{start1}{middle1}{end1}{pattern color=black!70,pattern=north east lines} \begin{tabular}{P P|P|P|P|P|} \cline{3-6} & C& \small -10,0 & \small 0,0& \tikzmark{start2} \small \textbf{0,0} \tikzmark{middle2}\tikzmark{end2} & \small 0,0 \\ [0.2ex] \cline{3-6} \end{tabular} \HatchedCell{start2}{middle2}{end2}{pattern color=black!70,pattern=north east lines} \begin{tabular}{ P P|P|P|P|P|} \cline{3-6} & D& \small -10,-40 & \small 0 0& \small 0,0 & \tikzmark{start3} \small \textbf{10,10} \tikzmark{middle3}\tikzmark{end3} \\ \cline{3-6} \end{tabular} \HatchedCell{start3}{middle3}{end3}{pattern color=black!70,pattern=north east lines} \end{document} How do I get these lines to meet?
- Pie chart with color palette, info inside and legendby José on August 27, 2018 at 8:19 am
I am trying to build the following pie chart with latex and the code below, however it seems quite difficult to match the legend, colors palette and external circle grouping colors. \documentclass[tikz,border=10pt]{standalone} \begin{document} \def\angle{0} \def\radius{3} \def\cyclelist{{"orange","blue","red","green"}} \newcount\cyclecount \cyclecount=-1 \newcount\ind \ind=-1 \begin{tikzpicture}[nodes = {font=\sffamily}] \foreach \percent/\name in { 0.01/1\% Cash, 4.26/ 5\% Miton Multi-Cap Income, 6.86/6\% Schroder Income Maximiser, 3.82/6\% Trojan Income, 3.32/7\% CF Woodford Equity Income, 2.91/7\% Artemis Global Income, 2.87/4\% First State Global Listed Infraestructure 2.63/4\% Lazard Global Listed Infraestructure 3.50/4\% Legg Mason RARE Global Income 2.55/6\% Newton Global Income 4.6/5\% Henderson Strategic Bond 5.01/4\% Invesco Perpetual Monthly Income Plus 4.4/5\% Jupiter Strategic Bond 0/4\% L&G All Stocks Index Linked Gilt Index 2.3/5\% L&G Short Dated Sterling Corporate Bond Index 5.95/4\% Royal London Short Duration Global High Yield Bond 3.55/4\% Twenty Four Corporate Bond 5.03/4\% Twenty Four Dynamic Bond 4.8/5\% F&C Property Growth & Income 4.44/5\% Aviva Multi Strategy Target Income 3.45/5\% Invesco Perpetual Global Targeted Income } { \ifx\percent\empty\else % If \percent is empty, do nothing \global\advance\cyclecount by 1 % Advance cyclecount \global\advance\ind by 1 % Advance list index \ifnum3<\cyclecount % If cyclecount is larger than list \global\cyclecount=0 % reset cyclecount and \global\ind=0 % reset list index \fi \pgfmathparse{\cyclelist[\the\ind]} % Get color from cycle list \edef\color{\pgfmathresult} % and store as \color % Draw angle and set labels \draw[fill={\color!50},draw={\color}] (0,0) -- (\angle:\radius) arc (\angle:\angle+\percent*3.6:\radius) -- cycle; \node at (\angle+0.5*\percent*3.6:0.7*\radius) {\percent\,\%}; \node[pin=\angle+0.5*\percent*3.6:\name] at (\angle+0.5*\percent*3.6:\radius) {}; \pgfmathparse{\angle+\percent*3.6} % Advance angle \xdef\angle{\pgfmathresult} % and store in \angle \fi }; \end{tikzpicture} \end{document} I found particularly complex to replicate it with latex, so any help will be welcome. Thanks for your support!
- How to draw a water droplet in Latex?by Camilo Ramirez on November 6, 2017 at 8:46 pm
Hey guys I am working in an infographic and I am trying to do it in LaTeX. In it I want to use the shape of a water droplet to show the water consumption. the final product should be something like this: Then I want to draw the water droplet shape to be able to use it like that in a table. Any ideas?
- Table with graphics in beamerby bkarpuz on September 1, 2017 at 11:50 am
How can we create a table as in the following picture? Here is what I have done. \documentclass[10pt,notheorems]{beamer} \usepackage{tikz} \usetikzlibrary{babel,decorations.markings,positioning,shapes,arrows} \usepackage{pgfplots} \pgfplotsset{compat=newest} \hypersetup{bookmarksdepth=4,bookmarksnumbered=true,bookmarksopen=true} \definecolor{mc1}{rgb}{0.368417,0.506779,0.709798} \usetheme{Warsaw} \usecolortheme{seahorse} \setbeamertemplate{theorems}[numbered] \setbeamertemplate{caption}[numbered] \begin{document} \begin{frame}[fragile]{Table of intervals}{} \begin{table} \centering \begin{tabular}{ccc} Notation & Set description & Picture \\ \hline $(a,b)$ & $\{x:\ a<x<b\}$ & \begin{tikzpicture} \begin{axis}[ %scaled ticks=false, axis lines=middle, %axis line style={draw=none}, width=50mm, height=20mm, xmin=0,xmax=4, ymin=-1,ymax=1, xtick={1,3}, xticklabels={$a$,$b$}, y axis line style={draw=none}, ytick=\empty, %yticklabels={} ] \addplot[very thick,color=mc1,smooth,samples=2,domain=1.1:2.9]{0}; \addplot[thick,color=mc1,fill opacity=0,only marks,mark=*] coordinates{(1,0)}; \addplot[thick,color=mc1,fill opacity=0,only marks,mark=*] coordinates{(3,0)}; \end{axis} \end{tikzpicture} \\ $[a,b]$ & $\{x:\ a\leq{}x\leq{}b\}$ & \begin{tikzpicture} \begin{axis}[ %scaled ticks=false, axis lines=middle, %axis line style={draw=none}, width=50mm, height=20mm, xmin=0,xmax=4, ymin=-1,ymax=1, xtick={1,3}, xticklabels={$a$,$b$}, y axis line style={draw=none}, ytick=\empty, %yticklabels={} ] \addplot[very thick,color=mc1,smooth,samples=2,domain=1:3]{0}; \addplot[thick,color=mc1,only marks,mark=*] coordinates{(1,0)}; \addplot[thick,color=mc1,only marks,mark=*] coordinates{(3,0)}; \end{axis} \end{tikzpicture} \\ $[a,b)$ & $\{x:\ a\leq{}x<b\}$ & \begin{tikzpicture} \begin{axis}[ %scaled ticks=false, axis lines=middle, %axis line style={draw=none}, width=50mm, height=20mm, xmin=0,xmax=4, ymin=-1,ymax=1, xtick={1,3}, xticklabels={$a$,$b$}, y axis line style={draw=none}, ytick=\empty, %yticklabels={} ] \addplot[very thick,color=mc1,smooth,samples=2,domain=1:2.9]{0}; \addplot[thick,color=mc1,only marks,mark=*] coordinates{(1,0)}; \addplot[thick,color=mc1,fill opacity=0,only marks,mark=*] coordinates{(3,0)}; \end{axis} \end{tikzpicture} \\ $\vdots$ & $\vdots$ & $\vdots$ \\ $(-\infty,\infty)$ & $\mathbb{R}$ & \begin{tikzpicture} \begin{axis}[ %scaled ticks=false, axis lines=middle, %axis line style={draw=none}, width=50mm, height=20mm, xmin=0,xmax=4, ymin=-1,ymax=1, xtick={1,3}, xticklabels={$a$,$b$}, y axis line style={draw=none}, ytick=\empty, %yticklabels={} ] \addplot[->,very thick,color=mc1,smooth,samples=2,domain=0:4]{0}; \end{axis} \end{tikzpicture} \end{tabular} \caption{Table of intervals}\label{tbltoi} \end{table} \end{frame} \end{document} How can I align the pictures properly? I would be very glad to hear suggestions.
- Tikz Matrix No shape namedby user109900 on July 12, 2016 at 8:41 am
I try to write my bachelor thesis with LaTeX. In this I have problems with TikZ. I like to make braces over my matrices like this: I have several problems: can´t draw dashed line between 6. and 7.row the nodes (I hope that u_1 etc. are nodes?) are not at the right position and after six nodes i can't add anymore. It says "No shape named 1-7" I like to have overbrace over every 3 columns (so from 1 to 3, 3-6 and 6-9) with a letter on it I would really appreciate it if someone could help me 🙂 And this is the code: \documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix,decorations.pathreplacing, calc, positioning} \begin{document} \begin{eqnarray*} \begin{tikzpicture} [baseline=-\the\dimexpr\fontdimen22\textfont2\relax ] \matrix (m)[matrix of math nodes,left delimiter={[},right delimiter={]},,nodes in empty cells] { d^{(1)}_1\\ d^{(1)}_2\\ d^{(1)}_3\\ d^{(1)}_4\\ d^{(1)}_5\\ d^{(1)}_6\\ % d^{(2)}_1\\ d^{(2)}_2\\ d^{(2)}_3\\ d^{(2)}_4\\ d^{(2)}_5\\ d^{(2)}_6\\ }; \draw[dashed] ($0.5*(m-6-1.south west)+0.5*(m-7-1.north west)$) -- ($0.5*(m-6-1.south east)+0.5*(m-7-1.north east)$); \node[left=12pt of m-2-1] (left-1) {i}; \node[left=12pt of m-5-1] (left-2) {k}; \node[left=12pt of m-8-1] (left-3) {i}; \node[left=12pt of m-11-1](left-4) {k}; \node[rectangle,left delimiter=\{] (del-left-1) at ($0.5*(left-1.east) +0.5*(left-2.east)$) {\tikz{\path (left-1.north east) rectangle (left-2.south west);}}; \node[left=12pt] at (del-left-1.west) {$E_1$}; \node[rectangle,left delimiter=\{] (del-left-3) at ($0.5*(left-3.east) +0.5*(left-4.east)$) {\tikz{\path (left-3.north east) rectangle (left-4.south west);}}; \node[left=12pt] at (del-left-3.west) {$E_1$}; \end{tikzpicture} = \begin{tikzpicture} [baseline=-\the\dimexpr\fontdimen22\textfont2\relax ] \matrix (n)[matrix of math nodes,left delimiter={[},right delimiter={]},column sep=0.5cm,nodes in empty cells]{ 1 & & & & & & & & \\ &1 & & & & & & & \\ & &1 & & & & & & \\ & & &1 & & & & & \\ & & & &1 & & & & \\ & & & & &1 & & & \\ & & &1 & & & & & \\ & & & &1 & & & & \\ & & & & &1 & & & \\ & & & & & &1 & & \\ & & & & & & &1 & \\ & & & & & & & &1 \\ }; \draw[dashed] ($0.5*(m-6-1.south west)+0.5*(m-7-1.north west)$) --($0.5*(m-6-9.south east)+0.5*(m-7-9.north east)$); \node[above=of n-1-1] (top-1) {$u_1$}; \node[above=of n-1-2] (top-2) {$w_1$}; \node[above=of n-1-3] (top-3) {$\phi_1$}; \node[above=12pt of n-1-4] (top-4) {$u_2$}; \node[above=12pt of n-1-5] (top-5) {$w_2$}; \node[above=12pt of n-1-6] (top-6) {$\phi_2$}; \node[above=10pt of m-1-7] (top-7) {$u_3$}; \node[above=10pt of m-1-8] (top-8) {$w_3$}; \node[above=10pt of m-1-9] (top-9) {$\phi_3$}; \end{tikzpicture} \end{eqnarray*} \end{document}
- How can we make a pumpkin, jack-o-lantern, or other halloween spirit, ghoul, or skeleton?by A.Ellett on October 31, 2014 at 7:04 pm
We have questions about Christmas trees and Hearts for Valentines but we have no questions that specialize in Halloween or Dia de los Muertos art. Here it goes: Using TikZ or PSTricks or any other of your favorite LaTeX tools, create pumpkins, ghouls, etc., appropriate to the season. I think multiple submissions should be fine provided different objects are created.
- Cut bottom of tabular by Zig-Zag pattern (in latex beamer)by Daniel F on June 8, 2013 at 11:20 pm
I try to present a part of a huge table inside the latex beamer environment. A small part of this table is sufficient to understand what is inside so i decided to indicate the cut-out be a bottom zig-zag line as shown below: \begin{tikzpicture} \node(elenore)[minimum width=3cm, minimum height=1cm] at (0, 0) { \begin{tabular}{c| c c | l } \cline{2-3} & \multicolumn{2}{c|}{comparison} & \\ \cline{1-4} \multicolumn{1}{|c|}{A} & B & C & \multicolumn{1}{l|} {value} \\ \cline{1-4} \multicolumn{1}{|c|}{(1,\texttt{X},\texttt{\$},U,11)} & & (\texttt{a},\texttt{\$},1) & \multicolumn{1}{l|}{C}]$} \\ \multicolumn{1}{|c|}{(2,\texttt{r},1,10)} & (\texttt{O},1) & & \multicolumn{1}{l|}{$H_{1} = [\texttt{aa}]$} \\ \multicolumn{1}{|c|}{(3,\texttt{a},\texttt{a},3,2)} & & (\texttt{a},\texttt{a},6) & \multicolumn{1}{l|}{$H_5 = [\texttt{yyyyyy}]$} \\ \multicolumn{1}{|c|}{(4,\texttt{a},5,1)} & (\texttt{a},5) & & \multicolumn{1}{l|}{$H$ = [\texttt{text}]$} % \\ \end{tikzpicture} \draw[decoration={zigzag, mirror,segment length=6.25mm}, decorate] (elenore.south west) -- (elenore.south east); My Problem is: how can i stick the zig-zag line perfectly from the beginning of the very left table border to the very right one? Currently it overlaps a little bit what looks quite ugly. Any idea?
- Big block matrix with tikzby 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}
- Penrose tiling in TikZby Yuji on June 27, 2012 at 3:54 pm
How can I auto-generate a Penrose tiling by TikZ? Here's my code for Mathematica: GG = (Sqrt[5]+1)/2; standardthin = {1/2+Sqrt[GG^2-(1/2)^2] I , 0, 1}; standardthick = {GG/2+Sqrt[1-(GG/2)^2] I, 0, GG}; sectthin[n_, t_] := If[n > 0, Join[sectthin[n-2, {t[[2]], t[[3]], (GG*t[[3]]+t[[1]])/(GG+1)}], sectthick[n-1, {(GG*t[[3]]+t[[1]])/(GG+1), t[[1]], t[[2]]}]], {thin @@ N[t]}]; sectthick[n_, t_] := If[n > 0, Join[sectthick[n-2, {(GG*t[[2]]+t[[3]])/(GoldenRatio+1),t[[1]],t[[2]]}], sectthin[n-1, {t[[3]], (GG*t[[2]]+t[[3]])/(GG+1), t[[1]]}]], {thick @@ N[t]}]; addtothick[n_, t_, d_] := If[d == 0, {}, Join[{frame @@ t}, If[EvenQ[d], Join[addtothick[n+2, {t[[2]], t[[3]], ((GG+1)*t[[1]]-GG*t[[3]])},d/2], sectthin[n+1, {((GG+1)*t[[1]]-GG*t[[3]]), t[[1]], t[[2]]}]], Join[addtothin[n+1, {t[[2]], t[[3]], ((GG+1)*t[[1]]-t[[2]])/GG}, (d-1)/2], sectthin[n-1, {t[[3]], ((GG+1)*t[[1]]-t[[2]])/GG, t[[1]]}]]]]]; addtothin[n_, t_, d_] := If[d == 0, {}, Join[{frame @@ t}, If[EvenQ[d], Join[addtothin[n+2, {((GG+1)*t[[3]]-GG*t[[2]]), t[[1]], t[[2]]}, d/2], sectthick[n+1, {t[[3]], ((GG+1)*t[[3]]-GG*t[[2]]), t[[1]]}]], Join[addtothick[n+1, {t[[3]], ((GG+1)*t[[2]]-t[[1]])/GG, t[[1]]}, (d -1)/2], sectthick[n-1, {t[[2]], t[[3]], ((GG+1)*t[[2]]-t[[1]])/GG}]]]]]; triangle[a_, b_, c_] := Graphics[Line[{Re[#], Im[#]} & /@ {a, b, c, a}]]; thin := triangle; thick := triangle; frame[a_, b_, c_] := Graphics[{Thickness[0.005], Line[{Re[#], Im[#]} & /@ {a, b, c, a}]}] Show[addtothin[0, standardthin, 200], AspectRatio -> Automatic] which creates something like this: