TikZ
- Draw simple figures: l3draw vs PGF performancesby PHL on April 30, 2026 at 3:08 am
I have some lua code that generates coordinates of many triangles/quadrilaterals I then want to draw/fill. See this answer about Penrose tilings for a concrete example. The drawing is actually done in TikZ via the luadraw package, but I am wondering if I can make the code faster by replacing TikZ with l3draw. Rewriting my actual code to remove TikZ and luadraw dependences (and use l3draw or any other drawing tool) is not a complex task, but will ask me some time due to my limited programming skills. So I would prefer to know in advance if this is a good idea or not. Apart possibly performance, is there any other reasons to use l3draw over pgf for this kind of task? Edit: I am not using TikZ/pgf for the rest of the document. Suggesting to use another environment (as picture) is a valid answer.
- Representation of a double cone with section and orthogonal projectionsby Sebastiano on April 29, 2026 at 8:08 pm
I should create a drawing that illustrates this domain in 3D: T= \{(x, y, z) \in \mathbb{R}^3\colon x^2 +y^2\leq (z-9)^2, 0\leq z\leq 3 \}. It is a double cone with vertex at (0,0,3) if it were x^2 +y^2= (z-9)^2. I may have to change the scale but I don’t want the drawing to look worse. How can I colour the two-sloped cone part that satisfies the inequality x^2 +y^2\leq (z-9)^2? ...and then adding 0\leq z\leq 3? \documentclass{article} \usepackage{tikz} \usetikzlibrary{patterns} \usepackage{tikz-3dplot} \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{2pt} \begin{document} \tdplotsetmaincoords{60}{110} \begin{tikzpicture}[tdplot_main_coords,scale=0.9] \pgfmathsetmacro{\tini}{0.5*pi} \pgfmathsetmacro{\tfin}{1.85*pi} \pgfmathsetmacro{\tend}{2.5*pi} \def\h{10.2} \draw[thick,->] (0,0,0) -- (3.5,0,0) node[below left] {$x$}; \draw[dashed] (0,0,0) -- (-2.5,0,0); \draw[thick,->] (0,0,0) -- (0,3.5,0) node[right] {$y$}; \draw[dashed] (0,0,0) -- (0,-2.5,0); \draw[thick,->] (0,0,0) -- (0,0,12) node[above] {$z$}; \fill (0,0,9) circle (1pt); \node[right] at (0,0,9) {$(0,0,9)$}; \foreach \angulo in {0,2,...,358}{ \draw[cyan,very thick,opacity=0.12,rotate around z=\angulo] plot[domain=0:2,smooth,variable=\t] ({0},{\t},{9 + \t}); \draw[cyan,very thick,opacity=0.12,rotate around z=\angulo] plot[domain=0:2,smooth,variable=\t] ({0},{\t},{9 - \t}); } \foreach \z in {7.6,7.8,...,10.4}{ \pgfmathsetmacro{\r}{abs(\z-9)} \draw[cyan,thick,opacity=0.35] plot[domain=\tini:\tfin,smooth,variable=\t] ({\r*cos(\t r)},{\r*sin(\t r)},{\z}); } \foreach \z in {7.6,7.8,...,10.4}{ \pgfmathsetmacro{\r}{abs(\z-9)} \draw[cyan,thick,opacity=0.35] plot[domain=\tfin:\tend,smooth,variable=\t] ({\r*cos(\t r)},{\r*sin(\t r)},{\z}); } \pgfmathsetmacro{\r}{abs(\h-9)} \draw[red,very thick] plot[domain=0:360,smooth,variable=\t] ({\r*cos(\t)},{\r*sin(\t)},{\h}); \node[red, above right] at ({\r},0,\h) {$z=h$}; \fill[yellow,opacity=0.35] plot[domain=0:360,smooth,variable=\t] ({\r*cos(\t)},{\r*sin(\t)},0); \draw[red,thick] plot[domain=0:360,smooth,variable=\t] ({\r*cos(\t)},{\r*sin(\t)},0); \foreach \angle in {0,45,...,315}{ \pgfmathsetmacro{\x}{\r*cos(\angle)} \pgfmathsetmacro{\y}{\r*sin(\angle)} \draw[gray,dashed,opacity=0.5] (\x,\y,0) -- (\x,\y,\h); } \node[blue,right] at (0,0,11.5) {$x^2 + y^2 = (z-9)^2$}; \end{tikzpicture} \end{document}
- Creating a custom symbol in TikZ whose colour agrees with that of the surrounding textby varkor on April 29, 2026 at 11:36 am
I have created a custom ⍟ symbol using TikZ, which works well, except that it ignores the colour of the surrounding text. MWE: \documentclass{article} \usepackage{tikz} \usepackage{scalerel} \newsavebox{\whitecircstar}\sbox{\whitecircstar}{\kern.075em\tikz{\node[draw, circle,line width=.36pt, inner sep=0]{$*$};}\kern.075em} \newcommand{\ostar}{\mathbin{\scalerel*{\usebox{\whitecircstar}}{\odot}}} \begin{document} \textcolor{red}{Before $\ostar$ After} \end{document} Output: How can I make \ostar the same colour as the surrounding text? My understanding was that . was a special symbol for the current colour in xcolor, but adding color=. to the node arguments had no effect.
- Multiple splits in Tikz rectangle with distinct linesby iago on April 29, 2026 at 9:24 am
My goal is to get a rectangle like the one below, but with text in the nested rectangles. Line types could be for example the following: I saw tikz: Multiple splits of rectangle, but it does not answer the question on the line types. Beyond that, I am a beginner using Tikz, and I'd like the answer explained, since the linked answer is complex to understand. Thanks!
- How to add a translucent background picture on a title page, behind titles?by Cham on April 28, 2026 at 10:08 pm
I would like to add a very large picture on a title page, covering the whole page with a large offset (picture pasted to the upper-left side of the page), blended on the page background (below the title, author's name and other text elements), with some transparency effect, and background blending effect. How should we achieve this? The picture is supposed to be partly shown on the page, about half of it showing on the upper-left side, like an "intrusion" on the page (sorry for the bad english description. I hope you get the picture). Here's a MWE to be modified, showing a title page prototype: \documentclass[11pt,twoside]{book} \usepackage[T1]{fontenc} \usepackage[tt=false]{libertinus} \usepackage[french]{babel} \usepackage[stretch=50]{microtype} \usepackage[letterpaper,left=1.25in,right=1in,top=0.5in,bottom=0.5in,includeheadfoot,headheight=15pt]{geometry} \usepackage{titlesec} \usepackage{graphicx} \usepackage[dvipsnames]{xcolor} \usepackage{float} \usepackage{fancyhdr} \usepackage[titles]{tocloft} \usepackage{shadowtext} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \frontmatter % Title Page : \begin{titlepage} \definecolor{lightbrown}{RGB}{177, 149, 93} \definecolor{darkbrown1}{RGB}{58, 41, 26} \definecolor{darkbrown2}{RGB}{50, 30, 0} % Frame : \begin{tikzpicture}[remember picture, overlay] \draw[line width = 1in,color = white] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$); \draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$); %\draw[line width = 1pt,color = darkbrown1] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$); \end{tikzpicture} \shadowoffsetx{2.5pt} \shadowoffsety{3.5pt} \shadowcolor{gray!80} \definecolor{pagetitre}{RGB}{150,120,100} \pagecolor{pagetitre} \centering \vspace*{\baselineskip} \vfill {\textcolor{black}{\fontsize{26}{0}\selectfont\sffamily\textbf{\shadowtext{Some Nice Title Here}}}} \\[2.5\baselineskip] {\textcolor{black}{\huge\sffamily\scshape Someone}} \vfill \vfill \includegraphics[width=11cm]{example-grid-100x100pt} \vfill {\textcolor{black}{\Large\selectfont\sffamily\scshape Some copyright notice}} \end{titlepage} \pagecolor{white} Blabla \end{document} So how can I add a very large picture blended with the page background colour, with some transparency effect, and a large up-left offset? The large picture should fit inside the frame defined with the tikzpicture environment, and stay below all text on the title page.
- 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}
- 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 can I draw grid of cylinders?by minthao_2011 on November 25, 2025 at 9:02 am
I used Mathematica and tried grid of cylinder I don’t know how to draw with other tools. How can I draw it?
- 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}
- 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}
- 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! 🥂🥳
- How to hatch pattern this table excluding the circled region?by rakatex on May 23, 2020 at 8:53 pm
I would like to circle the elements in the matrix table (How to create a small cell with borders in the top corner of a cell in the table?) and hatch pattern the matrix table excluding the circled numbers and inlays. I would also like to fill the cells in the demand and supply with red color as indicated in the figure. Please help me. Please note that the red lines drawn in the figure are approximate, in the final solution, I would like to have perfectly slanted group of lines (45 degree hatch lines). \documentclass[tikz,border=3mm]{standalone} \usepackage{amsmath} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture}[mmat/.style={matrix of math nodes,nodes in empty cells, row sep=-\pgflinewidth,column sep=-\pgflinewidth, nodes={minimum width=5.5em,minimum height=3.5em, draw,anchor=center, text depth=0.25ex,text height=0.8em}}, inlay/.style={label={[draw,thin,anchor=north east,minimum width=0.7cm, minimum height=0em,inner sep=1.4pt]north east:#1}}] \matrix[mmat] (mat){ & P & Q & R & S & \textit{Supply} \\ A & |[inlay=10]| 300 & |[inlay=20]| 200 & |[inlay=30]| 0 & |[inlay=40]| 0 & 500 \\ B & |[inlay=50]| 0 & |[inlay=60]| & |[inlay=70]| & |[inlay=80]| & 500 \\ C & |[inlay=90]| 0 & |[inlay=100]| & |[inlay=110]| & |[inlay=120]| & 500 \\ Demand & |[inlay=130]| 300 & |[inlay=140]| 200 & |[inlay=150]| 1000 & |[inlay=160]| 500 & 2000 \\ }; \draw (mat-1-1.north west) -- (mat-1-1.south east); \draw[stealth-] ([yshift=2ex,xshift=-0.5ex]mat-1-1.east) -- ++ (-2ex,0) node[left,font=\itshape]{To}; \draw[stealth-] ([xshift=3ex,yshift=0.5ex]mat-1-1.south west) -- ++ (0,2ex) node[above,font=\itshape]{From}; \end{tikzpicture} \end{document}
- 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?
- Powerful pedagogic graph of lognormal distributionby JeT on October 14, 2018 at 1:54 am
I found this graph to explain the transformation from normal to lognormal distribution. I am no latex expert and I was wondering if anyone knew how to reproduce it ? thank you ! Here is MWE \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.7} \begin{document} \begin{tikzpicture} \begin{axis}[rotate=-90,grid=both, samples at={-4,-3.99,...,6}, ] \addplot[smooth,very thick,color=blue,samples=100] {(1/sqrt(2*pi*1))*exp(-(x-0)^2/(2*1)}; \addlegendentry{$\mathcal{N}(0,1)$} \end{axis} \begin{scope}[shift={(6,8)}] \begin{axis}[grid=both, samples at={-4,-3.99,...,6}, ] \addplot[color=red,very thick,samples=100] {(1/x)* (1/sqrt(2*pi*1))*exp(- (ln(x)-0)^2/(2*1)}; \addlegendentry{$\mathcal{LN}(0,1)$} \end{axis} \end{scope} \begin{scope}[shift={(6,0)}] \begin{axis}[grid=both, samples at={-3,-2.99,...,3}, ] \addplot[color=red,very thick,samples=100] {exp(-x)}; \addlegendentry{$x=e^y$} \end{axis} \end{scope} \end{tikzpicture} \end{document}
- 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.
- 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: