book
归档: tex 
flag
mode_edit

最近用 $\mathrm{ti}k\mathrm z$ 画了不少图

这东西的唯一学习方法就是看 example ,多看几个就学会了(你有本事去看好几百页的 document 啊)

抱歉图都坏掉了,请到https://gitee.com/margatroid/dialgram 查看成品 svg 图片

数学

fig - 1

fig-1

\documentclass[usenames,dvipsnames]{standalone}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{quotes,angles,calc}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,x=1cm,y=1cm]
\draw[->,color=black] (-4.9,0) -- (4.9,0) node[below]{\footnotesize{$x$}};
\draw[->,color=black] (0, -0.3) -- (0, 3.6) node[right]{\footnotesize{$y$}};

\foreach \x in {-4,-3,-2,-1,1,2,3,4}
  \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
  \coordinate (A) at (1, 0);
  \node at (A) [below right]{$A$};
  \coordinate (B) at (0, 0);
  \node at (B) [below right]{$B$};
  \coordinate (C) at (0.93, 2.24);
  \node at (C) [above]{$C$};
  \coordinate (D) at (-4.47, 1.87);
  \coordinate (E) at (0, 2);
  \node at (D) [left]{$D$};
  \node at ($(D)+(0,0.2)$) [above right]{$x^2+(y-2)^2=20$};
  \draw (A) -- (B) -- (D) -- (C) -- (A);
  \draw (B) -- (C) node[midway, sloped, above]{$\rho$};
  \pic [draw, ->, "$\theta$", angle eccentricity=1.5] {angle = A--B--C};
  \draw (A) circle [fill=black,radius=0.5pt];
  \draw (B) circle [fill=black,radius=0.5pt];
  \draw (C) circle [fill=black,radius=0.5pt];
  \draw (D) circle [fill=black,radius=0.5pt];
  \draw (E) circle [fill=black, radius=0.5pt];
  \draw (E) circle [radius=4.472135955];
\end{tikzpicture}
\end{document}

fig - 2

fig-2

\documentclass{standalone}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{quotes,angles,calc}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,x=1cm,y=1cm]
  \draw[help lines] (0, 0) grid (3, 3);
  \draw[shift={(1/e,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[above right] {\footnotesize $\frac 1 e$};
  \draw[shift={(0,-1/e)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $- \frac 1 e$};
  \draw[dashed] (1/e, 0) -- (1/e, -1/e);
  \draw[dashed] (0, -1/e) -- (1/e, -1/e);
  \draw (1/e, -1/e) circle [fill=black, radius=0.5pt];
  \node at (0,0) [above left] {\footnotesize$O$};%nowadays, $O$ should be $\mathrm{O}$

  \draw[->] (-0.3,0) -- (3.3,0) node[right] {\footnotesize$x$};
  \node at (1,0) [below right] {\footnotesize$1$};

  \draw[->] (0,-0.5) -- (0,3.3) node[above] {\footnotesize $y$};
  \node at (3,1.7) {\footnotesize {$y=x\ln x$}};
  \draw[domain={(0.0001)}:3,samples=200,smooth] plot ({\x},{\x*ln(\x)});
\end{tikzpicture}
\end{document}

fig - 3

fig-3

\documentclass{standalone}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{quotes,angles,calc}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,x=1cm,y=1cm]
\draw[->,color=black] (-6.5,0) -- (6.5,0) node[below]{\footnotesize{$x$}};
\draw[->,color=black] (0, -6.5) -- (0, 6.5) node[right]{\footnotesize{$y$}};

\foreach \x in {-6,-5,-4,-3,-2,-1,1,2,3,4,5,6}
  \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\foreach \y in {-6,-5,-4,-3,-2,-1,1,2,3,4,5,6}
  \draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};

\coordinate (A) at (4, 2);
\coordinate (O) at (0, 0);
\coordinate (B) at (2.68, 1.34);
\coordinate (C) at (3.7, 4.16);
\draw (O) -- (A);
\draw[->, color=purple] (O) -- (B) node [sloped, midway, above]{$\vec{a}$};
\draw[->, color=purple] (B) -- (C) node [sloped, midway, above]{$\vec{b}$};
\draw[->, color=brown] (O) -- (C) node [sloped, midway, above]{$\vec{c}$};

\node at (A) [below right]{\footnotesize $A$};
\node at (B) [below right]{\footnotesize $B$};
\node at (O) [below right]{\footnotesize $O$};
\draw (O) circle [radius=6];
\draw (O) circle [radius=3];
\draw[olive, dashed] (B) circle [radius=3];
\draw[red, dashed] (A) circle [radius=3];
\draw (A) circle [fill=black, radius=0.5pt];
\draw (O) circle [fill=black, radius=0.5pt];
\draw (B) circle [fill=black, radius=0.5pt];
\end{tikzpicture}
\end{document}

物理

电路图

fig - 1

fig - 1

\documentclass{standalone}
\usepackage[european]{circuitikz}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{circuitikz}
  \draw (0,0)
  to[battery1,l=$E$,a=$r$] (2, 0)
  to[nos] (3, 0)
  to node[draw,circle,fill=white,thick] {A} (5, 0)
  to[short] (5, 0)
  to[short, -*] (5, 2)
  to[vR] (0, 2)
  to[short, *-] (0, 0);
  \draw (0, 2)
  to[short] (0, 4)
  to node[draw,circle,fill=white,thick] {V} (5, 4)
  to[-|] (5, 2);
\end{circuitikz}
\end{document}

fig - 2

fig - 2

\documentclass{standalone}
\usepackage[european]{circuitikz}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{circuitikz}
\draw (0, 0)
  to [battery1, a=$\mbox{\textit{E, r}}$] (1, 0)
  to [switch, a=$S_1$] (3, 0)
  to [pR, a=$R_1$, n=R1] (5, 0)
  to [] (5, 0)
  to [] (5, 2)
  to node[draw,circle,fill=white,thick] {G} (0, 2)
  to [] (0, 2)
  to [] (0, 0);
\draw (5, 2)
  to [short, *-] (5, 4)
  to [switch, a=$S_2$] (3, 4)
  to [vR, a=$R_2$] (1, 4)
  to [] (0, 4)
  to [short, -*] (0, 2);
\draw (R1.wiper) -| (3, 0);
\end{circuitikz}
\end{document}

fig - 3

fig - 3

\documentclass{standalone}
\usepackage[european]{circuitikz}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{circuitikz}
\draw (0, 0)
  to [battery1, a=$\mbox{\textit{E, r}}$] (2.5, 0)
  to [switch, a=$S_1$] (5, 0)
  to [] (5, 2);
\draw (0, 0)
  to (0, 2)
  to [pR, n=Rp, a=$R_p$] (5, 2);
\draw (0, 2)
  to [short, *-] (0, 4)
  to node[draw,circle,fill=white,thick] {V} (2.5, 4)
  to [vR, a=$R_1$] (5, 4)
  |- (Rp.wiper);
\draw (2.5, 4)
  to [short, *-] (2.5, 5.5)
  to [switch, a=$S_2$] (5, 5.5)
  to [short, -*] (5, 4);
\end{circuitikz}
\end{document}

OI 相关

fig - 1

fig - 1

\documentclass{standalone}
\usepackage{tikz,pgf}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{tikzpicture}
  [sibling distance= 3em,
  level distance= 3em,
  every node/.style = {
    shape=circle,
    draw=black
  }]
  \node (root) {}
    child {
      node (A1) {}
      edge from parent[green]
      child {
        node {}
        child {
          node {}
          child {
            node (D1) {}
          }
          child {
            node {}
            edge from parent[black]
          }
        }
        child {
          node {}
          edge from parent[black]
        }
      }
      child {
        node {}
        child[opacity=0] {
          edge from parent [opacity=0] % invisable node
        }
        child {
          node (C3) {}
        }
      }
    }
    child[opacity=0] {
      edge from parent [opacity=0] % invisable node
    }
    child {
      node (A2) {}
      child[opacity=0] {
        edge from parent [opacity=0] % invisable node
      }
      child {
        node {}
        edge from parent[green]
        child {
          node (C4) {}
          child {
            node {}
            edge from parent[black]
          }
        }
        child {
          node (C5) {}
        }
      }
    };
  \path (root) edge[red] (C3);
  \path (A1) edge[red, bend right] (D1);
  \path (A2) edge[red] (C4)
             edge[red, bend left] (C5);
\end{tikzpicture}
\end{document}

这张图是给 OIwiki 画的,老命都快画没了

fig - 2

fig - 2

\documentclass{standalone}
\usepackage{tikz,pgf}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{tikzpicture}
  [sibling distance= 3em,
  level distance= 3em,
  every node/.style = {
    shape=circle,
    draw=black
  },
  semiNode/.style={fill=blue, draw=blue, inner sep=0pt,minimum size=3pt, midway}]
  \node (root) {}
    child {
      node (A1) {}
      child {
        node {}
        child {
          node {}
          child {
            node (D1) {}
            edge from parent node[semiNode] (d1) {}
          }
          child {
            node {}
            edge from parent node[semiNode] (d2) {}
          }
          edge from parent node[semiNode] (c1) {}
        }
        child {
          node {}
          edge from parent node[semiNode] (c2) {}
        }
        edge from parent node[semiNode] (b1) {}
      }
      child {
        node {}
        child[opacity=0] {
          edge from parent [opacity=0] % invisable node
        }
        child {
          node (C3) {}
          edge from parent node[semiNode] (c3) {}
        }
      edge from parent node[semiNode] (b2) {}
      }
      edge from parent node[semiNode] (a1) {}
    }
    child[opacity=0] {
      edge from parent [opacity=0] % invisable node
    }
    child {
      node (A2) {}
      child[opacity=0] {
        edge from parent [opacity=0] % invisable node
      }
      child {
        node {}
        child {
          node (C4) {}
          child {
            node {}
            edge from parent node[semiNode] (d3) {}
          }
          edge from parent node[semiNode] (c4) {}
        }
        child {
          node (C5) {}
          edge from parent node[semiNode] (c5) {}
        }
        edge from parent node[semiNode] (b3) {}
      }
      edge from parent node[semiNode] (a2) {}
    };
  \path (root) edge[red] (C3);
  \path (A1) edge[red, bend right] (D1);
  \path (A2) edge[red] (C4)
             edge[red, bend left] (C5);
  \path (a1) edge[blue, bend left] (b2);
  \path (b2) edge[blue, bend left=50] (c3);
  \path (b1) edge[blue, bend right=50] (c1);
  \path (c1) edge[blue, bend right=50] (d1);
  \path (b3) edge[blue, bend right] (c4)
             edge[blue, bend left=50] (c5);
\end{tikzpicture}
\end{document}

navigate_before navigate_next