TikZ
- Value for option of anchor not iterable in TikZby youthdoo on June 3, 2026 at 3:15 pm
The following code raises an error \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture} \def\radius{3} \def\smallr{0.3} \def\angleof#1{#1*360/18+3*360/18} \foreach \i in {0,...,17} { \draw ( \angleof{\i}:\radius ) circle (\smallr); } \foreach \i/\labl/\pos in { 1/$1$/center, 2/$2$/center, 3/$3=d$/east, 4/$4$/center, 6/$6=2d$/east, 9/$9=3d$/east, 12/$12=4d$/west, 15/$15=5d$/west, 18/$18=6d$/west } { \node[anchor=\pos] at ({\angleof{\i}}:\radius+\smallr+.25) {\labl}; } \end{tikzpicture} \end{document} The problem is with the second \foreach loop. But the error message is confusing, Package PGF Math Error: Unknown function `west' (in 'west '). I don't see why west would be used as a "function" in any way. What is the correct way of assigning different anchor points in the iteration?
- How to include a white background photo (jpg) in a 10% gray background?by Learner on May 31, 2026 at 11:20 am
I am using \includegraphics{photo.jpg} to upload a photo in a 10% gray background. For 10% gray background INSIDE border \fill[gray!10] ($(current page.north west) + (1cm,-1cm)$) rectangle ($(current page.south east) + (-1cm,1cm)$); To upload the photo (with white background, I used \node at ($(current page.south)+( 6cm,5.2cm)$) { \includegraphics{sig_digital.jpg} }; This produced the following photo: We can see the background is not matching, the photo has white background. I have one option, I can make the background to be white. But I want to keep the background gray while adjust the photo background. Edit: I am adding the full latex code: \documentclass[12pt,reqno]{amsart} %\documentclass [border = .2cm] {standalone} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=newest} \topmargin=0.02cm \textwidth = 17cm \textheight = 23cm \baselineskip=11pt \usepackage{color} \makeatletter \renewcommand*{\@cite}[2]{\fcolorbox{black}{white}{#1\if@tempswa, #2\fi}} %\renewcommand*{\@cite}[2]{\fcolorbox{green}{white}{#1, #2}} \renewcommand*{\@biblabel}[1]{{\fcolorbox{green}{white}{#1}}\hfill} \makeatother \setlength{\oddsidemargin}{0.01 pt} \setlength{\evensidemargin}{0.01 pt} \renewcommand{\baselinestretch}{1.4} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{graphicx} \graphicspath{ } \usetikzlibrary{intersections} \usetikzlibrary{patterns} \usepackage{dsfont} \usepackage{amssymb} \usepackage{relsize} \usepackage{soul} \usepackage{exercise} \usepackage{lipsum} \usepackage{epstopdf} \usepackage{pdflscape} \usepackage{csquotes} \usepackage{wrapfig} \usepackage{accents} \usepackage{adjustbox} \usepackage{tikz-3dplot} \usepackage{caption} \usepackage{subcaption} \usepackage{calligra} \usepackage[colorlinks]{hyperref} \hypersetup{citecolor=black} \newtheorem{fig}{figure}[section] \numberwithin{figure}{section} \newcommand\norm[1]{\left\lVert#1\right\rVert} \theoremstyle{plain} \newtheorem{thm}{Theorem}[section] \newtheorem*{thm*}{Theorem} \newtheorem{lem}[thm]{Lemma} \newtheorem{prop}[thm]{Proposition} \newtheorem{cor}{Corollary}[thm] \theoremstyle{definition} \newtheorem{defn}{Definition}[section] \newtheorem{conj}{Conjecture}[section] \newtheorem{exmp}{Example}[section] \theoremstyle{remark} \newtheorem{rem}{Remark} \newtheorem*{note}{Note} \usepackage{mathtools} \makeatletter \@namedef{subjclassname@2020}{% \textup{2020} Mathematics Subject Classification} \makeatother \renewcommand\ExerciseName{Question~} \renewcommand\ExerciseHeader{% \noindent\parbox[t]{.18\textwidth}{% \bfseries\large\ExerciseName\ExerciseHeaderNB\hfill}% \parbox[t]{.72\textwidth}{% \centering\bfseries\large% \ExerciseHeaderTitle\ExerciseHeaderOrigin}% \par\medskip } \newcommand{\md}[1]{\hfill\makebox[0pt][r]{[#1]}} %md=mark distribution \begin{document} \thispagestyle{empty} \begin{tikzpicture}[remember picture,overlay] % Light gray background INSIDE border \fill[gray!10] ($(current page.north west) + (1cm,-1cm)$) rectangle ($(current page.south east) + (-1cm,1cm)$); % Border \draw[line width=3pt] ($(current page.north west) + (1cm,-1cm)$) rectangle ($(current page.south east) + (-1cm,1cm)$); \draw[line width=1pt] ($(current page.north west) + (1.2cm,-1.2cm)$) rectangle ($(current page.south east) + (-1.2cm,1.2cm)$); % Title % Title (no node name needed) \node at ($(current page.north)+(0,-2.5cm)$) { {\Huge \bfseries Certificate of Presentation} }; % Main underline \draw[line width=1.3pt, color=blue] ($(current page.north)+(-4.7cm,-3.35cm)$) -- ($(current page.north)+(4.7cm,-3.35cm)$); % End dots \fill[color=blue] ($(current page.north)+(-4.9cm,-3.35cm)$) circle (2.2pt); \fill[color=blue] ($(current page.north)+(4.9cm,-3.35cm)$) circle (2.2pt); % Left stem \draw[line width=0.7pt, color=blue] ($(current page.north)+(-5.05cm,-3.35cm)$) -- ($(current page.north)+(-5.22cm,-3.35cm)$); % Left upper leaf \draw[line width=0.7pt, color=blue] ($(current page.north)+(-5.22cm,-3.35cm)$) .. controls +(-0.14,0.14) and +(0.14,0.11) .. ($(current page.north)+(-5.72cm,-3.16cm)$) .. controls +(-0.14,-0.11) and +(-0.10,0.00) .. ($(current page.north)+(-5.22cm,-3.35cm)$); % Left lower leaf \draw[line width=0.7pt, color=green] ($(current page.north)+(-5.22cm,-3.35cm)$) .. controls +(-0.14,-0.14) and +(0.14,-0.11) .. ($(current page.north)+(-5.72cm,-3.54cm)$) .. controls +(-0.14,0.11) and +(-0.10,0.00) .. ($(current page.north)+(-5.22cm,-3.35cm)$); % Right stem \draw[line width=0.7pt, color=blue] ($(current page.north)+(5.05cm,-3.35cm)$) -- ($(current page.north)+(5.22cm,-3.35cm)$); % Right upper leaf \draw[line width=0.7pt, color=blue] ($(current page.north)+(5.22cm,-3.35cm)$) .. controls +(0.14,0.14) and +(-0.14,0.11) .. ($(current page.north)+(5.72cm,-3.16cm)$) .. controls +(0.14,-0.11) and +(0.10,0.00) .. ($(current page.north)+(5.22cm,-3.35cm)$); % Right lower leaf \draw[line width=0.7pt, color=green] ($(current page.north)+(5.22cm,-3.35cm)$) .. controls +(0.14,-0.14) and +(-0.14,-0.11) .. ($(current page.north)+(5.72cm,-3.54cm)$) .. controls +(0.14,0.11) and +(0.10,0.00) .. ($(current page.north)+(5.22cm,-3.35cm)$); \node at ($(current page.north west)+(10.7cm,-5.6cm)$) { \includegraphics[width=4cm]{DHU_logo.png} }; % Body Text (for presenters) \node[align=center, text width=21cm] at ($(current page.center)+(0,0.1cm)$) { \large This is to certify that \\[0.5cm] {\LARGE \textbf{Participant Name}} \\[0.3cm] {\large (Affiliated to XYZ University)} \\[0.3cm] has presented a research paper titled \\[0.3cm] {\large \bfseries ``Title of the Research Paper''} \\[0.3cm] at the \\[0.1cm] { \color{blue!60!black}{{ $\mathbb{T}\mathbb{W}\mathbb{O}-$$\mathbb{DAY}$ $\mathbb{WORKSHOP}$ $\mathbb{AND}$ $\mathbb{CONFERENCE}$ $\mathbb{IN}$ $\mathbb{MATHEMATICS}$}\\[0.25cm] $\mathbb{HONORING}$ $\mathbb{SRINIVASA}$ $\mathbb{RAMANUJAN}$}}\\[0.6cm] held at Darjeeling Hills University from 2--3 July 2026.\\[0.4cm] We appreciate his/her valuable contribution to the conference. }; % Signature Lines \node at ($(current page.south)+( 6cm,3.5cm)$) { \begin{tabular}{c} \rule{5cm}{0.4pt}\\ (Organizer Name) \\ Affiliation \end{tabular} }; %add digital signature \node[scale=0.9] at ($(current page.south)+( 6cm,5.2cm)$) { \includegraphics{sig_digital.jpg} }; \end{tikzpicture} \end{document} The output is as follows: Here is the photo link
- Automatically shift arrow heads in TikZ for piecewise defined functions or gapsby CampanIgnis on May 30, 2026 at 7:40 pm
The tip of arrow heads in TikZ usually extends on exactly the specified coordinate, for example in \draw[->] (0,0) -- (1,1);. Is it possible to align the center of the end mark automatically at the specified coordinate? This is useful for plotting piecewise defined functions using * or o as arrow heads such as in https://commons.wikimedia.org/wiki/File:Discontinuity_jump.eps.png. Another way to achieve a similar result is by calculating the coordinates of the points and adding the points manually by \filldraw[fill=white] (1,0.5) circle (0.75pt);. To illustrate what I would like to have: The center of the two circles should be in the middle of the two blue lines of the MWE. It would also be great if we could define certain x-values to set marks at exactly desired points. MWE \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows} \begin{document} \begin{tikzpicture}[scale=3] \draw[blue!25,line width=4.80pt] (0,-0.25) -- ++(0,1.25) (1,-0.25) -- ++(0,1.25) ; \draw[domain=0:1, smooth, variable=\x, samples=4, *-o] plot ({\x}, {0.55}); \draw[->] (0,0) -- (1,0); \end{tikzpicture} \end{document}
- How to make the double arrow style more like the `single arrow` in `shapes.arrows`?by Explorer on May 29, 2026 at 10:30 am
What I want to replicate originally is something as below: Now my key point is the arrow of the following style, similar to the single arrow shape in shapes.arrows: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta,positioning,shapes.arrows,decorations.markings} \begin{document} \begin{tikzpicture}[ node distance=2cm and 1cm, shrink/.style={shorten >=#1cm,shorten <=#1cm}, myarrow/.style={ shrink=.75,thick,-Stealth, postaction=decorate, decoration={ markings,mark=at position .5 with { \draw[shrink=0,-] (-10pt,-10pt) -- (10pt,10pt); } } }, mysinglearrow/.style={ shape=single arrow,minimum height=1.5cm,inner sep=3pt,draw,line width=1.2pt, } ] \node[draw] (betaII) {AAAAAAAA}; \node[draw] (betaI)[below left=of betaII]{BBBBBBBBB}; \node[draw] (normal)[below right=of betaII]{CCCCCCCCC}; \draw[myarrow] (betaII.west) -- (betaI.north); \draw[myarrow] (normal.north) -- (betaII.east); \draw[myarrow] (betaI) -- (normal); \node[mysinglearrow,rotate=45] at (-1.75,-1.5) {}; \end{tikzpicture} \end{document} However, that is not behave as a "arrow", but a shape. I dislike the syntax: \node[mysinglearrow,rotate=45] at (-1.75,-1.5) {}; Here below is the simplified version, based on the similar solution code here: % Source - https://tex.stackexchange.com/a/662285 \documentclass[tikz,margin=1cm]{standalone} \usetikzlibrary{arrows.meta} \tikzset{ doubleTriangle/.style args={#1 and #2 colored by #3 and #4}{ -Triangle, line width=#1,#3, postaction={ draw, -Triangle,#4, line width=#2, /utils/exec=\pgfmathsetlengthmacro{\doubleTriangleShortenStart}{((#1)-(#2))/2}, /utils/exec=\pgfmathsetlengthmacro{\doubleTriangleShortenEnd}{1.2*(sqrt(3))*((#1)-(#2))}, shorten <=\doubleTriangleShortenStart, shorten >=\doubleTriangleShortenEnd, }, }, } \begin{document} \begin{tikzpicture} \node[draw,below left] at (0,0) {A}; \node[draw,above right] at (5,5) {B}; \draw[doubleTriangle=1cm and 0.7cm colored by black and white] (0,0) -- (5,5); % \draw[doubleTriangle=1cm and 0.7cm colored by black and white,shorten >=.5cm,shorten <=.5cm] (0,0) -- (5,5); \end{tikzpicture} \end{document} which gives: Noted that the arrow's width is not the same. What I was after as an arrow style, is something as below: Any suggestions on how to make more elegant syntax of this arrow style?
- White halo around black & transparent image in tikzby aky-her on May 24, 2026 at 12:36 pm
I have a png image that contains pure black crosshatching and the rest is fully transparent. I added that to a tikz image, but against a black background, a fine white line is added (see the picture) around the edges of the hatching. Why is the white line there and how can I get rid of it? Is this an issue with the image or with how I am using tikz? edit: here is a link to the file: https://limewire.com/d/47cga#KK6HtC3jAV (I am using an external file sharing site, because pasting the file here as an image actually removed the issue. My problem is solved, but I still don't know what was wrong or how to fix this outside of making an SO question, pasting the image there, downloading a second copy and discarding the question without posting it. At least this confirms that the issue was with the image.) Edit: I am using the default Ubuntu Document Viewer. I also tried several free online pdf viewers, all had the same issue. Here is my code: \documentclass{article} \usepackage[paperheight=8cm, paperwidth=6cm, left=0pt, top=0pt, right=0pt, bottom=0pt]{geometry} \usepackage{tikz} \begin{document} \begin{tikzpicture}[remember picture, overlay, shift = {(current page.south west)}] \node at (current page.center) [] {\includegraphics[height=\paperheight]{example-image-a.png}}; \node at (current page.center) [] {\includegraphics[height=\paperheight, width=\paperwidth]{ims/border_pure_black.png}}; \end{tikzpicture} \end{document}
- How is pos determined for a node on a rectangle path in TikZ?by internet on May 5, 2026 at 3:14 pm
I am trying to understand how TikZ calculates the position of a node when using the pos option on a rectangle path. Here is a minimal example: \documentclass[border=10pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[thin, gray!25] (0,0)--(4,4); \foreach \p in {0.1, 0.3, 0.5, 0.7, 0.9} { \draw (0,0) rectangle (4,4) node[pos=\p, black] {\p}; } \end{tikzpicture} \end{document} From my experiments, it seems that the position is determined along the diagonal of the rectangle rather than along its perimeter. How exactly is pos computed for a rectangle path? Is there a general rule for how pos is defined for different path constructions in TikZ? I checked the TikZ/PGF manual, but the manual doesn’t seem to explain how pos works specifically for the rectangle case.
- How come when filling in TikZ, there is a visible gap between adjacent fills?by Jasper on November 12, 2025 at 1:00 am
How come when filling in TikZ, there is a visible gap between adjacent fills? \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \fill (0,0) -- (1,1) -- (1,0) -- cycle; \fill (0,0) -- (1,1) -- (0,1) -- cycle; \end{tikzpicture} \end{document}
- Clip in tikz-3dplotby Angelo Aliano Filho on March 9, 2025 at 9:34 pm
I have the code below working perfectly: \documentclass[tikz,border=0mm]{standalone} \usepackage{tikz-3dplot} \definecolor{vinho}{rgb}{0.0, 0.26, 0.15} \usepackage{xfp} \newcommand{\ar}[1]{\fpeval{round(#1,2)}} \usetikzlibrary{positioning} \begin{document} \tdplotsetmaincoords{75}{120} \foreach \ang in {45}{ \begin{tikzpicture}[tdplot_main_coords,font=\small] \draw[-latex] (0,0,0) -- (4,0,0) node[below left]{$x$}; \draw[-latex] (0,0,0) -- (0,4,0) node[right]{$y$}; \draw[-latex] (0,0,0) -- (0,0,4) node[above]{$z$}; \draw[dashed] (0,0,0) -- (-4,0,0) (0,0,0) -- (0,-4,0) (0,0,0) -- (0,0,-2.5); \draw[fill,gray,opacity=0.1] (-4,-4,0) -- (-4,4,0) -- (4,4,0) -- (4,-4,0) -- cycle; \foreach \Rmax in {0,0.025,...,0.95,1}{ \draw[opacity=0.15,samples=50,smooth,domain=0:360,vinho,line width=0.7pt] plot({2*sqrt(2)*\Rmax*cos(\x)},{sqrt(2)*\Rmax*sin(\x)},{2-2*\Rmax^2}); } \foreach \Tmax in {0,5,...,360}{ \draw[opacity=0.15,samples=50,smooth,domain=0:1,vinho,line width=0.7pt] plot({2*sqrt(2)*\x*cos(\Tmax)},{sqrt(2)*\x*sin(\Tmax)},{2-2*\x^2}); } % \coordinate (P0) at (1,1,0.75); \coordinate (P1) at ({3*cos(\ang)},{3*sin(\ang)},-0.5); \coordinate (P2) at ({-3*cos(\ang)},{-3*sin(\ang)},-0.5); \coordinate (P3) at ({-3*cos(\ang)},{-3*sin(\ang)},1.5); \coordinate (P4) at ({3*cos(\ang)},{3*sin(\ang)},1.5); \draw[vinho,fill,fill opacity=0.05] (P1) -- (P2) -- (P3) -- (P4) -- cycle; % \draw[-latex,blue,thick] (0,0,0) -- ({1.5*cos(\ang)},{1.5*sin(\ang)},{0}) node[below right] {$\mathbf{u}$}; \draw[-latex,red] (P0) -- +({cos(\ang)},{sin(\ang)},{-0.5*cos(\ang)-2*sin(\ang)}) node[right=-2pt] {$\frac{\partial f}{\partial \mathbf{u}}$}; %Cut the parabola with zmin here..... \draw[black,smooth,domain=-2:2,samples=100,thick] plot({\x},{(-sin(\ang)+cos(\ang)+sin(\ang)*(\x))/cos(\ang)},{2-0.25*(\x)^2 -((-sin(\ang)+cos(\ang)+sin(\ang)*(\x))/cos(\ang))^2}); % \fill (P0) node[above] {\scalebox{0.8}{$P_0$}} circle (2pt); \node[name=funcao,anchor=west] at (1,5,3) {$f(x,y) = 2-\frac{x^2}{4} - y^2$}; \node[name=P,below=1cm of funcao.west,anchor=west] {$P_0=(1,1)$ e $\mathbf{u} = (\cos \ar{\ang}º,\sin \ar{\ang}º)$}; \node[,below=1cm of P.west,anchor=west] {$\frac{\partial f}{\partial \mathbf{u}} (P_0) = \ar{-0.5*cos(\ang*pi/180)-2*sin(\ang*pi/180)}$}; \end{tikzpicture} } \end{document} Whose output is the following: However, I would like to cut the image with a given zmin (for example, cut from zmin=-1). How can I do this with tikz-3dplot. I have tried with clip command but I don't get the desired result.
- Tikz symbols over colors in tableby David Moldes on November 14, 2023 at 1:53 pm
I am using the tikz package to create checkmarks and crosses, but if I color the rows, then they are only partially seen. Here is a minimal working example: \documentclass[table]{article} \usepackage{graphicx, xcolor} % Required for inserting images \usepackage{tabularx,booktabs} \usepackage{amsmath,amsfonts,amssymb,amscd,amsthm} \usepackage{multirow} \usepackage{array} \usepackage{multicol} \definecolor{DarkGreen}{rgb}{0.0, 0.5, 0.0} \definecolor{DarkRed}{rgb}{0.76, 0.13, 0.28} \definecolor{lavender}{rgb}{0.9, 0.9, 0.98} \usepackage{tikz} \def\checkmark{\color{DarkGreen}\tikz\fill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;} \def\cross{\color{DarkRed}$\mathbin{\tikz [x=1.4ex,y=1.4ex,line width=.2ex, red] \draw (0,0) -- (1,1) (0,1) -- (1,0);}$} \begin{document} \begin{table}[] \begin{tabular}{lccccc} \toprule & \multicolumn{3}{c}{\textbf{Proteins}} & \textbf{CHs} & \multicolumn{1}{l}{} \\ \cline{2-5} \multicolumn{1}{c}{\textbf{DES}} & \textit{BCA Microplate} & \textit{BCA 1 mL} & \textit{Bradford} & \textit{Dubois} & \textit{\textbf{Apt?}} \\ \toprule \rowcolor{lavender} \textit{ChCl:Lactic acid} & -22,6\% & 13,2\% & 15,0\% & 4,3\% & \multirow{2}{*}{\checkmark} \\ \rowcolor{lavender} \textit{ChCl:Lactic acid} & -32,0\% & 6,3\% & -7,5\% & 12,9\% & \\ \textit{ChCl:2Lactic acid} & -43,6\% & 8,3\% & 10,8\% & 11,9\% & \multirow{2}{*}{\checkmark} \\ \textit{ChCl:2Lactic acid} & -46,7\% & -2,0\% & -3,1\% & 20,8\% & \\ \rowcolor{lavender} \textit{ChCl:3Lactic Acid} & -41,7\% & 6,4\% & 5,9\% & 12,9\% & \multirow{2}{*}{\checkmark} \\ \rowcolor{lavender} \textit{ChCl:3Lactic Acid} & -51,1\% & -1,6\% & 3,9\% & 35,1\% & \\ \textit{ChCl:6Lactic Acid} & -57,3\% & -3,3\% & 3,1\% & 42,9\% & \multirow{2}{*}{\cross} \\ \textit{ChCl:6Lactic Acid} & -54,6\% & -1,1\% & 6,4\% & 28,0\% & \\ \bottomrule \end{tabular} \end{table} \end{document}
- pgfplots or tikz curved axis/surface for vector fieldby ElleZi on July 25, 2023 at 8:21 pm
I am looking to draw a 2D plane of vectors in latex. Essentially a combination of the following two pictures. I can do the first picture with just \path and \draw, and the second with quiver. But, I cant seem to be able to do both. How would I go about doing this? Image 1 \begin{tikzpicture} \draw[black,shorten >= 3pt,shorten <= 3pt] (0,0) to[out=-10,in=150] (6,-2) -- (12,1) to[out=150,in=-10] (5.5,3.7) -- cycle; (0,0) to[out=-10,in=150] (6,-2) -- (12,1) to[out=150,in=-10] (5.5,3.7) -- cycle; \end{tikzpicture} Image 2 \begin{tikzpicture} \begin{axis}[ xmin = -4, xmax = 4, ymin = -4, ymax = 4, zmin = 0, zmax = 1, axis equal image, xtick distance = 1, ytick distance = 1, view = {20}{90}, scale = 1.25, ] \addplot3[ quiver = { u = {sin y}, v = {sin x}, scale arrows = 0.05, }, quiver/colored = {blue}, -stealth, domain = -4:4, domain y = -4:4, ] {0}; \end{axis} \end{tikzpicture}
- Circled inline letters with minimum size to contain each single letter of the a-z alphabetby Enlico on January 22, 2023 at 5:36 pm
This was a very good starting point for the solution below, which is still not perfect for my usecase. I've tried to adapt it to show 3 circled letters with zero or more intervening letter between the circled ones and zero or more letters right out of the first and third circle. In other words, the desired scheme is that I want to type xOxOxOx, where each O represents a single circled possibly different letter, and each x represents a sequence of zero or more letters. The desired result is something like this (the code is below): What I don't like of this solution is that I had to hardcode a 1.3 multiplicative factor for \f@size. Indeed, if I remove *1.3, the size of the circle around m will be bigger than that of the circles around i and j. The 1.6 in the linked answer seemed a bit too much. Here's the MWE verified on David Carlisle's TeXlive.net: \documentclass{article} \usepackage{tikz} \begin{document} \makeatletter \newcommand\stencil[7]{% \tikz[outer sep=0, inner sep=0, baseline=(A.base), anchor=west]{ \node (A) {\vphantom{Wpm}#1}; \node[shape=circle, draw, minimum height={\f@size*1.3}] (B) at (A.east) {\vphantom{Wpm}#2}; \node (C) at (B.east) {\vphantom{Wpm}#3}; \node[shape=circle, draw, minimum height={\f@size*1.3}] (D) at (C.east) {\vphantom{Wpm}#4}; \node (E) at (D.east) {\vphantom{Wpm}#5}; \node[shape=circle, draw, minimum height={\f@size*1.3}] (F) at (E.east) {\vphantom{Wpm}#6}; \node (G) at (F.east) {\vphantom{Wpm}#7}; }% } \makeatother before\stencil{h}{i}{j}{k}{}{m}{}after beforeh before \stencil{h}{i}{j}{k}{}{m}{} after before h \end{document}
- Centering 2 tikz picturesby Barbaros Teoman Kosoglu on November 4, 2022 at 10:56 pm
\begin{tikzpicture}[declare function={f(\x,\y)=3-2*\y;}] \def\xmax{3} \def\xmin{-3} \def\ymax{3} \def\ymin{-3} \def\nx{15} \def\ny{15} \pgfmathsetmacro{\hx}{(\xmax-\xmin)/\nx} \pgfmathsetmacro{\hy}{(\ymax-\ymin)/\ny} \foreach \i in {0,...,\nx} \foreach \j in {0,...,\ny}{ \pgfmathsetmacro{\yprime}{f({\xmin+\i*\hx},{\ymin+\j*\hy})} \draw[blue,shift={({\xmin+\i*\hx},{\ymin+\j*\hy})}] (0,0)--($(0,0)!2mm!(.1,.1*\yprime)$); } \def\yo{1} \draw[magenta] plot[domain=\xmin:.9] (\x,{3/2}); \draw[->] (\xmin-.5,0)--(\xmax+.5,0) node[below right] {$x$}; \draw[->] (0,\ymin-.5)--(0,\ymax+.5) node[above left] {$y$}; \draw (current bounding box.north) node[above] {Slope field of \quad $y'=3-2$.}; \end{tikzpicture} \begin{tikzpicture}[declare function={f(\x,\y)=3-2*\y;}] \def\xmax{3} \def\xmin{-3} \def\ymax{3} \def\ymin{-3} \def\nx{15} \def\ny{15} \pgfmathsetmacro{\hx}{(\xmax-\xmin)/\nx} \pgfmathsetmacro{\hy}{(\ymax-\ymin)/\ny} \foreach \i in {0,...,\nx} \foreach \j in {0,...,\ny}{ \pgfmathsetmacro{\yprime}{f({\xmin+\i*\hx},{\ymin+\j*\hy})} \draw[blue,shift={({\xmin+\i*\hx},{\ymin+\j*\hy})}] (0,0)--($(0,0)!2mm!(.1,.1*\yprime)$); } \def\yo{1} \draw[magenta] plot[domain=\xmin:.9] (\x,{3/2}); \draw[->] (\xmin-.5,0)--(\xmax+.5,0) node[below right] {$x$}; \draw[->] (0,\ymin-.5)--(0,\ymax+.5) node[above left] {$y$}; \draw (current bounding box.north) node[above] {Slope field of \quad $y'=3-2$.}; \end{tikzpicture} How can I align these 2 figures next to each other properly centered to the page. They look like this when I compile it.
- Using tikz spath3 with *nodes*by DimanNe on November 26, 2021 at 8:39 am
I can use spath3 with paths (not nodes) in this way: \documentclass{article} \usepackage{tikz} \usetikzlibrary{spath3, intersections} \begin{document} \begin{tikzpicture} \draw[spath/save = rect, rounded corners=12pt] (0,0) rectangle (2,1); \draw[spath/save global = line3] (-1,-1) -- (0.4,0.75); \draw[spath/save global = line4] (-1,-1) -- (1,0.5); \tikzset{spath/.cd, split at intersections with={rect}{line3}, split at intersections with={rect}{line4}, get components of={rect}\cpts } \draw[ultra thick, color=red, spath/restore=\getComponentOf\cpts{3}] node {}; \end{tikzpicture} \end{document} Result: So far so good. But what I really need is highlight a part of rectangle node in the intersection with a double line, and it does not work: \documentclass{article} \usepackage{tikz} \usetikzlibrary{spath3, intersections} \begin{document} \begin{tikzpicture} \node[spath/save global = rect, rectangle, rounded corners=12pt, draw=black!50, thick, fill=white, minimum height=27pt] {asdfasdfasdfasdf}; \draw[spath/save global = line, line width=1pt, double=white, draw=black!20, double distance=3pt] (-2, -1) -- (-0.5,0.0); \tikzset{spath/.cd, split at intersections with={rect}{line}, split at intersections with={rect}{line}, get components of={rect}\cpts } \draw[ultra thick, color=red, spath/restore=\getComponentOf\cpts{2}] node {}; \end{tikzpicture} \end{document} Any ideas?
- TIKZ Macro for drawing pyramids of circlesby jadou on October 30, 2020 at 12:31 pm
I would like to provide the size of the pyramid and to get something as below. Thank you
- Communication Diagram in TikZby Gregory Gelfond on April 16, 2020 at 3:30 pm
I'm trying to find a way to generate the following diagram using TikZ: I know how to generate it minus the adornments such as the cloud, and icons for the server and client (using a simple node like a circle etc.), but I haven't been able to find any library of shapes that would allow me to replicate this. As a stop-gap I can use OmniGraffle on the Mac to generate a scaleable PDF, but if I can use TikZ to do this I'd prefer to.
- How to draw tan(x) without pgfplot?by user108724 on January 27, 2020 at 4:42 pm
I want to know why output of the following MWE is ugly? i.e. yrange=-3:3 has no effect!! \documentclass[12pt]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \begin{document} \begin{tikzpicture}[domain=-4:4] \draw[very thin,color=gray] (-0.4,-4) grid (4,4); \draw[->] (-4.2,0) -- (4.2,0) node[right] {$x$}; \draw[->] (0,-4.2) -- (0,4.2) node[above] {$y$}; \draw[domain=-2*pi:2*pi, color=blue, samples=100, yrange=-3:3] plot[yrange=-3:3] (\x,{tan(\x r)}) node[right] {$f(x) = \tan x$}; \end{tikzpicture} \end{document}
- Custom checkbox symbolby azetina on July 22, 2019 at 3:16 am
Consider the following MWE: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[line width=3pt,rounded corners] (0.75,1)--(0,1)--(0,0) -- (1,0) -- (1,0.5); \draw[xshift=0cm,yshift=0.35cm,line width=3pt] (0.25,0.25)--(0.5,0)--(1,0.5); \end{tikzpicture} \end{document} How can I create the same diagram by using coordinate or node definition. I want to convert this into a usable symbol that I can scale at any size, say the current font size and usable in mathmode. I know fontawesome has \faCheckSquareO, but I designed this since I want full control over the color of the each component of the diagram.
- \circlearound: Misalign of the circle centerby Candu on April 25, 2019 at 5:58 pm
I am using the following code, which I found here at StackExchange to draw a circle around some letters: \newcommand\circlearound[1]{% \setbox0=\hbox{#1}% \dimen0\wd0% \divide\dimen0 by 2% \begin{tikzpicture}[baseline=(a.base)]% \useasboundingbox (-\the\dimen2,0pt) rectangle (\the\dimen0,1pt); \node[circle,draw,minimum size=1.4em,outer sep=0pt,inner sep=0.2ex] (a) {#1}; \end{tikzpicture} } This works fine for normal letter but there is a misalignment for cursive fonts (italic type). Therefore, I want to define a second command \circlearoundItalic in which I misalign the center of the circle by 0.2em. Does anybody know the TikZ code to move the center of the circle by 0.2em to the right? Thank you!
- Text wrap of an objectby Matvey Sokolovsky on March 26, 2019 at 2:00 pm
I didn't manage to deal with a wrapping of my object. The object is made by function (that I found here), which is an LFG f-structure. I would like to place it on the right side of the page, and being wrapped with text on the left. All the code: % META \documentclass{article} \usepackage{lipsum} \usepackage{array} \usepackage{tikz} % ADDITIONAL FUNCTIONS \def\lfgms#1{ % creating figure with f-structure from LFG. \mbox{ \tabcolsep0pt\arraycolsep0pt $ \left[% \begin{tabular}{@{}>{\scshape}l@{\hspace{5pt}}>{\small}l@{}}% #1% \end{tabular}% \rule{0mm}{5mm}% \right]% $% }\vspace{1mm} } \newcommand{\mynode}[2] %creating nodes for tikz-lines {\tikz[baseline=(#1.base), remember picture]\node[outer sep=0pt, inner sep=0pt] (#1) {#2};} %DOCUMENT \begin{document} \lipsum[1] \lfgms{ ~pred & ~‘want\;\guilsinglleft\textsc{subj comp}\guilsinglright’~~\\ \\ ~tam & ~PRS\\ \\ ~foc & \mynode{foc4_1}{}\\ \\ ~subj & \mynode{zaur4}{\lfgms{ ~pred & `Zaur'~~\\ ~case & GEN~}}\\ \\ ~comp & \lfgms{ ~pred & ~‘come\;\guilsinglleft\textsc{subj}\guilsinglright’~~\\ \\ ~tam & ~ PAST \\ \\ ~foc & \mynode{foc4_2}{}\\ \\ ~subj & \mynode{alan4}{\lfgms{ ~pred & ~‘Alan'~~\\ \\ ~case & ~NOM~\\ }} } } \begin{tikzpicture}[overlay,remember picture] \draw[-] (foc4_1.east) -- (zaur4.east); \draw[-] (foc4_2.east) -- (alan4.east); \end{tikzpicture} \end{document} Now they are placed like this: So I want all the paragraph to wrap the object placed on the right. I tried to apply wrapfigure and got no result. PS compilator is xelatex
- On scaling I get an errorby Tolaso on April 24, 2018 at 9:32 am
When I scale the following code \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=0.6] [bend angle =60,inner sep=0pt, minimum size =10mm,very thick, from/.style={<-}, towards/.style={->}, protein/.style={circle,draw=black,very thick}, reaction/.style={}] \node[protein] (p) at (-2,0) {$\mathcal{A}$}; \node[protein] (ps) at (2,0) {$f(\mathcal{A})$} edge [towards, bend left] node [pos=0.5, below] {$f^{-1}$} (p) edge [from, bend right] node [pos=0.5, above] {$f$} (p) ; \end{tikzpicture} \end{document} I get the following error Package pgfkeys Error: I do not know the key '/tikz/towards' and I am going to ignore it. Perhaps you misspelled it. ...ft] node [pos=0.5, below] {$f^{-1}$} (p) If I remove the [scale=0.6] everything is fine and it compiles normally. What's going on and how can I can scale the figure?
- Decision Tree in LaTeX with TikZby Karine on November 3, 2017 at 5:42 am
Grid line doesn't have to be included \documentclass[10pt]{beamer} \usetheme{default} \usepackage{graphicx} \usepackage{amssymb,amsmath} \usepackage{tikz} \usetikzlibrary{matrix} \usepackage{adjustbox} \usepackage{caption} \ usepackage{subcaption} \setbeamercolor{title}{fg=black} \setbeamercolor{subtitle}{fg=gray} \setbeamercolor{footlinecolor}{fg=white,bg=green} \setbeamertemplate{footline}[text line]{% \parbox{\linewidth}{\vspace*{-10pt} \textit{Where Wall Street Goes to School} \hfill \insertpagenumber} } \setbeamertemplate{navigation symbols}{} – \begin{tikzpicture}[>=stealth,sloped][scale=0.8] \matrix (tree) [matrix of nodes, minimum size=0.25cm, column sep=2cm, row sep=1cm, ] { & $C_{i+1,j+1}$ \\ $C_{i,j}$ &$C_{i+1,j}$ \\ & $C_{i+1,j-1}$ \\ }; \draw[->] (tree-3-1) -- (tree-1-3) node [midway,above] {}; \draw[->] (tree-3-1) -- (tree-3-3) node [midway,above] {}; \draw[->] (tree-3-1) -- (tree-5-3) node [midway,below] {}; \end{tikzpicture} \end{adjustbox} –
- Highlight function in minted with background colorby jakun on June 21, 2017 at 12:30 pm
I would like to highlight a function in minted by giving it a background color in order to make the connection to a visualization better visible. I used to put the functions to be highlighted in a separate minted environment and specify a background color for the entire environment (in minted v1.7): % minted 2011/09/17 v1.7 \documentclass{article} \usepackage{minted} \newminted{c}{linenos, tabsize=4, gobble=2} \makeatletter \newenvironment{mintedBlock}{% % I can not use frame=topline|bottomline because that is inside of colored box % copied from /usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty line 918 in \def\FV@SingleFrameLine \noindent \FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}% }{% \FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}% } \makeatother \newcommand{\colorMain}{green!10}% \newcommand{\colorSum}{yellow!20}% \begin{document} \begin{mintedBlock} % I am using old package versions which are buggy, so firstnumber=last gives wrong numbering. \begin{ccode*}{frame=none, bgcolor=white} #include <stdio.h> \end{ccode*} \begin{ccode*}{frame=none, firstnumber=2, bgcolor=white} \end{ccode*} \begin{ccode*}{frame=none, firstnumber=3, bgcolor=\colorSum} int sum(int summand1, int summand2) { return summand1 + summand2; } \end{ccode*} \begin{ccode*}{frame=none, firstnumber=7, bgcolor=white} \end{ccode*} \begin{ccode*}{frame=none, firstnumber=8, bgcolor=\colorMain} int main() { int summand1 = 1; int summand2 = 2; printf("%d + %d = %d\n", summand1, summand2, sum(summand1, summand2)); } \end{ccode*} \end{mintedBlock} \end{document} The spacing of the rules was not perfect but apart from that it was good enough in minted 1.7. However I have recently upgraded to the newest version (minted 2.4.2dev) and now there are big spaces between the seperate minted environments. I have tried to remove them with \renewcommand{\vspace}{\@ifnextchar*\@gobbletwo\@gobble}% which makes it a lot better but still leaves too big spaces. Therefore I have tried it with a new approach: using escapeinside to insert tikz nodes with remember picture and drawing a rectangle around them later on. % minted 2017/02/10 v2.4.2dev \documentclass{article} \usepackage{minted} \newminted{c}{linenos, frame=lines, tabsize=4, gobble=1} \usepackage{tikz} \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture,baseline=(#1.base)] \node (#1) {\vphantom{I}};} \newcommand{\colorMain}{green!10}% \newcommand{\colorSum}{yellow!20}% \begin{document} \begin{ccode*}{breaklines, escapeinside=~~} #include <stdio.h> ~\tikzmark{sumtop}~int sum(int summand1, int summand2) { return summand1 + summand2; ~\tikzmark{sumbottom}~} ~\tikzmark{maintop}~int main() { int summand1 = 1; int summand2 = 2; printf("%d + %d = %d\n", summand1, summand2, sum(summand1, summand2)); ~\tikzmark{mainbottom}~} \end{ccode*} \begin{tikzpicture}[remember picture, overlay] \path[overlay, fill=\colorSum] (sumtop.north) rectangle ([xshift=\linewidth]sumbottom.south); \path[overlay, fill=\colorMain] (maintop.north) rectangle ([xshift=\linewidth]mainbottom.south); \end{tikzpicture} \end{document} Unfortunately the tikz picture is above the minted code. How can I put the tikzpicture behind the text? Also, I am not a hundred percent happy with this approach because I will run into problems if the code happens to move across a pagebreak. Does someone have a better idea?
- TikZ Drawing, Triangle, 2 Circlesby militarschutze on December 10, 2016 at 11:46 pm
I need to create something like this, anyone got any tipps or hints? This is how far I've gotten so far: \begin{tikzpicture} \draw (-2.82, 1.03) arc (-200: 60: 3); \draw (-3, 0) -- (3, 0); \draw (0, 0) -- (1.72, 0) -- (1.72, 0) -- (1.72, ); \end{tikzpicture} Kind of having trouble with figuring out how to define angles and actually draw them in. alpha = 72 degrees beta = 144 degrees alpha + beta = 216 degrees I have to draw it precisely with the given measurements. r (small radius) = 1.72 Any help would be great.
- Drawing "super-nodes" in a treeby Alex Shtoff on December 4, 2016 at 2:08 pm
I would like to draw a tree, with one of its node being a "super-node", which hides a sub-tree of some original tree. Here is the code: \begin{tikzpicture} \node [circle,draw] {A} child { node [circle,draw] {B} } child { node [circle,draw] {C} child { node [circle,draw] {E}} child { node [circle,draw] {F}} }; \node [xshift=6cm,circle,draw] {A} child { node [circle,draw] {B} } child { node [circle,draw,fill=gray!20] { \scriptsize \begin{tikzpicture} \node [circle,draw] {C} child { node [circle,draw] {E}} child { node [circle,draw] {F}}; \end{tikzpicture} } }; \end{tikzpicture} The result is that the super-node is "center-aligned", and hides the whole tree. I would like the super-node C's top-left corner to be at the same height as node B.
- How can I rotate this ellipse on xy plane?by alejandro muñoz on June 22, 2016 at 7:14 pm
I want to enclose the red circles into an ellipse, but this ellipse should rotate, but the rotation is wrong. \documentclass[border=1cm]{standalone} \usepackage[x11names,dvipsnames]{xcolor} \usepackage{tikz} \usepackage{tikz-3dplot} \usepackage{pgfplots} \usetikzlibrary{arrows,snakes,patterns,decorations.markings,shapes.geometric,angles,quotes,bending,petri,decorations.text,calc,arrows.meta,mindmap,trees} \usepgfplotslibrary{groupplots,polar} % \tdplotsetmaincoords{120}{50} %\tdplotsetmaincoords{45}{0} \begin{document} \definecolor{ffwwqq}{rgb}{1.,0.4,0.} \definecolor{ccqqqq}{rgb}{0.8,0.,0.} \definecolor{qqzzqq}{rgb}{0.,0.6,0.} \definecolor{ffffff}{rgb}{1.,1.,1.} %\definecolor{DeepPink1}{rgb}{0.49019607843137253,0.49019607843137253,1.} \definecolor{uuuuuu}{rgb}{0.26666666666666666,0.26666666666666666,0.26666666666666666} \begin{tikzpicture}[scale=5, tdplot_main_coords,axis/.style={->},thick] \draw[axis] (-1, 0, 0) -- (1, 0, 0) node [right] {$x$}; \draw[axis] (0, -1, 0) -- (0, 3, 0) node [right] {$y$}; \draw[axis] (0, 0, -1) -- (0, 0, 1) node [above] {$z$}; \draw [color=ffffff,fill=ffffff,fill opacity=1.0] (0.,0.) circle (6.cm); \fill[fill=black,fill opacity=0.75] (-7.,7.) -- (7,7.) -- (7,-7) -- (-7.,-7) -- cycle; \fill[white] (0,0,0) circle (6); \begin{scriptsize} \draw [fill=qqzzqq] (-2.5,2.) circle (0.25); \draw [fill=qqzzqq] (2.5,0.) circle (0.25); \draw [fill=qqzzqq] (0.,-3.1) circle (0.25); \draw [fill=ccqqqq] (-1.26,2.84) circle (0.125); \draw [fill=ccqqqq] (-3.74,1.16) circle (0.125); \draw [fill=ccqqqq] (1.26,-2.84) circle (0.125); \draw [fill=ccqqqq] (3.74,-1.16) circle (0.125); \draw [fill=ccqqqq] (1.26,1.16) circle (0.125); \draw [fill=ccqqqq] (3.74,2.84) circle (0.125); \draw [fill=ccqqqq] (-1.26,-3.36) circle (0.125); \draw [fill=ccqqqq] (0.5,-5.5) circle (0.125); \draw [fill=ccqqqq] (-0.5,-0.7) circle (0.125); \draw [fill=ccqqqq] (5.5,0.7) circle (0.125); \draw [fill=ccqqqq] (-4.38,3.46) circle (0.125); \draw [fill=ccqqqq] (-0.62,0.54) circle (0.125); \draw [fill=ccqqqq] (5.62,-0.54) circle (0.125); \draw [fill=ccqqqq] (-2.5,-1.) circle (0.125); \draw [fill=ccqqqq] (2.5,-5.2) circle (0.125); \draw [fill=ccqqqq] (-2.5,5.) circle (0.125); \draw [fill=ccqqqq] (2.5,0.) circle (0.125); \end{scriptsize} \fill[color=ffwwqq,ffwwqq,fill opacity=0.1] (0, -3.1,0) circle [x radius=4, y radius=3, rotate=90];%this ellipse \fill[color=ffwwqq,ffwwqq,fill opacity=0.1] (2.5,0,0) circle [x radius=3.3, y radius=3.6, rotate=0]; \fill[color=ffwwqq,ffwwqq,fill opacity=0.1] (-2.5,2,0) circle [x radius=2.5, y radius=3.5, rotate=0]; \end{tikzpicture} \end{document}
- How to draw the following pictures?by bing on May 23, 2016 at 2:15 am
I want to draw the following pictures, but I don't know how to draw it. Could anyone help me?
- plotting a function in 3d plotby WeakLearner on September 18, 2015 at 3:14 am
I want to plot functions within the simplex, but every time I add a function in the usual 2d plot way i get an error. How can I add a function of two variables, for example x^2+y^2 =0.5, here is the example: \documentclass[11pt]{article} \usepackage{tikz} \usepackage{tikz-3dplot} \usepackage{ifthen} \begin{document} \tdplotsetmaincoords{80}{130} \begin{tikzpicture}[scale=2,tdplot_main_coords] \coordinate (O) at (1,0,0); \coordinate (P) at (0,1,0); \coordinate (Q) at (0,0,1); \draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$}; \draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$}; \draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$}; \draw[thick,color=red] (O) -- (P); \draw[thick, color=red] (P) -- (Q); \draw[thick, color=red] (Q) -- (O); \end{tikzpicture} \end{document} update I tried with a different piece of code, but I still cannot write in a function of two different variables: \documentclass[border=3pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis}[ view/h=135, axis lines=center, xmax=1.5, ymax=1.5, zmax=1.5, ytick={1}, xlabel={$x_{1}$}, ylabel={$x_{2}$}, zlabel={$x_{3}$}, ] \addplot3[patch,blue!70!black!50,forget plot] coordinates { (1,0,0) (0,1,0) (0,0,1) }; \addplot3[no markers,red!90!black] coordinates { (0.25,0.1,0.45) (0.2,0.1,0.4) (0.24,0.36,0.4) (0.16,0.32,0.62) (0.12,0.3,0.58) (0.1,0.26,0.64) }; \addplot3[domain=0:2, red, thick] {x^2+y^2}; \node[fill=red!90!black,inner sep=1pt,circle,label={180:$Y$}] at (axis cs:0.1,0.26,0.64) {}; \end{axis} \end{tikzpicture} \end{document} For example, here I did x^2, which works, but I want to write y^2 for example which doesnt work, or z^2.. or any function of two variables. Note: the x^2 isn't actually the graph i want but im just trying to get the code to work for any function of two variables update 2 I had forgotten to use \addplot3, it seems to be working now.
- Draw a 2D functions in tikzby Dipole on August 4, 2015 at 10:58 am
I want to be able to plot in a 3D environment any type of function of two variables z = f(x,y), where x and y are specified within a given range. For instance plot f(x,y) = x^2 + y^2 where x in [-2,2] and y in [-2,2] as a "wireframe" surface plot. I want this plot to go on the rectangle (defined in the same coordinate system) that I have drawn, without the axis labels. How can this be done \documentclass[border=10pt,varwidth]{standalone} \usepackage{tikz,tikz-3dplot} \usepackage{pgfplots} \pgfplotsset{ every axis/.append style = {thick},tick style = {thick,black}, % % #1 = x, y, or z % #2 = the shift value /tikz/normal shift/.code 2 args = {% \pgftransformshift{% \pgfpointscale{#2}{\pgfplotspointouternormalvectorofticklabelaxis{#1}}% }% },% % range3frame/.style = { tick align = outside, scaled ticks = false, enlargelimits = false, ticklabel shift = {10pt}, axis lines* = left, line cap = round, clip = false, xtick style = {normal shift={x}{10pt}}, ytick style = {normal shift={y}{10pt}}, ztick style = {normal shift={z}{10pt}}, x axis line style = {normal shift={x}{10pt}}, y axis line style = {normal shift={y}{10pt}}, z axis line style = {normal shift={z}{10pt}}, } } \begin{document} % ----- First plot \tdplotsetmaincoords{70}{155} \begin{tikzpicture} [scale=3, tdplot_main_coords, axis/.style={->,blue,thick}, vector/.style={-stealth,black,very thick}, vector guide/.style={dotted,black,thick}, ] %standard tikz coordinate definition using x, y, z coords \coordinate (O) at (0,-0.5,0); %tikz-3dplot coordinate definition using r, theta, phi coords \pgfmathsetmacro{\ax}{1} \pgfmathsetmacro{\ay}{-1} \pgfmathsetmacro{\az}{0.5} \coordinate (P) at (\ax,\ay,\az){}; %draw axes \draw[axis] (0,-0.5,0) -- (2,-0.5,0) node[anchor=north east]{$y$}; % x-axis becomes y axis \draw[axis] (0,-0.5,0) -- (0,-2,0) node[anchor=south]{$x$}; %minius y-axis becomes positive x axis \draw[axis] (0,-0.5,0) -- (0,-0.5,2) node[anchor=south]{$z$}; \draw[thick,tdplot_main_coords] (1.5,0.5,0)-- (1.5,-0.5,0) -- (-1.5,-0.5,0)--(-1.5,0.5,0)--cycle; \begin{axis}[range3frame, view={55}{45}] \addplot3[surf, colormap/hot2, samples=41, domain=0:2] {0.1*(x^2+y^2)}; \end{axis} \end{tikzpicture} \end{document}
- Absolute positioning and blend groups in TikZby Marcos on June 5, 2015 at 4:05 pm
In order to have absolute positioning of a tikzpicture (meaning, in terms of the "current page" node), we need to set the "overlay" option for the picture. It seems there is a conflict between this and setting blend groups within the picture. If this is so, is there a way to circumvent it? I'd like to have both functionalities working together in the same tikzpicture. As an MWE, take \documentclass[11pt]{article} \usepackage{tikz} \pagestyle{empty} \begin{document} \begin{tikzpicture}[ remember picture, overlay,%<- Comment and uncomment to check the difference every path/.append style={fill opacity=0.75}, ] \begin{scope}[blend group=lighten] \fill[green] (90:1) circle[radius=1.5]; \fill[orange] (180:1) circle[radius=1.5]; \fill[red] (0:1) circle[radius=1.5]; \end{scope} \begin{scope}[xshift=6cm,blend group=darken] \fill[green] (90:1) circle[radius=1.5]; \fill[orange] (180:1) circle[radius=1.5]; \fill[red] (0:1) circle[radius=1.5]; \end{scope} \begin{scope}[xshift=12cm,blend mode=multiply] \fill[green] (90:1) circle[radius=1.5]; \fill[orange] (180:1) circle[radius=1.5]; \fill[red] (0:1) circle[radius=1.5]; \end{scope} \begin{scope}[yshift=-4cm,blend group=screen] \fill[green] (90:1) circle[radius=1.5]; \fill[orange] (180:1) circle[radius=1.5]; \fill[red] (0:1) circle[radius=1.5]; \end{scope} \begin{scope}[yshift=-8cm,blend group=overlay] \fill[green] (90:1) circle[radius=1.5]; \fill[orange] (180:1) circle[radius=1.5]; \fill[red] (0:1) circle[radius=1.5]; \end{scope} \end{tikzpicture} \end{document}
- Pascal's triangle in tikzby dalibor.zeleny on May 6, 2011 at 12:21 am
I would like to typeset the top part of Pascal's triangle. To get the triangle with the names of the binomial coefficients, i.e., {n \choose k}, I used the following code \begin{tikzpicture} \foreach \n in {0,...,4} { \foreach \k in {0,...,\n} { \node at (\k-\n/2,-\n) {${\n \choose \k}$}; } } \end{tikzpicture} The result is this Now I want to be equally lazy and do something like this for the values of the binomial coefficients, i.e., replace {\n \choose \k} in the node label with \CalculateBinomialCoefficient{\n}{\k} where \CalculateBinomialCoefficient is a hypothetical macro that calculates the binomial coefficient. Has anyone done something like that? The result should look like this: