Tag Info

Hot answers tagged

50

Someone on pgf-users list writes to T Tantau : I suggest keeping the old syntax, \tikzstyle{my style}=[some options,...] since it is much easier to read and understand. The new syntax would be for the more "advanced" users and library writers. Answer of Till Tantau : I'm a bit undecided on this. First, for compatibility reasons ...


37

You can use >=latex to specify the latex arrow tip, and \tikzset to set it globally. This will be overridden by any local definitions of the arrow tip. \documentclass[tikz,border=2mm]{standalone} \tikzset{>=latex} \begin{document} \begin{tikzpicture}[<->] \draw [>=stealth,red] (0,.6) -- +(1,0); \draw [blue] (0,.3) -- +(1,0); \draw (0,0) -- ...


26

TikZ and its underlying engine PGF have a powerful built-in module pgfkeys. It can also be used as a standalone package (via \usepackage{pgfkeys}) to manipulate options for other purposes. No matter which command is used, therefore, every defined option goes to some instruction in the form of \pgfkeys{/key family/key/.subkey = {value list} } Since TikZ ...


26

Here a code you can study \documentclass[11pt,ngerman]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[upright]{fourier} \PassOptionsToPackage{dvipsnames,svgnames}{xcolor} \usepackage{tikz} \usetikzlibrary{arrows, calc,intersections,patterns} \usepackage{babel} \tikzset{% add/.style args={#1 and #2}{ to path={% ...


26

Below I show two possibilities; in both cases I defined two structures, one for theorems and the other one for lemmas (with some variations on the colors and in the position of the head); the mechanism should be clear for other structures (the code contains some comments). Using the mdframed package and its framemethod=tikz option (so TikZ is used): ...


25

Following your list, here are a bunch of TikZ-styles to draw the nodes: feel free to customize colors and dimensions as needed. They are very basic styles, something one could write just by having a vague idea of the shapes present in pgfmanual. There are comments when special libraries should be loaded in the preamble. Code: ...


21

Here is a list of 710 keys (automatically extracted from the pgfmanual): > above above delimiter above left above left of above of above right above right of absolute accepting text accepting where alias align allow upside down ampersand replacement anchor and gate and gate IEC symbol append after command arrow box arrows arrow box east arrow arrow box ...


21

Here is an idea: use dashed, and define a decoration which draws the vertical line which crosses each dash to produce a plus: \usetikzlibrary{decorations.markings} \tikzset{ pluses/.style={ dashed, decoration={markings, mark=between positions 1.5pt and 1 step 6pt with { \draw[-] (0,1.5pt) -- (0,-1.5pt); } }, ...


20

You can adjust the in and out angles as well as shift the location of the start and end points: Notes: I also added basicstyle=\ttfamily to have a more listings like output. A \tikzmark was added on the left and right of each mark to simplify the computations of the midpoints. Code: \documentclass[11pt]{article} \usepackage{listingsutf8} ...


19

A different idea, define a new arrow shape named for example X (thanks to Qrrbrbirlbel to note that \pgarrowrightextend{0pt} was neccessary): \documentclass{article} \usepackage{tikz} \makeatletter \pgfarrowsdeclare{X}{X} { \pgfutil@tempdima=0.3pt% \advance\pgfutil@tempdima by.25\pgflinewidth% ...


18

Jake is correct in his now deleted answer. The options you pass to arrow inside are not applied as they are simply grabbed and not used (i.e. “gobbled”) similar to #1 in: \newcommand*{\myCommand}[1]{Foobar Rhubarb}% no "#1" in its definition You need to add #1 in your .style definition. But instead of using the .store in handler, consider using .initial ...


16

It is a complex problem and unfortunately it has a complex solution. Let's proceed. Why amplitude setting has no effect. This setting is only used for "manual" connections using style simple connection bar, and in this case you have to specify also the initial and final radii (see p.385 of the manual). When you use instead the mindmap style for the whole ...


16

To change it for all nodes: \tikzset{every node/.style={<style_specs>}} If you have a custom style, you can set this only for that specific node style: \tikzset{My Style/.style={red, draw=blue, fill=yellow!20, minimum size=0.5cm}} If you want to change an existing node style, you can use .append style to add to the nodes style specs: ...


16

You should go to section 83.2.2 Radial Shadings of the pgfmanual (version October 25, 2010). Here is a solution in which the color of that example is a bit changed and different center points are used: \documentclass{article} \usepackage{pgf} \begin{document} % spheres definitions \pgfdeclareradialshading{sphere}{\pgfpoint{0cm}{0cm}}% {rgb(0cm)=(1,1,1); ...


15

I used the approach (actually it was nearly the whole solution) contributed by @student and revised the code given by @Altermundus to look exactly like the figure in question. \documentclass[a4paper]{report} \usepackage{tikz} \usepackage{verbatim} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[ngerman]{babel} \usepackage{subfig} ...


15

I guess there is no TikZ way, but you can use the varwidth package: \documentclass{article} \usepackage{tikz} \usepackage{varwidth} \begin{document} \begin{tikzpicture}[node distance = 2cm, auto,->=stealth,point/.style= {circle,fill=red,minimum size=0pt,inner sep=0pt}] \tikzstyle{block} = [rectangle, draw,thick,fill=blue!0, text ...


15

\documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes} \begin{document} \thispagestyle{empty} \begin{tikzpicture}[ transformer/.style 2 args={draw, cylinder, gray!80, rotate=90, minimum height=#1, minimum width=#2}] \node [transformer={2.3cm}{1cm}] () at (0,0.6) {}; \end{tikzpicture} \end{document}


15

So basically a pre action on the path. I have added a style which is shown how to be called, notice that it will always draw. \documentclass{article} \usepackage{tikz} \begin{document} \tikzset{ triple/.style args={[#1] in [#2] in [#3]}{ #1,preaction={preaction={draw,#3},draw,#2} } } \begin{tikzpicture} \draw[triple={[line ...


15

I suggest a different approach, not optimal (see What do the pgfkeys key handlers .get and .store in do?), but it works. Indeed, one problem in your code is that, inside arrow style the keys do not inherit the correct path /tikz/arrow inside/key-name. To make it working you can do something like: \[ \int_{ \tikz[scale=0.3]{ \path[fill=lightgray] ...


15

\documentclass{article} \begin{document} \lineskip0pt \framebox[3cm]{\strut Text1} \makebox[3cm]{\strut\vrule} \framebox[3cm]{\strut Text2} \makebox[3cm]{\strut\vrule} \framebox[3cm]{\strut Text3} \end{document}


14

Not an answer but to long for a comment. For the filling you could try to declare a custom pattern like this (I adjusted the code from the vertical lines pattern from pgflibrarypatterns.code.tex) \documentclass{article} \usepackage{tikz} \usetikzlibrary{patterns} \pgfdeclarepatternformonly{myvertical ...


14

Notes: I have replaced the scriptsize environment (that does not even exist) with the option font=\scriptsize on the \tkzAxeXY macro. I used the standalone class. With plain TikZ you have a few possibilities: The cross out shape from the shapes.misc library offers you the possibility to cross out a node. Normally this is used to visualize something ...


13

Yes, and yes! \input tikz \usetikzlibrary{matrix} \tikzpicture [mymatrix/.style={ matrix of nodes, column sep=2cm, row 3/.style={minimum height=3cm}} ] \matrix[mymatrix] (m) { foo & bar & baz \\ baz & foo & bar \\ bar & baz & foo \\ }; \draw[dashed,->] (m-1-2) -- (m-1-3); \draw[->] (m-3-1) -- ...


13

You can decide to scale nodes for example by setting: \tikzset{every node/.append style={scale=0.6}} and then locally redefine the scaling just in the node you are interested in. For example: \documentclass{article} \usepackage[T1]{fontenc} \usepackage{tikz} \usetikzlibrary{mindmap} \tikzset{level 1 concept/.append style={font=\sf, sibling ...


13

Check out if this MWE with Asymptote does what you need. For demonstration in this example it uses three paths (guides) gtop,gbot and gmid to define functions f(x) for mean and s(x) for deviation, use the proper definitions of f(x) and s(x) instead. Array pen[] clrs defines colors, array real[] dh defines fractions of the total interval to cover with the ...


13

This is basically the same as Is there an easy way of using line thickness as error indicator in a plot?, only with functions instead of tabulated data. The trick is to use stack plots=y together with \closedcycle to create the bands. I've defined a new command, \addplotwitherrorbands[<optional styles>]{<function>}{<positive ...


13

Scaling affects all the glyph strokes and this can be not very pleasant (some strokes will be unnecessarily and excessively thick); changing the font size using the font switches or \fontsize produce more harmonious results. Compare the results in the following simple experiment; the upper line uses \fontsize; the lower line uses scale: ...


13

This can give you a starting point: \documentclass[border=4pt]{standalone} \usepackage[utf8]{inputenc} \usepackage{array} \usepackage{tikz} \usetikzlibrary{ shapes.multipart, matrix, positioning, shapes.callouts, shapes.arrows, calc} \definecolor{myyellow}{RGB}{245,177,0} \definecolor{mysalmon}{RGB}{255,145,73} \begin{document} { \sffamily ...


12

You can use the shapes.callouts library from TikZ: \documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes.callouts} \definecolor{myblue}{RGB}{122,175,234} \newcommand\tikzmark[1]{% \tikz[remember picture,overlay]\node (#1) {};} \newcommand\MyNote[3][]{% \begin{tikzpicture}[remember picture,overlay] \node[rectangle callout, fill=myblue,text ...


12

There are three different options for setting colours of specific elements: draw, fill, and text. The colour specified using draw applies to outlines, fill applies to areas (and filled arrow tips, like stealth and latex, but unlike the default), text applies to the text in nodes. color is a shorthand for setting all three of these simultaneously. Just ...



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