Tag Info

New answers tagged

0

Here's how to do the more general and simpler clipping approach in Metapost. (I've left out the fading and the brace, but they could be added with a little more effort.) prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); color purple; purple = 3/4 red + 1/4 blue; path xx, yy, r[], band; u = 1cm; xx = (left -- 10 right) scaled u; yy = (down -- ...


6

The angles can easily be calculated by using the annotated rectangular triangle: \documentclass[a4paper,12pt]{article} \usepackage[svgnames]{xcolor} \usepackage{tikz} \usetikzlibrary{patterns} \usetikzlibrary{fadings} \usetikzlibrary{decorations, decorations.pathreplacing} \begin{document} \begin{center} \begin{tikzpicture}[scale=0.9] ...


10

You have to choose proper angles for arc. But the easiest is to clip % addition here! \begin{scope} \clip (-5,1.5) rectangle (6,2.5); \draw[thick, color=purple] (1.5,3) circle (1.5cm); \end{scope} Code: \documentclass[a4paper,12pt]{article} %% why so many packages for a MWE? \usepackage{parskip} \usepackage{amssymb} ...


1

How about placing the node on the front layer with a follow-up path command: \path (b1) to node[X,anchor=east,yshift=-2mm] {ACK(AckNum$=$1000)} (a2); Here's the complete document: \documentclass[12pt,tikz,border=3mm]{standalone} \usetikzlibrary{arrows,arrows.meta,backgrounds,positioning} \pgfdeclarelayer{foreground} \pgfdeclarelayer{background} ...


3

You can use text=LemonChiffon option to specify the text color along with the font= option to apply \bfseries. Below, I have replaced the \whttxt macro with the whttxt option to apply these two: Notes: You should use \tikzset instead of \tikzstyle as per Should \tikzset or \tikzstyle be used to define TikZ styles?. Code: \documentclass{article} ...


1

Another solution is to use transform canvas, e.g.: \documentclass[tikz, border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{positioning,calc} \begin{document} \begin{tikzpicture} \node (A) at (3,0) {$A$}; \node (B) at (5,1) {$B$}; \path[-] (A) edge (B) \path[-,transform canvas={yshift=5mm,xshift=-2.5mm}] (A) edge (B); \end{tikzpicture} ...


3

You can make things tighter by reducing the level and sibling distances, using a smaller font etc. etc. but forest does a good job of packing stuff in. The edge path is adapted from Gonzalo Medina's answer. \documentclass[tikz,border=5pt]{standalone} \usepackage{forest} \begin{document} \begin{forest} for tree={ grow=east, parent ...


4

(Note: the shifted lines do not care about the border of the nodes.) You may use the simple decoration provided by JLDiaz in this answer: \documentclass[tikz]{standalone} \usetikzlibrary{decorations} \pgfdeclaredecoration{simple line}{initial}{ \state{initial}[width=\pgfdecoratedpathlength-1sp]{\pgfmoveto{\pgfpointorigin}} ...


6

One answer using the rotation symetry of the figure : \begin{tikzpicture}[thick, scale=.35] \draw[densely dotted, gray, shift={(-4.5,-4.5)}] (0,0) grid +(9,9); \draw (-4.5,-4.5) rectangle (4.5,4.5); \node {x}; \foreach[count=\i] \a in {0,1,2,3} { \begin{scope}[rotate={90*\a}] \draw (4.5,3.5) -| ++(-1,-1) -| ++(-1,-1) -| ++(-1,-1) -- ...


3

Just playing around (without tikz), building up stacked layers of \Sv (solid vertical), \Dv (dashed vertical), \Sh (solid horizontal), \Dh (dashed horizontal). Optional argument on vertical lines provides text following line Quirks: \Sd (solid dot) needed in upper right corner of graph, due to the way I construct things. and \intersect may need to be ...


2

I suggest a different definition of the ll adjusting the in and out values: The code: \documentclass{article} \usepackage{tikz} \usetikzlibrary{graphs} \usetikzlibrary{quotes} %\tikzset{ % ll/.style={ % in=210, % out=150, % distance=3mm, % looseness=8 % }, %} \makeatletter \tikzset{ ll/.style={ in=150, out=210, loop, ...


6

May be you should use pgfplots which offers fill between facility. But here is a tikz version: \documentclass{article} \usepackage{tikz} \begin{document} \begin{center} \begin{tikzpicture} \draw[thick] (-3,3) parabola bend (0,1.25) (3,3); \draw[thick] (-3,-3) parabola bend (0,-1.25) (3,-3); \fill[left color = ...


3

\documentclass{article} \usepackage{tikz-cd} \begin{document} \emph{Does} work: \begin{tikzcd}[/tikz/column 2/.style=red] 8 & 1 \\ 3 & 5 \\ 4 & 9 \\ \end{tikzcd} \end{document} We need to specify the full path of the /tikz/column 2 style because options passed to {tikzcd} are executed in the path /tikz/commutative diagrams. The ...


2

If it looks like a tree, it should be a forest... \documentclass[tikz,border=12pt,mult,varwidth]{standalone} \usepackage{forest,amssymb} \usetikzlibrary{shadows,arrows.meta} \begin{document} \tikzset{ my shadow/.style={drop shadow={shadow xshift=.25ex, shadow yshift=-.25ex}} } \begin{forest} for tree={ draw, parent anchor=south, child ...


2

You can use intermediate coordinates. So the line on the left can be achieved by: \path[diatostealth, thick] (a.south) -- ++(0,-0.5cm) -| (b.north) ; means: start at (a.south). the ++ means the coordinate which is -0.5cm below the last point, the -| means to draw a horizontal and then ventical line to the point (b.north). Code: ...


2

.style tries to split the input at = to recognize key/value pairs. You need to hide the = sign in braces: \documentclass{article} \usepackage{tikz} \begin{document} \makeatletter \tikzset{ drawif/.style={% \expandafter\ifnum\@firstofone{1=\test} draw\else fill\fi } } \makeatother \def\test{1} \tikz{\node[drawif] {Test};} \def\test{0} ...


5

What happens is that tikz is trying to parse the style you are defining as a style and gets confused when it reads \ifnum. What you actually want here is to run some code when setting the drawif style. This code will in turn set some styles under certain conditions. To run code when setting a style you can use the .code key instead of the .style one. ...


0

I would define a style and either use it in all the constructions where you want this capability or scope the portions of the diagram which you want to turn off visible and invisible construction: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[bla/.pic={\node {A};}, none/.style={text ...


1

You can use the everyline=true option so that all parts of the mdframed get the whole frame. Using middleextra and secondextra, you can add material for the continuing parts of the mdframed. In the example below I added "Excursus (Cont.)" at the upper left part of the frame in the continuation parts. The code: \documentclass{article} ...


7

% arara: lualatex \documentclass{article} \usepackage{fontspec} \begin{document} \setmainfont{code2000.ttf}\symbol{"2702} \setmainfont{quivira.otf}\symbol{"2702} \setmainfont{symbola.ttf}\symbol{"2702} \end{document} If you are on pdfLaTeX: Included in TikZ: % arara: pdflatex \documentclass{report} \usepackage{tikz} \usepackage{marvosym} ...


2

With tcolorbox it's easy to define your own shadows. You'll have to adjust box dimensions, but next code could serve as starting point. \documentclass{article} \usepackage{xcolor} %\usepackage{fancybox} \usepackage{mwe} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage[french]{babel} \usepackage[most]{tcolorbox} ...


0

For future reference, I would guess that most Googlers will arrive here trying to define a style which contains a defined colour (rather than defining the colour within the style itself). That's easy to do: \begin{tikzpicture} \definecolor{dkblue}{rgb} {0.00,0.33,0.68} \tikzset{ myStyle/.style = {draw=dkblue, very thick, rectangle} } \node [myStyle] ...


2

If you desire to align the text into two side-by-side sections you can use minipages: Notes: For the minipage on the right you had used an itemize which adds bullets for the list items, but as you show numbers in your image, I changed that to enumerate. Code: \documentclass[11pt,twoside,openany,svgnames,x11names]{book} \usepackage{wallpaper} ...


4

You can add additional nodes in singleextra \documentclass{article} \usepackage[tikz]{mdframed} \usepackage{lipsum} \definecolor{greentitle}{cmyk}{.3,.02,.4,0} \makeatletter \newenvironment{understanding}[1][]% {\begin{mdframed}[ bottomline=false, leftline=false, rightline=false, linecolor=greentitle, backgroundcolor=white, ...



Top 50 recent answers are included