# Tag Info

## New answers tagged diagrams

3

You may want to learn tikz-cd: \documentclass{article} \usepackage{tikz-cd} \begin{document} \[ \begin{tikzcd}[row sep=2.5em] A' \arrow[rr,"f'"] \arrow[dr,swap,"a"] \arrow[dd,swap,"g'"] && B' \arrow[dd,swap,"h'" near start] \arrow[dr,"b"] \\ & A \arrow[rr,crossing over,"f" near start] && B \arrow[dd,"h"] \\ C' \arrow[rr,"k'" near ...

0

This behaviour may be due to the option [h!], which forces the figure to be here. Try using [h], or (even better) something like [htbp] (Here, or on Top, or on Bottom, or at least on a Page for the remaining floating objects).

2

You can use the calc-library to set the connection-points for your lines. It's a simple approach which should be enough in the most situations. A small MWE: \documentclass[tikz, border=5mm]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \node at (0,0) [draw, rectangle, minimum height=2cm, minimum width=.5cm] (mynode) {}; ...

3

And a Metapost approach... prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); % r = side of hexagon, n = repetitions of the grid (- and +) r = 5mm; n=10; % make a shape to draw path tri; tri = for t=0 step 120 until 359: origin -- (r,0) rotated t -- endfor cycle; % save the pattern as a picture centered on the origin picture grid; grid = ...

3

Another way could be to draw hexagonal nodes over an adjusted coordinate system. The idea came adapting Paul Gaborit's Pascal triangle for How can I draw Pascal's triangle with some its properties?. shapes.geometric library helps to draw hexagon where the minimum size is the diameter of the circumcircle. Therefore, selecting adjusted values for x ...

6

Here's a different approach using Metapost that preserves the right angles in the OP art work. The link above explains how to get started with Metapost. prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); % unit width, height, and radius of the nodes u = 46; v = 17; r = 4; % a W-shaped path to draw % with five points: points 0 and 4 are the ...

11

Again with tikz but using pic: \documentclass[border=3mm]{standalone} \usepackage{tikz} \usetikzlibrary{patterns,calc} \tikzset{% pics/.cd, dam/.style args={#1#2#3#4#5}{ code={ \begin{scope}[shift={(#1)}] \coordinate (a) at (0,0); %% starting point \coordinate (b) at +(0,#2); % height of right side \coordinate (c) at ...

12

A tikz solution where an L shape pool is drawn by a macro called mypool that takes 6 arguments, displayed below. #1=starting point, #2=vertically down length, #3=for Label L4-L8, #4=horizontal length of the pool #5=end point #6=Pool label 1-5. Code \documentclass[border=10pt]{standalone}%[11pt]{article} \usepackage{tikz} ...

9

A PSTricks solution: \documentclass{article} \usepackage{pstricks} \newpsobject{water}{psframe}{ dimen = m, linestyle = none, fillstyle = solid, fillcolor = blue!30 } \newpsobject{basin}{psframe}{ dimen = m, linestyle = none, fillstyle = hlines, hatchsep = 2pt } \def\pool(#1,#2)[#3,#4]#5#6{ \water(#1,#2)(!#1 #4 add #2 0.5 add) ...

9

Here a simple way using pst-node and multido: \documentclass[1pt, pdf, svgnames]{standalone} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fourier} \usepackage{pstricks-add} \usepackage{xcolor} \begin{document} \begin{pspicture}(-1,-4)(4,6) \psset{radius = 0.15, xunit = 2cm, yunit = 1.2cm, fillstyle = solid} \psaxes[yaxis = false, ...

5

You can use the approach from Probability density function of Uniform Distribution. The actual plot is defined using this code: \begin{axis}[ clip=false, jump mark left, ymin=0,ymax=1, xmin=0, xmax=6, every axis plot/.style={very thick}, discontinuous, table/create on use/cumulative distribution/.style={ create ...

2

Your question is quite vague which is why I was hesitating to post an answer. But I suspect (unless you're actually using A, B, and C as compounds) the answer will be “I'd use chemfig”, anyway... Chemical schemes can be typeset fairly easy with chemfig once you understand how the \arrow command works. The siunitx package can be used for numbers with units, ...

4

This is essentially the same as Tikz and babel error \documentclass[a4paper,12pt, brazil]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{babel} \usepackage{tikz-cd} \tikzset{ every picture/.prefix style={ execute at begin picture=\shorthandoff{"} } } \begin{document} \[ \begin{tikzcd}[column sep=small] Y_1 \ar[dr, ...

10

portuges.ldf (loaded by option brazil) makes " an active shorthand that disturbs the tikz-cd code. The shorthand can be disabled via \shorthandoff: \documentclass[a4paper,12pt,brazil]{article} \usepackage{babel} \usepackage{tikz-cd} \begin{document} \shorthandoff{"} \[\begin{tikzcd}[column sep=small] Y_1 \ar[dr, "\pi_1"'] \ar[rr, "f"]& & ...

4

Is this what you want? Problem 1: Adding the pictures, like database Display Database Instance Relationship with TikZ, for example in the cells (stack-5-6) (stack-6-6) with the name to make an arrow in future. Cells (stack-5-6) (stack-6-6) doesn't exist because you declared option nodes in empty cells=false and no nodes are created in empty cells. But ...

3

Using hobby package (\usetikzlibrary{hobby}) and calc for operations with coordinates we get this (PGF/Tikz 3.0.x) \documentclass[12pt,twoside,a4paper]{book} \usepackage{graphicx,wrapfig,tikz} \usetikzlibrary{calc,hobby} % To draw the smooth curve \begin{document} \tikzset{ circ/.pic={ % Defines a circle to mark the coordinates. \fill (0,0) ...

8

This is an attempts where pics skill is used, requiring tikz 3.0 Code \documentclass[border=10pt]{standalone}%[12pt,twoside,a4paper]{book} \usepackage{graphicx,wrapfig,tikz} \usetikzlibrary{positioning,shapes} \tikzset{myarrow/.pic = { \begin{scope}[rotate=-90,scale=0.5] \draw[fill=black] (-0.5,0) -- (0,0.5)--(0.5,0)--(0.5,1)-- ...

1

This demonstrates left and right shifted images with captions aligned with both the text and with the images. \documentclass{scrartcl} \usepackage{scrextend} \usepackage{geometry} \geometry{ top=3.5cm, bottom=3.5cm, outer=6cm, inner=2cm, heightrounded, marginparsep=0.8cm, marginparwidth=4.7cm, twoside=true, ...

0

I finally came up using the following code with some examples how to set up the pictures and captions: \documentclass{scrartcl} \usepackage{scrextend} \usepackage{geometry} \geometry{ top=3.5cm, bottom=3.5cm, outer=6cm, inner=2cm, heightrounded, marginparsep=0.8cm, marginparwidth=4.7cm, twoside=true, hmarginratio=1:1 } ...

7

You can prepare your diagrams using TikZ, but you ought to convert them to EPS afterwards. It's best to have them as seperate standalone files. For more information, see: Export eps figures from TikZ 'Standalone' TikZ pictures But the basic idea is the following: Prepare your figures using the standalone class, for example: ...

2

Nice work on your solution! Someone may come along with a better way to do this, but I've taken your code, added the page numbers, and solved the page height problem. I also added a conditional for the last page, to check if it was already printed as part of the last double-page spread. For my example, I used the biblatex manual which should be available ...

9

The following is intentionally made simple without labels just for fun with PSTricks. \documentclass[pstricks,border=12pt,12pt]{standalone} \usepackage{pst-eucl,pst-plot} \pstVerb{realtime srand} \psset { algebraic, saveNodeCoors, NodeCoorPrefix=N, PointName=none, PointSymbol=none, } ...

19

I decided to post this answer for several reasons: This picture gives me the opportunity to show some useful options for users of TikZ. I defined customizable macros for: Dimensions of the tank \tankwidth, \tankheight and \waterheight. This allows to change them without affect the picture (without exaggeration); I defined a color for the water to allow ...

22

\documentclass[tikz,border=5]{standalone} \usetikzlibrary{decorations.pathmorphing} \usepackage[detect-all]{siunitx} \tikzset{ ragged border/.style={ decoration={random steps, segment length=1mm, amplitude=0.5mm}, decorate, } } \begin{document} \begin{tikzpicture} \fill[cyan!30] decorate[ragged border]{ (0,2) -- (6,2) ...

1

Here's an attempt in plain Metapost, using two of the built-in transformation commands: rotated t and reflectedabout(p,q). prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); % define the image of the F to transform s = 16; picture f; f = image(fill fullcircle scaled s; label("F" infont "cmss10" scaled 1.2,origin) withcolor white;); % define ...

6

And just for comparison, here is a version in Metapost, using the boxes library, as described in Drawing Boxes with Metapost. The main item of interest here is how to get the boxes drawn with white text on a blue background: you can't use the provided drawboxed command, because this does not let you specify a colour, so I've used the bpath and pic commands ...

13

On the one hand, TikZ is very powerful and comprehensive, on the other hand, it is very hard to find solutions for concrete tasks. In addition, there are often many ways to realize graphics. I tried to use you existing code and added the code you need to draw the given graphic. Most things should be clear. Maybe I am wrong, but it seems that you don't have ...

2

A free of charge answer with PSTricks. Compile it with xelatex for your convenience or with latex->dvips->ps2pdf for my convenience. Option 1 \documentclass[pstricks,border=12pt,12pt]{standalone} \usepackage{pst-eucl} \begin{document} \begin{pspicture}(-5,-5)(5,5) \psline(-5,0)(5,0) \psline(0,-5)(0,5) ...

4

Try this quick solution: \documentclass[12pt,border=0.125cm]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[line width=0.7pt,p/.style={circle,fill,inner sep=1.5pt}] \draw (1,0)node[yshift=-1cm]{$\mathcal{R}(A)$} -- (9,0)node[yshift=1cm,left]{$Ax_{1s}$} (5,4)--(5,-4) (1,-2)--(9,2); \draw [dashed](7,1)node[p]{}--node[right]{$r$} ...

4

I don't know what kind of a surface rendition you have in mind but you can do it in pgfplots, say, via surfaces. \documentclass[border=2mm]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[domain=0:1, y domain=0:1,samples=20,no marks] \addplot3+[surf,colormap/blackwhite](x,y,{(x < y^2?1:0)}); \end{axis} ...

3

This one is just a modification of percusse's answer, to use loops instead of having big chunks of code: \documentclass[border=3mm]{standalone} \usepackage{pgfplots} % Unit circle plot style \pgfplotsset{unit circle/.style={width=4cm,height=4cm,axis lines=middle,xtick=\empty,ytick=\empty,axis ...

4

Unit balls so why not pgfplots? \documentclass[border=3mm]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[axis lines=middle,xtick=\empty,ytick=\empty,axis equal,enlargelimits,xmax=1,ymax=1,xmin=-1,ymin=-1] %p=0.5 \begin{scope}[very thick,dotted,orange,domain=0:pi,samples=50] \addplot[] ({(cos(deg(x)))^(4},{ ...

7

This is another boring after noon with some free time. To explain code, it will be terribly boring though! \documentclass[tikz,border=3mm]{standalone} \begin{document} \begin{tikzpicture} \draw [<->] (-4,0)--(4,0); \draw [<->] (0,-4)--(0,4); \draw[blue] (-3,0) -- (0,3) -- (3,0) -- (0,-3) -- (-3,0); \node at (0,-4.5) {$p=1$}; \end{tikzpicture} ...

5

Each directory path should be in its own set of braces. But what you seem to have done here is put each part of the path in its own set, which won't work. Assuming you want to set one directory which is C:/Users/Me/Desktop/ then your command should be \graphicspath{{C:/Users/Me/Desktop/}}.

3

If you put this line between two blocks of code \tikzset{every node/.style={draw}} this is what you would see You can see that all of them have extra spacing around the math text inside them. This is because the tikzpicture options you have provided minimum width = 3em, minimum height = 3em applies to everything unless you override them. One option ...

6

You have set a node size with a minimum of 3ems in both width and height within the whole tikzpicture environment while this should only be associated with the main node/.style. Here is what I mean: \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows} \begin{document} \begin{tikzpicture}[>=stealth',shorten >=1pt,auto, thick, main ...

1

it works better with: \node at (0,0) {\includegraphics[width=2cm]{your picture}};

2

This is an attempt where matrix of nodes is used. The text may need some corrections because some of them are hard to read. Code \documentclass[tikz,border=1cm]{standalone} \usetikzlibrary{matrix, shapes, arrows,calc, positioning} \begin{document} %\begin{figure} %\begin{center} \tikzset{% blockA/.style = {rectangle, draw, text width=6cm, ...

2

You can do it with pgfplots. Here is an example: \documentclass{article} \usepackage{pgfplots,siunitx} \pgfplotsset{width=7cm,compat=1.10} \begin{document} \begin{tikzpicture} \begin{axis}[enlargelimits=false,axis on top,xlabel = Displacement (\si{\milli\meter}), ylabel = Load (\si{\kilo\newton})] \addplot graphics ...

2

As @OSjerick suggested in the comments, do have a look at the LaTeX templates for that sort of task. If though you insist on 'doing things yourself', take this as a guide: \documentclass[12pt]{article} \usepackage{graphicx} \usepackage{hyperref} \usepackage{mwe} \begin{document} \begin{figure}[htbp] \begin{minipage}[c]{0.6\textwidth} ...

2

My own attempt After some trial and error, this is my current attempt so far: \documentclass{article} \usepackage[a4paper,margin=2cm]{geometry} \usepackage{graphicx} \usepackage{multido} \def\filename{test.pdf} \def\scale{.05} \pdfximage{\filename} \newcount\N % counter for the last doublepage spread \N=\pdflastximagepages\relax \advance\N by -1\relax ...

4

I shamelessly stole from esdd's answer and just changed the design a little bit to make it look less cluttered. \documentclass[margin=10pt]{standalone} \usepackage{amsmath} \usepackage{pgfplots} \pgfplotsset{compat=1.3} \newcommand\clipright[1][white]{ \fill[#1](current axis.south east)rectangle(current axis.north-|current axis.outer east); ...

5

My suggestion is Code: \documentclass[margin=10pt]{standalone} \usepackage{amsmath} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \newcommand\clipright[1][white]{ \fill[#1](current axis.south east)rectangle(current axis.north-|current axis.outer east); \pgfresetboundingbox \useasboundingbox(current axis.outer south ...

3

If I understand it correctly the histogram bins are overlapping and you want to fix that. My solution is to adjust spacing of each symbolic coordinate rather than adjusting the bin width. One solution is to use the x=<dimension> key. It requires some fiddling around with the appropriate dimension; most histograms in fact don't use this compact way of ...

1

And here's a simple approach with Metapost to extend the set of solutions. prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); % define a unit size u := 1cm; % define the paths and point we need % the y = sqrt(x) curve path f; f = (origin for x=0.1 step 0.1 until 6: .. (x,sqrt(x)) endfor) scaled u; % the axes path xx, yy; xx = (0,-u/2+ypart ...

1

Since inkscape can export figures as .tex file, it has to put all relevant drawing information as \LaTeX commands, such it needs additional packages as xcolor etc. Since this exported figure can be included basically anywhere inside of a document via \input, the relevant packages must be loaded of course in the preamble of the document, not in the document ...

Top 50 recent answers are included