TikZ
- Special LaTeX characters and TikZ Math Modeby berkus on September 12, 2025 at 6:50 pm
Is there a simple fix (other than not using \i in the math mode) to get the correct character in the following MWE? \documentclass[]{standalone} \usepackage{tikz} \usetikzlibrary{math} \begin{document} \tikzmath{ int \i; \i=7; } \begin{tikzpicture} \node at (0, 0) {ABC ı}; \end{tikzpicture} \end{document} The output of the MWE is
- Beamer: Design blocks as puzzle pieces with 169 ratioby Gudrun on September 12, 2025 at 5:59 pm
samcarter_is_at_topanswers.xyz provided kindly a solution for the previous question Beamer: What else is possible besides blocks? I struggle with the following now: My beamer is 169. the puzzle pieces don't stretch automatically. If I change scale, they change size, but puzzle title and position don't move automatically. See red piece. I have no feel for the right numbers, hence that would mean multiple compilation to test for the right position. Green starts at 0, but red finishes somewhere else as I manually set the starting point. Would it not be nicer to have it as flexible number of puzzle pieces? I know tikz can calculate and one could define lengths, but I did not achieve a result. If everything depends on number of pieces it could be more logical? How to shift the position of the itemize automatically, so it uses the most reasonable text width of a puzzle piece? My MEW runs through, but looks ugly . I would be very grateful, if somebody could elaborate better how to define number of puzzle pieces, distribute them over the whole text with (here also for 16/9 ratio) , and have the puzzle titles also moved with the scaling, i.e. red puzzle title is in the red piece. Itemize text uses a whole, reasonable puzzle piece width. \documentclass[aspectratio=169]{beamer} % test aspect ratio \usetheme{Madrid} \useoutertheme{shadow} \useoutertheme{infolines} \useoutertheme[subsection=false]{miniframes} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{jigsaw} \begin{document} \begin{frame}{Puzzle Example} \begin{tikzpicture}[ mypuzzle/.style={ text=violet, text width=2cm, font=\footnotesize, align=center, thick, scale=4, } ] \path (0,0) pic[ mypuzzle, fill=teal!30, pic text={ \begin{itemize} \item test \item test \end{itemize} }, pic text options={xshift=-0.3cm,yshift=0.5cm} ]{piece={1}{1}{0}{0}}; \node[text width=3cm,fill=teal,inner xsep=0pt,anchor=south west,align=center,text=white] at (0,3) {Puzzle Piece 1}; \path (4,0) pic[ mypuzzle, fill=violet!30, pic text={ \begin{itemize} \item test \item test \end{itemize} }, pic text options={yshift=0.5cm} ]{piece={-1}{-1}{0}{-1}}; \node[text width=3cm,fill=violet,inner xsep=0pt,anchor=south west,align=center,text=white] at (3,3) {Puzzle Piece 2}; \path (8,0) pic[ mypuzzle, fill=orange!30, pic text={ \begin{itemize} \item test \item test \end{itemize} }, pic text options={xshift=0.3cm,yshift=0.5cm} ]{piece={-1}{-1}{0}{1}}; \node[text width=3cm,fill=orange,inner xsep=0pt,anchor=south west,align=center,text=white] at (6,3) {Puzzle Piece 3}; \path (11.5,0) pic[ mypuzzle, fill=red!40, pic text={ \begin{itemize} \item test \item test \end{itemize} }, pic text options={xshift=0.3cm,yshift=0.5cm} ]{piece={-1}{0}{0}{1}}; \node[text width=3cm,fill=red,inner xsep=0pt,anchor=south west,align=center,text=white] at (9,3) {Puzzle Piece 4}; \end{tikzpicture} \end{frame} \end{document}
- How to draw cuboids in LaTeX easily [duplicate]by user110391 on September 12, 2025 at 4:59 am
I've just started familiarizing myself with tikz, and I've only sticked to 2D shapes. Now, I need to draw the following photo in LaTeX: Not like an exact replica of course, but the same idea. Doing this with 2D coordinates would be a pain, and I know you can work with packages and stuff that just allows you to define shapes based on 3D coordinates, and the package does the rest. But I don't know what package this is, and how to use it. What is the simplest way for me to draw cuboids in LaTeX?
- declaring tikz shapes with makeshape combined with bounding boxesby atticus on September 11, 2025 at 8:01 pm
I recently stumbled over this issue when declaring own tikz shapes with makeshape, but see for yourself: \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning,fit} \usepackage{demoProblem} \begin{document} \begin{tikzpicture} \node[draw] (origin) {origin}; \begin{scope}[local bounding box=A1] \node[myShape, right=3cm of origin] {}; \end{scope} \node[draw,fit=(A1), label=below:{box}] (box) {}; \end{tikzpicture} \begin{tikzpicture} \node[draw] (origin) {origin}; \begin{scope}[local bounding box=A1] \node[myShape, right=3cm of origin, left] {}; \end{scope} \node[draw,fit=(A1), label=below:{box}] (box) {}; \end{tikzpicture} \begin{tikzpicture} \node[draw] (origin) {origin}; \begin{scope}[local bounding box=A1] \node[myShape] at (3,0) {}; \end{scope} \node[draw,fit=(A1), label=below:{box}] (box) {}; \end{tikzpicture} \end{document} With the following demoProblem.sty: \RequirePackage{makeshape} \def\myShapeAnchor{ \pgf@xa=\pgfshapeminwidth \pgf@ya=\pgfshapeminwidth \pgf@xa=.5\pgf@xa \pgf@ya=.5\pgf@ya \pgfpathmoveto{\pgfpoint{.75\pgf@xa}{.4\pgf@ya}} \pgfpathlineto{\pgfpoint{-.75\pgf@xa}{.4\pgf@ya}} \pgfpathlineto{\pgfpoint{-.97\pgf@xa}{-.18\pgf@ya}} \pgfpathlineto{\pgfpoint{-.99\pgf@xa}{-.18\pgf@ya}} \pgfpathlineto{\pgfpoint{-.99\pgf@xa}{-.4\pgf@ya}} \pgfpathlineto{\pgfpoint{.99\pgf@xa}{-.4\pgf@ya}} \pgfpathlineto{\pgfpoint{.99\pgf@xa}{-.18\pgf@ya}} \pgfpathlineto{\pgfpoint{.97\pgf@xa}{-.18\pgf@ya}} \pgfpathclose % \pgfusepath{stroke} } \def\myShapeBorder{ % Deckel \pgfmoveto{\northeast \pgf@x=.75\pgf@x \pgf@y=.4\pgf@y} \pgflineto{\northeast \pgf@x=.97\pgf@x \pgf@y=-.18\pgf@y} \pgflineto{\northeast \pgf@x=-.97\pgf@x \pgf@y=-.18\pgf@y} \pgflineto{\northeast \pgf@x=-.75\pgf@x \pgf@y=.4\pgf@y} \pgfclosepath \pgfusepath{stroke} } \pgfdeclareshape{@myShape}{ \setpaths{\myShapeAnchor}{\myShapeBorder} \savedanchor\northeast{% \pgf@x = \pgfshapeminwidth \pgf@y = \pgfshapeminwidth \pgf@x=.5\pgf@x \pgf@y=.5\pgf@y } \anchor{north}{\northeast \pgf@y=.4\pgf@y \pgf@x=0pt} \anchor{east}{\northeast \pgf@x=.9\pgf@x \pgf@y=0pt} \anchor{south}{\northeast \pgf@x=0pt \pgf@y=-.4\pgf@y} \anchor{west}{\northeast \pgf@x=-.9\pgf@x \pgf@y=0pt} } \tikzset{ myShape/.style 2 args={ shape=@myShape, minimum size=#1, fill=#2 }, myShape/.default={1cm}{black} } All this results in the following output: You see the boxes in the first two lines are extended to the right/left compared what I'd expect. Now I already have that \pgfusepath{stroke} in the \myShapeAnchor which currently is commented out. Adding it back in, I see the path specified there is drawn/evaluated right/left of the actual node correlating to the extend. Now I think I already found out the issue is that when using the positioning library, pgf/tikz evaluates the anchorpath first in order to know where to place the node. Now in this evaluation, the node draws a path which is captured by the bounding box, resulting in this weird extension of the box. Do I see this correctly? Now I wonder of course if this can be fixed with the shape (I'd still like to use the bounding box). Looking at the docs of makeshape, it says Its key features are: a mechanism for specifying the \anchorborder behaviour as a path Am I correct in that when I want to fix this at the shape level, I need to stop using makeshape essentially (thereby go the hard way of declaring the anchorborder with potentially complex operations)? (or at least makeshape is not of much help anymore when not using that feature)
- The 'TeX capacity exceeded' problem that occurs in Hasse diagram drawingby MBKandemir on September 11, 2025 at 10:58 am
I want to create the Hasse diagram in the image. I am writing the following code, but I am getting the error: Package pgfkeys Error: The key '/tikz/node distance' requires a value. I am going to ignore this key. ] TeX capacity exceeded, sorry [input stack size=10000]. ] Is there anyone who can help with a solution to this error? Thank you in advance for your interest. \begin{tikzpicture}[ node distance=1cm, % Düğümler arası dikey mesafe every node/.style={draw=black, fill=black, circle, inner sep=1.5pt}, % Düğüm stili label style={font=\footnotesize, below=2pt of #1} % Etiketlerin stili ve konumu ] % İlk zincir \node[label={$x_{01}$}] (x01) at (0,0) {}; \node[label={$x_{11}$}] (x11) [above=of x01] {}; \node[label={$x_{21}$}] (x21) [above=of x11] {}; \node[label={$x_{p1}$}] (xp1) at (0,4) {}; \draw (x01) -- (x11) -- (x21); \draw[dotted] (x21) -- (xp1); % İkinci zincir \node[label={$x_{02}$}] (x02) at (1.5,0) {}; \node[label={$x_{12}$}] (x12) [above=of x02] {}; \node[label={$x_{22}$}] (x22) [above=of x12] {}; \node[label={$x_{p2}$}] (xp2) at (1.5,4) {}; \draw (x02) -- (x12) -- (x22); \draw[dotted] (x22) -- (xp2); % Üçüncü zincir \node[label={$x_{03}$}] (x03) at (3,0) {}; \node[label={$x_{13}$}] (x13) [above=of x03] {}; \node[label={$x_{23}$}] (x23) [above=of x13] {}; \node[label={$x_{p3}$}] (xp3) at (3,4) {}; \draw (x03) -- (x13) -- (x23); \draw[dotted] (x23) -- (xp3); % Ortadaki elipsler \node at (4.5, 2) {$\cdots$}; % n. (son) zincir \node[label={$x_{0n}$}] (x0n) at (6,0) {}; \node[label={$x_{1n}$}] (x1n) [above=of x0n] {}; \node[label={$x_{2n}$}] (x2n) [above=of x1n] {}; \node[label={$x_{pn}$}] (xpn) at (6,4) {}; \draw (x0n) -- (x1n) -- (x2n); \draw[dotted] (x2n) -- (xpn); \end{tikzpicture}
- Beamer: What else is possible besides blocks?by Gudrun on September 10, 2025 at 10:00 pm
for a beamer presentation I have 4 blocks with itemize env next to each other. I was wondering if there is a more interesting design for the blocks. I thought about 4 puzzle pieces connected. But I don't know how to connect the puzzle pieces automatically nor how to place an itemize env in one piece. Or how to have a better design? The pieces will stretch probably with more items/text, but that is fine for me. Some irregular puzzle. I prepared a MWE \documentclass{beamer} \usetheme{Madrid} \useoutertheme{shadow} \useoutertheme{infolines} \useoutertheme[subsection=false]{miniframes} \usepackage{jigsaw} \begin{document} \section{Section1} \begin{frame} \frametitle{Title1} \framesubtitle{Subtitle1} %Idea is to have 4 puzzle pieces connected to each other. %Each has a short title, maybe with a line break % All of them are connected %Suggested packages: https://github.com/samcarter/jigsaw %https://github.com/cpierquet/latex-packages/tree/main/thematicpuzzle \begin{columns}[T,onlytextwidth] \begin{column}{\textwidth} \begin{columns}[T,totalwidth=\textwidth] % Block 1 \begin{column}{0.23\textwidth} \begin{block}{Block 1 Block 1 extended} \scriptsize \begin{itemize} \item item1 \item item2 \item item3 \item A longer item. \item A very very very long item. \end{itemize} \end{block} \end{column} \hfill % Block 2 \begin{column}{0.23\textwidth} \begin{block}{Block 2} \scriptsize \begin{itemize} \item item1 \item item2 \item item3 \item A longer item. \item A very very very long item. \item item4 \end{itemize} \end{block} \end{column} \hfill % Block 3 \begin{column}{0.23\textwidth} \begin{block}{Block 3} \scriptsize \begin{itemize} \item item1 \item item2 \item item3 \item A longer item. \item A very very very long item. \end{itemize} \end{block} \end{column} \hfill % Block 4 \begin{column}{0.23\textwidth} \begin{block}{Block 4} \scriptsize \begin{itemize} \item item1 \item item2 \item item3 \item A longer item. \item A very very very long item. \end{itemize} \end{block} \end{column} \end{columns} \end{column} \end{columns} \begin{center} The take home message \end{center} \includegraphics[height=0.3\textheight]{example-image-duck} \end{frame} \begin{frame} \frametitle{Title2} Multiple items will stretch the jigsaw piece in vertical direction, but that is fine. \begin{tikzpicture} \path (2,-3) pic[ fill=lightgray, draw=teal, thick, scale=3, pic text={ Puzzle piece 1 Can it also have an itemize env inside with many items? }, pic text options={text=violet} ]{piece={1}{1}{0}{0}}; \path (5.5,-3) pic[ fill=lightgray, draw=teal, thick, scale=3, pic text={ Puzzle piece 2 Can it also have an itemize env inside with many items? }, pic text options={text=violet} ]{piece={-1}{-1}{0}{-1}}; %How to autoconnect the pieces? \path (9,-3) pic[ fill=lightgray, draw=teal, thick, scale=3, pic text={ Puzzle piece 3 Can it also have an itemize env inside with many items? }, pic text options={text=violet} ]{piece={-1}{-1}{0}{1}}; \path (12,-3) pic[ fill=lightgray, draw=teal, thick, scale=3, pic text={ Puzzle piece 3 Could one also have a tiny image inside? }, pic text options={text=violet} ]{piece={-1}{-1}{0}{1}}; \end{tikzpicture} \end{frame} \end{document}
- why the bounding box differ with tikz and l3draw?by Explorer on September 10, 2025 at 1:57 pm
I have the following code: \documentclass{article} \usepackage{showframe} \usepackage{l3draw} \usepackage{tikz} \begin{document} \ExplSyntaxOn \fbox{% \draw_begin: \draw_path_moveto:n { 0cm , 0cm } \draw_path_use_clear:n { } \group_begin: \draw_transform_rotate:n { 30 } \draw_transform_shift:n { 1cm , 3cm } \hbox_set:Nn \l_tmpa_box { A } \draw_box_use:N \l_tmpa_box % \bool_set_true:N \l_draw_bb_update_bool \group_end: \draw_end: } \ExplSyntaxOff \fbox{% \tikz{% \path (0,0); \node[rotate=30,inner sep=0pt,outer sep=0pt,anchor=south west] at (1,3) {A}; } } \end{document} Which gives: Why their boundbox not from (0,0) rectangle (1,3)? Is their easy way to make their bounding box the same? I have tried \bool_set_true:N \l_draw_bb_update_bool but it doesn't work.
- How can I draw a simple three dimensional coil?by Desiree on September 10, 2025 at 10:46 am
I would like to draw something like this using tikz: So far, I only managed this: using the following code: \documentclass[tikz]{standalone} %\usetikzlibrary{decorations} \usetikzlibrary{decorations.pathmorphing} \begin{document} \begin{tikzpicture} \draw[thick,decoration={aspect=0.3, segment length=3mm,amplitude=1cm,coil},decorate] (0,3) -- (0,0.15); \draw[thick] plot[smooth , tension=2] coordinates {(0,3) (-2.5,1.5) (0,0.15)}; \end{tikzpicture} \end{document} Is there a simple way to add the white gaps so that the coil looks three dimensional? Thanks in advance for your help!
- Latex tikzpicture is moved to the rightby David Collins on September 9, 2025 at 8:12 am
The tikz picture is moved to the right relative to the page layout. I want to stop that unintended movement. In the document class article, I've set the paper width and height to be 36in and 24in, respectively. The margins are 0.5in all the way around. The rectangle has dimensions 24.99in and 22.99in. If I set the rectangle dimensions to 25inand 23in, then it spills over into a second page. Separate problem. The rectangle should take up the entire page save for the margins. As seen in the first two images, the rectangle is moved to the right ~1/8th of an inch. How do I stop that so the tikz environment, and consequently the rectangle, is centered on the page? Here's my code for the following images: \documentclass[]{article} \usepackage[showframe]{geometry} \usepackage{tikz} \geometry{paperwidth=36in, paperheight=24in, left=0.5in, right=0.5in, top=0.5in, bottom=0.5in} \begin{document} \begin{tikzpicture}[x=1in,y=1in] \draw[draw=red, fill=orange, opacity=0.5] (0,0) rectangle (34.99,22.99); \end{tikzpicture} \end{document} Upper left corner: Upper right corner: Whole Image:
- Tikzposter class: subcolumn spaceby David Collins on September 9, 2025 at 5:41 am
This is another subcolumn problem in tikzposter. This question addresses a similar issue: Distance between subcolumns with Tikzposter. I use the accepted solution (a work around), but my poster has three subcolumns, and the second subcolumn spacing is still over-sized. This question: Subcolumn horizontal spacing problem with tikzposter presents the same two-subcolumn issue as the first referenced question above, but has no answer; and this question: subcolumns not working correctly in tikzposter concerns a different subcolumn issue. Following the work-around in the first referenced question, when I use subcolspace=-1.0cm the first subcolumn spacing is eliminated as shown in the image below. However the second subcolumn spacing is still oversized (see image below). When I change subcolspace=-1.0cm to subcolspace=-2.0cm, the second subcolumn spacing is reduced to zero but the first has overlap. Is there a known hack or work around to get both subcolumns spacings reduced to zero width? Here's my WME, with references to the appropriate section of the Documentation: \documentclass[a1paper, landscape, margin=10mm, innermargin=5mm, colspace=0mm, subcolspace=-1.0cm]{tikzposter} % See Section 3 %\tikzposterlatexaffectionproofoff \settitle{ \centering \vbox{\centering \color{titlefgcolor} {\bfseries \Huge \sc \@title \par} \vspace*{1em} {\huge \@author \par} \vspace*{1em} {\Large \@institute} }} %\titlegraphic{Logo} \title{The Title} \author{The Author} \institute{The Instiute} % See Section 4.1 \usetheme{Autumn} % See Section 5 \begin{document} \maketitle % See Section 4.1 \begin{columns} % See Section 4.4 \column{0.25} % See Section 4.4 \block{BLOCK A}{Some block text} \column{0.5} \block{BLOCK B}{Some more text} \begin{subcolumns} \subcolumn{0.25} \block[bodyinnersep=5mm, titlecenter]{\large{BLOCK B.1}}{Left side of image} \subcolumn{0.50} \block[]{}{Text in place of figure \\ no title in this block} \subcolumn{0.25} \block[bodyinnersep=5mm, titlecenter]{\large{BLOCK B.3}}{right side of image} \end{subcolumns} % See Section 4.2 \column{0.25} \block{BLOCK C}{Even more text} %\note{Notetext} % See Section 4.3 \end{columns} \end{document} and my result:
- How do I change the text size in this timetable template?by TRiG on September 8, 2025 at 6:00 pm
I’m using the sample timetable layout by Laurent Dutriaux on TeXample.net. Right at the top, the text is set to 11pt, but this does not appear to have any effect on the size of the text actually output. I can see nowhere to change the text size. Some of the fields in my timetable (e.g., “Programming”) overlap the bounds of their box and look ugly. I cannot find a way to fix this. Could you help? %!TEX encoding = UTF-8 Unicode % Based on a template by Laurent Dutriaux at https://texample.net/timetable/ \documentclass[a4paper,11pt]{article} \usepackage[utf8]{inputenc} \usepackage{fourier} % Utilisation des polices texte \usepackage{tikz} \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{5pt}% \usetikzlibrary[positioning] \usetikzlibrary{patterns} % \usepackage[french]{babel} % styles français \title{A simple Timetable} \author{Laurent Dutriaux} \date{\today} \newcommand{\daywidth}{2.2 cm} \begin{document} \maketitle \begin{tikzpicture}[x=\daywidth, y=-1cm, node distance=0 cm,outer sep = 0pt] % Style for Days \tikzstyle{day}=[draw, rectangle, minimum height=1cm, minimum width=\daywidth, fill=yellow!20,anchor=south west] % Style for hours \tikzstyle{hour}=[draw, rectangle, minimum height=1 cm, minimum width=1.5 cm, fill=yellow!30,anchor=north east] % Styles for events % Duration of sequences \tikzstyle{hours}=[rectangle,draw, minimum width=\daywidth, anchor=north west,text centered,text width=5 em] \tikzstyle{1hour}=[hours,minimum height=1cm] \tikzstyle{2hours}=[hours,minimum height=2cm] \tikzstyle{3hours}=[hours,minimum height=3cm] %Style for type of sequence \tikzstyle{C1h}=[1hour,fill=red!20] \tikzstyle{C2h}=[2hours,fill=red!20] \tikzstyle{Math3h}=[3hours,fill=blue!20] \tikzstyle{P1h}=[1hour,fill=green!10] \tikzstyle{P2h}=[2hours,fill=green!10] \tikzstyle{PE3h}=[3hours, pattern=north west lines, pattern color=magenta!60!white] \tikzstyle{Sk1h}=[1hour, pattern=north east lines, pattern color=magenta] \tikzstyle{Sk2h}=[2hours, pattern=north east lines, pattern color=magenta] \tikzstyle{Planche}=[1hour,fill=white] % Positioning labels for days and hours \node[day] (lundi) at (1,9) {Monday}; \node[day] (mardi) [right = of lundi] {Tuesday}; \node[day] (mercredi) [right = of mardi] {Wednesday}; \node[day] (jeudi) [right = of mercredi] {Thursday}; \node[day] (vendredi) [right = of jeudi] {Friday}; \node[hour] (9-10) at (1,9) {09-10}; \node[hour] (10-11) [below= of 9-10] {10-11}; \node[hour] (11-12) [below = of 10-11] {11-12}; \node[hour] (12-13) [below = of 11-12] {12-13}; \node[hour] (13-14) [below = of 12-13] {13-14}; \node[hour] (14-15) [below = of 13-14] {14-15}; \node[hour] (15-16) [below = of 14-15] {15-16}; %Position of sequences \node[C2h] at (1,9) {Computer Hardware}; \node[Math3h] at (1,12.75) {Maths for IT}; \node[C1h] at (1,11.25) {Computer Hardware}; \node[C2h] at (2,9) {Operating Systems}; \node[C2h] at (2,11.25) {Operating Systems}; \node[C2h] at (2,13.75) {Operating Systems}; \node[C2h] at (3,9) {Computer Hardware}; \node[C1h] at (3,11.25) {Computer Hardware}; \node[Math3h] at (3,12.75) {Maths}; \node[P2h] at (4,9) {Programming}; \node[P1h] at (4,11.25) {Programming}; \node[PE3h] at (4,12.75) {Personal Effectiveness}; \node[Sk2h] at (5,9) {Skills \& Guidance}; \node[Sk1h] at (5,11.25) {Skills \& Guidance}; \end{tikzpicture} \end{document}
- How come when I use multiple fills with fill opacities which sum to more than 1, it is still the case than I can see things drawn behind them?by Jasper on September 6, 2025 at 8:54 pm
How come when I use multiple fills with fill opacities which sum to more than 1, it is still the case than I can see things drawn behind them? What does fill opacity actually do? \documentclass[tikz,border = 1cm]{standalone} \begin{document} \begin{tikzpicture} \fill (0,0) rectangle (1,1); \fill[opacity=0.6,white] (0,0) rectangle (1,1); \fill[opacity=0.6,white] (0,0) rectangle (1,1); \end{tikzpicture} \end{document}
- Draw an n-pointed regular star with overlapping armsby Andyc on September 6, 2025 at 3:49 pm
I'm trying to draw a {n,m} star. I would like to have the star consisting of two concentric stars and hide some of the overlapping parts of the arms. For a five-pointed star, something like There may be easier ways to do this, like with clip or by redrawing the visible part after having drawn the whole thing, but I don't think any of these methods get around the problem of finding the intersections of the arms with each other. So far I have gotten the intersections of outer-outer and inner-inner arms working, but I'm having trouble with the outer-inner intersections. This code \documentclass[margin=3pt]{standalone} \usepackage{tikz} \usetikzlibrary{intersections, calc} \begin{document} \begin{tikzpicture} \def\radiuse{10} % Outer radius \def\radiusep{0.9} % Ratio to inner radius \def\zacken{7} % Number of points \def\jump{3} % Point to skip to % Draw the pointed star \foreach \x in {0,...,\numexpr\zacken-1\relax}{ \draw[name path global/.expanded=outer\x] ({90 + 360/\zacken*\x}:{\radiuse}) -- ({90 + 360/\zacken*(\x+\jump)}:{\radiuse}); \draw[name path global/.expanded=inner\x] ({90 + 360/\zacken*\x}:{\radiuse*\radiusep}) -- ({90 + 360/\zacken*(\x+\jump)}:{\radiuse*\radiusep}); } % Find the intersections of the outer and inner arms \foreach \i in {0,1,...,\numexpr\zacken-2\relax}{ \pgfmathsetmacro{\init}{int(\i+1)} \foreach \j in {\init,...,\numexpr\zacken-1\relax}{ \path[name intersections={of={outer\i} and {outer\j}, name=OO, total=\nOO}]; \coordinate (O\i\j) at (OO-1); \path[name intersections={of={inner\i} and {inner\j}, name=II, total=\nII}]; \coordinate (I\i\j) at (II-1); } } % --------------- Until here it was easy ------------------ % --------------- Now comes the tricky part --------------- \foreach \i in {0,1,...,\numexpr\zacken-1\relax}{ \foreach \j in {0,1,...,\numexpr\zacken-1\relax}{ \ifnum\i=\j % Do nothing: parallel arms will not intersect \else \path[name intersections={of={outer\i} and {inner\j}, name=OI, total=\nOI}]; \ifnum\nOI>0 \coordinate (OI\i\j) at (OI-1); \node at (OI\i\j) {OI\i\j}; \fi \fi } } \end{tikzpicture} \end{document} gives me the following error message: ! Undefined control sequence. \pgffor@body ...me=OI, total=\nOI }]; \ifnum \nOI >0 \coordinate (OI\i \j ) ... l.47 ^^I^^I} The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined. ! Missing number, treated as zero. <to be read again> > l.47 ^^I^^I} A number should have been here; I inserted `0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.) Repeated several times (from line 418 to lie 1256 of the log file), but all identical. I tried to define \nOI outside of the last two \foreach loops with \newcount\nOI \nOI=0 Then I don't get that error anymore, but I don't get any coordinate whatsoever: nothing gets written by the \node at (OI\i\j) {OI\i\j}; statement. Why is that? If anyone can come up with a better/easier way to achieve what I'm trying to do, maybe even with lua or any other method, that would be fine too.
- Misalign fill with color TikZ matrix node with textby Kazh on September 6, 2025 at 6:11 am
When I fill a TikZ matrix node that contains text in typewriter font, the color goes beyond the rectangle drawn. Writing anchor=center inside nodes does align the color inside the rectangle, but the text is no longer at the base. Is it possible to fill the nodes and keep the text at base level line? MWE: \documentclass{beamer} \usetheme{Warsaw} \usepackage{tikz} \usetikzlibrary{matrix} \usetikzlibrary{calc} \usetikzlibrary{arrows} \usetikzlibrary{positioning} \usetikzlibrary{backgrounds} \usetikzlibrary{fit} \begin{document} \begin{figure} \begin{tikzpicture} [nodes in empty cells, nodes={minimum width=0.8cm, minimum height=0.5cm, inner sep=0pt}, row sep=-\pgflinewidth, column sep=-\pgflinewidth, % inner sep=0pt, outer sep=0pt, ampersand replacement=\&] \matrix(m1)[matrix of nodes] { \& \& \texttt{a} \& \texttt{b} \& \texttt{c} \& \texttt{d} \& \texttt{e} \\ }; \node (t) [left=2mm of m1-1-1] {\(t\)}; \draw (m1-1-1.west|-m1-1-1.north) rectangle (m1-1-7.south-|m1-1-7.east); \matrix(m2) [matrix of nodes, below=5mm of m1-1-3, anchor=center, matrix anchor=inip.center, ] { |(inip)| \& \texttt{a} \& \texttt{b} \\ }; \draw (inip.west|-inip.north) rectangle (m2-1-3.south-|m2-1-3.east); \node [left=2mm of inip] {\(m\)}; \begin{scope}[on background layer] \fill[fill=green!30] (m1-1-3.north east) rectangle (m1-1-3.south west); \fill[fill=green!30] (m1-1-4.north east) rectangle (m1-1-4.south west); \fill[fill=green!30] (m1-1-5.north east) rectangle (m1-1-5.south west); \fill[fill=green!30] (m1-1-6.north east) rectangle (m1-1-6.south west); \fill[fill=green!30] (m1-1-7.north east) rectangle (m1-1-7.south west); \fill[fill=green!30] (inip.north east) rectangle (inip.south west); \fill[fill=green!30] (m2-1-2.north east) rectangle (m2-1-2.south west); \fill[fill=green!30] (m2-1-3.north east) rectangle (m2-1-3.south west); \end{scope} \end{tikzpicture} \end{figure} \end{document}
- TikZ plot with `let` and `domain=\x1:\y1` for a curveby sergiokapone on September 5, 2025 at 6:35 pm
I'm trying to draw a parabola ( y = t^2 ) in TikZ using the let operation to extract coordinates from a point (B) and use them to define the domain for a plot. However, the following code does not draw count domains correct: \documentclass[tikz, border=1cm]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \coordinate (B) at (-3, 3); \draw[variable=\t] let \p1=(B) in plot[domain=\x1:\y1] (\t, {\t*\t}); \end{tikzpicture} \end{document} I expect this code to draw the parabola ( y = t^2 ) in a range defined by the x- and y-coordinates of point (B) (\x1=-3, \y1=3). However, no curve is drawn. How do I properly convert dimensional units to dimensionless units so that the point coordinate matches its value for domain? Of course, this is a toy example, but in a real problem I need to take the bounds from the coordinates of the points. Any insights or alternative solutions would be greatly appreciated!
- SetChild{} in Tblrtikzby Ryan Kong on September 4, 2025 at 3:46 pm
My goal is to recreate the following table (focus on the red part): Below is my MWE: \documentclass{article} \usepackage{tabularray} \UseTblrLibrary{tikz} \begin{tblrtikzbelow} \draw[red] (3-2.east) -- (3-3.center); \draw[red] (3-3.center) -- (5-3.center); \draw[red] (5-2.east) -- (5-3.center); \end{tblrtikzbelow} \begin{document} \begin{tblr} { width=\textwidth, colspec={X[c]X[c]|X[c]}, } \hline Solution & Scores & \SetCell{l}\quad Comment \\ \hline $a^2$ &&\\ $=b^2+c^2$ & 1 point &\\ $=2^2+3^2$ && \qquad\quad \color{red}{Good!}\\ $=x^2+y^2$ && \end{tblr} \end{document} I am currently facing two problems: The red lines should be dynamic, instead of manually typing cell indices like (3-2). I tried to use \SetChild{id*=Start} and \SetChild{id*=End} and attempted the following: \begin{tblrtikzbelow} \draw[red] (Start.east) -- (End.center); \end{tblrtikzbelow} It doesn't work. I have no idea how to use \node in tblrtikzbelow. I tried something like \node[red] (2-3.center); but it also doesn't work. I would like it to be positioned at the middle right of the red vertical line. The documentation about this part has too little examples so I have a difficult time understanding tikz in tabularray. I would be very grateful if anyone could help me on this.
- How to draw thousands of icons in a Tikz picture?. When you try drawing only 50 icons, the error is ! Dimension too largeby Mika Ike on September 3, 2025 at 6:07 am
The target is drawing 123000 over a pie chart (don´t worry about people over people). But the problem is that with only 50 people is obtained the error: ! Dimension too large. The 'mwe' runs well drawing 45 people (\newcommand{\imax}{45}), but fails when you type 50 or more instead. \documentclass[10pt,a5]{article} \usepackage[utf8]{inputenc} \usepackage[spanish]{babel} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{fontawesome7} \begin{document} \begin{tikzpicture} \newcommand{\PieRadius}{6} \newcommand{\imax}{45} % The target is drawing 123000 people over a pie. No worry about people over people. \foreach \i in {1,2,...,\imax}{ \draw (\i*360/\imax:\PieRadius) node{\faPerson}; %\draw (1,1) node{\faPerson}; % With this line the error occurs swhen you draw 50000 people. The error is ! TeX capacity exceeded, sorry [main memory size=5000000]. } \end{tikzpicture} \end{document} How can I draw 123000 people using TikZ?. End of the question. Note 1.- I think that TikZ may be not the ideal tool for the graphic, but nowadays I´m not using any kind of language program, so I try using TikZ. Note 2.- I tried changing main_memory.hugetex = ... in texmf.cnf as any other posts suggested. Curiosity (It´s not the question, it´s the final target in another phase).- The origin of this is the sensation of a not accurate of a graph when I read a few days ago: enter link description here What I finally will try, after solve the problem of ddrawing thounsands os people, is sketched on th next image
- Stereographic projection in latexby Octavius on August 1, 2025 at 3:02 pm
I wanted to generate the following graph: I want to modify the following latex code to obtain my graph \documentclass[tikz,border=10pt]{standalone} \usepackage{tikz} \usepackage{amsmath} \usepackage{tikz-3dplot} \usetikzlibrary{3d, calc} \begin{document} % Ángulo de visualización \tdplotsetmaincoords{60}{120} \begin{tikzpicture}[tdplot_main_coords, scale=3] % Nuevo radio reducido de la esfera \def\radius{0.6} % Ejes coordenados \draw[->, thick] (0,0,0) -- (1.2,0,0); % eje x sin etiqueta \draw[->, thick] (0,0,0) -- (0,0,1.2) node[anchor=south west] {\textcolor{magenta}{$\mathbb{R}^{m+1}$}}; \draw[->, thick] (0,0,0) -- (-0.7,-0.7,0); % eje y negativo para efecto 3D % Plano R^m \fill[cyan!20, opacity=0.3] (-1,-1,0) -- (1,-1,0) -- (1,1,0) -- (-1,1,0) -- cycle; \node at (0.9,-1,0.03) {\textcolor{magenta}{$\mathbb{R}^m$}}; % nueva posición en la esquina izquierda % Esfera más pequeña \shade[ball color=orange!60, opacity=0.8] (0,0,0) circle (\radius); % Líneas de latitud y longitud (esfera decorativa) \foreach \theta in {15,30,...,165} \draw[opacity=0.2] plot[domain=0:360] ({\radius*sin(\theta)*cos(\x)}, {\radius*sin(\theta)*sin(\x)}, {\radius*cos(\theta)}); \foreach \phi in {0,30,...,150} \draw[opacity=0.2] plot[domain=0:180] ({\radius*sin(\x)*cos(\phi)}, {\radius*sin(\x)*sin(\phi)}, {\radius*cos(\x)}); % Punto x sobre la esfera más pequeña \coordinate (x) at (0.3, 0.2, 0.4); \filldraw[blue] (x) circle (0.5pt) node[anchor=west] {\small $x$}; % Punto P (fuera del centro) \coordinate (P) at (-1.3, 0, 0); \filldraw[black] (P) circle (0.5pt) node[anchor=east] {\small $P$}; \draw[dashed] (P) -- (x); % Punto φ(x) \path (x) -- (P) coordinate[pos=1.8] (fx); \filldraw[red] (fx) circle (0.5pt) node[anchor=south] {\small $\varphi(x)$}; \draw[dashed, thick, red!70!black] (x) -- (fx); % Centro \filldraw[black] (0,0,0) circle (0.4pt); \end{tikzpicture} \end{document} I get the following graph: but I want it to be like mine, I hope for some suggestion. Thanks
- draw small spheres on cube vertices in 3D using tikzby user22744 on December 10, 2024 at 1:20 pm
I am trying to draw a cube with spheres on 4 vertices in perspective (I'll have then to insert a gray transparent plane but that seems doable). I am dealing with the first sphere... for which I tried to use a \fill[ball] command, but this flatten the circle as it is not a real 3D ball but rather a 2D circle... would anyone have suggestions on how to plot spheres on 4 corners ? (I try to produce a tetrahedral symmetry for more details so I'll also have a sphere in the center of the cube). Here is a MWE: \documentclass[tikz]{standalone} \usetikzlibrary{perspective} \begin{document} \begin{tikzpicture}[3d view,scale=2] \draw (0,0,0)--(1,0,0); \draw (0,1,0)--(0,0,0); \draw[dashed] (1,0,0)--(1,1,0); \draw[dashed] (1,1,0)--(0,1,0); \draw[dashed] (1,1,0)--(1,1,1); \draw (0,0,1)--(1,0,1)--(1,1,1)--(0,1,1)--cycle; \draw (0,0,0)--(0,0,1); \draw (1,0,0)--(1,0,1); \draw (0,1,0)--(0,1,1); \fill[ball color=blue!20,opacity=1.7] (0,0,1) circle (0.05) node[above] {a}; \end{tikzpicture} \end{document} and what it produces: Have a good day ! Marc
- Why does this MWE not compile (heatmap with contour lines)?by Sim Son on August 22, 2023 at 2:08 pm
I'm trying to plot some 3D data which is saved in a csv file. Plotting just the color map works fine, but I also need to add the contour lines, so I get a result similar to this: My intuition was that it's possible to simply add another \addplot3[...] table {...} block to my existing plot like this: \begin{tikzpicture} \begin{axis}[...] \addplot3[surf] table {data.csv}; % <- this is my existing plot, which works \addplot3[...] table {data.csv}; % <- this should be okay?! \end{axis} \end{tikzpicture} This question seems to be about the exact same issue, so I tried to adapt the answer into my document, but to no avail. In the end I found that even this minimal example doesn't compile for me (which is the accepted answer from the mentioned question): \documentclass[border=1 cm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{filecontents}{data_test.dat} 0 0 3 0 2 1 0 3 2 1 0 1 1 2 2 1 3 2 2 0 1 2 2 2 2 3 1 \end{filecontents} \begin{document} \begin{tikzpicture} \begin{axis}%[view={0}{90}] \addplot3[surf] table {data_test.dat}; \addplot3[contour lua={levels={1,2,3}}] table {data_test.dat}; \end{axis} \end{tikzpicture} \end{document} When I try to compile this in my TeXworks installation with the LuaLaTeX engine (using the option --shell-escape) I get the following error : ! Package pgfkeys Error: I do not know the key '/tikz/contour lua', to which you passed 'levels={1,2,3}', and I am going to ignore it. Perhaps you misspelled it. This error message looks quite similar to the kind of errors I had with my original document, but why do I get it even in this MWE? Since the OP of the mentioned question has the exact same requirements as I do, I'm confident that my problem is solved once I'm able to compile the MWE above. Thanks for spending your time! Edit: I just checked for updates in the MiKTeX Console and updated all suggested packages - nothing changed. I also included \listfiles at the top of my document, which returned: *File List* standalone.cls 2018/03/26 v1.3a Class to compile TeX sub-files standalone shellesc.sty 2019/11/08 v1.0c unified shell escape interface for LaTeX ifluatex.sty 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead. iftex.sty 2020/03/06 v1.0d TeX engine tests xkeyval.sty 2020/11/20 v2.8 package option processing (HA) xkeyval.tex 2014/12/03 v2.7a key=value parser (HA) standalone.cfg 2018/03/26 v1.3a Default configuration file for 'standalone' class article.cls 2020/04/10 v1.4m Standard LaTeX document class size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option) luatex85.sty 2016/06/15 v1.4 pdftex aliases for luatex pdftexcmds.sty 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO) infwarerr.sty 2019/12/03 v1.5 Providing info/warning/error messages (HO) ltxcmds.sty 2020-05-10 v1.25 LaTeX kernel commands for general use (HO) pgfplots.sty 2020/02/29 v1.17 Data Visualization (1.17) graphicx.sty 2020/09/09 v1.2b Enhanced LaTeX Graphics (DPC,SPQR) graphics.sty 2020/08/30 v1.4c Standard LaTeX Graphics (DPC,SPQR) trig.sty 2016/01/03 v1.10 sin cos tan (DPC) graphics.cfg 2016/06/04 v1.11 sample graphics configuration luatex.def 2020/10/05 v1.2a Graphics/color driver for luatex tikz.sty 2020/12/01 v3.1.7a (3.1.7a) pgf.sty 2020/12/01 v3.1.7a (3.1.7a) pgfrcs.sty 2020/12/01 v3.1.7a (3.1.7a) pgfrcs.code.tex pgfcore.sty 2020/12/01 v3.1.7a (3.1.7a) pgfsys.sty 2020/12/01 v3.1.7a (3.1.7a) pgfsys.code.tex pgfsyssoftpath.code.tex 2020/12/01 v3.1.7a (3.1.7a) pgfsysprotocol.code.tex 2020/12/01 v3.1.7a (3.1.7a) xcolor.sty 2016/05/11 v2.12 LaTeX color extensions (UK) color.cfg 2016/01/02 v1.6 sample color configuration pgfcore.code.tex pgfcomp-version-0-65.sty 2020/12/01 v3.1.7a (3.1.7a) pgfcomp-version-1-18.sty 2020/12/01 v3.1.7a (3.1.7a) pgffor.sty 2020/12/01 v3.1.7a (3.1.7a) pgfkeys.sty pgfkeys.code.tex pgfmath.sty pgfmath.code.tex pgffor.code.tex tikz.code.tex l3backend-luatex.def 2020-09-24 L3 backend support: PDF output (LuaTeX) ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions supp-pdf.mkii epstopdf-base.sty 2020-01-24 v2.11 Base part for package epstopdf epstopdf-sys.cfg 2021/03/18 v2.0 Configuration of epstopdf for MiKTeX ***********
- How to draw cube chain?by gkndy on May 14, 2022 at 11:36 am
I'm trying to find the easiest way to draw a 3D cube chain in latex. Help me I know how to draw cube in tikz. For example \newcommand{\tikzcuboid}[4]{% width, height, depth, scale \begin{tikzpicture}[scale=#4] \foreach \x in {0,...,#1} { \draw (\x ,0 ,#3 ) -- (\x ,#2 ,#3 ); \draw (\x ,#2 ,#3 ) -- (\x ,#2 ,0 ); } \foreach \x in {0,...,#2} { \draw (#1 ,\x ,#3 ) -- (#1 ,\x ,0 ); \draw (0 ,\x ,#3 ) -- (#1 ,\x ,#3 ); } \foreach \x in {0,...,#3} { \draw (#1 ,0 ,\x ) -- (#1 ,#2 ,\x ); \draw (0 ,#2 ,\x ) -- (#1 ,#2 ,\x ); } \end{tikzpicture} } \newcommand{\tikzcube}[2]{% length, scale \tikzcuboid{#1}{#1}{#1}{#2} } I find this code in Need help creating a 3D cube from a 2D set of nodes in TikZ
- Fit text in a circular shapeby Diana on October 16, 2021 at 6:15 am
I'm trying to fit a text within the arrows but in a circular shape, however, the text doesn't bend nicely. \documentclass[border=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{arrows} \begin{document} \begin{tikzpicture}[paths/.style={->, thick, >=stealth'}] \node (species_1) at (-3,0.5) {}; \node (species_2) at (0,0) {}; \node (species_3) at (2,-2) {}; \node (species_4) at (0,-4) {}; \node (species_5) at (-2,-2) {}; \node (species_6) at (-3,-4) {}; \draw[-triangle 90 cap, very thick,double, double distance=9pt] (species_2) to [bend left=40] node[black, sloped,bend left=40]{Develop} (species_3); \draw[-triangle 90 cap, very thick,double, double distance=9pt] (species_3) to [bend left=40] node[black, sloped] {Design} (species_4); \draw[-triangle 90 cap, very thick,double, double distance=9pt] (species_4) to [bend left=40] node[black, sloped] {Plan} (species_5); \draw[-triangle 90 cap, very thick,double, double distance=9pt] (species_5) to [bend left=40] node[black, sloped] {Deploy} (species_2); \draw[-triangle 90 cap, very thick,double, double distance=9pt] (species_6) to node[black, sloped] {Plan}(species_4); \end{tikzpicture} \end{document} Update, I managed to use the code in the link provided, now how can I use the same code to have the same drawing aligned vertically? Code: \documentclass[border=5pt]{standalone} \usepackage{xcolor} \definecolor{ocre}{HTML}{800000} \definecolor{sky}{HTML}{C6D9F1} \definecolor{skybox}{HTML}{5F86B3} \usepackage{tikz} \usepackage{pgfmath} \usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings} % arctext from Andrew code with modifications: %Variables: 1: ID, 2:Style 3:box height 4: Radious 5:start-angl 6:end-angl 7:text {format along path} \def\arctext[#1][#2][#3](#4)(#5)(#6)#7{ \draw[#2] (#5:#4cm+#3) coordinate (above #1) arc (#5:#6:#4cm+#3) -- (#6:#4) coordinate (right #1) -- (#6:#4cm-#3) coordinate (below right #1) arc (#6:#5:#4cm-#3) coordinate (below #1) -- (#5:#4) coordinate (left #1) -- cycle; \def\a#1{#4cm+#3} \def\b#1{#4cm-#3} \path[ decoration={ raise = -0.5ex, % Controls relavite text height position. text along path, text = {#7}, text align = center, }, decorate ] (#5:#4) arc (#5:#6:#4); } %arcarrow, this is mine, for beerware purpose... %Function: Draw an arrow from arctex coordinate specific nodes to another %Arrow start at the start of arctext box and could be shifted to change the position %to avoid go over another box. %Var: 1:Start coordinate 2:End coordinate 3:angle to shift from acrtext box \def\arcarrow(#1)(#2)[#3]{ \draw[thick,->,>=latex] let \p1 = (#1), \p2 = (#2), % To access cartesian coordinates x, and y. \n1 = {veclen(\x1,\y1)}, % Distance from the origin \n2 = {veclen(\x2,\y2)}, % Distance from the origin \n3 = {atan2(\y1,\x1)} % Angle where acrtext starts. in (\n3-#3: \n1) -- (\n3-#3: \n2); % Draw the arrow. } \begin{document} \begin{tikzpicture}[ % Environment Cfg font=\sf \scriptsize, % Styles myarrow/.style={ thick, -latex, }, Center/.style ={ circle, fill=ocre, text=white, align=center, font =\footnotesize\bf, inner sep=1pt, }, RedArc/.style ={ color=black, thick, fill=ocre, blur shadow, %Tikzedt not suport online view }, SkyArc/.style ={ color=skybox, thick, fill=sky, blur shadow, %Tikzedt not suport online view }, ] % Drawing the center \node[Center](SOSA) at (0,0) {Team 1\\ Blog}; \coordinate (SOSA-R) at (0:1.2); % To make compatible with \arcarrow macro. % Drawing the Tex Arcs % \Arctext[ID][box-style][box-height](radious)(start-angl)(end-angl){|text-styles| Text} \arctext[SSN][SkyArc][8pt](1.5)(25)(-20){|\footnotesize\color{black}|Design}; \arctext[SCap][SkyArc][8pt](1.5)(75)(27){|\footnotesize\color{black}| Develop}; \arctext[SRel][SkyArc][8pt](1.5)(107)(77){|\footnotesize\color{black}| Test}; \arctext[SRel][SkyArc][8pt](1.5)(152)(109){|\footnotesize\color{black}|Deploy}; \arctext[SRel][SkyArc][8pt](1.5)(200)(154){|\footnotesize\color{black}|Review}; \draw[-stealth, ultra thick](-2,-1)to node[below, midway]{Sprint 1}++(4,0); %Drawing the Arrows %\arcarrow(above/below ID)(abobe/below ID)[shift] % %Same level Arrows % \draw[myarrow] (left SSNX) -- (right DUAM); % \draw[myarrow] (left SSN) -- (left SRel); % \draw[myarrow] (left SCap) -- (right SSN); \end{tikzpicture} \end{document}
- Creating an rectangular arrangement of filled circles using different colorsby BMBM on May 5, 2020 at 8:09 am
For a visualization I have in mind I'd like to create an rectangular arrangement of filled circles using different colors. For example, something like this: + + + + + + + * + + * * + * * * * * * * Where the + would be blue circles and the * would be red circles. I created a somewhat functional version of this adapted from some other question: \documentclass[border=5pt,tikz,multi]{standalone} \usetikzlibrary{fit,positioning} \begin{document} \begin{tikzpicture}[ultra thick] \coordinate (c0) at (0,0); \foreach \i [count=\j, evaluate=\j as \k using \j-1, evaluate=\j as \n using { \j>0 ? "blue" : "red" }] in {1,...,3} \node (c\j) [right=5 pt of c\k |- c0, circle, anchor=north west, minimum size=1mm, draw, fill=\n, \n] {}; \coordinate (c0) at (0,1); \foreach \i [count=\j, evaluate=\j as \k using \j-1, evaluate=\j as \n using { \j>1 ? "blue" : "red" }] in {1,...,3} \node (c\j) [right=5pt of c\k |- c0, circle, anchor=north west, minimum size=1mm, draw, fill=\n, \n] {}; \coordinate (c0) at (0,2); \foreach \i [count=\j, evaluate=\j as \k using \j-1, evaluate=\j as \n using { \j>2 ? "blue" : "red" }] in {1,...,3} \node (c\j) [right=5pt of c\k |- c0, circle, anchor=north west, minimum size=1mm, draw, fill=\n, \n] {}; \end{tikzpicture} \end{document} Which renders like this: I have a few problems with that: I can't find a way to make the vertical and horizontal margins between the circles equal. Meaning all margins inside the arrangement of circles should be equal. In the above image, the circles are too large, the vertical distances are too much and the horizontal margins are too small. It requires quite a bit of code, I wonder if there is a more convenient way to tell which circles should have which color.
- How to draw a diagram of PCR cycle? [closed]by Chang Ye on May 7, 2018 at 5:45 pm
I want to draw a diagram as the image below, but it is difficult for me to start. The height of vertical line represent the temperature, and the slop of slash is fix. Number above the vertical line is the temperature, and number below it is the time. It is possible to wrap the drawing into a single function like this? \drawPCR{[95.0,11:00]}{[94.0,1:00],[59.0,1:00],[72.0,1:00]}{[60.0,45:00],[4.0,∞]}
- non-square picture dimensions for a LaTeXiT circleby user1337 on October 17, 2017 at 10:46 am
Running the following in LaTeXiT preamble: \documentclass[10pt]{article} \usepackage[usenames]{color} %used for font color \usepackage{amssymb} %maths \usepackage{amsmath} %maths \usepackage[utf8]{inputenc} %useful to type directly diacritic characters \usepackage{tikz} body \begin{tikzpicture} \draw (1.5,1.5) circle [radius=1.5]; \end{tikzpicture} produced the following picture When I right-clicked on it, and chose "Get Info" it says that it has dimensions 618 × 620. My questions are: how come such a symmetric shape resulted in uneven dimensions? Is there a way to predict the image dimensions from the TikZ parameters (e.g. radius)? Is there a natural way to get a circle with equal dimensions in TikZ? Thanks.
- Graph Theory: improving custom arc / edge notation?by SumNeuron on February 6, 2017 at 9:25 am
Context I personally am a fan of the Wolfram Language, especially for its symbolic notation. The Wolfram Language uses the following symbols for arcs and edges respectively: Suppose I wish to type some Mathematica pseudo-code and use these conventions rather than their "full form" (\[DirectedEdge] and \[UndirectedEdge]). Then I can, somewhat, recreate these icons using tikz: \newcommand{\ue}[1]{% \begin{tikzpicture}[#1]% \draw[fill = black] (.25ex,.25ex) circle (.3ex); \draw[thick] (.55ex,.25ex) -- (1.55ex,.25ex);% \draw[fill = black] (1.85ex, .25ex) circle (.3ex);% \end{tikzpicture}% } \newcommand{\de}[1]{% \begin{tikzpicture}[#1]% \draw[fill = black] (.25ex,.25ex) circle (.3ex); \draw[thick, ->] (.55ex,.25ex) -- (1.85ex,.25ex);% \end{tikzpicture}% } Where ue and de stand for undirected / directed edge respectively. While I would prefer to use edge and arc, arc is already taken in the namespace. To be fair, using these symbols doesn't look like the worst thing ever seen when typeset: \noindent\textbf{Adjacency}: if there exists an edge $e \in \mathbf{E}$, for $v_i, v_j \in \mathbf{V}$ such that $e$ is defined by $v_i$~\ue{}~$v_j$ (equivocally $v_j$ \ue{} $v_i$), then $v_i$ \& $v_j$ are said to be adjacent. Personally, I am in favor of these symbols rather than the explicit stating of an (un)ordered set of two vertices, and walks look ok-ish as well: Question While these tikz drawings work in the given cases, I have noticed that in caption environments the symbols is no longer centered with the text. Further, spacing can be an issue. How can the following be achieved? automatic binding (the preceding and succeeding character elements must be in the same line). automatic centering to the preceding / succeeding character. the ability to work in the math environment. easy scaling. Also, you opinion about using these glyphs in general would be appreciated. Be honest, how ugly are they?
- How to draw parallelepiped and cube with LaTeXby ryuk on January 2, 2016 at 2:41 pm
How can I draw these solid figures with LaTeX? \begin{tikzpicture} \pgfmathsetmacro{\cubex}{5} \pgfmathsetmacro{\cubey}{1} \pgfmathsetmacro{\cubez}{3} \draw[red,fill=yellow] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle; \draw[red,fill=yellow] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle; \draw[red,fill=yellow] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle; \end{tikzpicture} I have used that code. How can I draw and write the quotes and dimensions?
- My version of Red-Black Treeby Selena on September 15, 2014 at 6:35 am
Here's the code I have \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows} \tikzset{ treenode/.style = {align=center, inner sep=0pt, text centered, font=\sffamily}, arn_n/.style = {treenode, circle, white, font=\sffamily\bfseries, draw=black, fill=black, text width=1.5em},% arbre rouge noir, noeud noir arn_r/.style = {treenode, circle, red, draw=red, text width=1.5em, very thick},% arbre rouge noir, noeud rouge arn_x/.style = {treenode, rectangle, draw=black, minimum width=0.5em, minimum height=0.5em}% arbre rouge noir, nil } \begin{document} \begin{tikzpicture}[->,>=stealth',level/.style={sibling distance = 5cm/#1, level distance = 1.5cm}] \node [arn_n] {1} child{ node [arn_r] {2} child{ node [arn_n] {4} child{ node [arn_r] {6}} child{ node [arn_r] {7}} } child{ node [arn_r] {3} edge from parent node[above left] {$x$} } ; \end{tikzpicture} \end{document} I want to write something beside each arrow... I tried using edge from parent node[above left]{$x$} But it messes up the whole thing, probably cause I'm inserting it in the wrong location. Plus, I wanna write something beside each circle.. Is there a way to do that too? Help please!
- Special tree in tikzby mrbela on December 19, 2013 at 11:28 pm
I'm trying to draw a tree like this: The root has three children and every of this two... The nodes in the first two tiers has additional informations.. I searched for examples like that, but could only find trees, which children always have the same amount of children (for example here: http://www.texample.net/tikz/examples/feature/trees/). I thank you for your help!
- 3D helix torus with hidden linesby Jubao on September 4, 2012 at 1:44 pm
How can I generate the above image using TikZ (possibly other methods will work if they produce better looking results)? I would like to have a nicely shaded (not so dark image) without gridlines and possibly enough opacity on the torus to see the hidden part of the helix. The image given is very close to what I want though and I would just try to make it visually a little better.