• Hollowed-out sphere effect
    by Sebastiano on July 13, 2026 at 10:49 pm

    How can I obtain the hollowed-out sphere effect? The drawing above is my original done many years before. \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows.meta, calc, positioning, shapes.geometric} \begin{document} \begin{tikzpicture}[ scale=1.2, axis/.style={thick, ->} ] \coordinate (O) at (0, 0); \coordinate (X) at (-2, -2.3); \coordinate (Y) at (5.5, 0); \coordinate (Z) at (0, 4); \coordinate (P) at (3.1, 1.3); \draw[axis] (O) -- (X) node[left, font=\large, xshift=-3pt] {$x$}; \draw[axis] (O) -- (Y) node[below, font=\large, yshift=-3pt] {$y$}; \draw[axis] (O) -- (Z) node[left, font=\large, xshift=-3pt] {$z$}; \begin{scope} \shade[ball color=gray!30!white, opacity=0.85] (O) circle (0.9); \draw[gray!60, thin] (O) circle (0.9); \fill[gray!60!black, opacity=0.9] plot[smooth cycle, tension=0.7] coordinates { ($(O)+(-0.2, 0.4)$) ($(O)+(0.5, 0.5)$) ($(O)+(0.6, -0.4)$) ($(O)+(0.1, -0.6)$) ($(O)+(-0.3, -0.3)$) }; \shade[inner color=black!80, outer color=gray!70!black, opacity=0.5] plot[smooth cycle, tension=0.7] coordinates { ($(O)+(-0.2, 0.4)$) ($(O)+(0.5, 0.5)$) ($(O)+(0.6, -0.4)$) ($(O)+(0.1, -0.6)$) ($(O)+(-0.3, -0.3)$) }; \end{scope} \fill[black] (O) circle (0.07) node[below, yshift=-4pt, font=\large] {$O$}; \draw[->, >=Stealth, shorten >= 2.5pt, shorten <= 2pt] (O) -- (P) node[midway, above, yshift=2pt, font=\large] {$r$}; \fill[black] (P) circle (0.08) node[above, yshift=3pt, font=\large] {$P$}; \node[right, font=\Large\itshape, xshift=2pt, yshift=-2pt] at (P) {$m$}; \node[below, font=\large] at (0.2, -0.95) {$M$}; \end{tikzpicture} \end{document}

  • Why does cycle produce a diagonal?
    by D G on July 13, 2026 at 7:11 pm

    I don't understand why there is a diagonal. \documentclass[tikz,border=12pt]{standalone} \begin{document} \begin{tikzpicture} \node [draw=red] (A) at (1,1) {A}; \draw (0,0) |- (A) |- cycle; \end{tikzpicture} \end{document} Expected output \begin{tikzpicture} \node [draw=red] (A) at (1,1) {A}; \draw (0,0) |- (A) |- (0,0); \end{tikzpicture} Edit Considering the following code. \begin{tikzpicture} \node [draw=red] (A) at (1,1) {A}; \draw (0,0) |- (A) |- cycle; \end{tikzpicture} Suppose there were two separate paths within a single \draw command: first path: (0,0) |- (A.west) second path: (A.south) |- cycle In that interpretation, cycle seems to have two contradictory behaviors: It remembers (0,0) from the first path and uses it as the destination of |- in the second path. However, it also treats (A.south) as the starting point of the second path instead of (0,0). Am I misunderstanding how cycle is supposed to work?

  • Framing an Imported Image by a Tikzpicture
    by Jethro on July 13, 2026 at 1:00 am

    This question is a followup to the one posed here: How to Point the Rounded Corners of a Filled Tikzpicture Inward? MWE: \documentclass{article} \usepackage{tikz,graphicx} \begin{document} \begin{tikzpicture} \node[inner sep=0pt] at (0,0) {\includegraphics[width=.9\linewidth]{example-grid-100x100pt}}; \def\W{9} % width of the rectangle \def\H{15} % height of the rectangle \def\R{0.6} % radius of the inverted corners. \draw[line width=7pt, brown, fill=blue!80, radius=\R, delta angle=-90] (0, \R) arc [start angle= 90] -- +(right:\W-2*\R) arc [start angle=180] -- +( up:\H-2*\R) arc [start angle=270] -- +( left:\W-2*\R) arc [start angle= 0] -- cycle; \end{tikzpicture} \end{document} which produces: I am trying to get the imported image to fit into the tikzpicture---upon which, I can size it so that it is perfectly framed by the brown border. Can somebody tell me what I am doing wrong and how to fix it? Thanks.

  • How to Point the Rounded Corners of a Filled Tikzpicture Inward?
    by Jethro on July 12, 2026 at 7:49 pm

    MWE: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \def\W{9} % width of the rectangle \def\H{15} % height of the rectangle \def\R{0.8} % radius of the inverted corners. \draw[ultra thick, fill=blue!80] (0, \R) arc (180:270:\R) -- (\W-\R, 0) arc (270:360:\R) -- (\W, \H-\R) arc (0:90:\R) -- (\R, \H) arc (90:180:\R) -- cycle; \end{tikzpicture} \end{document} output: How may I modify the code such that all four rounded corners are pointing inward; that is, the rounded part is pointing towards the interior of the figure and not the exterior? Thanks.

  • How to plot a graph?
    by charuanl on July 12, 2026 at 11:18 am

    I want to plot a graph for this below picture I already tried but the graph wasn't smooth. This is the graph that I tried to plot Here's my code : \documentclass{article} \usepackage{tikz} \begin{document} \begin{center} \begin{tikzpicture}[x=1.2cm, y=0.7cm] \draw[thick, ->, >=stealth] (-2, 0) -- (6, 0) node[right] {X}; \draw[thick, ->, >=stealth] (0, -3.5) -- (0, 6.5) node[above] {Y}; \draw[thick, <->, >=stealth, color=black!80!blue] plot[smooth, tension=0.7] coordinates {(-1.5, 1.5) (0, 5) (2, 0) (4, -2) (4.8, 3)}; \fill (0, 5) circle (2.5pt); \node[above right] at (0, 5) {$(0, 5)$}; \fill (2, 0) circle (2.5pt); \node[above right] at (2, 0) {$(2, 0)$}; \fill (4, -2) circle (2.5pt); \node[below, yshift=-2pt] at (4, -2) {$(4, -2)$}; \node[above left] at (5.2, 3) {$y = f(x)$}; \end{tikzpicture} \end{center} \end{document}

  • Nesting tikzcd (specifically) within tikzpicture
    by Just Some Old Man on July 10, 2026 at 7:34 pm

    I would like to have a tikzcd within tikzpicture. The reason for this is I want to have a standard commutative diagram from tikzcd, but then also put lines, text, and shapes in the "background" of the diagram using tikzpicture treating the diagram as static and without interacting with the diagram at all (allowing for overlap, for example). A solution for tikzpicture within tikzpicture is using \newsavebox, but this doesn't work for tikzcd within tikzpicture. Specifically, \UseRawInputEncoding \documentclass[11pt]{article} \renewcommand{\baselinestretch}{1.05} \usepackage{tikz-cd} \begin{document} \newsavebox{\mybox} \sbox{\mybox}{ \begin{tikzpicture} \end{tikzpicture} } \end{document} compiles, but \UseRawInputEncoding \documentclass[11pt]{article} \renewcommand{\baselinestretch}{1.05} \usepackage{tikz-cd} \begin{document} \newsavebox{\mybox} \sbox{\mybox}{ \begin{tikzcd} A \arrow[r] & B \end{tikzcd} } \end{document} does not compile and throws the following error. Moreover, \UseRawInputEncoding \documentclass[11pt]{article} \renewcommand{\baselinestretch}{1.05} \usepackage{tikz-cd} \begin{document} \newsavebox{\mybox} \sbox{\mybox}{ \begin{tikzpicture} \begin{tikzcd} A \arrow[r] & B \end{tikzcd} \end{tikzpicture} } \end{document} does not compile and throws the following error. How can I have a tikzcd within tikzpicture?

  • Slight shift when exchanging TikZ node and line by exchanging some of their characteristics
    by Denis Bitouzé on July 10, 2026 at 3:02 pm

    Thanks to https://tex.stackexchange.com/a/764554/18401, I can easily have a (TikZ) node followed by a line, the total width of them being fixed (40mm below). In the following MCE, I use code from the link above (not optimizing in order to make it clearer) and: for the first case, I use: the east anchor, draw to the right, the west anchor of the node considered for the total width, and the result is as expected; for the second case, I want to exchange the node and the line (not mirroring them), so my code exchanges: east anchor → west anchor, draw to the right → draw to the left, west anchor → east anchor of the node considered for the total width. But, for the second case, there is slight shift (about 1pt) to the right I can't explain. How to get rid of it? \documentclass{article} \usepackage{tikz} \usepackage[showframe]{fgruler} \usepackage{geometry} \geometry{ paperwidth=60mm, paperheight=50mm, margin=1cm, marginparwidth=0mm, textwidth=40mm, } \newcommand{\test}[3]{% \noindent% \tikz \draw[line width=2pt] (0,0) node[line width=0pt,inner sep=0pt,draw, anchor=#1, ] (foo) {Foo} -- ([shift=(#2:40mm)]foo.#3);% } \begin{document} \test{east}{right}{west} \test{west}{left}{east} \end{document}

  • Why the interline spacing is different depending on where the font size is set? [duplicate]
    by CarLaTeX on July 10, 2026 at 7:43 am

    In the first node the font size is set as node argument. In the second node the font size is set where within the node text. Why the line spacing is different? \documentclass{book} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[draw, rectangle, minimum height=1cm, anchor=west, text width=10cm, align=flush left, font=\Large] {Some text. Some text. Some text. Some text. Some text. Some text.}; \end{tikzpicture} \vspace{1cm} \begin{tikzpicture} \node[draw, rectangle, minimum height=1cm, anchor=west, text width=10cm, align=flush left] {\Large Some text. Some text. Some text. Some text. Some text. Some text.}; \end{tikzpicture} \end{document}

  • TikZ pic is not handling pgfkeys
    by PaulTanenbaum on July 10, 2026 at 2:50 am

    I'm trying to use a pic to produce diamonds of a fixed width and height (specified by a parameter) and of specified line and fill colors. My first attempt was based on code I copied and pasted from Google in response to the search "can tikzpicture pic macros have arguments." Google responded with what seemed to be just what I needed (under a heading of "Default Values and Keyword Arguments"). But I have not been able to get my tweak of it to work. (But having typed that last sentence, I've now tried the code verbatim as Google provided it, and I got a pgfkeys error. Sigh). In my attempts, I have gotten the default values to work: if I change the default values, then those changes are reflected in the output. But for some reason when I pass my pic key-value pairs, they seem to have no effect. Oh, and when (by way of debugging) I try commenting out the lines that set the defaults, I get error messages about the resulting "undefined control sequences." I've also looked at various answers here on SE and tried adjusting my code to resemble theirs. No such adjustments have made any difference. Nor, I'm sorry to say, has the PGF/TikZ manual been of any help. I'm confident that the problem is some fairly simple thing that I'm too bone-headed to find. So here's a MWE: \documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \tikzset{ pics/mydiamond/.style={ code={ \node[ draw, diamond, color=\mydiamondcolor, fill=\mydiamondfill, minimum width=\mydiamondradius*2, minimum height=\mydiamondradius*2, align=center] (0,0) {}; } }, % Set defaults pics/mydiamond/.cd, color/.store in=\mydiamondcolor, color=purple, fill/.store in=\mydiamondfill, fill=yellow!30, radius/.store in=\mydiamondradius, radius=2mm, } \tikzset{blue thing/.style={color=blue,fill=blue!20}} \begin{document} These three diamonds should be of different sizes and colors, \begin{tikzpicture} \draw (0,0) pic {mydiamond}; \draw[radius=5cm, color=red, fill=green] (1,0) pic {mydiamond}; \draw (2,0) pic {mydiamond={radius=10cm, color=blue, fill=white}}; \end{tikzpicture} But they are not. Nor do such diamonds seem to pick up on .styles (\begin{tikzpicture} \draw (0,0) pic[blue thing] {mydiamond}; \end{tikzpicture}, see what I mean?), although things like garden-variety nodes and geometric shapes (\begin{tikzpicture} \draw[blue thing] (0,0) node {Blue Thing!}; \end{tikzpicture} and \begin{tikzpicture} \draw[blue thing, radius=2mm] (1.2,0) circle; \end{tikzpicture}) do. \end{document} The output I get from that MWE is As my MWE illustrates, among the variants I've tried is taking the key-value pairs out of the brackets appended to the \draw command and putting them into ={} appended to the pic name. But no dice.

  • Simulating a granular concrete surface texture in TikZ
    by Sebastiano on July 9, 2026 at 4:06 pm

    I have this my image in Adobe Illustrator. How can I simulate a coarse-grained concrete surface with the libraries? \documentclass{article} \usepackage{tikz} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture}[scale=1] \draw[->,thick] (-3.2,-1.65)--(4.3,-1.65) node[below right] {$x$}; % ground \fill[pattern=north east lines,pattern color=gray] (-3.2,-1.9) rectangle (4,-1.65); \end{tikzpicture} \end{document}

  • Programmatically set the length of TikZ line so that both itself and an east anchored node at its starting point have a given length
    by Denis Bitouzé on July 9, 2026 at 10:18 am

    I would like to draw a TikZ line with an east anchored node at its starting point, such that both the line and the node globally having a given width. For example, in the following MCE example, how can I programmatically set the length \mywidth so that the line and the “Foo” node have a combined length of 50 mm? \documentclass{article} \usepackage{tikz} \usepackage[showframe,type=alledgesT]{fgruler} \newlength\mywidth \setlength\mywidth{40mm} \begin{document} \noindent% \tikz \draw (0,0) node[anchor=east,draw] {Foo} -- (\mywidth,0); \end{document}

  • How to make a relatively more beautiful classification table of quadratic functions?
    by D G on July 9, 2026 at 12:16 am

    Objectives: remove top left cell all contents are vertically and horizontally centered well balanced padding in each cell make it relatively much more beautiful \documentclass[12pt,border=12pt]{standalone} \usepackage{amsmath,array,tikz} \usetikzlibrary{math} \newcommand{\graph}[2][]{ \begin{tikzpicture}[baseline=(current bounding box.center)] \draw[blue,thick,->] (-1.5,#2)--(1.5,#2) node[right]{$x$}; \draw[red,thick,domain=-1.5:1.5,samples=100] plot(\x,{#1\x*\x/2}); \end{tikzpicture} } \renewcommand{\arraystretch}{1.8} \setlength{\tabcolsep}{18pt} \begin{document} \begin{tabular}{| >{\centering\arraybackslash}m{2.2cm}| >{\centering\arraybackslash}m{5.2cm}| >{\centering\arraybackslash}m{5.2cm}|} \cline{2-3} & $\mathbf{a>0}$ & $\mathbf{a<0}$ \\ \hline $\mathbf{D<0}$ & \graph{-1/2} & \graph[-]{1/2} \\ \hline $\mathbf{D=0}$ & \graph{0} & \graph[-]{0} \\ \hline $\mathbf{D>0}$ & \graph{1/2} & \graph[-]{-1/2} \\ \hline \end{tabular} \end{document} Any improvements are always welcome!

  • Trail or trace of a moving charged particle
    by Sebastiano on July 8, 2026 at 12:31 pm

    I think in 2019 I built the following image with Adobe Illustrator for my book. Now, since there are so many images in pdf, I am slowly creating them in TikZ code. I wanted to know if there is something to create a trail for the blue particle similar to the main image or any other idea you have. Thank you. \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows.meta} \tikzset{rhtip/.tip={Triangle[line width=1pt, fill=white, length=9pt, width=9pt]}, pics/clock/.style args={#1/#2}{ code={ \def\dist{0.38} \draw[thin] (0,0) circle (\dist); \draw[line width=.7pt] (0,0) -- ({0.16*cos(90-30*#1-0.5*#2)}, {0.16*sin(90-30*#1-0.5*#2)}); \draw[line width=.7pt] (0,0) -- ({0.28*cos(90-6*#2)}, {0.28*sin(90-6*#2)}); } } } \begin{document} \begin{tikzpicture}[scale=.8] \draw[->] (0,0) -- (4.8,0) node[right] {$x$}; \draw[->] (0,0) -- (0,4.8) node[above] {$z$}; \draw[->] (0,0) -- (1.8,1.1) node[above] {$y$}; \node at (-0.4,4.3) {$\Sigma$}; \shade[ball color=cyan] (2.7,1.2) circle (0.2); \draw[brown!80!black,line width=2pt,-rhtip] (2.9,1.2)--(3.8,1.2) node[midway,above left] {$\mathbf{u}$}; \pic at (2.5,2.5) {clock={1/10}}; \node[blue!60!black] at (3.35,2.9) {$C(u)$}; \begin{scope}[shift={(5,1)}] \draw[->] (0,0)--(4.5,0) node[right] {$x'$}; \draw[->] (0,0)--(0,4.8) node[above] {$z'$}; \draw[->] (0,0)--(1.8,1.1) node[above] {$y'$}; \node at (-0.4,4.3) {$\Sigma'$}; \draw[magenta,line width=2pt,-rhtip] (0,3.6)--(1.8,3.6) node[midway,above] {$\mathbf{v}$}; \draw[green!60!black,line width=2pt,-rhtip] (2.1,1.3)--(3.7,1.3) node[midway,below] {$\mathbf{u}'$}; \pic at (2.5,2.5) {clock={2/20}}; \node[blue!60!black] at (3.55,2.9) {$C'(u')$}; \end{scope} \end{tikzpicture} \end{document}

  • How to custom arrow style with `chemfig` within `\hreac`?
    by Explorer on July 8, 2026 at 12:23 pm

    This post is the follow-up of my previous question and jlab's answer, together with the comment: You can't use custom arrows with \hreac. It's why I redefined an existing one. Here below is the code to show "You can't use custom arrows with \hreac." % https://tex.stackexchange.com/a/764525 % https://tex.stackexchange.com/a/484655 \documentclass{article} \usepackage{chemfig} \ExplSyntaxOn \definearrow3{===}{% \CF_arrowshiftnodes{#3}% \path[allow ~ upside ~ down](\CF_arrowstartnode)--(\CF_arrowendnode)% node[pos=0,sloped,yshift=\CF_arrowdoublesep](\CF_arrowstartnode @u0){}% node[pos=0,sloped,yshift=-\CF_arrowdoublesep](\CF_arrowstartnode @d0){}% node[pos=1,sloped,yshift=\CF_arrowdoublesep](\CF_arrowstartnode @u1){}% node[pos=1,sloped,yshift=-\CF_arrowdoublesep](\CF_arrowstartnode @d1){};% \draw (\CF_arrowstartnode @u0)--(\CF_arrowstartnode @u1);% \draw (\CF_arrowstartnode @d1)--(\CF_arrowstartnode @d0);% \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode% } \ExplSyntaxOff \begin{document} \schemestart A\arrow{===}B \schemestop \hreac A >{===} B \endhreac \end{document} The custom arrow style === here, was allowed in \schemestart...\schemeend, but NOT within \hreac...\endhreac: \CF_error ...e {Package \CFname \space Error: #1.} l.28 >{===} ? Any suggestion on allowing === with \hreac? IMHO, === was common-seen with stoichiometric equation (see texdoc chemformula, sec 9. Arrows). If possible, if chemfig could provide more user-friendly interface to custom arrow, that would be better.

  • Why itemize move upward in the second frame? [duplicate]
    by vi pa on July 6, 2026 at 9:17 am

    \documentclass{beamer} \usepackage{tikz} \setbeamertemplate{navigation symbols}{} \begin{document} \begin{frame} \begin{itemize} \item why \item itemize \item move \item upwards \item in the second frame? \end{itemize} \end{frame} \begin{frame} \begin{itemize} \item why \item itemize \item move \item upwards \item in the second frame? \end{itemize} \begin{tikzpicture}[remember picture,overlay] \fill (current page.center) circle[radius=.5cm]; \end{tikzpicture} \end{frame} \end{document} tikzpictures with overlay should have no bounding box. Why in the second frame the same itemize of the first frame move upward?

  • Coloring a region of a sphere in 3D using TikZ
    by John on June 23, 2026 at 11:15 am

    I have just started using the 3d library in TikZ (and I'm quite new to the tikz package itself). I am modelling a physics problem; I want to draw a sphere that represents my system. The particularity of that sphere is to have regions delimited by parallel circles around the North and South poles; I would like to color these regions in a different shade than the rest of the sphere. I have been looking everywhere and I can't find how to do this (if it is possible); using \path and \fill doesn't seem to work. Sorry if it's a stupid question, thanks for your help! Here is my code (I'm also showing the θ,φ parametrization in my sketch; in commentary, my failed attempts for coloring the North Pole): \documentclass{article} \usepackage{tikz} \usepackage{tikz-3dplot} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[scale=3,tdplot_main_coords] \def\rvec{1.2} \def\thetavec{55} \def\phivec{35} \def\thetaRC{10} \shadedraw[tdplot_screen_coords,ball color = white] (0,0) circle (\rvec); \coordinate (O) at (0,0,0); \tdplotsetcoord{C}{\rvec}{\thetavec}{\phivec} \tdplotsetcoord{UD}{\rvec}{\thetaRC}{90} \tdplotsetcoord{UG}{\rvec}{\thetaRC}{-90} \draw[thick,->] (0,0,0) -- (1.7,0,0) node[anchor=north east]{$x$}; \draw[thick,->] (0,0,0) -- (0,1.7,0) node[anchor=north west]{$y$}; \draw[thick,->] (0,0,0) -- (0,0,1.7) node[anchor=south]{$z$}; \draw[-stealth,very thick,color=green!60!black] (O) -- (C) node[above right=-2] {P}; \draw[dashed, color=green!60!black] (O) -- (Cxy); \draw[dashed, color=green!60!black] (C) -- (Cxy); \tdplotdrawarc[color=green!40!black]{(O)}{0.4}{0}{\phivec}{anchor=north}{\(\varphi\)} \tdplotsetthetaplanecoords{\phivec} \tdplotdrawarc[color=green!40!black,tdplot_rotated_coords]{(0,0,0)}{0.7}{0}{\thetavec}{anchor=south west}{\(\theta\)} \draw[dashed] (\rvec,0,0) arc (0:360:\rvec); \draw[thick] (\rvec,0,0) arc (0:110:\rvec); \draw[thick] (\rvec,0,0) arc (0:-70:\rvec); %\tdplotdrawarc[fill=green!40!black]{(0,0,.995*\rvec)}{.0998}{0}{360}{anchor=south west}{\(\theta\)}; %\path[fill=red,fill opacity=0.5] (0,0,\rvec) -- plot[variable=\t,domain=0:360] (xyz spherical cs:radius=\rvec,longitude=\t,latitude=90-\thetaRC); \end{tikzpicture} \end{document}

  • Scale, transform shape, and the anchor border
    by karlh on June 18, 2025 at 9:22 pm

    When a node is scaled with transform shape and scale, the anchor border no longer lines up with the background path. At first I thought this was a bug in my own code, but I now realize that "standard" shapes (such as rectangle) do this, too. Here is a minimal example: \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}[transform shape] \node [name=r,draw,rectangle,minimum height=2cm,minimum width=3cm, line width=0.25cm] {Rectangle}; \draw [shift=(r.0),green] plot [mark=x] coordinates {(0,0)}; \draw [shift=(r.north),green] plot [mark=x] coordinates {(0,0)}; \node [name=s,draw,scale=2,color=gray,rectangle,minimum height=2cm,minimum width=3cm, line width=0.25cm] {Rectangle}; \draw [shift=(s.0),cyan] plot [mark=x] coordinates {(0,0)}; \draw [shift=(s.north),cyan] plot [mark=x] coordinates {(0,0)}; \end{tikzpicture} \end{document} I expected the blue crosses to be on the border of the gray rectangle, as the green ones are on the black one. How do I get around this? I think I know why it happens (it's because the lines do not scale but the outer x/y separations do, I think), but I'm not certain how to work around it. In this particular case, I'm trying to draw a picture that's exactly \textwidth wide in a document that shows points on the anchor border of a node, similar to those that appear in the PGF manual. It works fine if there is no scaling, but if I scale the node larger or smaller, those anchors do not lie in the right place. I tried transform canvas={scale=2}, but that put the node in the upper left corner and cut most of it off.

  • Using new coordinate system and relative coordinates
    by user30654 on February 28, 2025 at 2:47 pm

    This is my first, and most certainly naive, attempt to use \tikzdeclarecoordinatesystem to create a new coordinate system. The change of coordinates involves a translation of the origin (for example, along the vector (1,1)) followed by a scaling of the x unit vector (for example, by multiplying this vector by 0.5). The following code seems to achieve what I want: \documentclass[a4paper,11pt]{article} \usepackage{tikz} \makeatletter \tikzdeclarecoordinatesystem{new} {% \tikzset{cs/.cd,x=0,y=0,#1}% \pgfpointadd{\pgfpoint{1cm}{1cm}}{\pgfpoint{0.5*\tikz@cs@x cm}{\tikz@cs@y cm}} }% \makeatother \begin{document} \begin{tikzpicture}[line width=0.8pt] \draw[gray!50] (-3,-3) grid[step=1] (3,3) ; \draw plot[only marks,mark=x, mark size=3pt] coordinates{(0,0)} ; % \fill[blue] (new cs: x=0,y=0) circle (2pt) ; %\draw[red] (new cs: x=0,y=0) --++(new cs: x=0,y=1) ; % doesn't work \end{tikzpicture} \end{document} Unfortunately, as soon as I want to use relative coordinates, this no longer works. For example, the instruction \draw (new cs: x=0,y=0)--++(new cs: x=0,y=1) ; draws a segment between the coordinate points (1,1) and (2,3), whereas I would have expected to obtain a segment between the coordinate points (1,1) and (1,2) (in the initial coordinate system). I therefore assume that my use of \tikzdeclarecoordinatesystem is incorrect. Could someone point me in the right direction?

  • TikZ: Shapes with an angular colour gradient
    by StormyTeacup on April 18, 2024 at 2:05 pm

    Cross-posting from Stack Overflow: https://stackoverflow.com/q/78347764/2777074 Good people! I'm trying to draw some shapes with an angular colour gradient, but I am unable to find the general syntax for how fill a shape like that. I'm going to need to draw an awful lot of these diagrams, but to give you an idea of the basic way I want these things to look like when they're finished, I am attaching this picture: So, what I want is something so that I can specify "the gradient starts with colour X at angle A, and ends with colour Y at angle B". Does TikZ picture have such a function, or is it necessary to define something on one's own? Look forward to your responses! The only thing I've been able to come up with would be to use the method described in this answer to create a circular shape as a background, then to "hide" most of it with white with a cut-out of my shape remaining, but the problem with this approach is not only that it's kind of inelegant, it also will not work if I need to have several shapes next to one another. https://stackoverflow.com/questions/72813749/tikz-fill-a-circle-with-shading-color-by-angle EDIT: It being requested that I add some code snippet, I have put together this one, which produces the figure I have in mind, albeit without the desired gradient: \begin{tikzpicture} \draw[thick, arrows=<->] (-5,0)--(5,0); \draw[thick, arrows=<->] (0,-5)--(0,5); \draw[fill=red, draw=none] (2.5,0) arc (0:225:2.5) -- (225:2.2) -- (243:3) -- (225:3.8)--(225:3.5) arc (225:0:3.5) -- cycle; \draw[fill=blue, draw=none] (290:2.5) arc (290:335:2.5) -- (335:2.2) -- (353:3) -- (335:3.8) -- (335:3.5) arc (335:290:3.5) -- cycle; \end{tikzpicture} The image produced looks as follows:

  • Interesting weird TikZ behaviour
    by vishalpaudel on September 4, 2023 at 7:30 am

    I was trying to draw a grid of points with the weights of the points as the average of x and y: \usepackage{tikz} ... \begin{center} \begin{tikzpicture} \foreach \x in {1,2,3,4,5,6} { \foreach \y in {1,2,3,4,5,6} { \fill (\x, \y) circle ({(\x + \y)/2}); } } \end{tikzpicture} \end{center} ... The output is unexpected(Screenshot attached)! Does anyone know what is happening? I am using Lualatex on overleaf. edit 1: Solved the original problem: but need an explanation of the earlier behaviour.

  • An easy way to draw a sphere and cube
    by LH8 on August 25, 2023 at 12:03 pm

    I'm using tikz and would like to obtain this picture: My try: \documentclass[a4paper,12pt]{book} \usepackage{tikz} \usepackage{tikz-cd} \usetikzlibrary{arrows,patterns,snakes,fit,shapes.geometric,arrows.meta,decorations.markings,positioning,shapes,backgrounds} \begin{document} \begin{tikzpicture} \pic {cuboid} node[left]{\simeq} (1,0,0) \simeq \draw[dashed] (0,0,0) circle (1); \draw[dashed] (-1,0,0) arc (180:360:1 and 0.6); \draw[dashed] (1,0,0) arc (0:180:1 and 0.6); \caption{Sample} \end{tikzpicture} \end{document}

  • TikZ: Is there concept of layouts in tikz (which I could use in composite pic's)?
    by DimanNe on November 28, 2021 at 12:25 pm

    In Qt there is concept of layouts (for example, vertical layout arranges all objects vertically and possibly aligns them, horizontal - arranges horizontally, etc...). I am trying to solve a problem where layouts would help a lot. Namely, I would like to specify (1) nodes on the left ({n1}, {n2}, {n3}, {n4}, ...), (2) text for the center node, (3) nodes on the right. And expect the code to generate multiple nodes that have the following properties: nodes on the left are aligned to the right, and center of the group of the nodes is aligned with the center of the center node. the same with right nodes, but mirrored. each node has to be referenc-able outside there should be bounding box with anchors for the entire "thing" to be able to arrange them. Here is an example of how it could look in latex: \pic (a) [anchor=north] at(0, 0) { % `a` is the name of entire "thing" lcrpic={{n1}, {n2}, {n3}, {n4}, {n5}, {n6}, {n7}} % List of nodes on the left {Center1:\\many nodes on the left} % Center node {{n1}} % Nodes on the right }; I did manage to make the code below produce the picture below: \pic (a) [anchor=north] at(0, 0) { lcrpic={{n1}, {n2}, {n3}, {n4}, {n5}, {n6}, {n7}} {Center1:\\many nodes on the left} {{n1}} }; \pic (b) [anchor=north] at ({$(a-bb.south) - (0cm, 0.4cm)$} -| {$(a-center.south)$}) { lcrpic={{111111111111111111111111}} {Center2:\\Long nodes on the left} {{11}, {22}, {33}, {44}} }; \node (f) [nodefx_default] at (-6, -3) {Nodes must be reference-able outside:}; \draw[line width=1pt, draw=red!20] (f) -- (a-leftnodes-node-6); \draw[line width=1pt, draw=red!20] (f) -- (b-leftnodes-node-1); BUT The code is cumbersome, inefficient and ugly. My question is: what is the right approach in tikz to achieve this? (Maybe there is something that is similar to layouts in Qt?) MWE \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc, positioning} \makeatletter \newcommand{\gettikzxy}[3]{% \tikz@scan@one@point\pgfutil@firstofone#1\relax \edef#2{\the\pgf@x}% \edef#3{\the\pgf@y}% } \begin{document} \begin{tikzpicture} \tikzstyle{noders_default} = [rectangle, rounded corners=8pt, minimum height=17pt, font=\footnotesize, text centered, draw=black!20, thick, fill=white] \tikzstyle{nodefx_default} = [noders_default, text width=60pt] % ============================== left ============================== % the only useful "output" of the pic is "-bb" (invisible) node - it stores geometry of the left part and is used in pics/leftnodes \tikzset{ pics/leftnodeslayout/.style n args = {1}{ code={ \begin{scope}[local bounding box = layoutBoundingBox] \foreach [count=\ei, remember=\ei as \prevei (initially 0)] \elem in {#1} { \ifnum \prevei=0 \node (-node-\ei) [noders_default, draw=none, opacity=0, text opacity=0] {\elem}; \else \node (-node-\ei) [noders_default, anchor=north east, draw=none, opacity=0, text opacity=0] at (-node-\prevei.south east) {\elem}; \fi } \end{scope} \gettikzxy{(layoutBoundingBox.north west)}{\xLeft}{\yTop}; \gettikzxy{(layoutBoundingBox.south east)}{\xRight}{\yBottom}; \node[draw=none, green, dashed, minimum height=\yTop - \yBottom, minimum width=\xRight - \xLeft] (-bb) at (0,0) {}; } } } % Draw leftnodeslayout => get its "-bb" draw real nodes using "-bb" as reference: \tikzset{ pics/leftnodes/.style n args = {1}{ code={ \pic (layout) {leftnodeslayout={#1}}; \gettikzxy{(layout-bb.north west)}{\xLeft}{\yTop}; \gettikzxy{(layout-bb.south east)}{\xRight}{\yBottom}; \node[draw, green, dashed, minimum height=\yTop - \yBottom, minimum width=\xRight - \xLeft] (-bb) at (0,0) {}; \begin{scope} \foreach [count=\ei, remember=\ei as \prevei (initially 0)] \elem in {#1} { \ifnum \prevei=0 \node (-node-\ei) [noders_default, anchor=north east] at (-bb.north east) {\elem}; \else \node (-node-\ei) [noders_default, anchor=north east] at (-node-\prevei.south east) {\elem}; \fi } \end{scope} } } } % ============================== right ============================== % the only useful "output" of the pic is "-bb" (invisible) node - it stores geometry of the right part and is used in pics/righttnodes \tikzset{ pics/rightnodeslayout/.style n args = {1}{ code={ \begin{scope}[local bounding box = layoutBoundingBox] \foreach [count=\ei, remember=\ei as \prevei (initially 0)] \elem in {#1} { \ifnum \prevei=0 \node (-node-\ei) [noders_default, draw=none, opacity=0, text opacity=0] {\elem}; \else \node (-node-\ei) [noders_default, anchor=north east, draw=none, opacity=0, text opacity=0] at (-node-\prevei.south east) {\elem}; \fi } \end{scope} \gettikzxy{(layoutBoundingBox.north west)}{\xLeft}{\yTop}; \gettikzxy{(layoutBoundingBox.south east)}{\xRight}{\yBottom}; \node[draw=none, green, dashed, minimum height=\yTop - \yBottom, minimum width=\xRight - \xLeft] (-bb) at (0,0) {}; } } } % Draw rightnodeslayout => get its "-bb" draw real nodes using "-bb" as reference: \tikzset{ pics/rightnodes/.style n args = {1}{ code={ \pic (layout) {rightnodeslayout={#1}}; \gettikzxy{(layout-bb.north west)}{\xLeft}{\yTop}; \gettikzxy{(layout-bb.south east)}{\xRight}{\yBottom}; \node[draw, green, dashed, minimum height=\yTop - \yBottom, minimum width=\xRight - \xLeft] (-bb) at (0,0) {}; \begin{scope} \foreach [count=\ei, remember=\ei as \prevei (initially 0)] \elem in {#1} { \ifnum \prevei=0 \node (-node-\ei) [noders_default, anchor=north west] at (-bb.north west) {\elem}; \else \node (-node-\ei) [noders_default, anchor=north west] at (-node-\prevei.south west) {\elem}; \fi } \end{scope} } } } % ============================== LeftCenterRight (lcr) ============================== % The same approach here, but for the entire leftnodes-center-rigthnodes: \tikzset{ pics/lcrlayout/.style n args = {3}{ code={ \pic (leftnodes) {leftnodeslayout={#1}}; \gettikzxy{(leftnodes-bb.north west)}{\xLeftL}{\yTopL}; \gettikzxy{(leftnodes-bb.south east)}{\xRightL}{\yBottomL}; \pic (rightnodes) {rightnodeslayout={#3}}; \gettikzxy{(rightnodes-bb.north west)}{\xLeftR}{\yTopR}; \gettikzxy{(rightnodes-bb.south east)}{\xRightR}{\yBottomR}; \begin{scope}[local bounding box = layoutBoundingBoxForLCR] \node (-center) [nodefx_default, draw=none, opacity=0, text opacity=0] {#2}; \node (fakeleftbbrect) [draw=none, anchor=east, left=20pt of -center.west, minimum height=\yTopL - \yBottomL, minimum width=\xRightL - \xLeftL] {}; \node (fakerightbbrect) [draw=none, anchor=west, right=20pt of -center.east, minimum height=\yTopR - \yBottomR, minimum width=\xRightR - \xLeftR] {}; \end{scope} \gettikzxy{(layoutBoundingBoxForLCR.north west)}{\xLeft}{\yTop}; \gettikzxy{(layoutBoundingBoxForLCR.south east)}{\xRight}{\yBottom}; \node[draw=none, green, dashed, anchor=south west, minimum height=\yTop - \yBottom, minimum width=\xRight - \xLeft] (-bb) at (\xLeft, \yBottom) {}; } } } \tikzset{ pics/lcrpic/.style n args = {3}{ code={ \pic (-layout) {lcrlayout={{#1}}{#2}{{#3}}}; \gettikzxy{(-layout-bb.north west)}{\xLeft}{\yTop}; \gettikzxy{(-layout-bb.south east)}{\xRight}{\yBottom}; \gettikzxy{(-layout-bb.south)}{\xBbC}{\yBbC}; \gettikzxy{(-layout-center.south)}{\xC}{\yC}; \begin{scope}[xshift=\xBbC - \xC] \node[draw, blue, dashed, minimum height=\yTop - \yBottom, minimum width=\xRight - \xLeft] (-bb) {}; \pic (-leftnodes) [anchor=west] at (-bb.west) {leftnodes={#1}}; \node (-center) [nodefx_default, anchor=west, right=20pt of -leftnodes-bb.east] {#2}; \pic (rightnodes) [anchor=west, right=20pt of -center.east] {rightnodes={#3}}; \foreach [count=\ei, remember=\ei as \prevei (initially 0)] \elem in {#1} { \draw[line width=1pt, draw=black!20] (-center) -- (-leftnodes-node-\ei.east); } \foreach [count=\ei, remember=\ei as \prevei (initially 0)] \elem in {#3} { \draw[line width=1pt, draw=black!20] (-center) -- (rightnodes-node-\ei.west); } \end{scope} } } } % % The interface I want and tests: % \pic (a) [anchor=north] at(0, 0) { lcrpic={{n1}, {n2}, {n3}, {n4}, {n5}, {n6}, {n7}} {Center1:\\many nodes on the left} {{n1}} }; \pic (b) [anchor=north] at ({$(a-bb.south) - (0cm, 0.4cm)$} -| {$(a-center.south)$}) { lcrpic={{111111111111111111111111}} {Center2:\\Long nodes on the left} {{11}, {22}, {33}, {44}} }; \node (f) [nodefx_default] at (-6, -3) {Nodes must be reference-able outside:}; \draw[line width=1pt, draw=red!20] (f) -- (a-leftnodes-node-6); \draw[line width=1pt, draw=red!20] (f) -- (b-leftnodes-node-1); \end{tikzpicture} \end{document}

  • Tikz/PGF Anchors at locations computed in \backgroundpath
    by Marshmallow314 on November 25, 2021 at 2:28 pm

    I am trying to create an AO logic gate, which consists of three predefined shapes, as via \declarepgfshape. So far, I was able to define the shape in \backgroundpath. However, I want to have some anchors for my new figure. These shall be inherited anchors from the three predefined shapes. However, I did not manage to transfer the location of the anchors from figures I defined in \backgroundpath to somewhere outside this section. Is there any way to save coordinates inside backgroundpath or some way to define the three subshapes outside of it? To go a bit more into detail, I would like to inherit the output of the lower subshape to be the output of my new shape and something similar for the inputs of the upper subshapes. Since their definition is non-trivial, I do not want to define all the anchors by hand. So far, I only achieved to create an \edef\@temp{} environment which makes it possible to access the subfigures defined in the backgroundpath from outside the shape definition. However, I can still not correctly use them inside \savedanchor. In my code below, The anchor, which should be at the bottom of the bottom gate, is directly in the origin. I read about redefining the subfigures in \edef\@temp{} in order to access them from outside the backgroundpath but redefining them and using them instead of \tikz@fig@name-bottom does not help either. Do you have a suggestion how to solve the problem? I know that I can access the anchors I need via a-bottom.output but I want a similar structure to access the output as for the usual AND- or OR-gates, which would be via a.output. Here you can see the outcome of the code I wrote. Here is the code which should attach the horizontal line at the bottom of the figure. Thanks a lot for your help! \documentclass[]{article} \usepackage{tikz} \usetikzlibrary{shapes.gates.logic.US,shapes.gates.logic.IEC} \makeatletter \pgfdeclareshape{dumbbell}{ \savedanchor{\center}{% \pgfpointorigin} \anchor{center}{\center} \backgroundpath{ \edef\@temp{% \noexpand\node[outer sep=0pt, or gate US, draw, rotate=270] at (0,0) (\tikz@fig@name-bottom){}; \noexpand\node[outer sep=0pt, and gate US, draw, logic gate inputs=nn, rotate=270, scale=0.8, anchor=east] at (\tikz@fig@name-bottom.north west) (\tikz@fig@name-right){}; \noexpand\node[outer sep=0pt, and gate US, draw, logic gate inputs=nn, rotate=270, scale= 0.8, anchor=east] at (\tikz@fig@name-bottom.south west) (\tikz@fig@name-left){}; } \@temp } \savedanchor{\output}{\tikz@fig@name-bottom.output} \anchor{output}{\output} } \begin{document} \begin{tikzpicture} \node[dumbbell] (a) at (0,0) {}; \draw (a.output) -- (1,0); \end{tikzpicture} \end{document}

  • create new style for books
    by Educ on January 23, 2020 at 8:34 am

    I would like to create something to look like the following image: Here are my attempts, but unfortunately I got some errors. by the way I'm using : Miktex This is XeTeX, Version 3.14159265-2.6-0.999991 (MiKTeX 2.9.7250 64-bit) (preloaded format=xelatex 2020.1.21) 23 JAN 2020 09:31. TeXnicCenter2.02 (stable ) 64bit \documentclass[12pt,a4paper]{book} \usepackage[utf8]{inputenc} \usepackage{amsmath,amssymb,amsfonts,tikz} \usepackage[explicit]{titlesec} \usepackage[most]{tcolorbox} \usepackage[left=1.5cm,right=1.5cm,top=1.5cm,bottom=1cm]{geometry} \usetikzlibrary{calc} \everymath{\displaystyle} \definecolor{col1}{RGB}{243,111,36} \definecolor{col2}{RGB}{0,182,187} \definecolor{col3}{RGB}{240,225,225} \definecolor{col4}{RGB}{221,10,138} \definecolor{col5}{RGB}{0,182,189} \usepackage{eso-pic} \usepackage{anyfontsize} \AddToShipoutPicture{\setlength{\unitlength}{1cm} \put(-0.5,28){ \begin{tikzpicture} \fill[col1](current page.north west)rectangle([xshift=0.5cm,yshift=-1.8cm]current page.north east); \end{tikzpicture} }} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \renewcommand\chaptername{COURS} \newcommand{\chaptitle}[1]{% \begin{tikzpicture}[overlay] \node[fill=col2 , minimum width=3.5cm, minimum height=4.5cm,xshift=2cm,yshift=3.1cm ] {} ; \node[xshift=2cm,yshift=2.3cm,scale=3 ] {\textbf{\textcolor{white}{{\sf \thechapter}}}} ; \node[ xshift=6.2cm,yshift=3.34cm,scale=1.2 ] {\textbf{\textcolor{white}{{\Huge\sf\bfseries \chaptername}}}} ; \node[xshift=4cm,yshift=1.8cm ,text width=\dimexpr14.5cm,anchor=west,align=flush left ] {{\Huge \textbf{#1}}}; \fill[top color =black!35,bottom color =black](0.24,0.85)--++(0,1)--++(-1,0)--cycle; \end{tikzpicture} } \titleformat{\chapter}[block] { }{ }{10pt}{ \Huge \chaptitle{#1} } \titlespacing*{\chapter} {0pt}{50pt}{0pt} \newcommand\SecTitle[1]{% \begin{tikzpicture} \node (A) [rectangle,fill=col5,minimum height=1cm,anchor=west,text width=\dimexpr12.5cm,anchor=west,align=flush left ] {\qquad {\Large \textbf{\textcolor{white}{\sffamily#1}}}}; \node [color=col5,line width=2pt, circle,draw=col5,fill=white](a) at ($ (A.north west)!0.5!(A.south west) $) {\Huge {\sffamily{\textbf{\textcolor{col5}{\arabic{section}}}}}}; \fill[col5]([ xshift=-0.09mm]A.north east)--([xshift=0.5cm]A.north east)--++(0,-0.2)to[out=-90,in=5]([xshift=-0.1mm]A.south east)--cycle; \end{tikzpicture} } \titleformat{\section} {\normalfont}{}{0em} {\SecTitle{#1}} \begin{document} \chapter{Brownian motion} \begin{tcolorbox}[colback=col3,colframe=col4,leftrule=5pt,toprule=0pt,rightrule=0pt,bottomrule=0pt,arc=0pt,outer arc=0pt,top=12pt] The aim of this book is to introduce Brownian motion as the central object of probability and discuss its properties, putting particular emphasis on the sample path properties. Our hope is to capture as much as possible the spirit of Paul L´evy’s investigations on Brownian motion, by moving quickly to the fascinating features of the Brownian motion process, and filling in more and more details into the picture as we move along. \end{tcolorbox} \section{Paul Levy's construction of Brownian motion} Definition of Brownian motion. Brownian motion is closely linked to the normal distribution. Recall that a random variable X is normally distributed with mean µ \end{document}

  • Curved paths and how to make this picture more fancy
    by himynameis on October 12, 2017 at 5:31 pm

    I want to show that a big frame consists of many small frames of another type. Therefor I started this tikzpicture. The big one is named long and the small frames are named small. \documentclass{article} \usepackage{amsmath} \usepackage[latin1]{inputenc} \usepackage{tikz} \usetikzlibrary{shapes,arrows} \usetikzlibrary{shapes.multipart} \usetikzlibrary{positioning} \usetikzlibrary{arrows.meta, calc, positioning, shapes, matrix} \usetikzlibrary{arrows} \usetikzlibrary{calc} \newcommand{\mylengthlong}{9cm} \newcommand{\myheightmod}{0.7cm} \newcommand{\mylengthsmall}{2cm} \newcommand{\myheightsmall}{0.7cm} \newcommand{\myfont}{\small} % vert. distance between small ones and big one \newcommand{\mydistance}{2cm} % length of small ones projection on the big ones \newcommand{\mylengthproject}{0.25cm} \tikzstyle{long}=[draw, minimum width = \mylengthlong, minimum height = \myheightmod, rounded corners] \tikzstyle{small}=[ minimum width = \mylengthsmall, minimum height = \myheightsmall, ] \begin{document} \begin{tikzpicture}[auto, font = {\sf \myfont}] % Hilfslinien % \draw[help lines] (-7,-7) grid (7,7); \node[long] (long) {long}; \node[small,draw] (small1) at ($(long.north west)+(\mylengthsmall/4,\mydistance)$) {small}; \draw (small1.south west) .. controls ($(small1.west)+(0,-1)$) and ($(long.west)+(0,1)$) .. (long.west); \node[draw, small, right = 0 of small1] (small2) {small}; \draw (small2.south west) .. controls ($(small2.west)+(0,-1)$) and ($(long.west)+(\mylengthproject,1)$) .. ($(long.north west)+(\mylengthproject,0)$); \draw (small2.south east) .. controls ($(small2.south east)+(0,-1)$) and ($(long.west)+(2*\mylengthproject,1)$) .. ($(long.north west)+(2*\mylengthproject,0)$); \node[draw, small, right = 0 of small2 ] (small3) {small}; \draw (small3.south east) .. controls ($(small3.south east)+(0,-1)$) and ($(long.west)+(3*\mylengthproject,1)$) .. ($(long.north west)+(3*\mylengthproject,0)$); \node[small, right = 0 of small3] (many) {...}; \draw (many.south east) .. controls ($(many.south east)+(0,-1)$) and ($(long.east)+(-1*\mylengthproject,1)$) .. ($(long.north east)+(-1*\mylengthproject,0)$); \node[draw,small, right = 0 of many] (small4) {small}; \draw (small4.south east) .. controls ($(small4.south east)+(0,-1)$) and ($(long.east)+(0,1)$) .. (long.east); \end{tikzpicture} \end{document} Can you think of any better way to achieve this kind of picture? Somehow, I think this picture doesn't make it clear what I want to show.

  • Multiple emitter transistor
    by Eduardo García on November 30, 2015 at 8:33 pm

    I'm trying to draw a multiple emitter npn transistor and multiple collector pnp transistor. I'm using tikz to draw all my electric circuits but there is nothing about it in the documentation nor this site. I need to draw something like Q1 in this image:

  • Drawing in LaTeX
    by Jack on November 15, 2014 at 5:05 pm

    I really like Tikz for drawing little and easy diagrams in my LaTex documents. However, I am not very skilled so I'm looking for someone to give me a help to realize this drawing (without colors: D). Thank you all for the help!

  • Draw Spiral Cone TikZ
    by Sebastian on September 13, 2013 at 3:50 pm

    Im trying to do a spiral cone in TikZ. I dont know what is the best way to do this.

  • TikZ: Define pattern with reference to external picture
    by knut on March 23, 2013 at 8:47 pm

    I want to fill a tikz-picture with a pattern, based on an external picture. Is this possible? If yes, how? I tried to define a new pattern with \pgfdeclarepatternformonly, but \pgfuseimage seems to be no valid command inside \pgfdeclarepatternformonly. Remark: In my example I used a marble-picture, but my question is independend from this special picture. I force the tile to 1cm. Probably it would be better to use the real size of the tile image. If I define \pgfdeclarepatternformonly after \begin{document} the LaTeX error disappear, but the pattern does not work. My MNWE (minimal not working Example): \documentclass[]{standalone} \usepackage{tikz} \usetikzlibrary{patterns} %Source: http://upload.wikimedia.org/wikipedia/de/thumb/f/f9/LapG.jpg/83px-LapG.jpg %But could be any other picture \pgfdeclareimage[width=1cm,height=1cm]{marble}{83px-LapG}%force quadratic tile \pgfdeclarepatternformonly{marble}{\pgfpoint{0cm}{0cm}}{\pgfpoint{1cm}{1cm}}{\pgfpoint{1cm}{1cm}}{ \pgfuseimage{marble}%! LaTeX Error: Missing \begin{document}. } \begin{document} \begin{tikzpicture} % This should create a rectangle with 15*15 tiles. \draw[pattern=marble] (0,0) rectangle (15,15); \end{tikzpicture} \end{document}

  • tikzpicture without leaving vertical mode
    by Caramdir on April 13, 2011 at 10:16 pm

    It seems that the tikzpicture environment always leaves vertical mode, even when the overlay option is given (and thus the picture doesn't actually take any space). This can cause unexpected behaviour. Is there a way to prevent TeX from leaving vertical mode?