Tag Info

New answers tagged

1

In phasors, the electrical quantities are represented by a magnitude and an angle. For example the following circuit with V and I can be expressed as follows: \documentclass[12pt,a4paper]{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \begin{document} \begin{equation} \begin{aligned} V_{sm} &= V_m \angle \phi,\quad ...


3

If it is simply a diagram, you can use a tabular. \documentclass{article} \newcommand\Phasor[2]{% \setlength\tabcolsep{2pt} %% change 2pt suitably \begin{tabular}{c|c} #1 & #2 \\\cline{2-2} \end{tabular} } \begin{document} This is \Phasor{a}{b} well a phasor. \end{document} Certainly one can use tikz but, for a change, I would not present ...


0

Here's a Metapost approach. There are no path morphing "decorations" defined in plain MP, so I've supplied a function called sinuous that returns a sine-wavy copy of a given path. It should work nicely on curved paths too. prologues := 3; outputtemplate := "%j%c.eps"; s_lambda = 6; % the length of the waves s_amplitude = 2; % their height vardef ...


0

Here's a simple approach in plain Metapost using the convenient direction .. of .. construction. To get an ellipse I've used fullcircle xscaled xx yscaled yy, and I've exploited the fact that there are 8 points on its path (with point 0 at 3 o'clock and point 4 at 9 o'clock). I have defined four ellipses, but two of them are left invisible. prologues ...


1

Another solution with tikz, as requested. The problem with the linked answer is that the arguments to the atan function in the pgf low-level layer have been reversed. Switching the arguments inside the wavy semicircle definition solves that issue. Code for the styles borrowed from here. \documentclass{standalone} \usepackage{tikz} ...


2

Asymptote MWE The endpoints p and q are defined as points on the bottom and top curve located at a fraction of the total curve length (arclength) along the curve, then the function drawEll is used to transform the unitcircle in order to place it between p and q. el.asy: import graph; import fontsize; size(6cm); defaultpen(fontsize(9pt)); pen ...


2

A non-GUI option is GLE. It can be a little hard to use but for publication-quality data-driven graphs you can't really beat it. Here's a motivating example. I'm not sure how you'd create something like this that looks as good in any other package. It's possible in IPE but it can be tedious if you change the data and have to manually update the graph; with ...


6

This an attempt with tikz skills --- \draw let ... in ... command. The tube is constructed via 2 segements(blue and red) through [bend left] and [bend right] curves. Use pos=xx to determined the ellipse contact points, which is labelled as (a) and (b) respectively, then compute the distance to determine the long radius, the short one is 0.3 times the ...


4

To get a better result, the major axes of the ellipse must be normal to both curves. Here I used Mathematica to find numerically the coordinates. F[x_] := x^3/4 + 1; G[x_] := (x - 1/2)^3/5 + 1/6; Plot[{F[x], G[x]}, {x, -2, 4}] Solve[{F'[a] == G'[b], F'[a] == (b - a)/(F[a] - G[b])}, {a, b}] // N Maximal Working Example ...


2

Run with xelatex or latex->dvips->ps2pdf. Needs an up-to-date version of pstricks.tex. It knows \psellipseAB which simplifies things for the user: \documentclass[border=10pt,pstricks]{standalone} \usepackage{pst-node} \begin{document} \begin{pspicture}[showgrid=false](7,7)%% showgrid=true \pnodes{a}(1,0)(2.3,2)(5.2,2.5)(6.25,3)(7,5) ...


6

Just for fun, with feynmp and egreg's feynmp-auto. If on MikTeX or TeX Live 2012 or earlier, compile with --shell-escape (or --enable-write18) as command-line options. All manual positioning (\fmfforce commands) is done to match your sample, but the positions can be computed automatically by leaving these out. \documentclass{standalone} ...


3

You could use the tikz package and the arrows and decorations library to achieve something similar to your drawing. \documentclass[tikz]{standalone} \usetikzlibrary{arrows,decorations.pathmorphing} \begin{document} \begin{tikzpicture}[ >=stealth', pos=.8, photon/.style={decorate,decoration={snake,post length=1mm}} ] \draw[gray,thick] (-2,0) -- ...


2

This is a starting point. First define a style (LL here) for snake lines. Then draw a line via \draw[options] (x1,y1) --(x2,y2)node[position]{label}; % Euclid coordi \draw[options] (0,0) --(alpha:radius)node[position]{label}; % polar coordi Options: thick, very thick, color, arrow type,...,LL] Code \documentclass[10pt,a4paper]{standalone} ...


5

I don't know the name of this illusion but the important thing is that it is about simple harmonic motion of equally-spaced points with equally-spaced phase difference. Enjoy! The same code was posted here. \documentclass[preview,border=12pt,multi]{standalone} \usepackage{pstricks} \psset{unit=.3} % static point % #1 : half of the number of points % #2 ...


1

You have to use three columns. \documentclass{article} \usepackage{tikz-cd} \begin{document} \[ \begin{tikzcd}[row sep=4em] X_{i} \arrow[rr,"f_{ij}"] \arrow[dr,"\phi_{i}"] \arrow[ddr,swap,end anchor={[xshift=0.2em]north west},"\psi_{i}"] && X_{j} \arrow[dl,swap,"\phi_{j}"] \arrow[ddl,end anchor={[xshift=-0.2em]north east},"\psi_{j}"] \\ ...


1

Just for fun with plain TeX's math mode only. \def\dju{\mathbin{\coprod}} \def\id{\mathop{\rm id}} \def\Ga{\hphantom{f()}G} \def\Ha{H\hphantom{g()}} \def\rar#1{\buildrel {#1} \over {\hbox to 4em{\rightarrowfill}}} \def\dar#1{\Bigg\downarrow\rlap{$\scriptstyle#1$}} \def\drar#1{\searrow\raise1ex\rlap{$\scriptstyle#1$}} $$ \matrix{ \Ga\dju \Ha ...


5

You need more than the six polygon shapes of the blue cube to draw hidden surfaces. And, of course, all objects must be calculated with action=none except of the last one: \documentclass{standalone} \usepackage{pst-solides3d} \begin{document} \begin{pspicture}(-3,-2)(3,3) \psset{viewpoint=20 25 15,Decran=50,solidmemory,action=none} ...


7

This is an attempt. On the first plot, the first quadrant is the same as the second plot, but x-axis and y-axis are labeled interchangeably, then draw the x-axis line on the negative direction. For detail usages of the commands, they can be found in the documentation of tikz-3dplot. Code \documentclass[border=10pt,varwidth]{standalone} ...


5

Using Andrew Stacey's purpose-built tqft library: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{tqft} \begin{document} \begin{tikzpicture}[tqft/cobordism/.style={draw},tqft/every boundary component/.style={draw}] \pic [tqft/pair of pants]; \end{tikzpicture} There are many customization options as well as other shapes and connection ...


1

A TikZ solution: \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \draw (0,0) ellipse (.5 and .25); \draw (-1,-2) ellipse (.5 and .25); \draw (1,-2) ellipse (.5 and .25); \draw (-.5,0) to[out=-90,in=90] (-1.5,-2); \draw (.5,0) to[out=-90,in=90] (1.5,-2); \draw (-.5,-2) to[out=90,in=90] (.5,-2); \end{tikzpicture} ...


0

For this sort of free-format chart, Metapost is often a good fit, because it's all just labels and lines. The key thing is to establish sensible horizontal and vertical units. You could consider writing a little function to do the labels and lines, but since there are not many and you might need flexibility about where the labels go, it's probably not ...


4

The basic idea for triangular diagrams is to consider more columns, in this case three; you may want to play with column sep or row sep in order to get better distances, as shown. \documentclass{article} \usepackage{tikz-cd} \begin{document} \[ \begin{tikzcd} & A \arrow{dr}{g} \\ B \arrow{ur}{f} \arrow{rr}{h} && C \end{tikzcd} \] \[ ...


1

I did something like that for a personal notes, The code is the following \begin{center} \begin{tikzpicture}[thick,line cap=round,yscale=2, % Styles axes/.style=, important line/.style={very thick}, information text/.style={rounded corners,draw=blue!80!black,fill=blue!10,inner sep=1ex}] \pgfkeys{/pgf/number ...


15

You're on the right track; however, some improvements can be made to your code; most importantly, nesting tikzpictures is not always the best choice; in fact, in the case at hand, it's not necessary at all. Here's one possibility using the petri library: \documentclass{article} \usepackage{tikz} ...


5

A much shorter solution \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}[ letter/.style={circle, minimum size=3pt, inner sep=0, outer sep=0, fill=black, label=below:#1}, number/.style={fill=white, pos=.5} ] \draw (0,0) -- node(A)[letter=A,pos=.2]{} node(C)[letter=C,pos=.6]{} ...


3

number line with tikz \documentclass{article} \usepackage{pgf,tikz} \pagestyle{empty} \begin{document} \begin{tikzpicture}[x=1.0cm,y=1.0cm] \clip(-2.5,-1) rectangle (11.5,2.5); \draw (-2,0)-- (3,0); \draw (5,0)-- (10,0); \draw [dash pattern=on 2pt off 2pt](-1,0)..controls (0.25,1) and (1,1) .. (2,0) ; \draw [dash pattern=on 2pt off 2pt](-1,0)..controls ...


6

One possibility: The code (requires PGF/TikZ version 3.0): \documentclass[border=3pt]{standalone} \usepackage{tikz} \usetikzlibrary{positioning,fit,patterns} \tikzset{ pics/media/.style ={ code = { % \node[text width=2cm,minimum height=2cm,#1] (back) {}; \node[draw,anchor=center,fill=white] at ([yshift=5pt]back.center) {Media}; ...


0

To startup, Have a look (with TikZ): \documentclass[12pt]{article} \usepackage{tikz} \usepackage[left=0in,right=0in]{geometry} \begin{document} \begin{tikzpicture} \draw[dashed, color=blue] (-3,0) rectangle (4,4); \filldraw[color=blue!20] (-2.5,1.2) rectangle (-0.5,2.7); \end{tikzpicture} \end{document}


1

My suggestion would be to first prepare all the documents in separate pdf files and then compile them into a single pdf file using some third party softwares. For example, if you are using OS X, preview.app can do this and in Ubuntu there are different options. If you want a pure latex solution, then you can use pdfpages to merge all your documents to a ...


2

The syntax of \vector and \line specifies that the length argument must be the horizontal distance, except for vertical lines, where it means the vertical distance. Thus, your picture should be: \setlength{\unitlength}{1mm} \begin{picture}(100,100) \put(0,10){\vector(1,0){100}} \put(102,8){$x$} \put(10,0){\vector(0,1){100}} \put(12,98){$y$} ...


2

Another option is the use of clip command to fill the particular areas, displayed below. Need the scope environment to limit the operation of filling, or it will take effect from thereafter. EDIT: Well, a much simpler way is to fill the shape directly as such. Replace the scope codes with the following code. the coordinate 1.7 is determined by ...


3

You can do this using a blend group (c.f. Section 23.3 of the pgf manual v3.0.0), which mixes the colors according to a specified blending mode. The possible modes are outlined in the manual, but screen or lighten are probably most appropriate for your desired output. This approach flattens items drawn inside the group, so I used a slightly different ...


7

Tikz solution, generalized to any queue length: \usetikzlibrary{calc} \def\cells#1#2#3{% % #1 = total number of cells % #2 = number of grey cells % #3 = index for "front" ("back" is mod(#3+#2-1, #1)) \foreach [count=\i from 0] \j in {1,...,#1} { \node[cell,label=above:\i] (cell\i) at (\i,0) {}; } \pgfmathsetmacro{\last}{#3+#2-1} \foreach \i in ...


2

One can either use \nextblock[under text]{color} or else the shorthands \grayblk[under text] for gray and \nullblk[under text] for white. Then, just repeat the invocations as needed. Use a \resetblock when complete. \documentclass{article} \usepackage{stackengine} \usepackage{xcolor} \newcounter{index} \newcommand\resetblock{\setcounter{index}{0}\medskip} ...


7

With simple tabular: \documentclass{article} \usepackage{array} \usepackage[table]{xcolor} \begin{document} \begin{tabular}{*6{r}} 0 & 1 & 2 & 3 & 4 & 5 \\\hline \multicolumn{1}{|r|}{\cellcolor{gray!40}} & \multicolumn{1}{r|}{\cellcolor{gray!40}} & \multicolumn{1}{r|}{\cellcolor{gray!40}}& ...



Top 50 recent answers are included