New answers tagged

1

Partial solution (I skipped the contour level plots to simplify, let that as an exercise for the braves): Using the three-way if (boolean)?(value if true):(value if false) and the special "number" NaN (not-a-number), and using the option unbounded coords=jump you can do the following: \addplot3 [surf, unbounded coords=jump] { (x-2)^2+(y-5)^2<9 ? ...


1

Does it help? It draws the picture and writes its size in its center. Printed values don't consider the scale factor. In this case, real height would be 1.5*171.27066pt. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} % WHAT HEIGHT DO I HAVE? \begin{tikzpicture}[scale=1.5] % help lines ...


4

Something like this? \documentclass[tikz,multi,border=10pt]{standalone} \usepackage[utf8]{inputenc} \usepackage{cfr-lm} \usetikzlibrary{decorations.text} \begin{document} \begin{tikzpicture} [ text=white, border/.style={line width=14mm}, font=\sffamily\itshape, curve me/.style={% decorate, decoration={% text effects ...


5

It is easier if you use Forest .... It is also much less typing. \documentclass[tikz,multi,border=10pt]{standalone} \usepackage[edges]{forest} \usepackage{array} \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} \newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} \usetikzlibrary{arrows.meta,shadows} \begin{document} \begin{forest} ...


2

A PSTricks solution: \documentclass{article} \usepackage{mathtools} \usepackage{pstricks-add} \newcommand*\diff[1]{\mathop{}\!\mathrm{d}#1} \def\arrow[#1](#2,#3)(#4,#5)#6{% \psline[ linewidth = 2.5\pslinewidth, arrows = -> ](#2,#3)(#4,#5) \pcline[ linestyle = none, offset = #1 ](#2,#3)(#4,#5) \ncput{$\displaystyle #6$}} ...


5

And just for comparison, here is the same figure with Metapost and luamplib. No bounding box issues here, but you have to process it with lualatex. \documentclass[border=5mm]{standalone} \usepackage{luamplib} \everymplib{ verbatimtex \leavevmode etex; beginfig(0); } \everyendmplib{ endfig; } \mplibcodeinherit{enable} \begin{document} ...


3

If you want to use a fly drawn with tikz you can use this code, that is a transcription from this SVG. \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{svg.path} \begin{document} \begin{tikzpicture}[scale=.21, yscale=-1, ultra thick] \draw svg{M423.7 480c24.3 8.3 51.3 11 71.3 28 17 12 30 30 50.3 36.2 8.8 4 17.6 8.5 24.6 15.2}; \draw ...


2

Another way with TikZ. I like to separate the labels from the drawings. \documentclass[border=5mm]{standalone} \usepackage{tikz} \usepackage{amsmath} \begin{document} \begin{tikzpicture}[axis/.style={thick,-stealth}, vector/.style={ultra thick,-latex} ] % drawing \draw [axis] (0,0) -- (13,0); \draw [axis] (0,0) -- (0,6); \draw[thick] ...


1

An alternative, pure TikZ solution: \documentclass[tikz,border=3mm,preview]{standalone} \usetikzlibrary{arrows.meta,positioning,quotes} \begin{document} \begin{tikzpicture}[ >={Triangle[]} ] % coordinate \draw[->] (-0.1,0) node[below left] {0} -- (9,0); \draw[->] (0,-0.1) -- (0,6); % ...


1

You can use the grouplots environment which, of course, groups plots. You can choose to display horizontally and vertically, with the distance you want. If you want the plot 2 to appear above, then you can list it first in the code. I left the command for the legend if you want, just uncomment it to use it. Output Code ...


2

This is the kind of thing where I wouldn't use pgfplots at all. If you want to change the width/height of the diagram, change x=8cm,y=4cm to your liking. The axis lines are drawn from (0,0) to (0,1)/(1,0). If you want to raise or lower the horizontal line, modify the value in \pgfmathsetmacro\Y{0.7} to some value between 0 and 1. If you want to move the ...


12

A workaround Clip the circle ! \fbox{\begin{tikzpicture}% \clip (0,0) circle (1cm); \fill [orange] (0,0) ++ (0:1) arc (0:120:1) -- (0,0) -- cycle; \fill [pink] (0,0) ++ (240:1) arc (240:360:1) -- (0,0) -- cycle; \fill [gray] (0,0) ++ (120:1) arc (120:240:1) -- (0,0) -- cycle; \end{tikzpicture}}


18

This is to do with the way that pgf constructs arcs using Bézier curves. The drawing algorithm involves drawing as much of an arc as a succession of rotated 90 degree arcs along with a smaller arc for what is left. The result can be examined by using the show path construction decoration to draw the polygons for each Bézier curve. It can be seen that ...


0

Here is code that just shows the two similar right triangles and the lengths y and y', and the angle bisector, drawn green. The two y's are now positioned consistently with respect to the green line. \documentclass{amsart} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections,quotes} ...


2

You need to pass the font option to your tikzpicture, using font= somewhere within the square brackets. I don't have the Roboto fonts, so I've used Baskerville to demonstrate. \begin{filecontents}{cv-style.cls} \ProvidesClass{cv-style}[2015/02/27 CV class] \NeedsTeXFormat{LaTeX2e} \ProcessOptions\relax \LoadClass{article} \RequirePackage{tikz} ...


1

Rotating an individual node seems to work, partially; the bounding box of the picture does not work well. (Based on John Kormlyo comment) Rotating inside node seems to work. \documentclass{article} \usepackage{tikz} \usepackage{hyperref} \begin{document} \section{Test section\label{sec:test}} \begin{tikzpicture} \node at (0,5) [draw=blue] ...


4

Most of the code you have posted is, IMHO, completely unrelated to the end goal you are trying to achieve. Yes, I'm sure it is possible to hide the prime by shifting nodes as you are attempting, but why make things more complicated than they need to be? The code proposed in egreg's comment can be neatly wrapped in a macro: % a macro for the prime taking no ...


2

With $in(S)$[sub] // {1, c, 2}, you specify a subgraph, which is described in section 27.10.1 (Sublayouts) of the TikZ manual (version 3.0.1a). As shown there, a subgraph is drawn with // [layout options]{sublayout} You can specify the position of the subgraph text (in your case $in(S)$) with either subgraph text top=<text alignment options> ...


0

It is important to note that you are not only using TikZ, but also PGFPlots. As described in section 4.17.1 (Accessing Axis Coordinates in Graphical Elements) in the manual, there are different coordinate systems in PGFPlots: axis cs: the axis coordinate system rel axis cs: a relative coordinate system, where the complete axis vectors are normalized to 1 ...


5

I would guess that if you define the colours in the same way in both cases, they would match. Both xcolor and matplotlib allow you to use RGB tuples, with values in the range zero to one, to define colors, so you could probably say e.g. green = (0,1,0) plt.plot(x,y,color=green) in matplotlib, and \definecolor{green}{rgb}{0,1,0} \draw [green] (0,0) -- ...


4

Your MWE produces the following warning: Package pgfplots Warning: running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing \pgfplotsset{compat=1.13} into your preamble. If you are running into problems you should always have a look at the log file. So in your case adding \pgfplotsset{compat=1.13} ...


1

Why not take a look at the git-repo of the developers? https://github.com/mredaelli/circuitikz The values are defined in the file: https://github.com/mredaelli/circuitikz/blob/master/tex/pgfcirc.defines.tex (For versions <0.5 this file was called circuitikz.code.tex) The shapes you will find in the other files, mainly pgfcircbipoles for path ...


15

I grab a fly image from the internet (http://derangedlacrimes.com/wp-content/uploads/2013/08/200px-Musca_illustration.png) and inset it: \documentclass{article} \usepackage{chessboard,stackengine,graphicx} \begin{document} \stackinset{l}{20pt}{t}{20pt}{% \rotatebox[origin=center]{-135}{\includegraphics[width=12pt]{200px-Musca_illustration}}} ...


5

Do you like this: \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{backgrounds,intersections} \begin{document} \begin{tikzpicture}[scale=2.5] %Axis \draw [<->,thick] (0,1.25) node (yaxis) [above] {$y$} |- (5,0) node (xaxis) [right] {$x$}; \draw [color=red,thick, name path=A] (0,1.20) node[left,color=black] {$40$} -- (4.95,0) ...


5

If I understand correctly, you want to use the relative positions of the saved nodes in your new picture. That is, each node should refer to a position in the new picture relative to the new origin. Here's some code that saves all the data for a list of specified nodes which can then be restored at a later time in the document. It uses LaTeX3 stuff ...


5

This creates 6 hyperlinks along the first edge which link to the second slide. \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{frame}{First} \begin{tikzpicture}\label{picture:first} \node (A) {$A$}; \node (B) [below right=2 and 3 of A] {$B$}; \path (A) edge [line width=5pt] node [pos=0, circle] ...


1

This is an attempt to show that the spirit of what I want can be done by knowledge of basic latex programming. Here is what I came up with: \documentclass{article} \usepackage{tikz} \usepackage{ifthen} \usepackage{intcalc} \usepackage{qrcode} \begin{document} \qrcode[]{Dummy code}%Original code \vspace{1cm} %Corrupted code \begin{tikzpicture}[scale=0.1] ...


1

A PSTricks solution: \documentclass{article} \usepackage{multido} \usepackage{pstricks} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \calc \fp_eval:n \ExplSyntaxOff % parameters \def\width{4} \def\height{3} \def\radius{0.3} \def\distance{1} % \distance > 2*\radius \begin{document} ...


1

A version in Metapost and luamplib, adapted from my answer to a similar question simply by changing the images used for the targets and the hits. Compile with lualatex. \documentclass[border=5mm]{standalone} \usepackage{fontspec} \setmainfont{Tex Gyre Pagella} \usepackage{luamplib} \begin{document} \mplibtextextlabel{enable} \begin{mplibcode} ...


3

Another way \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{quotes} \begin{document} \begin{tikzpicture} \path coordinate["$a$" right] (1) at (0,0) coordinate["$b$" right] (2) at (3,0) coordinate["$c$" right] (3) at (1,1.5) coordinate["$d$" above] (4) at (1,3) coordinate["$e$" below] (5) at ...


5

Put braces around the label text. \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node (1) [label=above:{$ab = A$}] at (-2,0) {node label}; \end{tikzpicture} \end{document}


2

A PSTricks solution: \documentclass{article} \usepackage{pstricks-add} \def\target{% {\psset{fillstyle = solid} \pscircle[fillcolor = white](0.7,0.7){0.7} \pscircle[fillcolor = blue!60](0.7,0.7){0.5} \pscircle[fillcolor = white](0.7,0.7){0.3} \pscircle[fillcolor = red!80](0.7,0.7){0.1}}} \def\dots[#1](#2,#3){% \psRandom[ dotsize = 2pt, ...


6

I suppose, that you like to obtain the following picture: From code below you can see, that the coordinates are determined by .center. Without this it is considered one of anchors on node's shape border. To be filled area under nodes, I also use `background library. \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{backgrounds} ...


3

Here is a suggestion using point meta=explicit symbolic, nodes near coords and every node near coord/.append style. \documentclass{standalone} \usepackage{pgfplots} \usepackage{pgfplotstable} \pgfplotsset{compat=newest} \pgfplotstableread{ 1 10 0.84 50 0.75 10 0.22 30 0.24 2 40 0.38 60 0.96 15 0.42 90 0.28 3 ...


3

The usual expansion problems with xstring, I'd say. But you're complicating things. The \clist_set:Nn function of expl3 purges empty items, so it's a straightforward application. \documentclass{article} \usepackage{xparse} \usepackage{xcolor} \ExplSyntaxOn \NewDocumentCommand{\SetArrayLength}{sm} { \IfBooleanTF{#1} {% star form: expect a control ...


2

Add it to the node options, so that it affects the whole node, and not just a part of it: font=\Large Also, the shape is a rectangle by default, and draw uses black by default. So in the end you can just write: \newcommand{\orgnode}[2]{\node[draw, font=\Large, align=center] at (#2) {#1};}


1

My solution would be: \documentclass[border=3mm,12pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \begin{scope}[black, thick, fill=gray, join=bevel] \path (6.5em,7em) coordinate (start); \filldraw (start) -- ++(30:3em) -- ++(90:0.5em) -- ++(-150:3em) -- cycle; \filldraw (start) -- ++(150:2em) -- ...


3

The problem is that when you declare the function, there are spurious spaces that are being created (so the problem is not the plot itself). I marked the space with a dot: \pgfmathdeclarefunction{gauss}{2} {. \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}% } If you delete all spaces from your function definition at the end of the line and ...


8

You can begin with this \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \r/\col in {2.8 cm/white,2 cm/blue!50!white,1.2 cm/white,0.4 cm/red!50!white}{% \path[draw,fill=\col] (0,0) circle (\r) ;} \foreach \coords in {(0,.4),(.2,.5),(.1,.6),(-.2,.5)}{% \draw[fill=blue] \coords circle (.6mm);} ...


3

I do not really understand want you want to do and version 3.12 is really old. My oldest version for testing is 3.16, current version on CTAN is 3.19a. But you have to change the font element chapter to get it visible on the black background. To shift it up use a negative value for \vspace*. \documentclass{scrbook} \usepackage{lmodern}% <- added ...


4

font=\scriptsize, for example, can be added to the node options for nodes you want set in a smaller size. Please see the decorations.markings library documentation in the TikZ manual for an explanation of the various options for configuring the position and number of arrows used. For example: \documentclass[border=10pt,tikz,multi]{standalone} ...


5

For this I would start by placing (and naming) nodes or coordinates at the desired locations. (A coordinate is basically a node with no size and no caption.) In the example below I name them according to location, with l/r meaning left/right, and t/m/b meaning top/mid/bottom. I would then connect the nodes as necessary. Using a thick line may be easier in ...


0

Another option to ensure the correct rotation of the node text within the \pic environment would be passing the [every node/.style={transform shape}] option to the tikz picture: \documentclass[border=10pt,tikz,multi]{standalone} \tikzset{% testboxtext/.pic={% code={ \tikzset{% test box text/.cd, #1 } \draw [black, ...


3

I am not sure, if I guessed all your packages right, I still get a font warning. However, you scaled most of your elements to the font size by chosing the unit em. Therefore to reduce size, you have to change the font size, which I did by saying \tiny in line 9: \documentclass[]{beamer} \usepackage{tikz} \usetikzlibrary{matrix, positioning, arrows} ...


1

I use KTikZ (QTikz on windows) for everything but if it is going to be involved I use Inkscape or just skip TikZ and use LaTeXDraw and use the image. One particularly useful trick that I stole from Mark Wibrow is to use Inkscape with snap to integer grid coordinates such that when you export it to TikZ the numbers are pretty decent that you can easily ...


3

And (mainly for amusement at this end, but partly for comparison) here is a Metapost + luamplib implementation based on the observation that the A points form a triangle and the B points form a hexgaon. Compile with lualatex (or adapt for plain Metapost). \documentclass[border=5mm]{standalone} \usepackage{luamplib} \mplibtextextlabel{enable} ...


3

If you add point meta=explicit symbolic to the axis options, you can manually specify the labels texts for nodes near coords, using the syntax \addplot coordinates { (x,y) [label text] }; With legend columns=3, and the standard colors, because I didn't feel like defining five new colors: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} ...


8

Okay, here is an even more compact form using the shapes.geometric library of tikz: \documentclass[border=3mm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} % \begin{document} % \begin{tikzpicture} \foreach \a in {30,150,270}{ \node[regular polygon, regular polygon sides=6, draw, minimum size=3cm, rotate=30] (\a) at ...


1

As of pgfplots 1.13, this works without any modifications, i.e. simply running pdflatex -shell-escape file.tex twice results in the desired output. Here is a reduced minimal without the extra image.tex (but otherwise identical), compiled with pgfplots 1.13 and pgf 3.0.1: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.10} ...


6

Here's a simplified version for your graph. Output Code \documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes} \tikzset{ poly/.style={draw, regular polygon, regular polygon sides=6, rotate=30, minimum size=\d cm}, style1/.style={circle, fill=gray, label={below:B}}, style2/.style={circle, fill=black, label={above:A}}, } ...



Top 50 recent answers are included