Tag Info

New answers tagged

4

I don't know who you are on 9gag, but if you did spend a bit of effort I would be more willing to go all the way but this is where my procrastination brought so far. Now you know how it goes so you can polish it. \documentclass[tikz]{standalone} \usetikzlibrary{calc} \tikzset{germany/.style={circle,draw,fill,minimum size=1cm, path picture={\foreach \x in ...


0

Here is something to start with. This is done by tikz-cd. % arara: pdflatex \documentclass{standalone} \usepackage{tikz-cd} \newcommand{\textCD}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}} \begin{document} \tikzset{% ,every path/.style={% ,line width=2pt ,line cap=round } } \begin{tikzcd}[% ,column sep=4em,row sep=4ex ...


3

You need \usetikzlibrary{arrows} and -latex' most probably, when doing the copy-paste from the original code, you got an incorrect character ’ in -latex’. The complete code: \documentclass[border=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \usetikzlibrary{arrows.meta,arrows} \begin{document} \begin{tikzpicture} [auto, ...


0

The usual linear interpolation calculations uses !<num>! syntax and for your example it is simply (via calc library) \draw (stop) -- ($(stop)!0.5!(start)$); But for the fun of it, if you want to do a multiplication operation via coordinates then you need to nest the calc indicator (because multiplication of two coordinates is undefined if we can ...


12

Since adequate answers have already been given, I've felt free to do this picture with MetaPost. For me it was an occasion to use some recent features of the luamplib package, (which gives an interface to MetaPost in LuaLaTeX). More precisely, I've made use of the px unit (which I didn't know of) thanks to the \mpdim command, and of the integration of ...


1

OK, I figured it out. The relevant anchor that the to function uses is neither input nor output but the anchorborder, which is actually based on the center anchor. The relevant sections of the pgfmanual is 102.5.3 for the description of \anchorborder and 97.5.3 for \pgfpointborderrectangle, which \anchorborder typically uses. I guess I learned something. ...


15

Noting that 1px=0.026458cm you can set the units in tikzpicture as \begin{tikzpicture}[x=0.026458cm,y=0.026458cm] And use standalone class. Now your code will be \documentclass[tikz]{standalone} \usetikzlibrary{shapes,snakes} \definecolor{grun}{HTML}{239D48} \definecolor{rot}{HTML}{BF0028} \definecolor{gelb}{HTML}{F6EC0F} \begin{document} ...


8

As mentioned in the comments, you need to use capital letters in your \definecolor argument for HTML. You can use the geometry package to set the page size to your desired flag size, then make the tikzpicture fill the whole page by using \begin{tikzpicture}[remember picture,overlay] and referencing anchors of the current page node. I've done this in the ...


4

Here's one possibility; the \multirow command from the multirow package won't be useful here since a TikZ matrix is not really a standard LaTeX matrix; you can use the anchors for some of the matrix cells to place the labels at the desired location (defining a command to do so, as in my example code). I also drew some horizontal lines to separate the groups ...


6

Late options don't cover every property. The append after command is a clever shortcut mechanism for \pgfpositionnodelater<...> commands (here in particular \pgfpositionnodelaterpath). Hence the fill has been already stored but not executed. However the shape etc. has been decided otherwise you wouldn't be able to use that trick for placements. After ...


2

You will have to define your x-ticks interval manually. % arara: pdflatex \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} \begin{axis}[% ,ymode=log ,xmode=log ,log ticks with fixed point ,xtick={10,15,...,35} ,minor xtick={1,...,40} ] ...


2

In your example, the variable \name is the result of \x*20, a float expression. So, you get 0.0, 1.00006, ... ,100.0. So your polygonal nodes are named 0.0, 1.00006, ... ,100.0. (You can't use . in the name of a node: (a.10) points on anchor with angle 10 from center of the a node.) You may use int(\x*20) to round your float expression: ...


1

CW from the comments: Set the calculation into a PGF math macro and use the macro as the extra y ticks setting: \documentclass[border=2pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \begin{document} \tikzset{ declare function={ func(\x)= \x*\x; } } \begin{tikzpicture} \def \xmin {-3} \def \xmax {3} ...


3

Looks like TikZ automatically used the Frenet–Serret Coordinate System to draw the decoration. To undo this, we need to reset the rotation/scaling/slanting part of the current transformation but keep the shifting part --- this is what \pgftransformresetnontranslations is claimed to do. So modify the definition of zigzag from ...


4

when I want to draw over an image, I first draw a grid with a proportional scale the image with foreach and the calc library. Then I use these coordinates to draw \begin{tikzpicture} \node[anchor=south west,inner sep=0] (img)at (0,0) {\includegraphics[width=\textwidth]{sample.png}}; \foreach \xx in {0,1,2,...,9}{% \draw[dashed] ...


3

You can simply use \resizebox (and \noindent which is fundamental). Also note the % after \end{tikzpicture}. \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage[margin=2cm]{geometry} \usepackage{pgfplots} \usepackage{lipsum} \usepackage{multicol} \begin{document} \section*{Introduction} \lipsum[1] A “balanced” risk strategy ...


3

You could instead use text effects along path which allows you to apply effects on a character-by-character basis, such as shifting the text above or below the line of the curve or to the left or right. For example: \documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{decorations.text} \begin{document} \begin{tikzpicture} \newlength{\mylt} ...


2

You may scale the whole figure to column width like this: \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage[margin=2cm]{geometry} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \usepackage{lipsum} \usepackage{multicol} \usepackage{csquotes} \usepackage{siunitx} \newsavebox{\measuredSize} \newcommand{\resizeToWidth}[2]{% ...


4

After fixing the width to 0.95\columnwidth and tinkering yticklabels by yticklabel style={inner sep=2pt,rotate=45,anchor=south east,font=\footnotesize} we get Code: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[margin=2cm]{geometry} \usepackage{pgfplots} \usepackage{lipsum} \usepackage{multicol} \begin{document} ...


5

You can control position along the line with align option. You can define some left indent or right indent values to indicate where to start or end the text. I don't know how to set a vertical offset but may be you can \draw a vertically shifted line and later \path the decorated text over the same non shifted line. \documentclass{standalone} ...


1

Surprisingly there is a very easy way to do so. Adding transform shape into your cross/.style results the right "X" instead of the left "X". (I set cross/.default={6pt} so they are larger.) Thinking that an X is nothing but lines connecting corners of the rectangular node. So the remaining problem is to apply current transformation on nodes. It then ...


9

With pgfplots \documentclass[border=4mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture} \begin{axis}[ clip=false, xmin=0,xmax=2*pi, %axis lines=left, %axis x line=middle, %axis y line=left, xtick={0,1.57,3.14,4.71,6.28}, xticklabels={$0$, ...


2

From pgfmathfunctions.random.code.tex we know that \pgfmath@rnd@z stores the current number. So we can wirte \makeatletter \def\pgfmathsaveseed{ \xdef\pgfmath@savedseed{\pgfmath@rnd@z} } \def\pgfmathloadseed{ \xdef\pgfmath@rnd@z{\pgfmath@savedseed} } and test it by \begin{frame}{first test} \begin{itemize} \item ...


8

A starting point for the second one: \documentclass{article} \usepackage{tikz} \usetikzlibrary{chains,shapes.multipart} \usetikzlibrary{shapes,calc} \usetikzlibrary{automata,positioning} \definecolor{myred}{RGB}{220,43,25} \definecolor{mygreen}{RGB}{0,146,64} \definecolor{myblue}{RGB}{0,143,224} \tikzset{ myshape/.style={ rectangle split, minimum ...


5

In such a simple case you can use transform canvas: \documentclass{minimal} \usepackage{tikz} \begin{document} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (2.5,0); \draw (A) -- (B); \draw[transform canvas={yshift=2cm}] (A) -- (B); \end{tikzpicture} \end{document} Output: In more complex scenarios make sure to read the ...


1

You have to fix equal minimum size to equivalent columns and rows in both matrices to obtain similar sizes. Otherwise, first column of costmat is adjusted to its size which is narrower than first column in conmat. \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \tikzset{box/.style={draw, minimum width=3cm, minimum height=1cm}} ...


0

I solved reinstalling texlive, I noticed that typing in the cmd pdflatex.exe it didn't find anything. Now I have it working and the string I wrote in the question is the right one. It works even without the optimize=false. pdflatex.exe -synctex=1 -interaction=nonstopmode --shell-escape %.tex


6

I fear, you have to set those manually: % arara: pdflatex \documentclass{article} \usepackage{modiagram} \usepackage[version=3]{mhchem} \begin{document} \begin{MOdiagram}[labels-fs=\scriptsize] \AO(1cm){s}[label={2s}]{0.5;} % AO1 \AO(1cm){s}[label={2p}]{2;} % AO2 \AO(1cm){s}{2.1;} % AO3 \AO(1cm){s}{2.2;} % AO4 ...


2

Based on the answer by @Ignasi, I found another work-around. By setting the shorten option to a negative value (-3.8pt works fine here, thanks to @Ignasi), the curve is made longer and is drawn correctly. The downside to this is that the arrow head goes further than the specified point ((4,4) in this example), so this work-around only works if the arrow ...


3

\documentclass{article} \usepackage{tikz,stackengine} \begin{document} \stackon[-5pt]{\resizebox{2in}{!}{Minimum Working Example}} {\begin{tikzpicture}\draw[color=cyan](0,0) circle (2);\end{tikzpicture}} \end{document}


3

One option is to use overlay for the tikzpicture; to achieve exact positioning, you could also use the tikzmark library to place some marks and then, using remember picture, to use those marks to place the tikzpicture at the desired location; a little example: \documentclass{article} \usepackage{tikz} \usetikzlibrary{tikzmark,calc} \begin{document} ...


3

Here's an option using hobby for the "wiggly" curve, the intersections library to determine appropriate points over the curves, and the decorations.markings library to place the arrows in the middle of the segments between the curves; the segments correspond to portions of lines steaming from the center of the circle: \documentclass{article} ...


1

You can name your shape and then use the input and ouptut anchors (inherited from rectangle ee) to place your labels: \draw (contact 1) to [relay={label=north:-K10,name=a}] (contact 2); \node[rotate=90,above left,font=\footnotesize] at (a.input) {$A2$}; \node[rotate=90,above right,font=\footnotesize] at (a.output) {$A1$}; In fact, once you name your ...


5

This should give you some idea. \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.markings} \begin{document} \begin{tikzpicture} \foreach \x in {1,...,10}{ \draw (4,0) arc(0:360:4cm) node[coordinate,pos=0.\x] (a-\x) {}; \draw[thick, red] (3,2) arc(0:360:4cm) node[coordinate,pos=0.\x] (b-\x) {}; ...


1

All you need is redefine the two commands like this \newcommand{\generatePageLayouts}{% \newgeometry{layoutwidth=\pagewidthDVDTray,layoutheight=\pageheightDVDTray,left=0mm,right=0mm,bottom=0mm,top=0mm} %\savegeometry{LayoutPageDVDTray} }% \newcommand{\switchToLayoutDVDTray}{% \pdfpagewidth=\pagewidthDVDTray \pdfpageheight=\pageheightDVDTray % for PDF ...


4

Hmm Tikz ought to fix that, but meanwhile make sure you have a \par or blank line in the scope of any font size change, \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[text width=4cm] {\fontsize{14pt}{20pt}\selectfont Foo\\Bar\\Baz\par}; \end{tikzpicture} \end{document}


2

OK, I was missing two things: I had to install GNUPlot (sudo apt-get install gnuplot) And enable write18 with --shell-escape


3

I show here how to do it with one cobbled together tikz image (I don't know how to use tikz, so please forgive the incompetence) and use an \includegraphics for the rest. Substitute your code for each \savestack. \documentclass{article} \usepackage{graphicx,tikz} \usepackage[usestackEOL]{stackengine} \def\incg{\includegraphics[width=.5in]{graph.jpg}} ...


0

@Joseph Wright @Alain Mattheus I modified my old code. Now it allows the points are calculated with the help of "calc". \documentclass{report} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \centerline{ \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (4,0); \coordinate (C) at (3,2); %-------------------- ...


3

If all you want to do is to stack some tikzpictures, you can avoid nesting tikzpicture environments (which could produce undesired results or force you to previously box the inner environments) by simply using \raiseboxes and some \hspaces: \documentclass{article} \usepackage{tikz} \begin{document} \noindent \begin{minipage}{\textwidth} \centering ...


2

Like this? \documentclass{article} \usepackage{tikz} \tikzset{ box/.style={% rectangle, minimum height=4cm, minimum width=4cm, bottom color=blue,top color=blue!50 } } \begin{document} \begin{tikzpicture} \foreach \x in{4,3,2,1}{ \node[box] (c1) at (\x,\x) {}; } \end{tikzpicture} \end{document}


6

To get better figures, I used the sloped option in the node command to be able to write a text tangent to a certain segment. For example, to put the 14 number in the top face of the first figure I used \path (A) -- node[sloped] {14} (C); where (A) and (C) are opposite vertices of this face. I did not know anything about this sloped option in the node ...


3

I agree with the comment of @percusse : this looks like a bug ! When we use draw=some color this color is used afterward by some arrows. And in a strange way node reset this behaviour. Here is another minimal example : \documentclass[tikz,border=7mm]{standalone} \begin{document} \begin{tikzpicture} \path[draw=orange] (0,0) circle(1cm); % this draw ...


5

In your question you said that you want to fill random nodes. If you want a realy random choice you can do the following random darkstyle style : \documentclass[tikz, border=7pt]{standalone} \usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,% decorations.pathreplacing,decorations.pathmorphing,shapes,% matrix,shapes.symbols} \tikzset{ ...


4

\documentclass{minimal} \usepackage{tikz} \usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,% decorations.pathreplacing,decorations.pathmorphing,shapes,% matrix,shapes.symbols} \begin{document} \begin{tikzpicture}[ darkstyle/.style={circle,draw,fill=gray!20,minimum size=20}, bluestyle/.style={circle,draw,fill=blue!20,minimum size=20}, ...


5

Couldn't resist to add a MetaPost version of this. \documentclass{standalone} \usepackage{luamplib} \begin{document} \begin{mplibcode} r = 10cm; % Unit d = 2r; beginfig(1); for n = 1 upto 1000: draw fullcircle scaled (d/n) shifted (r/n, 0) ; endfor endfig; \end{mplibcode} \end{document} To be run with LuaLaTeX.


4

A PSTricks solution: \documentclass{article} \usepackage{multido,pstricks} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \calc \fp_eval:n \ExplSyntaxOff % parameters \def\circles{100} \def\radius{3} \begin{document} \begin{pspicture}(\calc{2*\radius},\calc{2*\radius}) \multido{\i = ...


6

Another solution leveraging nodes' alignment property: \documentclass[tikz,border=10pt]{standalone} \pgfkeys{tikz/.cd, num of circles/.store in=\numcirc, num of circles=100, circle initial size/.store in=\circlesize, circle initial size=3cm, } \begin{document} \begin{tikzpicture} \foreach \n in {1,...,\numcirc}{ ...


9

May be better than infinity you fix a large number \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \n in {1,2,...,2000} \draw (1/\n,0) circle (1/\n); \end{tikzpicture} \end{document} Edit: we can replace \foreach \n in {1,2,...,2000} by \foreach \n in {1,...,2000} since the step is 1


4

Here is a solution for the graph of your example with n even. If n is odd there is no such coloring. I use math library to make the logic, but if you wan you can replace this part of the code by vanilla tex solution. \documentclass[tikz, border=7pt]{standalone} \usetikzlibrary{graphs,graphs.standard,math} \xdef\j{0} % the node number is stored globally ...



Top 50 recent answers are included