Tag Info

Hot answers tagged

11

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; ...


10

Update In comments it's been requested to also plot an exponential. You can use pgfplots: \documentclass{exam} \usepackage{amsmath} \usepackage{pgfplots} \begin{document} \begin{questions} \question Draw the graph of $f(x)=\lvert\log x\rvert$. \begin{tikzpicture} \begin{axis}[ axis lines=middle, samples=100, ymax=3 ] ...


8

\documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{fit,backgrounds} \begin{document} \begin{tikzpicture}[cable/.style={circle, fill=blue!30!black, minimum size=10mm, inner sep=0pt, outer sep=0pt}] \node[cable] (center) at (0,0) {}; \foreach \i in {0,1,...,6} \node[cable] (1-\i) at (60*\i:10mm) {}; \foreach \i in {0,1,...,12} \node[cable] ...


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} ...


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 ...


8

You need to move your \defs outside the tikzpicture (otherwise, they don't survive the group created for the environment). The caption is provided using \caption{$y=\protect\polynomial{\g,\f,\e,\d,\c,\b,\a}$} where \polynomial from the polynomial package gives the desired formatting for the polynomials. In fact, the code uses a redefinition of ...


6

Here is a straight-forward tikz decorations solution: (i) \documentclass[border=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{decorations.markings} \begin{document} % particle decorations borrowed from: Kjell Magne Fauske % http://www.texample.net/tikz/examples/feynman-diagram/ \tikzset{ every ...


6

Here a pure tikz-solution. The axes are drawn using the ifnum command. \documentclass[tikz, border=6mm]{standalone} \usepackage{amsmath} \begin{document} \begin{tikzpicture}[>=latex] \draw [<->] (0,2.5) node [above] {$y$} |- (4.5,0) node [right] {$x$}; \foreach \x in {0,...,4} { \draw (\x,0) -- ++(0,-4pt) node [below] {$\x$}; ...


5

You need the positioning library; add to the preamble \usetikzlibrary{positioning}. Your example: \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{figure}[hp] \centering \begin{tikzpicture} [place/.style={circle,draw=blue!50,fill=blue!20,thick,inner sep=0pt,minimum size=6mm}, ...


5

Is this the image you are after? After all the discussions and conversations, I think you now got the idea why there were some points misplaced. In brief, that is because the axes are basically used for plotting data points (table) and not dimensions and lengths. So, some conversions are required, e.g., the dimension 6mm may be entered 0.6, etc. So, my ...


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 ...


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, ...


4

% arara: pdflatex \documentclass{standalone} \usepackage{forest} \begin{document} \begin{forest} for tree={% edge path={\noexpand\path[\forestoption{edge}] (\forestOve{\forestove{@parent}}{name}.parent anchor) -- +(0,-12pt)-| (\forestove{name}.child anchor)\forestoption{edge label};} } [ \underline{A}, calign=child,calign child=3 [B] [M [C] [N [T] [B] ...


4

You cannot straightforwardly use dimensions when specifying coordinates within an axis environment. Since the specification for C doesn't use a dimension, it is correctly placed, but other coordinates are misplaced relative to the intended origin. To see that this is not an effect of TikZ itself, simply remove the axis environment and typeset the remaining ...


4

Instead of using \paperwidth and \paperheigh, I'd suggest you to use the current page. family of nodes and to place everything with respect to those modes (this implies that you have to use the remember picture,overlay keys for each tikzpicture and that the document needs two runs for the elements to reach their final positions). A complete example: ...


4

As percusse points out, after a path is used, it is forgotten and is no longer the "current path". However, the intersections library provides a key to name a path and save it so can be "remembered". In the following a from end of path key is defined which can be used to start a new path from the last point of the end of a remembered (i.e., named) path. ...


3

This runs without error and looks okay as far as I can tell. I had to substitute an example image instead of pic2.jpg \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{calc,tikzmark,arrows,shapes,backgrounds,decorations.pathreplacing} \tikzset{ every picture/.append style={remember picture}, na/.style={baseline=-.5ex}, arrow/.style={-stealth} ...


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} ...


3

Two diagrams to compare: The first diagram is the original one using a matrix of math nodes. The second one uses tikz-cd. The code: \documentclass[a4paper,11pt]{article} \usepackage{tikz-cd} \usetikzlibrary{matrix,arrows} \tikzset{ grade/.style={sloped,fill=white,inner sep=1pt,font=\tiny} } \begin{document} \begin{tikzpicture} \matrix (m) [matrix of ...


3

Loop Space' quote is not meant for the current implementation. His context is what if we didn't flush out the path as is the current implementation of TikZ. He is, if I'm not wrong building a story that led to spath package. Not the actual description of TikZ implementation. Every draw command resets the last known coordinate to the origin. In fact your ...


3

If you only want to use the axis environment to draw the axis, then don't try to do anything else with it. Note: the scope is used to shift the origin. I also simplified your angle labels. Later I came back and simplified all of the labels. \documentclass{amsart} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{tikz} ...


3

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 ...


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 ...


3

Disclaimer: I am not a colourosopher and I have almost no idea what I am talking about. That said, I think an elegant way to approach the problem would be using functional shading: it allows you to draw from known data (transformation matrices between colour spaces) and is easily adapted to analogous problems. I learnt a bit of theory from Ryan Juckett and ...


2

Another short solution (run with latex --> dvips --> ps2pdf): \documentclass[pstricks,border=10pt]{standalone} \usepackage{pst-eucl,pst-plot} \def\iTheta{120} \def\Radius{5} \def\Pb{4} \begin{document} \begin{pspicture}(-5,-1.5)(6.6,6) \psaxes[ticks=none,labels=none,linecolor=black!40]{<->}(0,0)(-5,-1.5)(6.2,5.5)[$x$,0][$y$,90] ...


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 ...


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

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 ...


2

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 ...


2

minimal class is not meant for the end-user --> See Why should the minimal class be avoided? Regarding your use case, the problem is that xstring provides conditions and tests that are not expandable, in other words, the conditions and tests do not replace stream with the result but rather would like to save the results hidden from the stream. This is also ...



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