# Tag Info

1

I'll left to you understand the code but next is a possible solution based in Paul Gaborit's example %%%%%%%%%%%%%%%%%%%%%%%%%%% % Author : Paul Gaborit (2009) % under Creative Commons attribution license. % Title : Pascal's triangle and Sierpinski triangle % Note : 17 lines maximum \documentclass[border=2mm, tikz]{standalone} ...

2

Are you after some thing like this? \documentclass[tikz, border=3mm]{standalone} \tikzset{% plus/.pic={ \node[circle,ball color=orange,inner sep=0pt,minimum width=2.5ex] {+}; }, minus/.pic={ \node[circle,ball color=green,inner sep=0pt,minimum width=2.5ex] {-}; } } \begin{document} \begin{tikzpicture} \foreach \x [evaluate={\a=\x+1}] in ...

0

Based on egreg answer, here, I used picture to overcome the problem. The problem with \pic was the scale, the inserted picture was not originally scaled, it fit with the graph scale in x and y. Furthermore, it was difficult to handle minipages using \pic. The difference between them is depicted in the picture: \documentclass[11pt]{report} ...

1

Here a MWE using \foreach to plot the charges. You need to set 1 or -1 for your charges. If you need another height than 1 or -1 for the charges you can adjust the value to your needs or just use the yscale-option of tikz. Hope this helps. \documentclass[tikz, border=10mm]{standalone} \begin{document} \begin{tikzpicture} \foreach \y [count=\x from 0] ...

6

To hatch the square you can use the patterns by loading the patterns library; \draw[pattern=north east lines] (P) -- (Q) node [midway, left]{$c$} -- (R) node [midway, right, above]{$c$} -- (S) node [midway, right]{$c$} -- (P) node [midway, below]{$c$} -- cycle; Also, angle marking accepts drawing options ...

3

You are giving the key below,left which tikz takes only as left (the latest key). It should be below left without , in the middle. So node [at start, below left]{$C$} would give you You can also use just below (which is better than left). If you want absolute control, you may use below left=below length and left length like below left=0mm and ...

3

Use the key yshift=: \documentclass[10pt]{amsart} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings} \usepackage{tkz-euclide} \usetkzobj{all} \begin{document} \begin{tikzpicture} \path (110:4.5) coordinate (A) (-30:3) coordinate (B) (0:0) coordinate (C); \draw (A) -- (B) node [at start, above left]{$A$} ...

5

\documentclass[tikz]{standalone} \usetikzlibrary{calc,positioning,decorations.text} \begin{document} \begin{tikzpicture}[scale=1, line join=bevel] % \a and \b are two macros defining characteristic % dimensions of the Penrose triangle. \pgfmathsetmacro{\a}{1.8} \pgfmathsetmacro{\b}{0.7} \tikzset{% apply style/.code = {\tikzset{#1}}, ...

8

Again with tikz but using pic: \documentclass[border=3mm]{standalone} \usepackage{tikz} \usetikzlibrary{patterns,calc} \tikzset{% pics/.cd, dam/.style args={#1#2#3#4#5}{ code={ \begin{scope}[shift={(#1)}] \coordinate (a) at (0,0); %% starting point \coordinate (b) at +(0,#2); % height of right side \coordinate (c) at ...

8

A tikz solution where an L shape pool is drawn by a macro called mypool that takes 6 arguments, displayed below. #1=starting point, #2=vertically down length, #3=for Label L4-L8, #4=horizontal length of the pool #5=end point #6=Pool label 1-5. Code \documentclass[border=10pt]{standalone}%[11pt]{article} \usepackage{tikz} ...

3

I should not do it for you but... just to illustrate that everything is possible. I added a new answer instead of editing the existing one because the source code is now much longer and contains ugly manipulations. Beware that I modified some \pgfdeclareshape's. \documentclass[a4,landscape]{article} \usepackage{tikz} \begin{document} \makeatletter ...

1

You need to use axis cs: for specifying the coordinates of the point. With axis cs: 500,4 in \pic [scale=50] at (axis cs: 500,4) {m2}; and x=.006mm (it is too campy), you get

8

A PSTricks solution: \documentclass{article} \usepackage{pstricks} \newpsobject{water}{psframe}{ dimen = m, linestyle = none, fillstyle = solid, fillcolor = blue!30 } \newpsobject{basin}{psframe}{ dimen = m, linestyle = none, fillstyle = hlines, hatchsep = 2pt } \def\pool(#1,#2)#3#4#5#6{ \water(#1,#2)(!#1 #4 add #2 0.5 add) \basin(!#1 ...

2

I had problems with adapting Jake's solution to my actual phase diagram, but succeeded to adapt percusse's solution from the previous thread Azimuth shading It includes a lot of postscripting I don't understand a bit, but it works on arbitrary area. \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepgfplotslibrary{fillbetween} ...

3

EDIT: As per requested by the OP, the labels are now rotated with each face. Try this: \documentclass[tikz,border=10pt]{standalone} \begin{document} \begin{tikzpicture}[scale=1, line join=bevel] % \a and \b are two macros defining characteristic % dimensions of the Penrose triangle. \pgfmathsetmacro{\a}{1.8} \pgfmathsetmacro{\b}{0.7} \tikzset{% ...

4

I have no time to do all of them. Here are some examples. (forget \newcommand) \documentclass{minimal} \usepackage{tikz} \begin{document} \makeatletter \pgfdeclareshape{slits}{ \savedanchor\centerpoint{\pgf@x=0cm \pgf@y=0cm} \saveddimen\halfwidth{ \pgf@x=.25cm \pgfmathsetlength\pgf@xa{.5\pgfkeysvalueof{/pgf/minimum width}} ...

4

Using an ampersand & inside a macro is not advised since it ends a group. Below is a workaround that replaces ampersands by control sequences, and then \& evaluates to the ampersand retro-actively. LaTeX then already evaluated the structure of your matrix to evaluate where the groups end afterwards. That way the structure defined by your macro ...

1

So from what I understand you want to draw a box somewhere in the left picture and connect it to the right picture like this? You probably won't get away without drawing the spy-looking things yourself, but it's easier than you might think. The key is to add the two keys at the right places: remember picture shares node names between all pictures that use ...

0

Here is the document with the small image. \documentclass{article} \usepackage{graphicx} \usepackage{mwe}% for image \usepackage[hidelinks]{hyperref} \begin{document} \lipsum[1] \medskip\noindent% \href[pdfnewwindow=true]{target.pdf}{\includegraphics[width=1in]{image}} \lipsum[2] \end{document} The following was used to create target.pdf ...

5

Try this: \documentclass[10pt]{amsart} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings} \usepackage{tkz-euclide} \usetkzobj{all} \begin{document} \begin{tikzpicture} \path (60:2.5) coordinate (A) (10:6) coordinate (B) (0:0) coordinate (C); \draw (A) -- (B) node [at start, above]{$A$} node [midway, ...

4

Just 4 fun with PSTricks. \documentclass[pstricks,border=15pt,12pt]{standalone} \usepackage{pst-plot} \psset{dimen=m} \begin{document} \begin{psgraph}[axespos=t](0,0)(-4,-4)(4,4){10cm}{!} \psclip{\pscircle{2}} \pspolygon*[linecolor=lightgray](0,-2)(2,0)(2,2)(-2,2)(-2,-2) \endpsclip \pscircle{2} \psplot[algebraic]{-1.5}{3.5}{x-2} ...

7

Another way, especially in more complex cases in which you are not sure about angles, is to just put \path [clip] (-3,-5)--(5,3)--(-3,3)--cycle; in a new scope together with your statement (without any change) \path[fill=black,opacity=0.2] (2,0) -- plot[domain=2:0] (0,0) circle (2cm) -- (0,-2) -- cycle; as follows: \documentclass[10pt]{article} ...

4

Replace \path[fill=black,opacity=0.2] (2,0) -- plot[domain=2:0] (0,0) circle (2cm) -- (0,-2) -- cycle; by \path[fill=black,opacity=0.2] (2,0) arc[start angle = 0, end angle = 270, radius = 2] -- cycle;

1

Update: This seems to be what the OP really wants. Code \documentclass[]{standalone} \usepackage{tikz} \usetikzlibrary{positioning} \tikzset{ pipe/.style = { draw, %top color=gray!60, %bottom color=gray!20, minimum width=4cm, minimum height=.1cm, anchor=east, }, source/.style = { draw, %top color=gray!60, ...

2

Something like is obtained adding \draw[|<->|] ($(A)!5mm!90:(C)$)--node[fill=white] {$z$} ($(C)!5mm!-90:(A)$); Explanation ($(A)!5mm!90:(C)$) is a new coordinate placed at 5mm of (A) and forming an angle of 90 degrees respect to the line (A) -- (C) (It corresponds to the upper extreme). More information about Distance modifiers in the page 145 ...

5

Here is a solution using titlesec , xcolor, colortbl, geometry and lettrine (this last one only for my pleasure…). I was unsure whether the light blue background was also required, so there's none in my code, but that can be changed: \documentclass[12pt]{book} \usepackage[utf8]{inputenc} \usepackage{microtype} ...

2

It seems you are mixing tkz-euclide commands with tikz. Following the same, you can add \tkzLabelAngle[pos = 0.5](B,C,A){$\theta$} to your code. \documentclass[10pt]{amsart} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{mathtools,array} \usepackage{tikz} \usepackage{tkz-euclide} \usetkzobj{all} ...

5

With tikz version 3, you can do this: \documentclass[tikz]{standalone} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture} \draw[|{Stealth}-{Stealth}|] (0, 0) -- (1, 0); \draw[||{Stealth}-{Stealth}||] (0, 1) -- (1, 1); %% || will produce thicker pipe \end{tikzpicture} \end{document}

4

I have re-drawn the cylinder and filled it with white so that whatever is drawn on background layer, is not visible. Further, by manipulating the dash pattern and using \foreach loop with some xshift, the desired effect can be achieved. \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{patterns} \pgfdeclarelayer{background} ...

11

You can use PGFPlots for creating plots of functions (and of data files): The binomial function isn't defined in the math engine, but you can define it yourself using the key declare function={binom(\k,\n,\p)=\n!/(\k!*(\n-\k)!)*\p^\k*(1-\p)^(\n-\k);} Then you can plot the function using \documentclass{article} \usepackage{pgfplots} \begin{document} ...

1

You don't have to convert pdf to ps, since pstricks code can be compiled with pdflatex: you just have to load pstricks with option pdf and launch the compiler with the --enable-write18 (MiKTeX) or --shell-escape (TeXLive, MacTeX). Then pstricks will launch auto-pst-pdf and you'll get a pdf image. Code modified: \documentclass[border=12pt]{standalone}% ...

1

You can use some thing like this: \documentclass[12pt,tikz,border=2mm]{standalone} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture}[plane/.style={trapezium,draw,fill=black!20,trapezium left angle=60,trapezium right angle=120,minimum height=1.5cm},scale=0.7] \node (p)[plane] at (0,0){.}; \draw (p.center) edge ++(0,2cm) edge[densely ...

2

Pretty much exactly the same as the answer from Harish Kumar except using pics: \documentclass[tikz, border=5]{standalone} \usetikzlibrary{patterns} \tikzset{% aperture/.pic={ \path [draw=black, rotate=#1-90, pattern=north east lines] (-3/4,-3/2) rectangle (3/4,3/2); \path [draw=black, rotate=#1-90, scale=1/8] (0,14) -- ++(-1,0) -- ++(0,2) ...

3

label and pin are node options, but the plot markers are not nodes, that's why those options don't produce any output. In this case, I wouldn't recommend using an \addplot command, since each of the points requires quite different styling. I'd simply use normal TikZ commands: \documentclass[varwidth=true, border=5pt]{article} ...

31

Possibly one of those occasions where nesting the tikzpicture environment (which is usually inadvisable) can be quite useful. \documentclass[tikz,border=5]{standalone} \usetikzlibrary{shapes.callouts,decorations.pathmorphing} \begin{document} \tikzset{people/.cd, name/.store in=\personname, name=, % % Face % face size/.store in=\facesize, face ...

4

Next time, kindly try to provide the code which you have tried so far. We would be glad if you could post a minimal working example (MWE). \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{patterns,arrows.meta} \begin{document} \begin{tikzpicture} \begin{scope} \node[font=\bfseries\sffamily] at (1,5.5) {A}; \node[draw,fill,pattern = ...

7

This is very easy and may be a duplicate too. Any way, I am posting this and if this is closed a duplicate, I will delete this answer. \documentclass[tikz,border=2mm]{standalone} \begin{document} \begin{tikzpicture} \node[anchor=south west,inner sep=0] (image) at (0,0,0) {\includegraphics[width=4in]{example-image-a}}; \begin{scope}[x={(image.south ...

7

You can sort the table using the pgfplotstable package. It provides a command \pgfplotstablesort[<options>]{<output table name>}{<input table>}. To read the testdata.dat file and sort it in descending order according to the second column, storing the sorted table in a macro called \datatablesorted, you'd use the following command: ...

3

This is a deliberate stab and every thing is hard coded. \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{intersections,calc} \begin{document} \begin{tikzpicture}[rotate=90] \path[use as bounding box] (0,-1.5) rectangle (3,1.5); \draw[blue,ball color=blue!20,name path global=circle] (1.5,0) circle (1.5 cm); \node[fill,circle,inner ...

7

Here another approach with reusable code and relative coordinates. This way you can reposition your nodes without the need to redraw your arrow-lines with hand. It hasn't got this nice pencil-decoration, but it shows how you can reduce your amount of code by reusing parts of it and connect them dynamically. You can fit the coordinates of the custom arrow ...

2

You need \usetikzlibrary{decorations.pathmorphing} \documentclass[tikz]{standalone} \usetikzlibrary{patterns} \usetikzlibrary{decorations.pathmorphing} \begin{document} \begin{tikzpicture}[decoration = coil, spring/.style = { decoration = { pre length = #1, post length = #1} }] \fill[pattern = north east lines] (-2cm, 0) coordinate ...

18

There you go : \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{calc,decorations.pathmorphing,patterns} \pgfdeclaredecoration{penciline}{initial}{ \state{initial}[width=+\pgfdecoratedinputsegmentremainingdistance,auto corner on length=1mm,]{ \pgfpathcurveto% {% From ...

2

If you are open to using the forest package, I think you might get something closer to what you are looking for. The forest package tends to do a lot better job of aligning the nodes in trees, so I think you will get something that looks a bit more "symmetrical". The syntax is slightly different, and the package is also much more powerful than tikz-qtree. I ...

1

Do you mean your result is not satisfactory depending on its code or its looking? If you want to get some code that can be reused you can do the following for example. It uses the scope-environment to do the shift and rotate. \documentclass[tikz, border=5mm]{standalone} \begin{document} \begin{tikzpicture}[very thick] \foreach \xoffset\lbl in {0/1,10/2} ...

4

This can be done quite trivially by using scopes and coordinate transformations. First thing, intstead of using the "advanced" coordinates routines, simply do: \fill[orange] (3,4) circle (2.5pt); which gives the same. Then onwards to transformations. The second rectangle can easily be drawn with the same commands and a scope % Draw next rectangle, ...

0

Just for comparison, in Metapost you can either draw the path directly using halfcircles or use the rboxes library to make rounded boxes. prologues:=3;outputtemplate:="%j%c.eps"; % A macro that returns the path of a rectangle with rounded ends vardef vessel(expr width, height) = halfcircle rotated -90 scaled height shifted (+1/2 width,0) -- ...

2

I'd consider removing the header from foo.dat. If you determine the header internally, there's less margin for error apparently (though I'm surprised by the error as well). It's an easy solution that works for files with large amounts of data as well. A working file looks like this: \documentclass{article} \usepackage{tikz} ...

3

The problem is very simple. After the first part of the path, (0,0) -- ++(2,0) (which is common), in the first case you use -- +(0,-1) in the second you add a capacity. The capacity symbol shifts the current position of the pen, something that your syntax -- +(0,-1) does not. Actually, you will perceive the same behaviour if you were using: ...

2

From your comments i got that you're running TexLive 2009 with pgf 2.0 - Depending on the package information this is an Ubuntu 10.04 (no support for clients anymore). For the test i installed the server edition and ran some tests. It looks like this installation is so outdated (had no looks at the changelogs yet), that there's no proper support for the ...

8

A shadow adds a preaction. TikZ does not provide a way to remove preactions. In your preamble, you may define your own reset preactions key : \makeatletter \tikzset{reset preactions/.code={\def\tikz@preactions{}}} \makeatother Here is a complete example: \documentclass[margin=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{positioning,shadows} ...

Top 50 recent answers are included