New answers tagged

1

Even you are new to TikZ, but in fact your question is already answered in some answers of your previous questions. For the manual and a minimal introduction to TikZ, see this. Here is a way that you can control numbers a, b via [declare function]. \documentclass[tikz,border=5mm]{standalone} \begin{document} \begin{tikzpicture}[nodes={midway,magenta},join=...


1

With use of the quotes library: \documentclass[border=3.141592]{standalone} \usepackage{tikz} \usetikzlibrary{quotes} \begin{document} \begin{tikzpicture}[scale=0.50] \draw (0,0) to ["$c$"] (3,10) -- (13,7) -- (10,-3) -- cycle ; \draw (3,7) -- (13,7) ; \draw (3,7) -- (3,10) ; \draw (10,7) -- (10,-3); \draw (0,0) to ["$b$"] (3,0) -- (...


2

\documentclass[12pt]{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} [scale=0.50] \draw (0,0) -- node[left](){c}(3,10) -- (13,7) -- (10,-3) -- cycle ; \draw (3,7) -- (13,7) ; \draw (3,7) -- (3,10) ; \draw (10,7) -- (10,-3) ; \draw (0,0) -- node[above, pos=0.2](){b}(10,0) ; \draw (3,0) -- node[right](){a}(3,10) ; \end{...


0

Check the next links below: Stata module/package to generate a publication-quality subject disposition flow diagram in LaTeX using the PGF/TikZ package directly within Stata using texdoc: https://github.com/IsaacDodd/flowchart A collection of common examples for scientific papers especially for Deep Learning: https://github.com/lingkangjie/LaTex_Figures


1

An attempt using the TikZ calendar library. Work only with lualatex (too many nodes for pdflatex). Some further detail in the code comments. % !TEX program = lualatex \documentclass[border=3mm]{standalone} \usepackage{fontspec}% for LuaLaTeX only \setsansfont{Roboto}% for LuaLaTeX only %\usepackage{txfonts} \usepackage{tikz} \usetikzlibrary{calendar,...


3

With the help of quotes and angles libraries, it's not difficult to get it. \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{calc, angles, quotes, backgrounds} \begin{document} \begin{tikzpicture} \draw (0,0) node[below left] {$C$} coordinate (C) -- (0,3) node[above left] {$A$} coordinate (A) -- (5,0) node[below right] {$B$} coordinate (B)--...


3

Whithout lua \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture} \draw[-Latex] (0,0) -- ++(90:3.5); \draw[-Latex] (0,0) -- ++(0:12.5); \begin{scope} \path[clip] (0,0) rectangle (12,3.5); \foreach \i/\j [count=\ni] in {0/orange,1/green,2/blue,3/red,4/brown} \draw[\j, xshift=-3cm] (3cm*\i,0)--...


5

Just for fun, an animated (beamer) version. \documentclass {beamer} \usepackage {tikz} \usetikzlibrary{calc} % beamer configuration \setbeamertemplate{navigation symbols}{} \usefonttheme {serif} \def\n{20} % transitions (half) \def\a{1.5} \def\b{3} \pgfmathsetmacro\l{\a+\b} % square lenght \definecolor{color1}{HTML}{1F78B4} \definecolor{color2}{...


0

Updated answer: How's this? I don't know what \x is for, so I just ignored it. The shade balls are now no longer wider than the small pipe. Is that on the right track? MWE \documentclass[tikz,border=5]{standalone} \usetikzlibrary{decorations.markings,decorations.pathreplacing,calc} \makeatletter \usetikzlibrary{spy, backgrounds} \usetikzlibrary{calc,fadings,...


8

You can use \usetikzlibrary{snakes} \documentclass[border=1cm]{standalone} \usepackage{tikz} \usetikzlibrary{snakes} \begin{document} \begin{tikzpicture}[->,>= stealth] \draw[snake=snake,red] (0,0) -- (3,0) node[below,xshift=-1.5cm,yshift=-0.25cm] {$\Delta E=hv$}; \end{tikzpicture} \end{document} You can achieve the same by using \...


3

Welcome to TeX.SE! Just add nodes above given coordinates: \documentclass[border=3.141593]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (0,0) node[above] {A} -- (2,1) node[above] {B}; \end{tikzpicture} \end{document} [![enter image description here][1]][1] Addendum: You are quite demanding: full service for two equal problems....


2

With support of Lua I figured something like this out: \documentclass{standalone} \usepackage{tikz} \usepackage{luacode} \begin{document} \begin{tikzpicture}[ x = 2cm, y = 2cm, plot label/.style = {above right}, xticklabel/.style = {below} ] \begin{luacode} xmin, xmax, denom, step = 0, 40, 8, 8 n = xmax - xmin ...


5

I propose this solution withe pst-eucl module of pstricks, which can mimick constructions of plane geometry: \documentclass[border=6pt]{standalone} \usepackage[x11names,svgnames]{xcolor}% \usepackage{pst-eucl} \begin{document} \begin{pspicture}(-1,-1)(7,5) \psset{PointSymbol=none, linejoin=1,CodeFigStyle=solid, CodeFigColor=black} \pstTriangle[PosAngle={...


2

This uses a 3-4-5 triangle. \documentclass[tikz]{standalone} \usetikzlibrary{calc,angles} \def\rightanglesize{2mm} \def\rightangle(#1)(#2)(#3){% draw right angle mark for angle #1-#2-#3 \path ($(#2)!{\rightanglesize}!(#3)$) -- ($(#2)!{\rightanglesize}!(#1)$) coordinate[midway] (rightangle#1#2#3); \draw ($(#2)!{\rightanglesize}!(#3)$) -- ($(#2)!...


2

You can use adjustbox to scale the clip. \documentclass{article} \usepackage{tikz} \usepackage{graphicx} \usepackage[left=2.00cm, right=2.00cm, top=1.00cm, bottom=1.00cm]{geometry} \newif\ifdeveloppath \tikzset{/tikz/develop clipping path/.is if=developpath, /tikz/develop clipping path=true} \newcommand{\clippicture}[2]{ \begin{tikzpicture} ...


5

\documentclass[tikz, border=1cm]{standalone} \usetikzlibrary{shadings} \begin{document} \begin{tikzpicture} \shade[shading=color wheel, even odd rule, shading angle=20] (0,0) circle[radius=2.4] (0,0) circle[radius=2.2]; \shade[shading=color wheel, even odd rule] (0,0) circle[radius=2.0] (0,0) circle[radius=1.8]; \node at (20:2.8) {$N1$}; \node at (...


5

Not sure if this is what you want? \documentclass{article} \usepackage{tikz} \usetikzlibrary{shadings} \begin{document} \tikz{ \shade[shading=color wheel,even odd rule] circle[radius=2.4]circle[radius=2.2]; \shade[shading=color wheel,even odd rule,transform canvas={rotate=72}] circle[radius=2]circle[radius=1.8]; \foreach\NODE in{...


4

Just be comparison with Asymptote! Compile at http://asymptote.ualberta.ca/ unitsize(cm); pair A=(0,0),B=(4,4); real a=1,b=3; defaultpen(fontsize(9pt)); // Define your triangles picture triangle(pen color, real poslabelb=0.5, bool labelc=true) { picture pic; fill(pic,(A+a*dir(90))--A--(A+b*dir(0))--cycle,color); label(pic,Label("$a$",...


1

As Black Mild suggested, you need to include nodes inside the pic to reference them. Following code shows another version for your switch. The complete switch is a pic and every port is a node with a path picture to draw the hole. \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{calc, shadings, shadows, shapes.arrows, matrix} \usetikzlibrary{...


8

It also can be done easily with pstricks: \documentclass[border=6pt]{standalone} \usepackage[x11names,svgnames]{xcolor}% \usepackage{pst-node} \usepackage{relsize} \begin{document} \begin{pspicture}(-3,-3)(11,3) %\psset{PointSymbol=none, PointName=none} \pnodes(-3,3){A}(3,3){B}(3,-3){C}(-3,-3){D} \pnodes(-1,3){A1}(3,1){B1}(1,-3){C1}(-3,-1){D1} \pnodes(5,3)...


0

Maybe the image below will help you (0.15mm is half the thickness of the line) \documentclass[a4paper]{article} \usepackage[showframe,margin=1cm]{geometry} \usepackage{tikz} \usepackage[most]{tcolorbox} \setlength{\parindent}{0pt} \begin{document} \begin{tikzpicture} \fill [fill=black!30] (0,0)--(1.7,0)--(1.7,0.6)--(0,0.6)-- cycle; \draw[color=red,...


13

It seems there is no plain TikZ yet. Here is my plain TikZ way. The code is quite lengthy but simple and highly customized (so you are free to customize ^^). I explain a bit: \a, \b, \c are three sides, pyth is the style for legendary; Most of nodes in the picture is in midway position, so I put nodes={black,midway} in a scope; Colors can be taken ...


0

Well decided to put work in progress here.. Chronos is something I made into a local package from https://tex.stackexchange.com/a/342699/144214 waiting for the author to reply regarding repo location, otherwise I will publish Right now it only has the coloured butt end line \documentclass[border=10pt,multi,tikz]{standalone} \usepackage{chronos} \begin{...


2

You can draw the body using a smooth curve (see this question). For instance, adding following lines to your tikzpicture: \draw[dashed, red] (-1,3.3) -- (1,3) -- (1.5,2.5) -- (2.5,2) -- (3,-1) -- (2.5,-3) -- (1.5,-2.5) -- (0.5,0) -- cycle; \draw plot [smooth cycle, tension=.4] coordinates {(-1,3.3) (1,3) (1.5,2.5) (2.5,2) (3,-1) (2.5,-3) (1.5,-2.5) (0.5,0)}; ...


2

As John has mentioned this looks more like a graph. If you want to draw it as a figure, here is my attempt: \documentclass[x11names,svgnames,11pt]{article} % \usepackage{tikz} \begin{document} \begin{figure} \centering ...


5

I found the problem: in the standard LaTeX math font, the minus sign has a box that is the same size of the plus sign, and centered. In the Latin Modern Math, the minus has a box which is asymmetric. Look at this example and test with or without unicode-math and Latin Modern Math... % TeX program = lualatex \documentclass{standalone} \usepackage{unicode-...


0

I figured out a walkaround! "Large" and "large" are not the same! I changed all to small "l" and it lined the icons up. \ifthenelse{\equal{\givencvdate}{}}{}{\textsc{\Large\icon{\Info}} to \ifthenelse{\equal{\givencvdate}{}}{}{\textsc{\large\icon{\Info}}


2

Please, always provide an MWE, which reproduce your problem Sorry, but your question is not entirely clear. What you like get from your code fragment? Just illustration of an intersection or intersections? Your code fragment is not complete. Paths defined in your code fragment doesn't intersect For illustration you can simplify your code of picture for ...


1

To fix this, you have to modify the cls file. I actually don't know whether it looks right in your context, since you do not provide a complete document showing your settings. First, change the definition of \icon to \newcommand*\icon[2][-1.3mm]{\tikz[baseline={(0,-1.5mm)}]{ \node[shape=circle,draw,inner sep=1pt, fill=mainblue,mainblue,text=white,...


2

Extending the scope may help \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{calc, shadings, shadows, shapes.arrows} \usetikzlibrary{positioning, intersections} \tikzset{mark coordinate/.style={inner sep=0pt, outer sep=0pt, minimum size=3pt, fill=#1, circle} } \begin{document} \begin{tikzpicture}[scale=1, font=\...


3

Most likely still in need of improvement but probably a place to start from: \documentclass{article} \usepackage{chemfig} \catcode`\_=11 \definearrow4{<Uu=>}{% \CF_arrowshiftnodes{#4}% \path[allow upside down](\CF_arrowstartnode)--(\CF_arrowendnode)% node[pos=0,yshift=1pt](\CF_arrowstartnode u0){}% node[pos=0,yshift=-...


6

Based on Zarko's answer, the following trick redefines \\ to mean what \nl means in Zarko's answer. Hence you can use \\ as usual. \documentclass[tikz,border=9]{standalone} \usetikzlibrary{chains} \begin{document} \makeatletter \def\tikz@align@newline{\vphantom{bg}\pgfutil@protect\tikz@align@newline@} \begin{tikzpicture}[ node ...


4

just guessing ... \documentclass[border=1mm]{standalone} \usepackage{tikz} \usetikzlibrary {decorations.pathmorphing} \begin{document} \begin{tikzpicture}[decoration=snake] \draw [decorate,dash pattern=on 0.5pt off 0.25pt, ->] (0,0) -- (3,0); \end{tikzpicture} \end{document}


2

The following approach modifies the codebase as lightly as possible. It lets you use in looseness along with in, and the good old computation is used to compute the second control point. Then, it uses out looseness to define the first control point as follows ($ the starting point ! out looseness ! the second control point $) You can swap out/from/start ...


5

If you no preference ... \documentclass[border=3.141592]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta, chains, positioning, quotes, shapes.geometric} \usepackage{amsmath} \usepackage[lm]{sfmath} \usepackage[low-sup]{subdepth} \begin{document} \begin{tikzpicture}[ node distance ...


4

You can add a couple of coordinates and draw the arrows passing through them. With the help of the calc library is easy to find their positions relative to the original nodes. Something like this: \documentclass[border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric, arrows, calc} \begin{document} \tikzstyle{process} = [circle, minimum ...


4

It feels like you want to define a path that depends only on the in angle. Since, in TikZ, curved paths are cubic béziers, specifying only the in angle isn't enough information. So we need to figure out another control point to give a reasonable curve. The following code does this in the following way. We start by defining the second control point at the ...


3

Needless to say, this is not the only approach possible. \documentclass{article} \usepackage{amsmath} \usepackage{tikz} \usetikzlibrary{tikzmark}% not used yet \newcommand{\tikzgroup}[2]% #1 = math, #2 = node name {\tikz[baseline=(#2.base), remember picture] {\node[inner sep=0pt] (#2) {$#1$};}} \begin{document} \hrule% size test \begin{equation*} \rule[-...


8

A possible solution: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{chains, positioning} \begin{document} \begin{tikzpicture}[ node distance = 1cm, start chain, execute at end node={\vphantom{bg}}, % <--- every node/.append style={on chain, draw, align=center}, ] \def\nl{\vphantom{bg}\\} %...


5

I put \Angle as the angle of phi, and I consider two cases \Angle from 0 to 180, and \Angle from 180 to 360. For example, with \Angle = 70 \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{3dtools,calc}%https://github.com/marmotghost/tikz-3dtools \begin{document} \foreach \Angle in {70} {\begin{tikzpicture}[3d/install view={phi=\Angle,...


2

Welcome to TeX.SE!! I'd do this with tikz and a matrix of math nodes from the (tikz) matrix library. The calc library could be useful too to control the positions (which can be improved as needed). Something like the following: \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{calc,matrix} \begin{document} \begin{tikzpicture}[line cap=round] \...


1

First Example \documentclass[preview,border=12pt]{standalone}% please change it to your own class, for example article, book, etc \usepackage{amsmath} \usepackage{cancel} \begin{document} $ \begin{aligned} t &=\frac{\bcancel{a}\times b}{\bcancel{a}} \\ &= b \end{aligned} $ \end{document} Second Example \documentclass[12pt]{article} \usepackage{...


2

For a single paragraph, you can use \hangindent. Wrapfig can handle multiple paragraphs, which makes it more complicated (and fragile). I wasn't sure what to use for the height of the first line (to align the tops). 13pt and \ht\strutbox were both too big. Also, I wasn't sure what [align=justify] does, but however you specify it, what you need is a \parbox....


2

Note that your question is about PGF/TikZ, not pgfplots. The command \pgfgetlastxy returns numbers in pt. To get some number in cm, you can use \pgfmathsetmacro{\dABcm}{\dAB*(1pt)/(1cm)} \documentclass[tikz,border=5mm]{standalone} \begin{document} \begin{tikzpicture} \draw[gray!30] (-1,-1) grid (5,4); \path (0,0) coordinate (A) node[below left]{A} (4,3) ...


12

pgf stores the blend mode in an array, that is allowed (but deprecated in pdf 2.0) but the validator seems not to like it. You can patch the command to use only a name: \usepackage{etoolbox} \makeatletter \patchcmd\pgfsys@blend@mode{[ /\pgf@temp ]}{/\pgf@temp}{}{\fail} \makeatletter (I opened an issue for this https://github.com/pgf-tikz/pgf/issues/1037) ...


2

\documentclass{article} \usepackage[most, minted]{tcolorbox} \definecolor{Button1}{RGB}{254,94,86} \definecolor{Button2}{RGB}{254,188,45} \definecolor{Button3}{RGB}{38,202,59} \begin{document} \begin{tcblisting}{listing engine=minted,minted style=native, minted language=python, colback=white,colframe=black,listing only, title= \tikz { \node[...


4

The code is using remember=\myangle as \myangle. It looks a bit fishy to use the same command name (and this also not documentated). It probably worked because of an undocumented side effect (the second command wasn't properly initialized) but with https://github.com/pgf-tikz/pgf/issues/855 this has changed. \documentclass{article} \usepackage{tikz} \begin{...


4

Something like this? \documentclass{article} \usepackage{fullpage} \usepackage{tkz-tab} \begin{document} \begin{center} \begin{tikzpicture} \tkzTabInit[lgt=6,espcl=3,deltacl=0] {x /.8, $|x+1|$ /.8, $|x+2|$ /.8, $|x-3|$ /.8,$p(x)=|x+1|-|x+2|+|x-3|$/.8} {$-\infty$,$-2$,$-1$,$3$,$+\infty$} % four main references ...


2

Your tex file complies fine in my TeX Live 2021 and generates the following picture:


2

Welcome to TeX.SX! If you just want to make this work with plain expressions such as a_b or the like, that don't contain any additional macros, you could make use of the xstring package to replace the underscore in the node text by its equivalent macro, such as follows: \documentclass[tikz, border=2mm]{standalone} \usepackage{xstring} \newcommand\block[1][ ...


Top 50 recent answers are included