Tag Info

Hot answers tagged

12

Just playing around without really knowing what I am doing... \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \filldraw[fill=orange,line width=1pt] (0,0) -- (1,1) -- (1.05,.7) -- (7.5,0) -- (1.3,-.7) -- (1.35,-1) -- cycle; \filldraw[fill=orange,line width=1pt] (12.1,-.7) -- (11.85,.7) -- (4.7,.4) -- cycle; ...


11

Improved version: You can use a decoration and \pgfdecoratedpathlength: The code: \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.markings} \makeatletter \tikzset{% measureme/.style={ decoration={ markings, mark=at position 1 with {\node[below,black,anchor=west] {My length is \pgfdecoratedpathlength};}, ...


10

By default a node is an \mbox so does not accept display material such as a list. If you give it a width then it uses minipage so does accept display material: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[remember picture, overlay] \draw (current page.center) node[text width=3cm] { \begin{itemize} ...


9

I apologize to the OP for providing not a TikZ-only solution, but there are already three good TikZ-only answers and a future reader of this question may have use of my answer relying upon the tcolorbox package (which is actually based on TikZ). With the current version 3.30 (2014/11/17), a really short answer can be given using the \tcbincludegraphics ...


7

You can use mark options like mark options={draw=white,}: \documentclass[10pt]{article} \usepackage{pgfplots} \begin{document} %\tikzset{every mark/.append style={draw=white}} \begin{tikzpicture} \begin{axis}[ xmin=0, xmax=100, ymin=0, ymax=100, grid=major ] \addplot [mark=*,mark options={draw=white,}, line width=1pt] table { 10 10 ...


7

% arara: lualatex \documentclass{article} \usepackage{fontspec} \begin{document} \setmainfont{code2000.ttf}\symbol{"2702} \setmainfont{quivira.otf}\symbol{"2702} \setmainfont{symbola.ttf}\symbol{"2702} \end{document} If you are on pdfLaTeX: Included in TikZ: % arara: pdflatex \documentclass{report} \usepackage{tikz} \usepackage{marvosym} ...


6

Here is a solution (with double inclusion of picture): \documentclass[twoside,a4paper]{tufte-handout} \usepackage{blindtext} \usepackage{tikz} \usepackage{graphicx} \usepackage{calc} \newcommand*{\ClipSep}{0.4cm}% \begin{document} \marginnote{% \begin{tikzpicture} \node [inner sep=0pt,draw=white](a) {\includegraphics[width=\linewidth]{example-image}}; ...


6

Different frog ;-) from internet. The proposed solution utilizes the current bounding box information to draw 4 arcs at 4 corners and fill them with white color. The radius of the corners is defined by \r that can be adjustable. Code \documentclass[twoside,a4paper]{tufte-handout} \usepackage{blindtext} \usepackage{tikz} \usepackage{graphicx} ...


6

The problem is that in the options to the tikzpicture environment you have used shape=coordinate. This sets the default shape to a coordinate which means when a node is drawn and the shape is not explicitly given, a coordinate will be used and the text ignored. One solution is to use every pin/.style={shape=rectangle} in the tikzpicture keys: ...


6

the class apparently sets up \small to set \spaceskip which seems wrong in general and is a disaster inside a tikzpicture You can avoid the problem by moving \small or you can reset \spaceskip: \documentclass[twoside,a4paper]{tufte-handout} %\documentclass{article} %uncomment this to see what's happening \usepackage{tikz} \begin{document} ...


5

Why not just this? \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{calc} \makeatletter \newcommand\aescandash[1]{%% \let\ae@scan@dash@result\relax \ae@scan@dash@parse#1_\@nil \ae@scan@dash@result } \def\ae@add@to@result#1#2{%% \ifx#1\relax \def#1{#2}%% \else \expandafter\def\expandafter#1\expandafter{#1#2}%% \fi} ...


5

How about a path picture? Then the clipping is done for you. However you have to get the height of the image first which I did by putting it into a temporary box. It is probably more efficient to set the minimum width and minimum height keys to \wd\tmpbox and \ht\tmpbox+\dp\tmpbox respectively, but I just used \phantom. ...


5

Here is another answer that uses a box and tikz. To make this look different, I have used a macro \myclippedpic. \documentclass[twoside,a4paper]{tufte-handout} \usepackage{blindtext} \usepackage{tikz} \newcommand*{\ClipSep}{0.4cm}% \newbox\tmpbox \newcommand{\myclippedpic}[1]{% \setbox\tmpbox=\hbox{\includegraphics[width=\linewidth]{#1}}% ...


5

To see it better I've moved things around a bit. First of all, you are switching to even odd rule for clipping. An example to see how the areas are counted as even and odd \begin{tikzpicture}[even odd rule] \fill[clip] (0,0) circle (2cm) (60:2.5cm) arc (60:-60:2.5) (60:3cm) arc (60:-60:3cm); \end{tikzpicture} Note that this is a PostScript directive and ...


5

Fixed the exponent typo now it is behaving properly. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \draw[style=help lines] (-1.5,0) grid[step=1] (1.5,1.5); \node[fill,circle,inner sep=0.5pt] (one) at (1,0) {}; \node[fill,circle,inner sep=0.5pt] (i) at (0,1) {}; \pgfmathsetmacro\myfactor{1cm/1pt} % ...


5

You can use a proper rectangular clipping: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[step=1cm,color=gray!20] (-5,-5) grid (5,5); \draw[-] (-5,0) -- (5,0) node[right] {$x$}; \draw (0,0) node[below left] {$O$}; \draw[-] (0,-5) -- (0,5) node[above] {$y$}; \foreach \x in {-5, -4, -3, -2, -1, 1, 2, 3, 4, 5} ...


5

Sure you can, if you use the right syntax (you need three dots in {0.1,0.2,...,1.0}): The code: \documentclass[]{article} \usepackage{tikz} \usetikzlibrary{shapes,calc} \begin{document} \begin{tikzpicture} \node[draw,regular polygon, regular polygon sides=8,minimum width=5cm] (polygon) {}; \foreach \mypercent in {0.1,0.2,...,1.0} \node[draw,circle] ...


4

This is another attempt where each dot has an internal label (of Euclidean coordinate system) and utilize the labels as references to draw lines via foreach loop, some relative coordinates are used. As for labels around the diagram, only a few of them are shown, same techniques are applicable though. Code \documentclass[border=10pt]{standalone} ...


4

Use dash pattern \documentclass[border=5]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw [line width=.5pt,dash pattern=on 1pt off 2pt]circle(0.655cm); \end{tikzpicture} \end{document} See also pag. 168 of the manual


4

Don't leave a blank line between equation and tikz picture. You can specify a baselne for the picture. \documentclass{article} \usepackage{amsmath} \usepackage{tikz} \begin{document} \paragraph{a)} $ \begin{aligned}[t] &k:4x+3y=0 \text{en A(4,5)} \\ &d(A,k)=\dfrac{|ax_A+by_A-c|}{√{a²+b²}} \\ &\qquad =\dfrac{|4 · 4+3 · 5|}{√{4²+3²}} \\ ...


4

It is possible to insert a preprocessor, but obviously this involves a teensy hack of the node parser. In the code below I define a preprocess node content key which takes a macro as an argument. This macro should be defined to take one argument, which will be the text to process. Obviously if there is something more complex than simple text then the whole ...


4

One way is to record the name on the node to something else and use that name in the later styles. But you might use pics instead for less headache and more flexibility (in TikZ v3.0). \documentclass[tikz]{standalone} \usetikzlibrary{shapes, fit} \begin{document} \begin{tikzpicture} \tikzset{ main/.style={circle, minimum size=6mm, very ...


4

Defining new anchors is tricky and basically impossible without looking at the PGF code used to define the shape. But aliasing anchors is quite straightforward (once you have the command to do it): \documentclass[tikz,border=5]{standalone} \usetikzlibrary{shapes.geometric} \makeatletter \def\pgfaliasanchor#1#2#3{% \expandafter\gdef\csname ...


4

I cobbled this together using the example in the chemfig package (section 12.7). Edit: I also added a plain label (without arrows) next to the bond. I think this looks better because the line with arrows is not quite parallel to the line indicating the bond. \documentclass[a4paper, 12pt, twocolumn]{article} \usepackage[utf8]{inputenc} ...


4

Since the image is scaled so that it covers the entire page, then all that is required is the width and the height of the paper to set the shift and the scale transformations. This could be done using the shift, x and y keys but I have defined a custom page cs coordinate system so that it is possible to use coordinates like (1,1) in the usual way: ...


4

One option: The code: \documentclass{article} \usepackage{forest} \usetikzlibrary{positioning,arrows.meta} \newsavebox\Downtree \newsavebox\Uptree \tikzset{ nleft/.style={text width=15pt,midway,left,font=\strut\scriptsize}, nright/.style={text width=15pt,midway,right,font=\strut\scriptsize}, } \savebox\Downtree{\begin{forest} for tree={ s ...


4

You can patch the oneparchoices like \usepackage{xpatch} \xpatchcmd{\oneparchoices}{\penalty -50\hskip 1em plus 1em\relax} {\penalty -50\hskip 0.4em plus 0.25em\relax} %% change here as you like {} {} Change the values as you like. \documentclass{exam} \usepackage{tikz} ...


4

You can place an auxiliary coordinate in the mid-point of the arrow from pro1 to dec1 \draw [arrow] (pro1) -- coordinate[midway] (aux) (dec1); and then use this coordinate to draw the arrow: \draw [arrow] (pro2b) |- (aux); The complete code: \documentclass[12pt,twoside,a4paper]{book} \usepackage{tikz} \usetikzlibrary{shapes,arrows,positioning} ...


3

I can't compile that thing so I'm summoning my crystal ball and guess that you need to add scaled x ticks=false option to the first plot axis options. pgfplots loads TikZ. TikZ loads pgfkeys and xcolor. So you only need the first for those four packages.


3

Here is solution via calc library and using a to path operation to define the curvedlink style for edges: \documentclass{beamer} \usecolortheme{wolverine} \beamertemplatenavigationsymbolsempty \usepackage{tikz} \usetikzlibrary{matrix,arrows,positioning,calc} \tikzset{ curvedlink/.style={ to path={ let \p1=(\tikztostart.east), ...



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