Tag Info

2

The variables you are looking for are called 'styles'. The styles can also have parameters. As an example, mynode/.style={circle,minimum size=2cm,fill=#1}, mynode/.default={white} defines a style mynode with one parameter, the fill color. Its default value is white. \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[ mynode/...

3

You should use styles: \documentclass{article} \usepackage{tikz} \tikzset{ NodeClassic/.style={draw,circle, minimum size=2cm}, NodeRed/.style={circle, minimum size=2cm, fill=red}, NodeBlack/.style={circle, minimum size=2cm, fill=black!20}, } \begin{document} \begin{tikzpicture} \node[NodeClassic] (P0) at (0,0) {$1$}; \node[NodeRed] (P1) at (...

0

(Plotting animation frames with TikZ) We have to solve the equation of motion, which is a set of Ordinary Differential Equations (ODE). For a double-pendulum with equal masses and compound pendulum lengths, the four differential equations to be solved are listed at the end of section "Lagrangian" in this Wikipedia article: https://en.wikipedia.org/...

2

The nicematrix package offers a built-in way to increase the row heights using cell-space-top-limit and cell-space-bottom-limit similar to the commands provided by the cellspace package. Instead of multiple \Block commands and manual linebreaks, I suggest using a horizontally centered m type column for the second column. Since the text was too wide for the ...

7

I'g go for a 3d approach here. I think that it is almost as simple but it looks a little better. I left the labels for you. \documentclass[border=2mm]{standalone} \usepackage {tikz} \usetikzlibrary{3d} \begin{document} \begin{tikzpicture}[line cap=round,line join=round,x={(-0.3590cm,-0.4278cm)},y={(0.9333cm,-0.1646cm)},z={(0cm,0.8887cm)}] % coordinates ...

9

Another way to do it, directly with tikz: \documentclass[border=2mm]{standalone} \usepackage{tikz} \definecolor{mycolor}{HTML}{DB4323} \begin{document} \begin{tikzpicture}[mycolor,line join=round] \def\r {2} % radius \def\hs{4} % height (shaft) \def\hc{0.5} % height (base, capital) % BASE, CAPITAL \foreach\i in {0,180} {% \begin{scope}[...

4

The "AHA!" moment for this was realizing that the indentation for each line is equal to a multiple of the prevailing \baselineskip -- the optional argument to \cdcov allows you to alter this at will. The entry of the information is relatively straightforward (semicolon-separated entries), though the final assembly must be undertaken by the user. I ...

9

I have drawn using Mathcha (tool) for your Roman column(s) in LaTeX....They are the only unique pieces that I have left in my museum 😂😂😂😂. You can choose the colors directly into the code. I remember when I was drawing at my school when I was a student, I used a sanguine pencil. They are not perfect Roman columns like your drawing...but they are very ...

1

Here is a way to do that with nicematrix. \documentclass{article} \usepackage{nicematrix} \usepackage{tikz} \usetikzlibrary{backgrounds,calc} \begin{document} \newcommand\MyRule{\rule[-8mm]{0pt}{18mm}} \begin{NiceTabular}{r*{2}{>{$}wc{12mm}<{$}}}% [ baseline=3, code-before = \tikz \draw[shade] (2-|2) -- ($(3-|2)!0.5!(4-|2)$) -- ($... 1 Here's a start. Make sure you have a look at https://ctan.org/pkg/pgf, especially the document Minimal introduction to TikZ (unofficial). pgfplots might be too much at the beginning if you have never used it. In that case, just use tikz in the beginning. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{... 5 \documentclass{article} \usepackage{graphicx} \usepackage{lmodern} \newdimen\zz \zz=25pt \begin{document} \makeatletter \def\usezz{\ifcase\numexpr15-\@multicnt\relax Something About This\or Text about that\or MY NAME\or some Other text\or Random Words HERE\or Some Name\or This\or THAT\or ZZZZZZZ\or \LaTeX\ text\or \textit{Italic text}\or Mathematics$x^2+...

0

After reading this question, I found that using the tikz quotes library \usetikzlibrary{quotes} gives me the basic functionality I need, as in the example below, but I don't really understand what the quotes library is doing, or how to customize position, etc. using this library. Any other methods to accomplish this, or explanations of how to manipulate the ...

1

Red lines indicate textwidth/margins. \documentclass[12pt]{scrartcl} \usepackage{pgfplots} \usepackage{tikz} \usepackage{blindtext} \usepackage{showframe}\renewcommand*\ShowFrameColor{\color{red}} \newlength{\mylength} \settoheight{\mylength}{S} \begin{document} \noindent \begin{minipage}[t]{0.6\linewidth} \blindtext[0] \end{minipage}% \begin{...

1

\documentclass[12pt]{scrartcl} \usepackage{pgfplots} \usepackage{tikz} \usepackage{blindtext} \begin{document} \noindent \hbox to \linewidth{% \begin{minipage}[c]{0.5\linewidth} \blindtext[0] \end{minipage}\hspace{1in} \begin{minipage}[c]{0.3\linewidth} \begin{tikzpicture}[scale=0.4,] \begin{axis} [ view={0}{30}, axis lines=none,] ...

4

I think there has to be a simpler way to do it, but here is a possible solution. I changed the position of some "dice" slightly to improve the visibility of the lines connecting them. And these lines are all straight, some can be curved but then they would have to be removed from the \foreach. \documentclass[border=2mm]{standalone} \usepackage {...

1

Save complex contents of nodes, like tikzpictures with axis environments, in a box and use these boxes inside another tikzpicture. Use the LaTeX commands \newsavebox, \savebox and \usebox; see e.g. here for a description. You can set a minimum height and width of the nodes such that they do not collapse if there is not much text inside. In principle it is ...

0

\documentclass{article} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{positioning,calc, fit} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \tikzset{myblock/.style = {rectangle, draw, minimum height=3cm} } \begin{tikzpicture} % \node (foo)[myblock]{ % \begin{tikzpicture} \...

3

Your version is almost achived, congratulations. I used some of your work and add a bit of mine. \documentclass[tikz,border=3.141592mm]{standalone} \usetikzlibrary{arrows.meta} \usepackage{newtxtext,newtxmath} \newcommand{\defclr}{ \pgfmathsetmacro\wavelen{\wavemax-(\wavemax-\wavemin)*\i/\t} \definecolor{clr}{wave}{\wavelen}} \begin{document} \...

3

For the moment I ended up with this: \documentclass{article} \usepackage{tikz} \usetikzlibrary{patterns} \begin{document} \def\total{15} \newcommand{\plane}[3][fill=blue!10!white]{ \pgfmathsetmacro\wavelen{650-(650-420)*#2/\total} \definecolor{adc}{wave}{\wavelen} \fill[opacity=0.7,adc] (#3, 0, #2) rectangle (#3+3, 3, #2); } \hspace*{-4cm}% ...

2

My try below. I added the structure on variables on the 2 foreach, so you can position the nodes as you wish, that it will work. \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \n/\x/\y in { % layer 0 1/0/0, % layer 1 2/-1/1, 5/0/1, 3/1/1, % layer 2 4/-2/2, 10/-1/2, 6/0/2, ...

2

\coordinate[label = {[label distance=3pt]180:E}] (E) at (3,-3); MWE \documentclass[border=5pt]{standalone} \usepackage{tikz} \usetikzlibrary{matrix,decorations.pathreplacing, calc, positioning,fit} \begin{document} \begin{tikzpicture}[x=0.5cm,y=0.5cm] \coordinate[label = below left:A] (A) at (0,0); \coordinate[label = above:B] (B) at (1,4); \...

2

Here is an automatic method. \documentclass{article} \usepackage{nicematrix,tikz} \usetikzlibrary{calc} \ExplSyntaxOn \cs_new_protected:Nn \__projetmbc_ii:n { \begin{tikzpicture} \draw [->] ($(#1-|2)+(-1mm,4pt)$) -- ($(\int_eval:n { #1 + 1 } -| 2)+(-1mm,-4pt)$) ; \draw [->] ($(#1-|3)+(1mm,4pt)$) -- ($(\int_eval:n { #1 + 1 } -| 3)+(1mm,-... 3 \documentclass[tikz, border=2mm]{standalone} \begin{document} \begin{tikzpicture} \foreach \i in {0,1,2,...,8}{ \foreach \j [evaluate=\j as \num using int(9*(4-\j)+\i+1)] in {1,2,3,4} \node[fill=blue!15, minimum size=1cm, draw] at (\i,\j) {\num}; } \end{tikzpicture} \end{document} 1 One more solution, with defined styles of images' element, partly used polar coordinates, used the quotes library for labeling of vectors and light curve. By the library intersections are calculated coordinates of dashed lines so, that they are parallel to vectors: \documentclass[border=3mm]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta, ... 5 Welcome to Tex.Se. Here you have something small to begin with: Next time please provide a MWE. It is not that hard to learn at least the absolute basics, like drawing a line and showing some effort will be appreciated. \documentclass[border=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[inner ... 1 \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{calc,patterns,angles,quotes, arrows.meta} \begin{document} \begin{tikzpicture} \coordinate (origo) at (0,0); \draw[thick, -Latex] (origo) -- ++(90:3) ; \draw[thick, -Latex] (origo) -- ++(0:3) ; \draw[thick, -Latex] (origo) -- ++(20:3) node[red, pos=0.7, below=-2pt, sloped ](... 6 \documentclass[tikz, margin=3mm]{standalone} \usepackage{siunitx} \usetikzlibrary{positioning,calc, arrows.meta} \usetikzlibrary{decorations.pathreplacing} \begin{document} \begin{tikzpicture} \draw[->, -Latex, line width=1pt] (0,0)node(a){} -- (11,0) node (b) {} ; \foreach \x [count=\i] in {0,50,...,500} { \def \inBetSpace {1} \draw[line ... 0 Here's a LuaLaTeX-based solution. It employs two for loops. \documentclass{article} \usepackage{array} % for \extrarowheight length parameter and 'w' column type \usepackage{luacode} % for \luaexec macro \begin{document} \setlength\extrarowheight{2pt} % make squares 14pt wide and tall \setlength\tabcolsep{4pt} \begin{tabular}{|*{9}{w{c}{6pt}|}} \hline \... 0 \pgfmathprintnumber solves the problem. I really don't know why this is so complicated. 5 Here is a solution. \documentclass{article} \usepackage{nicematrix,tikz} \usetikzlibrary{calc} \begin{document}$\begin{NiceArray}{r@{}c@{}l} 2x+3 & {} = {} & 5x-4 \\[7mm] 2x & {} = {} & 5x-7 \\ \CodeAfter \begin{tikzpicture} \draw [->,shorten < = 1pt, shorten > = 1pt] let \p1 = ([xshift=-1mm]1-1.south east) , ...

2

You can start, for example, with the following example. The trick is to draw the resistor not between A and B, but from the intermediate horizontal level. A bit of math solves the rest (notice that the math here is for different angles than the one marked in the OP diagram). I did just one side and manually --- you can clearly use a \foreach loop, but to ...

1

\documentclass[border=10pt]{standalone} \usepackage{tikz} % Macro to read in configuration parameters \newcommand*\ReadCfg[3]{% \expandafter\xdef\csname#1#2list\endcsname{#3}% } % Provide list for upper positions (this macro will be looped by \foreach) % \jobname is 'AUT' \providecommand\ListUpper{% \csname\jobname upperlist\endcsname% } % This ...

3

With pgfplots package. The error dimension too large is avoided by use of restrict y to domain: \documentclass[12pt]{article} \usepackage{geometry} \usepackage{pgfplots} \pgfplotsset{compat=1.17} \usepackage[skip=1ex, font=small, labelfont=bf]{caption} \begin{document} \begin{figure}[ht] \pgfplotsset{ axis lines=center, grid, grid style={...

0

This is probably best solved outside of TikZ's matrix. Using beamer's \alt in an array environment as shown Update matrix entries in beamer is a simpler and more appropriate solution I'm now thinking.

0

Dimension too large is an annoying error. In most cases, you can use Asymptote (better accuracy) to avoid it. I give below an incomplete solution using plain TikZ. \documentclass{article} \usepackage{amsmath,amsfonts,amssymb} \usepackage{tikz} \begin{document} \subsubsection*{Negative Integer Powers} The graphs of power functions that have negative integer ...

1

The syntax could be hidden a bit and I'm not quite sure about the first column squares but something like \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \begin{frame}[fragile]{} \newcommand\showmatrix{% \begin{tikzpicture} % \tikzstyle{unseen} = [color=blue!70] \tikzstyle{seen} = [] \matrix (m) [...

3

As I see, your problem is already solved by @rmano answer (+1), however, I wouldn't recommend your approach of drawing your image. It make (according to my opinion) make image code longer and less clear. Compare the following two notation defining coordinates in your picture: \point{0}{f(14)} (0,{f(14)}) both defines the same coordinate. ...

0

In order to make your code compilable, you can use \begin{frame}[fragile] ... \end{frame} instead of \frame{ ... }. You might also want to add something along the lines of [scale=0.4] to your tikzpicture environment in order to make sure the image fits onto the slide: \documentclass{beamer} \usepackage{tkz-berge} \begin{document} \begin{frame}[fragile] \...

0

\documentclass{article} \usepackage{tikz} \usetikzlibrary{ positioning, calc, shapes.geometric, matrix} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{arrows.meta} \pgfplotsset{compat=1.17} \pgfplotsset{every x tick label/.append style={font=\footnotesize, yshift=0.6ex}}...

2

I am not sure about what you are trying to do here, but --- macro expansion in paths is not straightforward --- a macro is not a function, so you can have strange surprises (for example, #1^2 if passed -2 becomes -2^2 which will give -4...). I would use a function, really: \documentclass[border=10pt]{standalone} \usepackage{tikz} \newcommand{\point}[2] { ...

3

I may be misunderstanding your actual goal here, but I've found a solution that allows you to externalise the tcolorbox with its tikzpicture without surrounding it in another tikzpicture (as that causes no end of difficulties). It turns out that the tcolorbox package has its own externalisation feature that can be applied a bit more broadly than the external ...

5

As answered in comments, the correct way to write the coordinate is (3, {sqrt(3)}) with braces. The reason is that when parsing coordinates TeX is looking for a comma and a closing parenthesis, so when it sees (3, sqrt(3)) it gets confused by the parenthesis after 3 and it fails the parsing. You have to "hide" the parenthesis that is not part of ...

4

\documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \tikzset{sphere/.style={ draw, thick, #1!75!black, ball color=#1, circle, }} \tikzset{arrow/.style={ very thick, ->, >=latex }} \...

3

This is not an answer, but an extended reply to a comment question from the OP. I suggested creating one layer in each color and overlaying them with an (x,y) shift. As to how that might be done, I sure tikz has its own ways of retaining and overlaying layers, but here I use \stackinset to overlay three (in this case identical) layers. \documentclass{...

0

\documentclass[tikz, margin=3mm]{standalone} \usetikzlibrary{positioning,calc, arrows.meta} \usetikzlibrary {shapes,matrix} \usetikzlibrary {graphs, quotes} \begin{document} \begin{tikzpicture}[ terminal/.style={ circle, minimum size=1.5cm, very thick, draw=blue, anchor=center, },...

2

Here's how I would draw this. The blue nodes are linked to the lines so moving the nodes should move all the lines as well. The styles of the arrows and nodes can be changed by changing part of \tikzset{<name>/.style={<style>}}. \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \...

0

After some tests, it seems to me that a graph uses node contents as node names, therefore it's impossible that two nodes have the same contents because they are interpreted as the same node. If you want to "write" the same contents into different nodes of a tree, you need to give a particular name to every node and use as option to assign the ...

3

You can use the canvas setting and pic definition to draw angle easily. For example, if you draw on xy plane, simly define the canvas as \draw [canvas is xy plane at z = 0] <code here>; Here is the sample code, based on your code, as a starting point: \documentclass[tikz,border=10pt]{standalone} \usepackage{tikz-3dplot} \usetikzlibrary{angles,quotes} \...

1

Just use braces: \foreach \x in {1,2,3,4,5,6,7,8,9} {\draw (\x,1) circle(.25);}

1

Why not use the already provided trapezium shape? \documentclass[tikz, border=2mm]{standalone} \usetikzlibrary{positioning, arrows.meta, calc, shapes.geometric} \begin{document} \begin{tikzpicture} \node[trapezium, draw, minimum height=2cm, fill=magenta!50, shape border rotate=270] (a) {a}; \draw ($(a.top left corner)!.2!(a.top right corner)$)--++(0:...

Top 50 recent answers are included