New answers tagged

2

A short code with pstricks: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage{mathtools} \usepackage{pstricks-add, multido} \usepackage{auto-pst-pdf} \begin{document} \sffamily \begin{pspicture} \psset{dimen=middle, linewidth=0.6pt, braceWidthOuter=4pt, braceWidthInner=4pt, braceWidth=0.8pt, labelsep =-2ex} ...


1

Ultimately, there's a minimum width of the trees that arises from the text inside the leaf (end) nodes. For both trees, you can see that placing all the x_n <- 1 end to end results already takes over half the text width. If you want to force those trees to be side-by-side, you'll either have overlapping trees (as you currently do), or overlapping nodes. ...


4

For starting point in your learning (in case that as basic tool you select TikZ package) can serve the following MWE: \documentclass[tikz, border=3mm]{standalone} \usetikzlibrary{chains,decorations.pathreplacing} \begin{document} \begin{tikzpicture}[ node distance=0pt, start chain = A going right, X/.style = {rectangle, draw, ...


1

So far I've been able to draw such a thing using pgfplots: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture} \begin{axis}[ xmin=0, xmax=1, ymin=0, ymax=1, zmin=0, zmax=1, axis equal, ticks=none, hide axis, ] %lower face, drawn ...


0

As is explained in How do I draw shapes inside a tikz node? pics can be used for defining new objects. My main problem using pics is how to place where you want because they aren't nodes and positioning them is not so easy. Following code shows how to define EDFA block. EDFA/.pic={ \begin{scope}[scale=.5] \draw (-1,0) coordinate (in) -- ...


1

Regarding distance between edge labels and edges: see if the following addition to Alenanno code gives what you looking for: \tikzset{el/.style = {% edge label midway, outer sep=1.5mm, #1} % <--- #1: for position (left, right) } Put this before \begin{forest} and than instead edge label={node[midway,left]{...} use `edge ...


4

That's because you're setting the caption as a node, which is also not the standard way of doing this. Captions are added to figures in a Latex document externally to the picture, i.e. they are not part of it. Also, you're manually assigning a number to your figure and this makes the use of Latex a bit pointless, because one of the great advantages of ...


3

You could also use a matrix to simplify the code. \documentclass{exam} \usepackage{tikz} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{latexsym} \usepackage{mathabx} \usepackage{MnSymbol} \usetikzlibrary{shapes.geometric} \begin{document} \begin{center} \begin{tikzpicture}[scale=0.8] ...


4

I have to admit that my "cylinder" doesn't look very realistic, but in any case, the result can be achieved with a much shorter code. If you do not understand something, feel free to ask, but I think that typing a lot of \node definitions gets tedious. I left your package list as it was because I don't know if you use them somewhere else in your document, ...


1

\documentclass{amsart} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings,decorations.pathreplacing} \begin{document} \begin{tikzpicture} % axes + grid \draw[step=5mm,gray,dashed, line width=0.2pt] (-0.75,-1.25) grid (4.25,2.25); \draw[latex-latex] (-1,0) -- (5,0) ...


2

Coordinates (yaxis |- X) is determined by center of yaxis node, not with its right (east) border, as you like to have. So, all somilar constructed coordinates you need to change to yaxis.east and similarly to xaxis.north. \documentclass{article} \usepackage{tikz} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture}[font=\footnotesize] ...


3

You can print their value into a node but if you just want to see them without doing any node trick then you can print them in the log file \documentclass[tikz]{standalone} \usetikzlibrary{calc} \def\shoutmyn#1{\expandafter\show\csname tikz@cc@n@#1\endcsname} \begin{document} \begin{tikzpicture}[] \node (D1) {D1}; \node (D) at (3,2) {D}; \node (D2) at ...


3

A quick hack which is slightly better \documentclass[tikz]{standalone} \usetikzlibrary{backgrounds} \begin{document} \begin{tikzpicture} \node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (3, 10) (v0) {0}; \node[circle, draw=black, inner sep=0.5mm, font=\tiny] at (2.3, 9.65) (v1) {1}; \node[circle, draw=black, inner sep=0.5mm, font=\tiny] at ...


4

Another interpretation of "half dashed": \documentclass[tikz,border=5]{standalone} \usetikzlibrary{decorations.pathreplacing,calc} \tikzset{draw half paths/.style 2 args={% decoration={show path construction, lineto code={ \draw [#1] (\tikzinputsegmentfirst) -- ($(\tikzinputsegmentfirst)!0.5!(\tikzinputsegmentlast)$); \draw [#2] ...


1

I just realised you supplied images for the icons. Oh, well. Here is a pure TikZ solution. At least, it uses forest which is based on TikZ. In addition, it uses two pics for the icons, which are then used within the tree. This makes use of the new edges library for forest which includes a folder style for directory trees. It can draw the folders, too, but ...


1

The problem is that pgfplots does some juggling with \label, under the assumption that it means the same as in the LaTeX kernel, which unfortunately is false with tufte-book. \documentclass{tufte-book} \usepackage{lipsum} \usepackage{pgfplots} \usepackage{etoolbox} % patch pgfplots so that \label does the original job % tufte-book saves the original ...


1

I think you based your code on the question here. I tried to make a cleaner MWE using code from the pgfplots manual. As you can see, I don't have a solution but I got a little further. 2 out of 3 \ref commands worked as expected. In this case it didn't work if there was a line and marks. Maybe this helps others to look deeper into the issue. ...


2

First: You can ignore the warning or you set xmin and xmax symmetrical to 0. For example: xmin=-1 and xmax=1. Second: The bounding box of your picture is enlarged to the left by the long plot title. So with \raggedright the plot title is left aligned. So you have to change the position of the plot title. Code: \documentclass[paper=a4, parskip=half-, ...


2

Update Here is another suggestion without package titlesec. Now there are no rules below the headings. \documentclass[a4paper,12pt,oneside]{scrbook}[2015/10/03] \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[bitstream-charter]{mathdesign} \usepackage[scaled]{berasans} \usepackage[scaled]{beramono} \usepackage[english]{babel} ...


0

It's easier if you replace the command with a node, so you can use that to draw everything else. The line that goes over the text width is kind of manual for now. Meaning that it spans the text width and then the length of the node, plus the inner sep, is removed from that value. Output Code \documentclass[11pt]{book} ...


3

I can imagine why you might want to stick with TikZ syntax for self-confidence, familiarity and so on, but I would still recommend pgfplots for this or at least TikZ' own graphdrawing library. Anyways, for the inner sep outer sep stuff, maybe a visualization might help. The node contents are put in a placeholder (an \hbox or minipage environment and then ...


3

As Peter said, you should add at to specify the coordinates. However, you don't need these extra nodes. You can add the nodes directly to the "bars" above. You can add nodes to any path, and the rectangle is still a path. Output Code \documentclass[margin=10pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \shade[top ...


4

The lines do end at the nodes, you have to consider that nodes have some padding (inner sep, outer sep), and lines are drawn to the edge of the node, not the center. Add draw to the node options and you'll see this: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (4,2) node(p1)[draw,label={[label ...


5

In the second part to this answer a custom coordinate system was given. This can be used to plot the grids (albeit a bit slowly). The other requirements (not done here) involve re-orienting the x, y, and z vectors, and changing the content and positioning of the labels. \documentclass[tikz,border=5]{standalone} \usetikzlibrary{arrows} \tikzset{declare ...


3

Just about does it (although without the axes): \documentclass[tikz,border=5]{standalone} \usetikzlibrary{decorations.pathreplacing} \tikzset{arrow path/.style={decoration={show path construction, lineto code={ \path [->, every lineto/.try] (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast); }}, decorate}, every lineto/.style={draw, ...


5

As you have named the coordinates, just loop over their names: \documentclass[margin=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{arrows,calc} \begin{document} \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm] \clip(-0.5,-1) rectangle (5.5,3.5); % defining coordinates \coordinate (1) at (0,0); \coordinate (2) at ...


3

Here's how I would probably actually do this. I don't suggest this is an obvious solution, but the code is succinct and can be easily tweaked for the entire diagram. If anybody wishes to try this at home, let me know and I will give you a copy of the experimental package it uses. (I hope to get its sister to CTAN shortly, and maybe this one as well, but ...


2

I'm not very sure, what you mind with "half dashed line" ... if it is composed from two lines, one solid and one (on small distance from solid) dashed, see, if this is solve your problem: \begin{scope}[on background layer] % half dashed line \draw (n1) -- (n13); \draw[dashed] ($(n1)!2pt!90:(n13)$) edge ($(n13)!2pt!-90:(n1)$); \end{scope} This addition ...


3

You might use \bbordermatrix from \bordermatrix with brackets [ ] instead of parentheses ( ) \documentclass{article} \usepackage{xcolor} \usepackage{tikz} \usepackage{etoolbox} \usetikzlibrary{arrows,matrix,positioning,fit,arrows.meta,} \definecolor{ocre}{RGB}{0,173,239} \tikzset{% highlight/.style={rectangle,rounded corners,fill=ocre!50,draw, fill ...


3

This is rather close to just re-asking the same question but if you want to highlight a column in the first array rather than the second, just put the marks there. Or egreg wants me to do this \documentclass[11pt]{book} \documentclass[11pt]{book} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{xcolor} \definecolor{ocre}{RGB}{0,173,239} ...


7

So the problem with the code is that \subnode is never defined. You can get it defined by loading the tikzmark library. However, \newcommand\tikzmark... will then fail as the library defines the standard \tikzmark command. This problem can be avoided by simply choosing a different macro name, such as \mytikzmark. You cannot, however, use \mytikzmark or ...


2

An alternative possible solution with TikZ: It is generated by the following (to my opinion very concise) code: \documentclass{amsart} \usepackage{amsmath,amssymb} \usepackage{tikz} \usetikzlibrary{arrows,calc,positioning} % for show only a picture \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} ...


2

Another option is to use a LaTeX box --- never had problems with this (although you probably can't connect to "internal" objects). For simple cases it's quite easy: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{arrows,positioning,calc} \begin{document} \newsavebox{\genericfilt} \savebox{\genericfilt}{% \begin{tikzpicture}[font=\small, ...


2

You must move the "free variable" node ; arrow will automatically follow. \documentclass[11pt]{book} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{xcolor} \definecolor{ocre}{RGB}{0,173,239} \usepackage{blkarray} \makeatletter \renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{% \hskip -\arraycolsep \let\@ifnextchar\new@ifnextchar ...


4

This answer will focus on the funnel object, at least for the moment. Changes: Fixed funnel shapes. Removed one \foreach statement and included it in the previous one. Better node positioning. Output Code \documentclass{article} \usepackage[margin=2cm]{geometry} \usepackage{pgfplots} \definecolor{myellow}{RGB}{228,212,0} ...


1

Some very simple cross-sections will be possible in PGFplots and PSTricks (though I am not very familiar with the latter); however, arbitrary cross-sections is perhaps out of the league of these packages. In the case of PGFplots, it can handle 3D plots of the form z = f(x,y) quite well, but more complicate surfaces (such as parametric plots) will often lead ...


2

Instead of TiKZ-matrix you prefer to use tcolorboxes. Text is easily compound inside a tcolorbox than inside a node. With a tcbraster your boxes can be distributed like a matrix. And, of course, tikzmark is compatible with them. \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} ...


1

I've changed below to right and changed inner sep= to 3pt in your code: \documentclass[12pt, a4paper]{article} \usepackage[a4paper,top=1 in,bottom=1 in,left=0.7 in,right=0.7 in]{geometry} \usepackage[utf8]{inputenc} %\usepackage[misc]{ifsym} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{graphicx} \usepackage{tikz} ...


3

A shading will do it. Here a custom horizontal shading is used to (try to) avoid sharp lines at the edge of the of shaded region. How successful this is may be viewer dependent. Also, the shading is put on a background layer so it doesn't cover the lines: \documentclass[tikz,border=5]{standalone} \usepackage{tikz-3dplot} \usetikzlibrary{backgrounds} ...


2

This is a bit modified solution from the follow-up question's solution. I dedicded to draw the "steps" on top of the graphs, because this space is unused. Then also the vertical lines don't cross the xticklabels of the first axis environment. And I think it looks odd to have a full fill but an interrupted drawing. Please have a look at the comments of the ...


3

The graph drawing library is probably one of the more complex parts and on top of this, this particular diagram is a particularly complex diagram too. Looking through your code, there are a few issues I can identify: Firstly, there are quite a few superfluous libraries. This is not detrimental, but not exactly recommended either; The graph drawing ...


5

The simplest way is write matrix as TikZ matrix and add desired column frame and note to it: \documentclass[11pt]{book} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{tikz} \usetikzlibrary{arrows.meta,bending,matrix,positioning} \begin{document} \begin{equation} \begin{tikzpicture}[ node distance=1mm and 0mm, baseline] ...


1

Here is a more "automated" way of Zarkos anwer, where you don't have to draw all the "step lines" by hand. For details have a look at the comments in the code. \documentclass[border=2mm,many]{standalone} \usepackage{pgfplots} \usepackage{pgfplotstable} \pgfplotsset{compat=1.11} \usepackage{filecontents} \begin{filecontents}{data.txt} Time ...


0

For the shown example I am not convinced that you need to draw the "existing figure" outside the PGFPlots axis environment. But even if it should really be the case, you can match the PGFPlots coordinate system to the one of tikz and then use all of the possibilities PGFPlots offers to draw the heatmap. I also want to mention, that I would draw it the other ...


5

Fill the empty cell: \documentclass{article} \usepackage{tikz} \usepackage{booktabs} \usetikzlibrary{calc} \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};} \newcommand{\DrawBox}[3][]{% \tikz[overlay,remember picture]{ \draw[black,#1] ($(#2)+(-0.5em,2.0ex)$) rectangle ($(#3)+(0.75em,-0.75ex)$);} } ...


2

Your MWE compile without error but result seems to be different from your sketch ... Since you already got answer on your similar questions, which answer also solve problems you emphasized in question, I made (on basis of mine previous answers) the following flowchart: with following code: \documentclass{article} \usepackage{tikz} ...


2

This solution uses tikzmark and involves turning the itemize environment into an enumerate using the label option of enumitem. The list looks just the same, but the item number is used to turn the bullets into sub-nodes which can be referenced later in the picture. \documentclass[tikz, border=10pt, multi]{standalone} \usepackage{calc,enumitem} ...


19

I couldn't resist, so here's a solution using pgfplots (and some tikz), plus arara for creating the .gif animation. Output Click for bigger size Code % arara: animate: {density: 160, delay: 8} \documentclass[tikz]{standalone} \usepackage{amsmath,amssymb} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \usepgfplotslibrary{fillbetween} \begin{document} ...


22

Like this? \documentclass[tikz]{standalone} \usepackage{tikz} \begin{document} \foreach \angle in {0,10,...,360} { \begin{tikzpicture} % fill circle and plot \fill[blue!50] (-1,0) arc (0:\angle:1) -- (-2,0) -- cycle; \fill[blue!50] plot[smooth,domain=0:\angle] (pi/180*\x,{sin(\x)}) |- (0,0); % draw connection \draw (-2,0) +(\angle:1) ...


1

This is an area where the tkz-euclide package excels: \documentclass[border=5mm]{standalone} \usepackage[dvipsnames]{xcolor} \usepackage{tkz-euclide} \usetkzobj{all} \begin{document} \begin{tikzpicture} % Set up the canvas \tkzInit[xmin=0, xmax=7, ymin=0, ymax=4.5] % Clip things outside the canvas \tkzClip[space=0.5] % Define two starting points on a ...



Top 50 recent answers are included