Tag Info

New answers tagged

0

Since you are doing commutative diagrams, I'd suggest you to use a dedicated package such as the powerfult tikz-cd (built upon TikZ) which offer you a more convenient, cleaner and shorter syntax as well as ready to use features for your diagrams. A little example with your product: \documentclass[border=5pt]{standalone} \usepackage{tikz-cd} ...


2

If I understand the requirements correctly, then I think the problem is that the TeX box that contains the tikzpicture has some non-zero depth. In the following, I use the local bounding box key to explicitly name the picture (using the current bounding box doesn't work) and then use the baseline key to set the baseline of the tikzpicture to the bottom of ...


2

Something like this? Note that the use of the positioning library and the updated syntax <direction>=of <place> helps immediately with the spacing. Only one further adjustment really was needed here to increase the height a bit. The rest is just a question of tweaking the position of the labels e.g. below or above and using sloped for the 2 ...


4

How about this: \draw[name path = AE] (ORG) -- (A) -- (B) -- (C) -- (D) -- (E); \draw[name path = MN] (M) -- (N) -- (U) -- (V); \fill [name intersections={of=AE and MN, name=i, total=\t}] [red] \foreach \s in {1,...,\t} { (i-\s) circle (3pt) };


1

\documentclass{standalone} \usepackage{tikz} \usetikzlibrary{backgrounds} \begin{document} \begin{tikzpicture} \def\us{(0,2),(1,4),(2,0),(3,2),(4,1),(6,2),(6,4)} \foreach \u [count=\i from 1] in \us {\node (u\i) at \u [right] {$u_\i$};} \begin{scope}[on background layer] \fill[blue!20] (u1.center)--(u2.center)--(u3.center); \end{scope} %% For Test ...


3

This is because TikZ automatically uses the most appropriate anchor to connect two nodes, so you do not actually have a triangle, you have two edges. Try \fill[fill=blue] (u1.center) -- (u2.center) -- (u3.center) ; instead, it will show the difference. Other ways are to use \def\us{0/2,1/4,2/0,3/2,4/1,6/2,6/4} \foreach \x/\y [count=\i from 1] in \us { ...


3

You can also anchor nodes on its baseline: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[every node/.style={above=2mm, anchor=base}] \draw[color=red](0,3)--(11,3); \draw (0.5,2.5)--(0.5,3) node {For Example:}; \draw (3,2.5)--(2.5,3) node {this looks}; \draw (5,2.5)--(5.5,3) node {not nice vertically aligned}; ...


4

It's the style declarations and the empty line that is counted as whitespace. Remove the blank line and put the styles in the TikZ environment and it will be OK again. And please have a look at Should \tikzset or \tikzstyle be used to define TikZ styles? The easiest is to use a simple \tikzset{ b/.style={rectangle, draw, fill=white, node ...


6

This would be my first try, using a counter (no need of additional packages): \documentclass[a4paper,10pt,landscape]{article} \usepackage{tikz} \newcounter{cnti} \begin{document} \begin{tikzpicture} \foreach \i in {0,...,9}{ \setcounter{cnti}{\i}\addtocounter{cnti}{1} \node (i) at (\i, \i) {\alph{cnti}} ; } ...


8

One possibility: \documentclass[a4paper,10pt,landscape]{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach [count=\i] \j in {a,b,...,j}{ \node (\i) at (\i, \i) {\j} ; } \end{tikzpicture} \end{document} percusse mentions the alphalph package in a comment, and its \alphalph does exactly what you ...


2

Next code shows a solution for your first problem. You want similar fitting nodes, then if you build them with similar inner nodes, they will have same size. As an example \node[surround, fit = (id1)(id3.east|-id1.center)] {}; will build a node big enough for id1 (which fixes height and western border) but it will also encompass coordinate ...


2

If you want actual numbered captions, you can use \captionof in a node placed below the axis. You can have subfigure numbering if you prefer that, see e.g. http://tex.stackexchange.com/a/250032/586 \documentclass{article} \usepackage{pgfplots} \usepackage{capt-of} \begin{document} \begin{figure} \begin{tikzpicture}[every axis/.style={width=7cm}] ...


1

Multiple axes environments are hard to connect, but at least you could use a groupplot by loading the groupplots library. Here is an example: \documentclass{article} \usepackage{pgfplots} \usepgfplotslibrary{groupplots} \pgfplotsset{compat=1.12} \begin{document} \begin{figure}[ht] \centering \begin{tikzpicture} \begin{groupplot}[group style={group size=2 ...


2

\documentclass[tikz,border=10pt]{standalone} \usepackage{tikz-3dplot} \begin{document} \tdplotsetmaincoords{70}{20} % point of view \begin{tikzpicture}[tdplot_main_coords,scale=1] %draw black arc \draw[canvas is xy plane at z = 0, line width = 1pt] (0,0) arc (0:-90:-1); %draw rotated gray arcs (5°-steps) \foreach \rotStep in ...


2

You can name the label and add to the fit list. \node[obj,label={[name=id1-l]below:Outside}] (id1) at (2,2) {}; \begin{pgfonlayer}{background} \node[surround] (background) [fit = (id1)(id1-l)] {}; \end{pgfonlayer} If you are going to use this often times then making a style out of it might be a good idea.


1

I have no acces to comuter right now, so my answer will be short and non verifyed. I see three errors: In the for loop you can't let a space between } and { in the current version of tikzmath. Your draw command must be enclosed in { }; The coordinates in your draw command must be before the circle. You can check the following code: ...


3

Disclaimer: I am not a colourosopher and this is the first time I have ever touched colorimetry. Be warned. An elegant approach to your problem is functional shading. It allows for a very general solution, easily adjustable to other analogous problems (read: other colour spaces). On close inspection your dataset seems botched, so I'm just going to ignore ...


6

I have simplified the code by placing the origin at (0,0,0). The point of view can be set using: \tdplotsetmaincoords{70}{110} % rotation about the x and y axis The black arc rotation can be set using: \tdplotsetrotatedcoords{0}{0}{-5} % rotation about the x, y and z axis \documentclass[tikz,border=10pt]{standalone} \usepackage{tikz-3dplot} ...


1

One option is to use a tabular with two columns of type m{<length>} (requires the array package) with centered content. The first column for the 2x2 array of images and the second column for the colorbar. A little example illustrating this approach (adjust the settings according to your needs): \documentclass{article} \usepackage{graphicx} ...


3

Slightly modified ind simplified @daleif and @ AboAmmar solutions (they seems to me almost the same :-)): \documentclass[11pt, border=1mm, tikz, preview]{standalone} \usetikzlibrary{arrows,calc,fit,backgrounds} \newcommand{\psign}{+} \newcommand{\ppsign}{++} \begin{document} \begin{tikzpicture}[ node distance ...


4

\documentclass[11pt]{article} \usepackage{tikz,xcolor} \usetikzlibrary{arrows,calc,fit,backgrounds} \definecolor{fcolor}{HTML}{F1F1F1} \newcommand{\psign}{+} \newcommand{\ppsign}{++} \begin{document} \noindent \begin{tikzpicture} \tikzstyle{my node} = [draw,rectangle,minimum width=2.2cm,minimum height=0.8cm, node distance=2cm] %\draw[black!20] ...


3

This sort of does what you are looking for. Note that fit draws on top, you if you need a full color underneath, you may need to draw those nodes twice (onces to get the nodes for the fit calculation, and once to draw them again onto of the fit area, you can just store the drawing code in a macro and run that macro twice). \documentclass[11pt]{article} ...


1

An clumpsy solution: \documentclass[a4paper,12pt]{scrartcl} \usepackage[utf8]{inputenc} % input encoding \usepackage[T1]{fontenc} % use T1 fonts for font encoding \usepackage{amsfonts} % math font \usepackage{tikz} \newcommand{\Fr}{\textbf{F}} \newcommand{\F}{\mathbb{F}} ...


3

What about this? \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \draw (-3,0) -- (3,0); \draw (0,-3) -- (0,3); \draw [blue, dashed] (0,0) circle(2.5cm); \node[regular polygon, regular polygon sides=12, minimum size=5cm, rotate=-60, draw] at (0,0) (A) {}; \foreach \i ...


3

This reduces the amount of code, though the result could probably be better. (If some wizard comes up with a much better solution I'll likely delete this answer.) The labels are placed with the following loop: \foreach [count=\i] \x/\y in {10/0,8/5,5/8,0/10,-5/8,-8/5,-10/0,-8/-5,-5/-8,0/-10,5/-8,8/-5} { \path (\x,\y) ++({atan2(\y,\x)}:3.5cm) node ...


4

Here is a pgfplots approach: \documentclass[tikz,border=10pt]{standalone} \usepackage{pgfplots} \usetikzlibrary{decorations.text} \pgfmathdeclarefunction{gauss}{3}{% \pgfmathparse{1/(#3*sqrt(2*pi))*exp(-((#1-#2)^2)/(2*#3^2))}% } \begin{document} \begin{tikzpicture} \begin{scope}[rotate=-90] \begin{axis}[ domain=-0.5:2.5, xmin=-1, xmax=3, ...


3

I'm sure I've seen something very similar to this answer somewhere else, but I can't find it. But anyway, here is an image coordinate system which provides a way to refer to coordinates in the image (actually the node containing the image which should have zero innersep and outersep) using both relative coordinates (from 0 to 1) and exact coordinates (i.e., ...


6

Should point you in the right direction... \documentclass[tikz, border=5]{standalone} \begin{document} \begin{tikzpicture}[>=stealth, line cap=round] \draw [thick, ->] (0,-2) -- (0, 2) node [midway, sloped, above] {Spatial distribution}; \draw [thick, ->] (0,-2) -- (10,-2) node [midway, below] {Time}; \draw [thick, dotted] plot ...


1

I think you are a little bit confused about TikZ capabilities and of course the package pgfplots. First problem is that you need to let pdflatex or whichever engine you are using to reach out the system commands. For example, I use TeXnicCenter and my command line parameters are configured as -synctex=-1 -max-print-line=120 -interaction=nonstopmode "%wm" ...


3

Here is the most complex tree. You should be able to modify it to produce the simpler trees. If you get stuck, just post the code you have and ask how to solve the problem you come across. This uses the powerful forest package which allows the standard bracket notation to be used for drawing trees. My answer to an earlier question introduces forest and ...


2

\documentclass[a4paper,12pt]{article} \usepackage{tikz} \usepackage{floatrow} \floatsetup[figure]{% style=Boxed,captionskip=12pt,capposition=bottom,margins=centering,% } \usepackage[font=small]{caption} \begin{document} \begin{figure}[ht] \centering \begin{tikzpicture}[thick,scale=1] \filldraw[black] (0,0) circle (2pt) (1,1) circle (2pt) (1,-1) circle ...


1

The problem is that the tcolorbox changes \textwidth which is used bt the tikzpagenodes package to internally calculate the position for the page nodes it defines. You can see this using \documentclass[oneside]{book} \usepackage{tikzpagenodes} \usepackage[most]{tcolorbox} \newtcbtheorem{theo}{Theorem}{theorem style=plain}{th} \begin{document} ...


1

The Applet's are too close each other and overlap. Please compare a modified example. I am not sure what your \gls means... \documentclass{article} \usepackage{pdflscape} \usepackage{tikz} \usetikzlibrary{automata} \begin{document} and my code looks like this \def\gls{\MakeUppercase} \begin{figure} \centering \begin{tikzpicture} ...


2

You don't need any shift or those calculations, rather you can simply add raise=<length> to the brace options. Output Code \documentclass{memoir} \usepackage{tikz} \usetikzlibrary{calc, shapes.geometric, positioning, arrows.meta, decorations.pathreplacing} \begin{document} \begin{tikzpicture} \node (foo) [draw, minimum width=6 em] ...


2

I suppose you want to hide the thing in a box: \node[anchor=north,inner sep=0] at (title_for_a_set_of_rays){% \mbox{\boldmath$\mathrm{HR}(\ray{r},P)$}% }; Notes. I used a mock definition for \ray, as you didn't provide one. There should be no \, after the comma.


1

\usepackage{bm} % defines commands to access bold math symbols and then... \node[anchor=north,inner sep=0] at (title_for_a_set_of_rays)% {$\bm{\mathrm{HR}(\ray{r}, P)}$} font=\bfseries is not needed.


4

The root cause is a bug in pgfplots: apparently, the ticklabel coordinate systems do not work as expected. This morning, I have managed to improve the polar library such that the default for pgfplots 1.13 will directly result in the label placement as in your screenshot. I will also simplify sloped tick labels and add some more fine tuning to it. For the ...


2

A simple way of doing this is with a path picture. Using some extra magic, the path picture can be set up so (-1,-1) is the lower left corner and (1,1) is the upper right corner of the picture. This makes it quite straightforward to specify path picture elements. \documentclass[tikz,border=5]{standalone} \tikzset{% do path picture/.style={% path ...


2

You can put a sine curve as a tikz picture inside a node. \begin{tikzpicture} \node[draw,circle,inner sep=-0.4pt] at (0,0) {\tikz \draw[scale=0.15,domain=-3.141:3.141,smooth,variable=\t] plot (\t,{sin(\t r)});}; \end{tikzpicture}


0

I want to center the figures horizontally on the page. I prefer to do this with familiar commands in TikZ. Here is code that gives the display that I want. \documentclass{amsart} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections} \begin{document} \noindent \hspace*{\fill} ...


18

It is much easier to just draw everything in the correct order instead of using 3d coordinates (or layers). The crucial part is the last dozen of lines: \documentclass{standalone} \usepackage{xifthen} \usepackage{tikz} \usetikzlibrary{math} \begin{document} \begin{tikzpicture} \newdimen\r \newdimen\R \newcount\n \tikzmath{ \n = 19; ...


1

Thanks to Gonzalo Medina in this post : plot and fit from pgfplottable, I did manage to do what I wanted. The final code is : \documentclass{beamer} \usepackage{etex} \usepackage[frenchb]{babel} \usepackage[T1]{fontenc} \usepackage[utf8x]{inputenc} \usepackage{pgfplots} \usepackage{pgfplotstable} \usepackage{epstopdf} \usepackage{tikz} ...


8

One option using TikZ and the tikzpagenodes package (adjust the settings according to your needs). According to comments, the first page of each chapter should also have the new page style, so \aliaspagestyle{chapter}{solid} was used: The code: \documentclass{memoir} \usepackage[hmargin=3cm]{geometry} \usepackage{xcolor} \usepackage{lmodern} ...


2

Add forget plot to those plots that shouldn't be taken into account for the legend (the first two, in your example). You can use legend style to customize the legend formatting; in your case, you need draw=none to suppress the frame. Using the various coordinate systems provided by pgfplots, you can place elements at any desired location. In the example ...


8

Annotate at your leisure... \documentclass[tikz,border=5]{standalone} \usepackage[eulergreek]{sansmath} \usepackage{pgfplots} \pgfplotsset{compat=newest, tick label style={font=\sansmath\sffamily}, axis line style={draw=black!80, line width=0.1875ex}, y tick label style={/pgf/number format/fixed}, tick style={major tick length=0.0ex}, major grid ...


1

This one is makes a nice example of using buildcycle with subpath in Metapost. prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); path A, B, C, D, F; A = fullcircle scaled 240; B = fullcircle scaled 200 shifted 20 right; C = fullcircle scaled 100 shifted 30 left; D = fullcircle scaled 180 shifted 60 left shifted 40 up; F = buildcycle(subpath ...


0

\documentclass[10pt]{article} \usepackage{pgf,tikz} \usetikzlibrary{arrows,calc} \usepackage{calc} \pagestyle{empty} \begin{document} \definecolor{ffffqq}{rgb}{1,1,0} \definecolor{qqccqq}{rgb}{0,0.8,0} \definecolor{ffttzz}{rgb}{1,0.2,0.6} \definecolor{ttttff}{rgb}{0.2,0.2,1} \footnotesize \begin{tikzpicture}[line cap=round,line join=round,>=triangle ...


0

There are several issues. Two are easy to solve. First, do not leave blank line after a \foreach. TikZ wants to read onto the end of the loop without any paragraph breaks. Second, never use $$ in LaTeX documents. Here, it confuses TikZ but it is, in any case, bad. In this case, just change the $$s to $s. The third is less easy to solve and you will need ...


3

Why is the title not placed above the pentagon? Because point F is highest and not E. why is the tikzpicture flush against the right margin? That is because you are setting \hspace*{\fill}. \documentclass{amsart} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections} ...


1

And one more solution (It take me little more time because I allowed myself first to simplify the picture code :-) , i was lost in original one :-( ): \documentclass{amsart} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections} \begin{document} \begin{tikzpicture}[ node ...



Top 50 recent answers are included