一个tikz片段

一个片段

等有钱了换一个16g内存的笔记本就好了..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
\documentclass[convert={density=600,outext=.png}]{standalone}
\usepackage{tikz}
\usepackage{tikz-dimline}
\usetikzlibrary{calc}
\usetikzlibrary{patterns}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[%
xscale = 2,
yscale = 2,
line cap = round]

% 定义矩形框的四个点
\coordinate (a) at (-1, 0.5);
\coordinate (b) at (1, 0.5);
\coordinate (c) at (1, 0);
\coordinate (d) at (-1, 0);

% 顺次连接四个点,将底边设置为蓝色,标注热沉温度
\draw[thick] (a) -- (b) -- (c) ;
\draw[thick, blue] (c) -- (d);
\draw[thick] (d) -- (a);
\node (T0) at (0.8, 0.1) {\tiny \textcolor{blue}{$T_0$}};

% 绘制上方边界
\fill[pattern=north east lines] (a) rectangle ++(0.75,0.07);

\fill[pattern=north east lines] (b) rectangle ++(-0.75,0.07);

% 绘制热流,标注Q
\foreach \p in {-0.2, -0.1, 0, 0.1, 0.2}{
\draw[red, -{Triangle[width=3,length=3]}, line width=1, fill=red] (\p, 0.65) -- (\p, 0.5);
}
\node (Q) at (0, 0.72) {\tiny \textcolor{red}{$Q$}};

% 将热流箭头底部连接
\coordinate (h_A) at (-0.2, 0.65);
\coordinate (h_B) at (0.2, 0.65);

\draw[red, thick] (h_A) -- (h_B);

% 绘制左侧坐标系,标注x,z
\coordinate (origin) at (-0.95, 0.45);

\coordinate (x) at (-0.75, 0.45);

\coordinate (z) at (-0.95, 0.25);

\draw[-stealth, semithick] (origin) -- (x);
\draw[-stealth, semithick] (origin) -- (z);

\node[anchor=north west, shift=({-0.1, 0})] (x_c) at (x) {\tiny x};
\node[anchor=north west, shift=({-0.05, 0.1})] (z_c) at (z) {\tiny z};

%标注w, t, wg
\dimline[label style={below=0.1},
extension start length=0,
extension end length=0]{($(c) - (0,0.05)$)}{($(d) - (0,0.05)$)}{\tiny $w$};%

\dimline[label style={above=0.1},
extension start length=0,
extension end length=0]{(1.05, 0.5)}{(1.05, 0)}{\tiny $t$};

\dimline[label style={below=0.1},
extension start length=0,
extension end length=0]{($(h_A)-(0, 0.2)$)}{($(h_B)-(0, 0.2)$)}{\tiny $w_g$};

\end{tikzpicture}
\end{document}

执行

1
pdflatex --shell-escape main.tex

输出