New answers tagged

1

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

If C and D have the same width and height, you could just do this: \documentclass[tikz, border=10pt, multi]{standalone} \usetikzlibrary{shapes.geometric,arrows,positioning,fit} \begin{document} % Define block styles \tikzset{% block/.style = {rectangle, draw, fill=yellow, text width=5em, text centered, rounded corners, minimum height=2em}, line/.style = ...


1

The first thing you should check is the version of forest you have. If you have version 2, then the following answer applies. If you still have version 1, then it is irrelevant. Assuming you have version 2... The new version of forest introduces some backwards-incompatible changes. In this case, two of these concern us: Certain clusters of options are ...


0

All the three Feynman diagrams shown in the question can be realized with a few lines of code using the new TikZ-Feynman package (see also the project page). Here is the code to produce all of them. You must compile with lualatex in order to take advantage of the automatic positioning of the vertices. \documentclass[tikz]{standalone} ...


1

The new TikZ-Feynman package (see also the project page) makes it easy to create Feynman diagrams. The following is just an example to show its capabilities. The relevant key to produce the half circle is half left. You have to compile with lualatex in order to exploit the automatic positioning of vertices. \documentclass[tikz]{standalone} ...


1

\documentclass[french]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[a4paper]{geometry} \usepackage{babel} \usepackage{amsmath,amsthm, amssymb, latexsym} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \draw[thick] (0cm,0cm) circle(1cm); \draw[thick] (3cm,0cm) circle(1cm); \path ...


3

\documentclass[border=5mm]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} % \draw [help lines] (0,0) grid (10,10); \draw (0,0) rectangle (1,4); \draw [rotate around={-25:(1,4)}] (0,4) rectangle ({4/sin(25)+1},4+0.2); \draw [rotate around={-25:(1,4)}] (4,4+0.2+0.5) circle (0.5); \draw (-1,0) -- (10.3,0); \draw [latex-latex] ...


4

A nice one to do with the basic shapes in Metapost and the "Pythagorean minus" operator... \documentclass[border=5mm]{standalone} \usepackage{fontspec} \setmainfont{Helvetica} \usepackage{luamplib} \begin{document} \mplibtextextlabel{enable} \begin{mplibcode} beginfig(1); path ground, wall, ramp, ball; w = 21; h = 3w; r = 200; a = angle(r+-+h,-h); ...


2

Depending on how complicated your requirements are, the general approach I would take is to use a scripting language with regex to find all latex commands (in python, say \(?:[^a-zA-Z]|[a-zA-Z]+[*=']? from here), and then apply a custom built filter to limit it to math symbol commands. The part about keeping subscripts intact is much harder. Parsing ...


3

If you can use lualatex to process your document, then another alternative is luamplib and Metapost which I used to create this sketch of parts of your diagram. The nice thing about doing this sort of diagram "programmatically" is that you can draw it as a graph, so that, for example, the arrow is now an x-axis with a scale of years and the boxes are in ...


4

Well, regardless this is question "do-it-for-me" ... a picture is attractive to me, so I try the following: \documentclass[border=3mm, tikz, preview ]{standalone} \usetikzlibrary{arrows.meta, positioning} \begin{document} \begin{tikzpicture}[ node distance = 2mm and 1mm, line/.style = ...


4

As it was said, tikz and pgf will work nicely. You will find documentation here. I suggest that you start reading about nodes. For instance start with \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} % Necessary to use right=5cm of A \begin{document} \tikz{ \node (A) [rectangle,draw] {Text of A}; \node (B) ...


2

Well here's the diagram almost finished. Thank you @cfr, your example was perfect. \documentclass[tikz,border=10pt]{standalone} \usepackage{forest} \begin{document} \begin{forest} for tree={ edge path={ \noexpand\path [\forestoption{edge}] (!u.parent anchor) -- +(0,-2.5mm) -| (.child anchor)\forestoption{edge label}; }, parent anchor=south, child ...


2

Details are left as an exercise to the reader.... Focus is on the topic of the question i.e. adding labels. \documentclass[tikz,border=10pt]{standalone} \usepackage{forest} \begin{document} \begin{forest} for tree={ edge path={ \noexpand\path [\forestoption{edge}] (!u.parent anchor) -- +(0,-2.5mm) -| (.child anchor)\forestoption{edge label}; ...


2

Just to point out an alternative to "I know Tikz is the starting point." Here is an approach using Metapost as part of LuaLaTeX and the luamplib package. Compile with lualatex. \documentclass[border=5mm]{standalone} \usepackage{fontspec} \usepackage{luamplib} \setmainfont{Helvetica Neue} \begin{document} \mplibtextextlabel{enable} % this allows plain ...


10

\documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shapes,arrows,fit,calc,positioning} \tikzset{box/.style={draw, rectangle, thick, text centered, minimum height=3em}} \tikzset{line/.style={draw, thick, -latex'}} \begin{document} \begin{tikzpicture}[auto] \node [box] (inv) {Inventory}; ...


7

Here is a starting point with the forest package. This is actually a package for linguistic trees, but can be used for multiple purposes. \documentclass{article} \usepackage{forest} \begin{document} \begin{forest} for tree={edge=->} [Inventory [Obsolecence] [Deterioration [Decaying products] [Perishable Products ...


2

Taking some liberties (as pointed out in the comments, we don't know exactly what you are after) here is a quick implementation. The centers and radii of the circles are declared as commands and then the \clip command is used to build the intersecting regions, which are filled. \documentclass{article} \usepackage{tikz} \newcommand{\circleA}{(0cm,0cm) ...


0

It is not yet a complete answer, but it is way to long to put in a comment. Inspired bij this: Plot with magnifying glass, with a different plot in it May be you can do something with this: \documentclass[15pt,a4paper,headinclude, totoc]{scrartcl} \usepackage[usenames,dvipsnames]{xcolor} \usepackage{tikz} \usepackage{pgfplots} ...


2

You mean like this: \documentclass[11pt]{article} \usepackage{tikz} \usetikzlibrary{arrows} \begin{document} \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm] \draw[->,color=black] (0.,0.) -- (10.,0.); \foreach \x in {3} \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize A}; ...


1

Here's how you can do with Xy-pic \documentclass{article} \usepackage[all,cmtip]{xy} \begin{document} \[ \xymatrix@R-2ex{ \txt{Model 1} \ar[d] \\ \txt{Model 2} \ar[d] \\ \txt{Model 2\\simplified} \ar[d] \\ \txt{Model 3} } \] \end{document}


3

Your question shows some issues: Overlapping: Percusse already told you how to avoid the overlap of the plots on the y ticks, although a similar result can obtained even with just specifying enlarge x limits = 0.6, and no y limits. Or even no limits at all. You can choose what works for you. I chose none in this case. Ticks don't appear: The reason why ...


4

Try \documentclass[15pt,a4paper,headinclude, totoc]{scrartcl} \usepackage[usenames,dvipsnames]{xcolor} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \usetikzlibrary{angles,calc,intersections,quotes,positioning,shapes} \begin{document} \begin{center} \begin{tikzpicture}[scale=1.5, my angle/.style ...


7

The first figure can be drawn with TikZ. The second figure is a table that uses both \multirow (from the multirow package) and \multicolumn. If you want your figure captions to be put on the left side of your page, use \usepackage[singlelinecheck=off]{caption}: \documentclass{article} \usepackage{tikz} \usepackage{multirow} ...


5

First figure with tikz Code \documentclass[margin=5mm]{standalone} \usepackage{tikz} \begin{document} \tikzset{every node/.style={draw,minimum width=1cm}} \begin{tikzpicture} \node (c-1) {$C_1$}; \node[anchor=south west] (c-2) at (c-1.south east) {$C_2$}; \node[anchor=south west] (c-3) at (c-2.south east) {$C_3$}; \node[anchor=south west] (c-4) at ...


1

If only two boxes need to be stacked, tcolorbox can be used. By default all tcolorboxes have upper and lower parts. \documentclass{article} \usepackage[most]{tcolorbox} \tcbset{nobeforeafter} \newtcolorbox{mybox}[1][]{ enhanced, notitle, colframe=black, colback=white, segmentation style={solid,line width=0.5mm}, sharp corners, ...


0

Here is what I came up with so far. I tried to cram it using s sep although some there might be room for improvement. This is still not completely flawless from my point of view, but it should be ok to start with. Concerning the labels, the text should rather be left aligned than the actual text boxes (or whatever is the right notion here) The ...


2

If you can change to listings, with tikzmark, tikzmarklistings library and tcolorbox's comment and listing option you can do something similar to what you want. This is just a starting example. You will need to customize 'tcolorboxand listing, but also fight with how to definecomment` to fit your needs. Following code shows how to do it. tcolorbox offers ...


2

This is as far as I got. I can only run minted in draft mode and could not get escapeinside to work for any characters. \documentclass[draft]{article} \usepackage{tikz} \usetikzlibrary{tikzmark,calc,shapes.geometric} \usepackage{minted} \begin{document} \noindent\begin{tikzpicture}[remember picture,baseline=(n1.north)] \node[minimum ...


3

This solution also uses forest but it uses it via a wrapper provided by the package justtrees. This package is experimental but I'm happy to provide copies on request. (I need guinea pigs!) The point of justtrees is to make it easy to provide horizontally aligned labels to the left and/or right of the tree. In particular, it does all the calculating and ...



Top 50 recent answers are included