Tag Info

Hot answers tagged

17

Run with --shell-escape and needs imagemagick installed. \documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone} \usepackage{filecontents} \begin{filecontents*}{moon.tex} \documentclass[tikz,preview,border=15mm]{standalone} \usetikzlibrary{calc} \usetikzlibrary{3d,calc} \begin{document} \foreach \x in {5,10,...,355}{ \begin{tikzpicture} % ...


11

This can be done (admittedly with some effort) using fadings and decorations. The following is I guess more proof-of-concept than anything else but might prove useful: \documentclass[tikz, border=5]{standalone} \usetikzlibrary{decorations,fit,fadings} % Layers \pgfdeclarelayer{sleeper} \pgfdeclarelayer{rail} \pgfsetlayers{sleeper,rail,main} ...


9

Another approach, using PGFPlots to draw a surface plot: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ view={0}{90}, hide axis, axis equal image, xmax=pi, ymax=pi, samples y=6, colormap={redblue}{color(0cm)=(red); color(1cm)=(blue)} ] \addplot3 [ surf, shader=interp, ...


9

I think the problem arises because when the sprial changes direction two squares are drawn at each corner. For example, if the spiral is moving right, when the x < x_max condition is not met the direction is changed but the y coordinate is not moved up so the next square is drawn in the same place as the last square. I've corrected this in the code below ...


8

This is an attempts where pics skill is used, requiring tikz 3.0 Code \documentclass[border=10pt]{standalone}%[12pt,twoside,a4paper]{book} \usepackage{graphicx,wrapfig,tikz} \usetikzlibrary{positioning,shapes} \tikzset{myarrow/.pic = { \begin{scope}[rotate=-90,scale=0.5] \draw[fill=black] (-0.5,0) -- (0,0.5)--(0.5,0)--(0.5,1)-- ...


8

\documentclass[11pt]{article} \usepackage{tikz} \usetikzlibrary{patterns,angles} \begin{document} \tikz \draw (2,0) coordinate (A) -- (0,0) coordinate (B) -- (-1,-1) coordinate (C) pic [draw,->,red,pattern=north west lines] {angle = A--B--C} pic [draw,<-,blue,pattern=north east lines,thick,angle radius=1cm] {angle = C--B--A}; \end{document} ...


8

A possible way: fake the gradient by drawing lots of thin triangles in solid colors which smoothly change their color from red to blue. The resulting "disc" can be clipped to a rectangle, as the following example shows: \begin{tikzpicture} \path[clip] (0,0) rectangle (1,0.7); \foreach \i in {0,0.5,...,90} { \pgfmathsetmacro{\shade}{100/(90-0)*\i} ...


8

You can fix this problem by using the ybar interval style for both plots, but reversing the direction for the lower sum by using domain=17:1 instead of domain=1:17: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \begin{document} \begin{tikzpicture} \begin{axis}[ ...


7

Two version here, firstly a version that is not very friendly looking in some places but most of the parameters (number of tables and seats) are derived automatically from a list of children. It also will not easily generalize to other table layouts, and some "fooling around" will probably be required if the sizes are changed. ...


7

It's because whenever you use the ... notation, TikZ performs calculations such as what is the second number 0.2 and what is the first one; 0.1 so what is the step size... Then it does 0.2-0.1 operation to obtain the step size and TeX precision contaminates this result. After that TikZ starts adding the contaminated 0.1 to 0.2 (not 0.1 because these are ...


7

The non-alignment is caused by the use of thick for one rectangle but not the others. If you need variable line widths, you can compensate for the difference either by checking the widths TikZ is using for regular and thick lines or by specifying the widths you want. For example: \documentclass[a4paper,10pt]{standalone} \usepackage{tikz} ...


7

This is one solution. The curves are drawn via draw[] (A).. controls (B) .. (C); draw[] (C) to[out=xx,in=yy] (E); and the shaded line areas are done via clip skill with scope environment. Further the text are place via tikz node. Several style macros were predefined including the B/W shading. Code \documentclass[border=10pt]{standalone}%{article} ...


6

You can transform a color map to a PGF shading by means of \pgfplotscolormaptoshadingspec. Afterwards you can use tikz techniques to clip the resulting shading such that it shows only the visible area: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \begin{document} \thispagestyle{empty} % #1: left offset in [0,1] % #2: width ...


6

You are clearly a mathematician or something pretty close since your sentences are always inverted in an (ε, δ) way. You have to read the math backwards but the sentence forwards to decode :P \documentclass[]{article} \usepackage{pgfplotstable} \pgfplotsset{compat=1.10, perf name table/.default=mytable} \pgfplotstableread{ ode23 ode45 ...


6

Unfortunately the value isn't stored inside the key, as it is parsed immediately (the argument to the |x| key can be a coordinate) and then passed on to \pgfsetxvec. But there are still a couple of ways to get the x-component of the coordinate system. \documentclass[tikz,border=5]{standalone} \begin{document} \makeatletter \begin{tikzpicture}[x=14pt] ...


6

I think this is the best suggestion I have: \documentclass[tikz]{standalone} \usetikzlibrary{decorations.pathmorphing} \tikzstyle{track}=[ postaction={draw=gray,densely dashed,line width=14pt}, postaction={draw,decorate,decoration={curveto,raise=4pt},line width=2pt}, postaction={draw,decorate,decoration={curveto,raise=-4pt},line width=2pt}] ...


5

I don't enjoy Postscript, it makes my head hurt. Anyway here is another linear interpolated shading. You can use it in TikZ pictures too. \documentclass[]{article} \usepackage{tikz} \pgfdeclarefunctionalshading[vcol,hcol]{azimuth}{\pgfpointorigin}% {\pgfpoint{4cm}{4cm}}{\pgfshadecolortorgb{vcol}{\mycola}\pgfshadecolortorgb{hcol}{\mycolb}}{ atan 90 div dup ...


5

\documentclass[tikz,border=5mm]{standalone} \usepackage{amssymb} \begin{document} \begin{tikzpicture} \draw (4,0.2) -- node[fill=white,rotate=90,inner sep=-1.25pt,outer sep=0,anchor=center]{$\approx$} (8,0.2); \draw (4,1.8) -- node[fill=white,rotate=0,inner sep=-2.5pt,outer sep=0]{//} (8,1.8); \end{tikzpicture} \end{document}


5

The following approach uses the polar coordinates to place the moon in the orbit. The foreach-loop contains the code to place the moon on an offset (orbit) at a given angle. This way you can easily iterate over your desired angles and render your image. \documentclass[tikz, border=5mm]{standalone} \usetikzlibrary{calc} \begin{document} ...


5

Unless you use TiKZ for some other reason. There is no need to use it to obtain your diagram. With help from "The Comprehensive LaTeX symbols list" (for \xrightarrow and \xmapsto) and egreg's answer to Make box with minimum width (in math mode) (for \minwidthbox) is possible to write: \documentclass{article} \usepackage{amsmath,amssymb,empheq,mathtools} ...


5

While it is possible to access table elements by means of \pgfplotstablegetelem{0}{RED}\of{\test}, I would recommend to move the code which defines colors into the \addplot command: pgfplots supports advanced scatter plots in which you can define how each scatter point it is to be drawn. This is more efficient in TeX. A solution could be ...


5

And just for comparison, with Metapost. Not a sine or a cosine in sight! prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); a = 1.414cm; % this controls the scale of the whole figure pi = 3.14159265359; % define the cycloid path c; c = origin rotatedabout((0,a),100) shifted (a*-100/180*pi,0) for t=-99 upto 460: -- origin ...


5

Just for fun with PSTricks. The functions are intentionally made different from your case to let you modify them by yourself as an exercise. As the question is not easy to understand, I provide two answers. One of them should meet your requirement. Option 1: Equidistant tangent segments In this option, I make the tangent segments have the same length. ...


5

Something like this? \documentclass[tikz, border=5]{standalone} \begin{document} \begin{tikzpicture} \path (120:3) coordinate (A) (0:3) coordinate (B) (0:0) coordinate (C); \draw (A) -- (B) node [at start, above left] {$A$} node [midway, above] {$c$} -- (C) node [at start, right] {$B$} node [midway, below] {$a$} -- (A) node [at start, below] ...


5

For this kind of diagrams where you are putting many nodes relative to one another, a matrix approach would be more suited. You have to use \usetikzlibrary{matrix} and declare the nodes as the elements of a matrix. The row and column separations, node styles etc can be declared via \tikzset. You can refer to those nodes using the name of the matrix say (m) ...


5

A PSTricks solution: \documentclass{article} \usepackage{pstricks} \begin{document} \psset{dimen = m} % no overlapping of the rectangles \begin{pspicture}(8,4) \psframe(0,0)(8,2) \psframe(0,2)(8,4) \psframe[ fillstyle = solid, fillcolor = orange!70 ](0,2)(2,4) \end{pspicture} \end{document} or \documentclass{article} ...


5

\documentclass[]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \definecolor{C1}{RGB}{19,128,67} \definecolor{C2}{RGB}{255,255,255} \definecolor{C3}{RGB}{154,0,79} \pgfdeclarehorizontalshading{someShading}{50bp}{ color(0bp)=(C1); color(25bp)=(C2); color(50bp)=(C3) } \clip (0,0) rectangle ++(6,2.5); \shade [shading=someShading](0,0) ...


4

Just to sum up the above comments and get future readers an overview about the discussed answers: Prerequisites: \usetikzlibrary{positioning} Per node distance definition: \node (id) [below left=<x-value> and <y-value> of <reference>] {<text>}; Global distance definition: \begin{tikzpicture}[node distance=<x-value> ...


4

You can use the approach from pgfplots: Placing node on a specific x-position (which used the same basic idea as Thruston's answer: finding the intersection with a vertical line). I've removed stuff from your example that wasn't related to the problem at hand, and used the PGF math engine instead of gnuplot, which works fine in this case. ...


4

For this, some hacking is required. Unfortunately, due to some inconsistencies in the implementation between the circle split and the ellipse split shapes different methods must be used for both. If hacking is not desirable, then it might worth considering that a circle split shape with out the "split" drawn is just a circle shape with text stacked ...



Only top voted, non community-wiki answers of a minimum length are eligible