• How do I use Tikz to create new text characters with serifs?
    by ItsErtHere on February 27, 2026 at 8:59 pm

    I would like to create "half letters" that attach to the left side of letters in a math formula. This would not only allow for the Latin AE character, but also characters like AD, OP, TB, and so on. When using regular Tikz lines, the attachment to the left side of the main letter does not appear to have the same font as the right side. For example, I will merge A and P together: \begin{tikzpicture} \draw[x=1pt,y=1pt,xshift=1.2] (5.3,3.6) node[node font=\itshape] {P}; \draw[x=1pt,y=1pt] (0.3,0) -- (6,7); \draw[x=1pt,y=1pt] (3.1,3.5) -- (6.3,3.5); \draw[x=1pt,y=1pt] (0,0.25) -- (1,0.25); \end{tikzpicture} The result (on Overleaf): The AP merged letter, possibly useful to represent pressure in physics when P is already used for power. We see, when attaching the half-A with the P, the font does not match, and the "serif" that I attached does not match the font. How do I add a serif to the end of the diagonal line on the left half of the character that makes the attachment look like a part of the character? Preferably, I'd like a custom line style to lessen the amount of commands I have to do for each half-letter or a specific command to create a serif to be in line with the math font? Or, in this case, is it easier to just create a font? (I'm doing this for all uppercase Latin and lowercase Greek letters for completeness, so that could become quite tedious). I may also have to consider variable line thickness on the left half of the letters too, as seen on the right-side P. In summary, here are the criteria I'm considering in this project: The general shape of a serif when attached to a line at any angle (strait P versus a diagonal V). The variation of width in some lines, such as the curves on B, D and P. Intersections of lines. Advantages and disadvantages of creating a custom font (.sty), creating a serif shape in Tikz, or creating a custom line style for Tikz. This helps decide what the best option is for this project. The application I'm hoping this is useful for is to allow more characters in formulas for math, physics, and other sciences whose design could hint at what the characters mean. For example, in physics, consider the notation for volume and voltage (both are represented by V). If both volume and voltage are in one calculation, what other symbols can we use to represent either one in order to avoid confusion that still show what those symbols represent? In this case, voltage can be VT, and volume can be VU. (The choice is up to the writer, this is just an example). I plan to write a paper over this topic once I get the attachments created. While this is meant for use in physics, I see this having applications in other areas of science and mathematics as well. Thus, which option would be the best for this project, and how do I get started with it? The TIKZ site is helpful, but I did not find anything that looked immediately useful specifically for creation of Serif fonts. Any help would be appreciated!

  • Creating Boxplot from precomputed value for each line in table
    by skanarr on February 26, 2026 at 4:53 pm

    I am using the box plot prepared method from here: Read boxplot prepared values from a table. My problem is the following: I have multiple rows in that csv and I want a box plot for each of these rows. How can I loop over all rows and create those? Added bonus: Some of my table columns are shorter than others, some have only enough data for 2 box plots, some have enough data for 10 box plots. % 1: extra for box plot, % 2: Identifier % 3: table, % 4: row \newcommandx{\TimeBoxPlot}[4][1={}]{ \addplot+[#2, #1, fill, boxplot prepared from table={ table=#3, row=#4, lower whisker= #2-time-min, lower quartile= #2-time-1, median= #2-time-med, upper quartile= #2-time-q3, upper whisker= #2-time-max, sample size = #2-sample-size, draw position = edge_count, }, boxplot prepared, ] coordinates {}; } % draw % Identifier % Table \newcommandx{\PlotPoint}[3][1={}]{ \pgfplotstablegetrowsof{#3} \pgfmathtruncatemacro{\numrows}{\pgfplotsretval-1} \pgfplotsinvokeforeach{0,...,\numrows}{ \TimeBoxPlot[#1]{#2}{#3}{##1} } } The identifier Mentioned is just a string-prefix for the columns in question and also a style I defined, so they are colored and drawn correctly. Though every Identifier has unbounded coords=discard set thats about the similarities. The implementation of \PlotPoint does not work. It is the macro that should go through all the lines (at least those with values).

  • I am plotting a family of parabolas in TikZ, and there is a stray parabola. I'm confused
    by Jasper on February 25, 2026 at 7:14 pm

    I am plotting a family of parabolas in TikZ, and there is a stray parabola. I'm confused. \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \pgfmathsetmacro{\SIGMALstart}{-3} \pgfmathsetmacro{\SIGMALstop}{3} \pgfmathsetmacro{\SIGMALsamples}{50} \pgfmathsetmacro{\SIGMALstep}{(\SIGMALstop-\SIGMALstart)/(\SIGMALsamples-1)} \foreach \SIGMAL[parse=true] in {\SIGMALstart,\SIGMALstart+\SIGMALstep,...,\SIGMALstop} { \draw[ variable=\TAUL, domain=-3:3 ] plot ( {\SIGMAL*\TAUL}, {((\TAUL)^2-(\SIGMAL)^2)/2} ); } \end{tikzpicture} \end{document}

  • Two 'Missing character: There is no ; (U+003B) in font nullfont!' warnings with pgfplots
    by Apoorv Potnis on February 25, 2026 at 5:13 pm

    I get two Missing character: There is no ; (U+003B) in font nullfont! warnings when I compile the below code with LuaLaTeX. I don't see any line numbers for the warnings in the .log file. I don't see any visual problem with the output though. \documentclass{article} \usepackage[newcmbb]{fontsetup} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{decorations.markings} \usetikzlibrary {arrows.meta,bending} \newcommand{\e}{\symrm{e}} \begin{document} \begin{figure}[h] \centering \begin{tikzpicture}[line cap=round] \begin{axis}[ samples=200, domain=0.24:4.5, xmin=0, xmax=5, ymin=-4.4, ymax=0.5, axis lines=middle, ticks=none, width=0.5\textwidth, xlabel={$r$}, ylabel={$V(r)$}, x axis line style={thick, -{>[bend]}}, y axis line style={thick, {<[bend]}-{>[bend]}}, y label style={anchor=south}, x label style={anchor=west}, legend style={ draw=none, at={(axis cs:2,-1.8)}, anchor=north west, row sep=10pt } ] \addplot[thick, red] {-exp(-x)/(x)}; \addplot[thick, blue, dashed] {-1/(x)}; \addlegendentry{$\displaystyle\frac{-\e^{-r}}{r}$}; \addlegendentry{$\displaystyle\frac{-1}{r}$}; \end{axis} \end{tikzpicture} \end{figure} \end{document} I saw another question with the same warning but there was a \tikz command in it which was causing issues. There is no \tikz command in my code. And I can't seem to find any stray semi-colons in the TikZ code either.

  • How to write at an angle along a straight line
    by rpapa on February 24, 2026 at 8:33 pm

    Using "sloped" I know how to write text parallel to a line, but how do I make the text also at an angle in the second case? \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning,matrix,calc} \begin{document} \begin{tikzpicture} \draw [red,ultra thick] (0,0)coordinate(A1)-- (3,5)coordinate(A2); \path (A1) -- (A2) node[sloped,pos=0.3,draw,fill=white]{aa}; \draw [blue,ultra thick] (1,0)coordinate(A3)-- (4,5)coordinate(A4); \foreach \i in {1,...,5} \node [sloped,draw,fill=white] at ($(A3)!{\i*10mm}!(A4)$) {\i}; \end{tikzpicture} \end{document} To be clear, the nodes must have a set distance between them. I am proposing my solution, adapted from your responses. \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning,matrix,calc} \begin{document} \begin{tikzpicture} \draw [red,ultra thick] (0,0)coordinate(A1)-- (3,5)coordinate(A2); \path (A1) -- (A2) node[sloped,pos=0.3,draw,fill=white]{aa}; \draw [blue,ultra thick] (1,0)coordinate(A3)-- (4,5)coordinate(A4); \foreach \i in {1,...,5} \node [sloped,draw,fill=white] at ($(A3)!{\i*10mm}!(A4)$) {\i}; \draw [blue,ultra thick] (2,0)coordinate(A3)-- (5,5)coordinate(A4); \pgfmathanglebetweenpoints{\pgfpointanchor{A3}{center}}{\pgfpointanchor{A4}{center}} \edef\angleAB{\pgfmathresult} \foreach \i in {1,...,5} \node [rotate=\angleAB,draw,fill=blue,minimum height=2mm,minimum width=8mm,text=yellow] at ($(A3)!{\i*10mm-10mm}!(A4)$) {\i}; \newcommand{\tracepark}[4]{ \draw (#1) -- (#2); \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}} \edef\angleAB{\pgfmathresult} \foreach \i in {#3,...,#4} \node [rotate=\angleAB,draw,fill=blue,minimum height=2mm,minimum width=8mm,text=yellow] at ($(#1)!{\i*10mm-#3*10mm}!(#2)$) {\i}; } \coordinate(A5) at (-3,4); \coordinate(A6) at (3,-8); \tracepark{A5}{A6}{5}{10} \end{tikzpicture} \end{document}

  • align text in tikz node with minimum width
    by Hyperplane on February 24, 2026 at 1:01 pm

    \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[fill=yellow!80!black,align=right, minimum width=10cm] {This is a\\ demonstration text for\\ alignments.}; \end{tikzpicture} \begin{tikzpicture} \node[fill=yellow!80!black,align=left, minimum width=10cm] {This is a\\ demonstration text for\\ alignments.}; \end{tikzpicture} \end{document} When using align=right and align=left, the text is usually flushed to the right. But when I set a minimum width for the box it appears in the center instead: This feels like a bug in tikz. In Left alignment in TikZ, people suggested setting text width or wrapping the content in a parbox. However, these require knowing the width of the text beforehand, otherwise one gets overfull/underfull box warnings, so I do not consider them real solutions. I would expect the text width to be chosen automatically.

  • how to zoom in on tikz clipped image
    by Matteo on February 24, 2026 at 10:38 am

    I have the following situation: where the first \clip in the second frame is very small and I wish to present it a bit bigger for visibility reasons. I'm unsure how to tweak the code I'm using and if it is possible by simply using tikz + clip. Thanks in advance! MWE \documentclass[aspectratio=149]{beamer} \usepackage[T1]{fontenc} \usetheme{Singapore} \usecolortheme{dolphin} \usepackage{tikz} \usepackage[export]{adjustbox} \begin{document} \begin{frame} \frametitle<2>{Inset 1} \frametitle<3>{Inset 2} \only<1-3>{ \centering\includegraphics<1>[width=.75\textwidth]{example-image-a} \begin{adjustbox}{max width=\textwidth,max height=\textheight} \begin{tikzpicture} \clip<2> (-6,4) rectangle (6,5); \clip<3> (-6,-3.25) rectangle (6,-7.5); \node<2-> at (0,0) {\includegraphics[width=\textwidth]{example-image-a}}; \end{tikzpicture} \end{adjustbox} } \end{frame} \end{document} EDIT: sketch attempt Cropped from the original, the image can be stretch vertically, primarily, and horizontally up to the size of the frame while preventing Overfull hbox warnings. Proportion should be preserved but if not possible a vertical stretch has the priority.

  • How to draw arc segments of circular quiver diagram elegant with tikz?
    by Explorer on February 23, 2026 at 9:23 am

    Claim This post is more likely asking for better approach, focused on the arc's plot. And that is similar to, but I don't find the same one: Drawing cyclic quiver Drawing a circular graph using xypic https://tex.stackexchange.com/a/759710/322482 Descrption I found that just with: \draw[<->,shortstyle,violet] (\ang:\RR cm) arc[radius=\RR cm,start angle=\ang,delta angle=\deltaang]; The arc is not exactly centered at (0,0)(the violet part), thus I learnt from here and calculate the \deltaangg with cosline rule manually. Code \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \begin{document} \def\NN{5} \def\RR{5} \def\rr{0.5} \def\deltaang{\fpeval{360/\NN}} \def\deltaangg{\fpeval{acosd((2*\RR^2-\rr^2)/(2*\RR^2))}} % cosine rule \begin{tikzpicture}[ thick,>=Stealth,shortstyle/.style={shorten >=\rr cm,shorten <=\rr cm}] \foreach \i in {1,...,\NN}{ \def\ang{\fpeval{\deltaang*(\i-1)}} \path[draw,fill=gray!75] (\ang:\RR cm) circle[radius=\rr cm]; \def\startang{\fpeval{\ang+\deltaangg}} \def\endang{\fpeval{\ang+\deltaang-\deltaangg}} %%%%%%%%%%%%%% \draw[<->,shortstyle,violet] (\ang:\RR cm) arc[radius=\RR cm,start angle=\ang,delta angle=\deltaang]; %%%%%%%%%%%%%% % https://tex.stackexchange.com/a/66265/322482 \draw[<->,magenta] ([{shift=(\startang:\RR cm)}]0,0) arc[radius=\RR cm,start angle=\startang,end angle=\endang]; \foreach[parse=true] \j in {2,...,{\NN-2}}{ \def\nextang{\fpeval{\ang+\deltaang*\j}} \draw[shortstyle,<->] (\ang:\RR cm) -- (\nextang:\RR cm); } } \end{tikzpicture} \end{document} Question The magenta arcs is what I want, but I found it too hard to calculate \def\deltaangg{\fpeval{acosd((2*\RR^2-\rr^2)/(2*\RR^2))}}. Any suggestions on the code?

  • Getting memory error with lualatex when trying to make a knock-out masking with indic texts
    by Miloop on February 22, 2026 at 9:21 am

    I am trying to make a small decorative badge / logo for a friend. The plan is the have a background image (of grass and flowers), then a white mask. I want to "punch" a tamil word in there and two decorative rings (might modify that later). This is the work I have done so far: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{fadings, decorations.text} \usepackage{graphicx} \usepackage{ebgaramond} \usepackage{fontspec} \usepackage{polyglossia} \setdefaultlanguage{english} \setotherlanguage{tamil} \newfontfamily\tamilfont[Script=Tamil]{Lohit Tamil} \begin{document} \begin{tikzpicture} % ------------------------------------------------ % 1) Background image % ------------------------------------------------ \node (img) {\includegraphics[width=8cm]{example-image}}; % ------------------------------------------------ % 2) Define knockout mask (TEXT + CIRCLES) % Black = fully transparent % White = fully opaque % ------------------------------------------------ \begin{tikzfadingfrompicture}[name=knockoutmask] % Everything starts white (opaque) \fill[white] (-5,-5) rectangle (5,5); % Knockout shapes are black \begin{scope}[shift={(0,0)}] % Text \node[ text=black, ] {\texttamil{தமிழ்}}; %<- replacing this with normal English font seems to work, say "Test text". % Deco circles \draw[line width=5pt, black] (0,0) circle (0.9cm); \draw[line width=5pt, black] (0,0) circle (1.5cm); \end{scope} \end{tikzfadingfrompicture} % ------------------------------------------------ % 3) White overlay with inverted fading % ------------------------------------------------ \fill[ white, path fading=knockoutmask, fit fading=false ] (img.south west) rectangle (img.north east); \end{tikzpicture} \end{document} Using English-only text, the output looks like this (which is fine, I just want tamil text): Edit: I forgot the add the error message! ! TeX capacity exceeded, sorry [input stack size=10000]. \pgf@selectfontorig ->\pgf@selectfontorig \nullfont l.36 ] {\texttamil{தமிழ்} }; %<- replacing this with normal eng... If you really absolutely need more capacity, you can ask a wizard to enlarge me. Here is how much of LuaTeX's memory you used: 17190 strings out of 476081 100000,953878 words of node,token memory allocated 1552 words of node memory still in use: 31 hlist, 10 rule, 8 dir, 17 glue, 4 kern, 1 glyph, 105 attribute, 52 glue_sp ec, 105 attribute_list, 7 temp, 2 write, 46 pdf_literal, 21 pdf_colorstack, 1 pd f_setmatrix, 1 pdf_save, 1 pdf_restore nodes avail lists: 2:5 39160 multiletter control sequences out of 65536+600000 29 fonts using 4680087 bytes 10000i,7n,109p,428b,875s stack positions out of 10000i,1000n,20000p,200000b,200000s ! ==> Fatal error occurred, no output PDF file produced!

  • What is the best way to draw a potato (like found in vector analysis/continuum mechanics courses)
    by Dimitrios ANAGNOSTOU on February 21, 2026 at 11:34 pm

    I apologized if this is a duplicate. What is the best way to draw such figures with tikz (or other packages)? For the time being just the potato like figure. I do not care for the vectors and the infinitesimal mass element. I do not want someone to do the work for me. Just some advice or suggestions.

  • Latex: Tikz - rectangle to inherit the width of another rectangle
    by GJW on February 21, 2026 at 1:44 pm

    I would like node B to have exactly the same width as node A, without explicitly specifying a fixed dimension, with the following constraints: The two nodes are not adjacent in the source code. I do not want to hard-code a width (e.g., minimum width=3cm). Node A will always be at least as wide as node B. I would prefer a solution that does not rely on manually computing dimensions via \path let unless necessary. Here is a minimal example illustrating what I currently have: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \node [draw] (A) {Some text}; \path let \p1 = (A.south west), \p2 = (A.north east) in node [draw, minimum width=\x2-\x1-\pgflinewidth, minimum height=\y2-\y1-\pgflinewidth, below right] at ([yshift={\pgflinewidth}]A.south west) {more}; \end{tikzpicture} \end{document}

  • Strange intersection glitch of knots package?
    by Explorer on February 21, 2026 at 9:20 am

    This question based on the previous question: % Source - https://tex.stackexchange.com/a/759998 % Posted by Andrew Stacey % Retrieved 2026-02-21, License - CC BY-SA 4.0 \documentclass[tikz, border=1cm]{standalone} \usetikzlibrary{decorations.pathreplacing,knots} %\url{https://tex.stackexchange.com/q/759978/86} \begin{document} \begin{tikzpicture}[ basic strand/.style={ black, double=gray!10, double distance=1pt, line cap=round, thick, }, crossing strand/.style={ line width=2pt, only when rendering/.style={% draw=gray!10,% line width=1pt, double=none, } }, rounded corners=1pt, ] \begin{knot}[ consider self intersections=true, ignore endpoint intersections=false, background colour=black, every intersection/.style={ crossing strand }, only when rendering/.style={ basic strand }, clip width=1, flip crossing=1, ] \strand (7.5,7.5)--(6.5,5.5)--(7.5,3.5)--(6.5,1.5)--(4.5,0.5)--(2.5,1.5)--(0.5,0.5)--(1.5,2.5)--(0.5,4.5)--(1.5,6.5)--(3.5,7.5)--(5.5,6.5)--(7.5,5.5)--(6.5,3.5)--(7.5,1.5)--(5.5,0.5)--(3.5,1.5)--(1.5,0.5)--(0.5,2.5)--(1.5,4.5)--(0.5,6.5)--(2.5,7.5)--(4.5,6.5)--(6.5,7.5)--(5.5,5.5)--(7.5,4.5)--(6.5,2.5)--(7.5,0.5)--(5.5,1.5) --(3.5,0.5)--(1.5,1.5)--(0.5,3.5)--(1.5,5.5) --(0.5,7.5)--(2.5,6.5)--(4.5,7.5)--(6.5,6.5) --(4.5,5.5)--(5.5,3.5) % --(7.5,2.5) ; \end{knot} \end{tikzpicture} \end{document} With --(7.5,2.5) commented, it behaves good: However, if I uncommented that line, thing changed: Is that a bug or feature? Any possibility to improve this?

  • Using tikz's backgrounds library to draw something behind text
    by Werner on February 21, 2026 at 7:20 am

    Consider the following minimal example where I want to draw a rectangle behind a sequence of numbers (to highlight them): \documentclass{article} \usepackage{tikz} \usetikzlibrary{backgrounds,calc} \NewDocumentCommand{\tikzmark}{ m }{\tikz[overlay, remember picture] \node (#1) {};} \newcounter{seq} \NewDocumentCommand{\seqstart}{}{% \stepcounter{seq}% Start a new sequence \tikzmark{seq-start-\theseq}}% Set start marker \NewDocumentCommand{\seqend}{}{% \tikzmark{seq-end-\theseq}% Set end marker \tikz[remember picture, overlay] \scoped [on background layer] \fill [fill=blue!10!white] ($(seq-start-\theseq.south west) + (-0.5pt,1pt)$) rectangle ($(seq-end-\theseq.south east) + (0.5pt,1.1\normalbaselineskip)$);% } \begin{document} \[ 12, 15, 8, 11, 4, 7, 0, 3, 16, 19, 12, 15, 8, 11, 4, 7, 0, 3, \ldots \] \[ \seqstart{}12, 15, 8, 11, 4, 7, 0, 3, 16, 19\seqend{}, 12, 15, 8, 11, 4, 7, 0, 3, \ldots \] \end{document} The idea is that \seqstart would set a (counter-driven) \tikzmark representing the start of the sequence to be marked. Then \seqend would set a \tikzmark at the end and highlight it using the background layer. The counter allows for multiple such sequence marking within a larger document. However, the output shows that the rectangle highlighting a part of the sequence is not being drawn on background layer as requested. Why is that? How can I ensure the rectangle is drawn on the background layer behind document/text elements? The backgrounds library documentation (in the tikz documentation, section 45) mentions that on background layer can only be used inside a {scope} or \scoped, which is done above.

  • How to draw self-overlapped path with double line style?
    by Explorer on February 20, 2026 at 4:52 pm

    The question is similar to this solution, but not the same: \documentclass[tikz, border=1cm]{standalone} \usetikzlibrary{decorations.pathreplacing} % https://tex.stackexchange.com/a/572738/322482 \begin{document} \begin{tikzpicture}[ rounded corners=1pt, path decomposition/.style={% postaction={decoration={show path construction, lineto code={ \draw[#1] (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast); }, curveto code={ \draw[#1] (\tikzinputsegmentfirst) .. controls (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb) ..(\tikzinputsegmentlast) ; }, closepath code={ \draw[#1] (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast) {closepath};} } ,decorate}}] \draw[line cap=round, black, double=gray!10, thick, path decomposition={black, double=gray!10,thick}] (3,3) -- (1,1) -- (3,1) -- (1,3); % here below is what I want with only one path \begin{scope}[xshift=3cm] \draw[black, double=gray!10, thick, line cap=round] (3,3) -- (1,1) -- (1.5,1); \draw[black, double=gray!10, thick, line cap=round] (2.5,1) -- (3,1) -- (1,3); \draw[black, double=gray!10, thick] (1.3,1) -- (2.7,1); \end{scope} \end{tikzpicture} \end{document}

  • How to draw a half‑sphere with 5‑degree lines along the x‑axis in TikZ/PGF? [closed]
    by AruGip on February 19, 2026 at 8:40 pm

    I found this post and I'm trying to retrieve the version shown in the image below. Does anyone know how I can get that specific version? I've checked the documentation and explored the available properties, but I couldn't find anything that returns the same value shown there. Any ideas on how to achieve this?

  • Create a directed graph
    by Dimitrios ANAGNOSTOU on February 19, 2026 at 4:15 pm

    I want to create the following figure. Using the following code, I managed to get something close. But I cannot figure out how to get properly the diagonal vectors without too much trial and error. Any ideas? Thanks a lot! \documentclass[a4paper,11pt]{article} \usepackage[T1]{fontenc} \usepackage[french]{babel} \usepackage{tikz} \usetikzlibrary{positioning,arrows.meta} \begin{document} \begin{figure}[!htpb] \centering \begin{tikzpicture}[ node distance=3cm, box/.style={draw, rectangle, minimum size=1.2cm, font=\large}, arr/.style={->, >=Stealth, thick} ] % Nodes \node[box] (1) {1}; \node[box, below=of 1] (2) {2}; \node[box, right=of 1] (3) {3}; \node[box, below=of 3] (4) {4}; % Labels n_i \node[above=3mm of 1] {$n_1=3$}; \node[above=3mm of 3] {$n_3=1$}; \node[below=3mm of 2] {$n_2=2$}; \node[below=3mm of 4] {$n_4=2$}; % Horizontal 1 <-> 3 (two parallel arrows) \draw[arr] ([yshift=4pt]1.east) -- ([yshift=4pt]3.west); \draw[arr] ([yshift=-4pt]3.west) -- ([yshift=-4pt]1.east); % Vertical left \draw[arr] (1) -- (2); % Vertical right \draw[arr] (4) -- (3); % Bottom horizontal \draw[arr] (2) -- (4); % Diagonals \draw[arr] (2) -- (3); \draw[arr] ([xshift=-4pt]4.north) -- ([xshift=4pt]1.south); \draw[arr] ([xshift=-4pt]1.south) -- ([xshift=4pt]4.north); \end{tikzpicture} \end{figure} \end{document}

  • I am trying to \protected@edef a bmatrix, and then I token.get_macro that token from Lua, so I can print it to the .tex at a later time
    by Jasper on February 19, 2026 at 3:25 pm

    I am trying to \protected@edef a bmatrix, and then I token.get_macro that token from Lua, so I can print it to the .tex at a later time. The error: WARNING: mathml missing for hash E6607B372B3A7F4DE18DB36E2B449CBD ! You can't use `\spacefactor' in math mode. \@->\spacefactor \@m {} \DocumentMetadata{ lang = en ,pdfversion = 2.0 ,pdfstandard = {UA-2} ,tagging = on } \tagpdfsetup {math/mathml/luamml/load=true} \documentclass{article} \usepackage{luacode,unicode-math,tikz} \begin{document} \makeatletter \protected@edef\COUNTDOOKU{\( \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \)} \makeatother \begin{tikzpicture} \begin{luacode*} tex.sprint( ("\\node at (0,0) {%s};") :format( token.get_macro("COUNTDOOKU") ) ) \end{luacode*} \end{tikzpicture} \end{document}

  • uneven commutative diagram
    by mappingmoe on February 18, 2026 at 11:33 am

    I want to draw the following commutative diagram in LaTeX: I have tried tikzcd, but I think I won't work, since the rows have different size. Is there a clean way to do it? EDIT: my first approach was the following: \documentclass[a4paper]{article} \usepackage{tikz-cd} \begin{document} \begin{tikzcd} P \arrow{l}{pr} \arrow{d}{\pi} & TP \arrow{d}{T \pi}\\ I \arrow{ur}{\tilde{\gamma}} \arrow{r}{\dot{\gamma}} & M \arrow{l}{pr} & TM \end{tikzcd} \end{document}

  • tikz draw of solid effect of stack of unit cube legos: for mathlinks
    by Epa on February 4, 2026 at 8:06 am

    How to make the solid effect view better, as shown in the photo attached? \documentclass[]{standalone} \usepackage{amsmath, amssymb, latexsym, amscd, amsthm} \usepackage{tikz} \newcommand{\drawboxa}[4]{ \pgfmathsetmacro \angle {30} \pgfmathsetmacro \xd {{2/3*cos(\angle)}} \pgfmathsetmacro \yd {{2/3*sin(\angle)}} \pgfmathsetmacro \x {{#1-1+(#2-1)*(\xd)}} \pgfmathsetmacro \y {{#3-1+(#2-1)*(\yd)}} \draw[fill=#4] (\x,\y) -- (\x+1,\y) -- (\x+1,\y+1) -- (\x,\y+1) -- cycle; \draw[fill=#4] (\x,\y+1) -- (\x+\xd,\y+1+\yd)coordinate[pos=.5](M) -- (\x+1+\xd,\y+1+\yd) -- (\x+1,\y+1) -- cycle; \draw[fill=#4] (\x+1,\y+1) -- (\x+1+\xd,\y+1+\yd) -- (\x+1+\xd,\y+\yd)coordinate[pos=.5](M2) -- (\x+1,\y)-- (\x+1,\y+1)coordinate[pos=.5](M3); \path(M2)--(M3)coordinate[pos=.5](M4); \draw[fill=#4] (M)++(.5,0)coordinate(T1)++(.15,0)arc(0:-180:.15cm and .06cm)--++(0,.1)arc(-180:0:.15cm and .06cm)coordinate(T2)--++(0,-.1) (T2)arc(0:180:.15cm and .06cm); \draw[fill=black,opacity=.1](M4)circle(.12cm and .15cm) (\x,\y)++(.5,.5)circle(.15); \draw(M4)circle(.12cm and .15cm) (\x,\y)++(.5,.5)circle(.15); } \newcommand{\drawboxb}[3]{ \pgfmathsetmacro \angle {30} \pgfmathsetmacro \xd {{2/3*cos(\angle)}} \pgfmathsetmacro \yd {{2/3*sin(\angle)}} \pgfmathsetmacro \x {{#1-1+(#2-1)*(\xd)}} \pgfmathsetmacro \y {{#3-1+(#2-1)*(\yd)}} \draw[fill=white] (\x,\y) -- (\x+1,\y) -- (\x+1,\y+1) -- (\x,\y+1) -- cycle; \draw[fill=white] (\x,\y+1) -- (\x+\xd,\y+1+\yd)coordinate[pos=.5](M) -- (\x+1+\xd,\y+1+\yd) -- (\x+1,\y+1) -- cycle; \draw[fill=white] (\x+1,\y+1) -- (\x+1+\xd,\y+1+\yd) -- (\x+1+\xd,\y+\yd)coordinate[pos=.5](M2) -- (\x+1,\y)-- (\x+1,\y+1)coordinate[pos=.5](M3); \path(M2)--(M3)coordinate[pos=.5](M4); \draw[fill=white] (M)++(.55,0)coordinate(T1)++(.15,0)arc(0:-180:.2cm and .07cm)--++(0,.1)arc(-180:0:.2cm and .07cm)coordinate(T2)--++(0,-.1) (T2)arc(0:180:.2cm and .07cm) (T2)++(-.2,0)circle(.16cm and .04cm); \draw(M4)circle(.15cm and .2cm)circle(.11cm and .16cm) (\x,\y)++(.5,.5)circle(.2)circle(.15); } \usepackage{tikzbricks} %\printanswers \newcommand{\drawboxc}[4]{ \pgfmathsetmacro \angle {30} \pgfmathsetmacro \xd {{2/3*cos(\angle)}} \pgfmathsetmacro \yd {{2/3*sin(\angle)}} \pgfmathsetmacro \x {{#1-1+(#2-1)*(\xd)}} \pgfmathsetmacro \y {{#3-1+(#2-1)*(\yd)}} \draw[fill=#4] (\x,\y) -- (\x+1,\y) -- (\x+1,\y+1) -- (\x,\y+1) -- cycle; \draw[fill=#4] (\x,\y+1) -- (\x+\xd,\y+1+\yd)coordinate[pos=.5](M) -- (\x+1+\xd,\y+1+\yd) -- (\x+1,\y+1) -- cycle; \draw[fill=#4] (\x+1,\y+1) -- (\x+1+\xd,\y+1+\yd) -- (\x+1+\xd,\y+\yd)coordinate[pos=.5](M2) -- (\x+1,\y)-- (\x+1,\y+1)coordinate[pos=.5](M3); \path(M2)--(M3)coordinate[pos=.5](M4)coordinate[pos=.4](M5); \draw[fill=#4](M4)circle(.12cm and .15cm)++(0,.15)coordinate(Y1)++(0,-.15)coordinate(Y2); \draw[fill=#4](M5)++(0,-.025)circle(.12cm and .15cm)++(0,.15)coordinate(Y3)++(0,-.3)coordinate(Y4) (Y3)--(Y1)arc(90:270:.12cm and .15cm)--(Y4)arc(270:90:.12cm and .15cm); \draw[fill=black,opacity=.1](\x,\y)++(.5,.5)circle(.15) (M)++(.5,0)coordinate(T1)circle(.15cm and .06cm); \draw(\x,\y)++(.5,.5)circle(.15) (T1)circle(.15cm and .06cm); } \begin{document} \begin{tikzpicture} \def\x{3} %so luong block \foreach\h in{1,...,\x}{ \drawboxa{1}{1}{\h}{blue!25} } \def\d{.3} \draw(1,-\d) node[scale=1.3]{3}; \draw(.8,\x+1.2*\d) node[scale=1.2, above]{three}; \begin{scope}[xshift=100] \def\x{2} %so luong block \foreach\h in{1,...,\x}{ \drawboxa{1}{1}{\h}{blue!25} } \draw(1,-\d) node[scale=1.3]{2}; \draw(.8,\x+1.2*\d) node[scale=1.2, above]{two}; \end{scope} \begin{scope}[xshift=200] \def\x{5} %so luong block \foreach\h in{1,...,\x}{ \drawboxa{1}{1}{\h}{blue!25} } \draw(1,-\d) node[scale=1.3]{5}; \draw(.8,\x+1.2*\d) node[scale=1.2, above]{five}; \end{scope} \end{tikzpicture} \vspace{1cm} \begin{tikzpicture} \def\x{5} %so luong block %drawbox{x}{z}{y} %x la toa do x %z la toa do lop tinh theo goc xien %y la toa do y \drawboxb{1}{0}{0} \end{tikzpicture} \begin{tikzpicture} \def\x{5} % so luong block xanh \def\v{2} % so luong block vang \def\b{1} % so luong block xanh duong \pgfmathtruncatemacro{\xx}{\x+1} \pgfmathtruncatemacro{\vv}{\x+\v} \pgfmathtruncatemacro{\vvv}{\vv+1} \pgfmathtruncatemacro{\bb}{\vv+\b} \ifnum\x>0 \foreach \h in {1,...,\x}{ \drawboxc{\h}{1}{1}{brown!35} } \fi \ifnum\v>0 \foreach \h in {\xx,...,\vv}{ \drawboxc{\h}{1}{1}{yellow!55} } \fi \ifnum\b>0 \foreach \h in {\vvv,...,\bb}{ \drawboxc{\h}{1}{1}{blue!25} } \fi \end{tikzpicture} \end{document} The code was from user 11232 How to draw stacked cubes of different sizes and colors?

  • Simplifying an Asymptote figure for spherical coordinates
    by Sebastiano on January 26, 2026 at 12:58 pm

    I refer to the second code by the user Chris Chudzicki: % Source - https://tex.stackexchange.com/a/160528 % Posted by Chris Chudzicki, modified by community. See post 'Timeline' for change history % Retrieved 2026-01-26, License - CC BY-SA 3.0 \documentclass{article} \usepackage{asymptote} \begin{document} \begin{asy}[width=\textwidth] settings.render=6; settings.prc=false; import three; import graph3; import grid3; currentprojection=obliqueX; //Draw Axes pen thickblack = black+0.75; real axislength = 1.0; draw(L=Label("$x$", position=Relative(1.1), align=SW), O--axislength*X,thickblack, Arrow3); draw(L=Label("$y$", position=Relative(1.1), align=E), O--axislength*Y,thickblack, Arrow3); draw(L=Label("$z$", position=Relative(1.1), align=N), O--axislength*Z,thickblack, Arrow3); //Set parameters of start corner of polar volume element real r = 1; real q=0.25pi; //theta real f=0.3pi; //phi real dq=0.15; //dtheta real df=0.15; //dphi real dr=0.15; triple A = r*expi(q,f); triple Ar = (r+dr)*expi(q,f); triple Aq = r*expi(q+dq,f); triple Arq = (r+dr)*expi(q+dq,f); triple Af = r*expi(q,f+df); triple Arf = (r+dr)*expi(q,f+df); triple Aqf = r*expi(q+dq,f+df); triple Arqf = (r+dr)*expi(q+dq,f+df); pen thingray = gray+0.33; draw(A--Ar); draw(Aq--Arq); draw(Af--Arf); draw(Aqf--Arqf); draw( arc(O,A,Aq) ,thickblack ); draw( arc(O,Af,Aqf),thickblack ); draw( arc(O,Ar,Arq) ); draw( arc(O,Arf,Arqf) ); draw( arc(O,Ar,Arq) ); draw( arc(O,A,Af),thickblack ); draw( arc(O,Aq,Aqf),thickblack ); draw( arc(O,Ar,Arf) ); draw( arc(O,Arq,Arqf) ); pen thinblack = black+0.25; //phi arcs draw(O--expi(pi/2,f),thinblack); draw("$\varphi$", arc(O,0.5*X,0.5*expi(pi/2,f)),thinblack,Arrow3); draw(O--expi(pi/2,f+df),thinblack); draw( "$d\varphi$", arc(O,expi(pi/2,f),expi(pi/2,f+df) ),thinblack ); draw( A.z*Z -- A,thinblack); draw(L=Label("$r\sin{\theta}$",position=Relative(0.5),align=N), A.z*Z -- Af,thinblack); //cotheta arcs draw( arc(O,Aq,expi(pi/2,f)),thinblack ); draw( arc(O,Aqf,expi(pi/2,f+df) ),thinblack); //theta arcs draw(O--A,thinblack); draw(O--Aq,thinblack); draw("$\theta$", arc(O,0.25*length(A)*Z,0.25*A),thinblack,Arrow3); draw(L=Label("$d\theta$",position=Relative(0.5),align=NE) ,arc(O,0.66*A,0.66*Aq),thinblack ); // inner surface triple rin(pair t) { return r*expi(t.x,t.y);} surface inner=surface(rin,(q,f),(q+dq,f+df),16,16); draw(inner,emissive(gray+opacity(0.33))); //part of a nearly transparent sphere to help see perspective surface sphere=surface(rin,(0,0),(pi/2,pi/2),16,16); draw(sphere,emissive(gray+opacity(0.125))); // dr and rdtheta labels triple V= Af + 0.5*(Arf-Af); draw(L=Label("$dr$",position=Relative(1.1)), V--(1.5*V.x,1.5*V.y,V.z),dotted); triple U=expi(q+0.5*dq,f); draw(L=Label("$rd\theta$",position=Relative(1.1)), r*U ---r*(1.66*U.x,1.66*U.y,U.z),dotted ); \end{asy} \end{document} The code uses asymptote package to represent a volume element in spherical coordinates. Asymptote appears to be correctly installed in my MiKTeX distribution; however, the document does not compile and produces the following error: Package asymptote Warning: file `spy-1.pdf' not found on input line 15. (spy.aux)) No pages of output. Transcript written on spy.log. Sorry, but "MiKTeX Compiler Driver" did not succeed. I do not use Asymptote very often, so I am not sure about the cause of the problem. It is possible that the solution is related to what is discussed in the following TeX.StackExchange threads: 'filename-1.pdf' not found Asymptote Asymptote Code Generates .asy Files, But Asymptote Execution Fails In particular, I have not yet tried the solution proposed by the user user279206, and I do not know whether there is an alternative approach that would allow me to compile the document correctly with my MiKTeX distribution. In a previous question, I also asked whether it is possible to obtain the same arrow tip styles provided by Asymptote using TikZ: Arrows with spherical (conical) tips Since I do not understand Asymptote code, I kindly ask whether it would be possible to modify the original code by removing everything that is not strictly necessary, in order to obtain only the figure related to spherical coordinates, without the volume element and without additional unnecessary details to obtain this with the portion of a sphere. In TikZ there is a result: https://tikz.net/spherical_1/ This is my goal:

  • How to draw an arrow?
    by Marcus on October 18, 2025 at 7:54 pm

    How can I draw the following arrow? Here is the code for the boxes: \begin{tikzpicture} \def\w{2cm} \node[draw, rectangle, minimum width=\w, minimum height=1cm, anchor=west] (R1) at (0,0) {A}; \foreach [count=\i from 0] \letter in {A,B,C,D,E} { \node[draw, rectangle, minimum width=\w, minimum height=1cm, anchor=west] (R\i) at (\i*\w, 0) {\letter}; } \end{tikzpicture}

  • Simple way to make circular arrow arc?
    by Black Mild on October 6, 2019 at 3:32 pm

    I have 4 circle nodes with different sizes. Is there a simple way (TikZ, Asymptote,...) to connected them with circular arrow arcs? \documentclass[border=5mm,tikz]{standalone} \begin{document} \begin{tikzpicture}[every node/.style={circle,draw,fill=white}] \def\r{3} \draw[red] (0,0) circle (\r); % 4 nodes with different sizes \path (180:\r) node (Sp) {Spring} (90:\r) node (Su) {Summer} (0:\r) node (Au) {Autumn} (-90:\r) node (Wi) {Winter}; % How to make arrow arcs cicular? (the red one with arrow tips) \begin{scope}[-stealth,bend left] \draw (Sp) to (Su); \draw (Su) to (Au); \draw (Au) to (Wi); \draw (Wi) to (Sp); \end{scope} \end{tikzpicture} \end{document}

  • Tikzpicture /pfgplots in list of figures:
    by Jules Lecoustre on April 21, 2018 at 9:46 am

    I'm a beginner with LaTeX and i have insert graph, with a csv file and pfgplots But how can i have the title of the graph in the list of figures. Thank you \begin{center} \begin{tikzpicture} \begin{axis}[% title={$U=E-R\cdot I$ représentation graphique}, no markers, xmin=0, xmax=10, ymin=12, ymax=14, ] \draw[<->,thin] (axis cs:9, 12.5625) -- (axis cs:9, 13); \draw[<->,thin] (axis cs:0, 13.125) -- (axis cs:9, 13.125); \node at (axis cs:9.5,12.784){$\Delta U$}; \node [above] at (axis cs:4.5,13.125){$\Delta I$}; \draw [-,semithick,red] (axis cs:0, 13) -- (axis cs:10, 13); \draw [<-,semithick] (axis cs: 4,12.8) -- (axis cs:4,12.75); \draw [->,semithick] (axis cs: 4,12.75) -- (axis cs:5,12.75); \node [below] at (axis cs:4.5,12.75){$\dfrac{dU(I)}{dI}=-R$}; \addplot table [x=I, y=U, col sep=comma] {test.csv}; \end{axis} \end{tikzpicture} \end{center}

  • Span block width automatically over multiple smaller blocks
    by SampleTime on March 17, 2018 at 6:41 pm

    Given the following code: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{positioning} \tikzstyle{block} = [draw, rectangle, minimum height=3.5em, minimum width=4.5em] \begin{document} \begin{tikzpicture} \node [block,align=center](a) {A}; \node [block,align=center,right=1cm of a](b) {B}; \node [block,align=center,below=1cm of a](c) {C}; \end{tikzpicture} \end{document} I would like that the C-Block, which is below the A- and B-Block takes automatically the width that the A and B Block span. I would like it to look something like this: How can I achieve this without manually setting the width of the C-Block?

  • beamer package - tikz externalize and animations
    by Wanderer on December 7, 2016 at 5:48 pm

    I'm having a somewhat larger project, so I have split it up into multiple files and externalized the tikz figures to reduce compilation time. The basic setup is as follows: Let's say I have a folder Main on the lowest level, that contains a folder Sub and a file Main.tex, which has the following content: \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{external, matrix} \tikzexternalize{Main} % taken from: http://tex.stackexchange.com/questions/136143/tikz-animated-figure-in-beamer \tikzset{invisible/.style={opacity=0}, visible on/.style={alt={#1{}{invisible}}}, alt/.code args={<#1>#2#3}{\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}},} \begin{document} \tikzset{external/export=false} \include{Sub/Sub} \end{document} In the folder Sub, I have another folder Tikzand a file Sub.tex, which has the following content: \tikzsetexternalprefix{Sub/Tikz/img_} \begin{frame}{Test} \begin{figure} \tikzset{external/export=true} \tikzsetnextfilename{Test} \input{Sub/Tikz/Test.tikz} \end{figure} \begin{itemize} \item A \item B \end{itemize} \end{frame} In the folder Tikz I have a file Test.tikz, which has the following content: % taken from: http://tex.stackexchange.com/questions/136143/tikz-animated-figure-in-beamer \begin{tikzpicture} \matrix (magic) [matrix of nodes, ampersand replacement=\&, column sep=7mm, row sep=5mm]{ \node (se) [draw,shape=rectangle,visible on=<5->] {Existence Forte}; \& \node (yw) [draw,shape=circle,visible on=<1->] {Yamada-watanab}; \& \node (ul) [draw,shape=rectangle,visible on=<9->] {Unicité en Loi}; \\ \node (d1) [draw,shape=circle,visible on=<6->] {Définition}; \& \& \node (d2) [draw, shape=circle,visible on=<8->] {Définition}; \\ \node (we) [draw, shape=rectangle,visible on=<2->] {Existence Faible}; \& \node (ec) [draw, shape=circle,visible on=<10->] {Engelbert-Cherny}; \& \node (pu) [draw, shape=rectangle,visible on=<3->] {Unicité Trajectorielle}; \\ }; \draw[->, thick,visible on=<6->] (se) -- (d1); \draw[->, thick,visible on=<7->] -- (we); \draw[->, thick,visible on=<4->] (we) -- (yw); \draw[->, thick,visible on=<5->] (yw) -- (se); \draw[->, thick,visible on=<11->] (se) -- (ec); \draw[->, thick,visible on=<11->] (ul) -- (ec); \draw[->, thick,visible on=<12->] (ec) -- (pu); \draw[->, thick,visible on=<4->] (pu) -- (yw); \draw[->, thick,visible on=<8->] (pu) -- (d2); \draw[->, thick,visible on=<9->] (d2) -- (ul); \end{tikzpicture} What I now want to achieve is, that every page from the file img_Test.pdf (generated by compiling the code) is shown on its own frame in the presentation with the items A and B below, so it looks like an animation if one is clicking down the slides. But what I currently get is just a one-paged pdf showing just the first page of the figure and no items. If I just set tikzset{external/export=true} to false, everything works just fine, so it is just the externalization that causes this problem. I'm using the TeX Live distribution from the official Ubuntu repositories, do the editing with TeXstudio and compile with PdfLaTeX using the command pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex. The --shell-escape command is non-default, but I need it to get my tikz pictures compiled.

  • Adding vertical hierarchy lines to a category column of a table
    by badroit on August 8, 2014 at 8:15 pm

    I often need to represent hierarchies within tables but I've yet to find an elegant way to do this. Oftentimes I do a variation on the following theme, with nested whitespace in the category column: \documentclass{article} \usepackage{booktabs} \newcommand{\lvl}{~~~} \begin{document} \begin{tabular}{lr} \toprule \textbf{Category} & \textbf{\%}\\ \midrule Animal & 100 \\ \lvl Human & 50 \\ \lvl\lvl Man & 20 \\ \lvl\lvl Woman & 30 \\ \lvl Fox & 30 \\ \lvl\lvl Vixen & 16 \\ \lvl\lvl Dog & 14 \\ \lvl Chicken & 20 \\ \lvl\lvl Cock & 8 \\ \lvl\lvl Hen & 12 \\ \bottomrule \end{tabular} \end{document} I might mix that up with midrules between categories and different fonts for different levels and so on. But the result can sometimes be very "busy", especially if there's a bunch of levels. Instead, I was playing around with the idea of adding lines to more elegantly represent the hierarchy, sketched as follows in red (a similar effect in the same spirit would also suffice): But I'm not sure how to realise this in LaTeX in an elegant way. I'm guessing I could somehow decorate a table with TikZ but I'd only know how to specify manual points (e.g., I'm not sure how to anchor rows in a table). Thus I'm looking for any suggestions of elegant solutions to achieve the above effect. (An ideal answer would avoid explicit coordinates/distances and would be "highly reusable".)

  • Can we make a love heart with LaTeX?
    by Sibbs Gambling on October 20, 2013 at 4:48 pm

    I understand that this post may cause some down votes because it seems a bit off-topic, but having seen the discussions on Christmas Tree with LaTeX I am still willing to try. How do you draw a red cute love heart using LaTeX?

  • How to insert a linebreak in a TikZ matrix node?
    by Tim N on May 6, 2013 at 6:34 am

    How can I get a linebreak inside a matrix node? The following gives the error: Package tikz Error: Giving up on this path. Did you forget a semicolon?. unless I remove the linebreak. \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{chains} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture} \matrix (m) [ matrix of nodes ] { {some text} & {this node \\ does not work} \\ {other text} & {more text} \\ }; \end{tikzpicture} \end{document}

  • Overlay diagrams in TikZ
    by MYaseen208 on December 6, 2012 at 3:28 pm

    I want to join the vertices labeled as (1), b, abc, and ac but could not succeed. I'd highly appreciate if you point me out what I'm doing wrong and what is the solution. Thanks \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}[scale = 4, fill opacity = 1.0, thick, line cap = round, line join = round] %% Define coordinate labels. % t(op) and b(ottom) layers \path \foreach \layer/\direction in {b/{0, 0, 0}, t/{0, 1, 0}} { (\direction) \foreach \point/\label in {{0, 0, 0}/ll, {1, 0, 0}/lr, {1, 0, -1}/ur, {0, 0, -1}/ul} { +(\point) coordinate (\layer\label) } ($(\layer ll)!0.5!(\layer ur)$) coordinate (\layer md) }; % Put text next to the labels as requested. % Funilly enough we need to set fill opacity to 1. \draw \foreach \text/\label/\anchor in {% $\left(1\right)$/bll/east, $b$/bul/east, $c$/tll/east, $bc$/tul/east, $a$/blr/west, $ab$/bur/west, $ac$/tlr/west, $abc$/tur/west} { (\label) node[anchor=\anchor, fill opacity = 1] {\text} }; % Draw cube. \fill (0, 0, -1) circle (0.5pt); \foreach \direction in {(0, 0, 1), (0, 1, 0), (1, 0, 0)} { \draw[dashed, black] (bul) -- + \direction; } \fill[red!60, opacity=0.5] (tll) -- (tul) -- (bur) -- (blr); \fill[blue!60, opacity=0.5] (bll) -- (bul) -- (tur) -- (tlr); \draw (bll) -- (blr) -- (tlr) -- (tll) -- cycle; \draw (blr) -- (bur) -- (tur) -- (tlr) -- cycle; \draw (tll) -- (tlr) -- (tur) -- (tul) -- cycle; \foreach \point in {bll, blr, bur, tll, tlr, tul, tur} { \fill[fill opacity=1] (\point) circle (0.75pt); } \node[below] at (1.0, -0.2, 0.0) {$AC$}; \end{tikzpicture} \end{document}

  • How can I do this diagram with tikz?
    by Peter E on July 11, 2011 at 8:05 pm

    How can I do this diagram with tikz?