阶段 5 · 图表、表格与文献 40 / 48 ≈ 15 分钟读完

LaTeX pgfplots 画数据图:坐标轴、曲线与面板

图和正文出自同一份源文件,字体、颜色、数字就没有各说各话的机会。这一页把 axis 环境的选项一组组拆开:喂数据的三种写法、compat 究竟修好了什么、domain 与 samples 怎样共同决定一条曲线的形状,以及一张图什么时候不该再是图片、而该变成一个 groupplot。

    图即源码,还有那行 compat

    \usepackage{pgfplots} 会连带载入 TikZ(也就是 PGF),再在其上叠一层画图机制:一个懂坐标系、刻度摆放、数字格式、图例和色表的 axis 环境。它对文档的意义,和一切「由源码画出来的对象」没有区别:图跟着文字一起进版本库,标签用正文的字体按正文的字号排,换台机器重编译结果分毫不差,数据一改,改动落在源码里,而不是重导一张图片。

    宏包之后的第一行应该是 \pgfplotsset{compat=1.18},这不是走过场。pgfplots 在历史上改过好几轮轴标签、刻度标签与图例的摆放规则,兼容级别的作用就是把行为钉在你写的那个版本上,让一份老文档看上去仍是作者当年放下的样子。不写 compat 时日志会替你说——at least set compatibility version 1.3——而轴是按 1.3 之前的老规则画出来的,那些从没更新过的老源码里标签位置怪异,就是这么来的。

    请写明确的版本号,别写 compat=newest。后者等于允诺你的图会跟随今后每一次标签几何改动,而论文隔几年重编译后轴标签换了地方,就是它干的好事。把它写在主文件导言区一次即可;项目里如果是一堆各自独立编译的图,就放进共享样式文件,免得某张图的 compat 与文档各说各话。

    有条边界值得先说清:pgfplots 管的是「图」——有坐标系、轴上带数字的那种。示意图、流程图、电路图归 TikZ 或某个领域专用库,硬把示意图塞进 axis,只会得到更差的图和更慢的编译。

    Anatomy of a pgfplots axis: the drawn range from xmin and xmax, the evaluated range from domain, ticks and labels, the legend box, and what scale only axis changes begin{axis}[xmin=0,xmax=12,ymin=-1.2,ymax=1.2,domain=0:10,samples=61] domain = 0:10 → the function is evaluated here xmax - domain end = a visible gap the drawn curve stops where domain stops, no matter what xmin/xmax show 0 2 4 6 8 10 12 xlabel: time t [s] ylabel: x [mm] width (whole box, labels included, unless scale only axis = true) legend pos=outer north east one addlegendentry each after its own \addplot; order follows the source order title={...} above the axis, not above the figure: the caption is outside the environment entirely keys that decide the frame axis lines=left | middle | box | none grid=major, grid style={dotted} enlargelimits=0.05, clip=false axis on top (ticks over curves) only marks draws the data points
    一个坐标轴是一套坐标系外加若干彼此独立的决定:数据范围、显示范围、刻度怎么放、标签怎么放、图例放哪。

    把 axis 环境拆开看

    你能看到平面上哪一块,由两族键决定。xmin/xmax/ymin/ymax 钉的是看得见的范围;domain(三维还有 ydomain、zdomain)钉的是函数在哪里被求值。这是两件事,只设一件是常态:domain=0:5 配 xmax=10,曲线会悬在半空断掉——画截断模型时这是正经写法,纯属笔误时它看着就像出了错。

    尺寸归 width=、height= 和 scale only axis 管。默认情况下 width 要的是整个打印盒子的宽度,刻度标签和转了方向的 y 标签都算在内,于是两张 width 相同、标签长短不同的图,数据区反而不一样宽。scale only axis=true 把要求挪到轴框本身,面板必须对齐时你要的就是它;另一条路是固定 xlabel style/ylabel style,再靠纪律保证标签长度一致。

    第三族是刻度:xtick={0,2,...,12}(其中 ... 那套步长写法是 pgfplots 自己的,在排版时求值)、ytick pos=left、minor tick num=4、tick align=inside|outside|center、tick style={...},标签格式则走 xticklabel style={/pgf/number format/.cd,fixed,precision=2}。想自己写标签就得用 xticklabel={\tick, \ticknum} 这类代码:\tick 是数值、\ticknum 是序号,于是 xticklabel={\pgfmathprintnumber{\tick}\,ms} 只在后面补单位,不动数据本身。

    剩下的键管外框长相与叠放次序:axis lines=left|middle|center|box|none、axis background/.style={fill=gray!5}、grid=major 配 grid style、留点余量免得点贴框的 enlargelimits=0.05、想让曲线明显穿出边框时的 clip=false,以及把框和刻度画到图线之上的 axis on top——密集的曲线正盖住你的刻度标签时,要设的就是它。

    \log_{10} y = \log_{10} a + b\,\log_{10} x \qquad (y = a\,x^{b})
    \log_{10} y = \log_{10} a + b\,\log_{10} x \qquad (y = a\,x^{b})
    width 与 height 请用 \pgfplotsset{...} 作为全局风格一次定好;每张图各自报尺寸,正是一本附录看起来像十一份不同文档拼出来的原因。

    给绘图命令喂数据的三条路

    \addplot {⟨expression⟩} 是在轴坐标系里算一个数学表达式。这套语言是 pgf 的而不是 TeX 的:乘号是 *、幂是 ^、函数有 sin、cos、exp、ln、sqrt、abs、mod——而最关键的一条:除非把参数裹进 deg( ),或者设 trig format plots=rad 风格,三角函数吃的是弧度。作者心里想着赫兹、写下 cos(3*x),它就静静地画错给你看。

    \addplot coordinates {(0,0) (1,1.2) (2,1.9)} 写的是逐条点列——三四个测量点用它正合适,别的都不合适,因为这个列表要 TeX 亲自解析,既慢又难读。真实数据集请用 \addplot table {file.dat},那是下一节的主题。

    第三种写法的意义在于风格怎么合并。\addplot[blue,dashed]{...} 会替换掉整条绘图样式,轴的配色循环就此被跳过,第二张图和第一张同色;\addplot+[mark=none]{...} 是追加,循环照旧往下走。差别只是那一个 + 号——两条曲线的图出来一种颜色,最常见的原因就是它。

    其余的都得换别的画法:\addplot gnuplot {\x**2} 把表达式交给外部的 gnuplot 去算(需要 --shell-escape,机器上还得有那个可执行文件),raw gnuplot 允许你原样贴一段 gnuplot 源码,\addplot graphics [xmin=...,xmax=...,ymin=...,ymax=...] {scan.png} 则把扫描来的图叠在坐标系上、好按轴去读它的像素——老图的原始数据已经丢了时,这是正经用法。

    \documentclass[a4paper]{article}
    \usepackage{pgfplots}
    \pgfplotsset{compat=1.18}       % without this the labels use old positions
    
    % A house style: every axis in the document gets the same size and font.
    \pgfplotsset{%
      width=0.75\textwidth, height=0.55\textwidth,
      label style={font=\small}, tick label style={font=\small},
      every axis plot post/.append style={thick},
    }
    
    \begin{document}
    
    \begin{figure}[htbp]
      \centering
      \begin{axis}[
        title={Damped oscillator},
        xlabel={time $t$ [s]},
        ylabel={displacement $x$ [mm]},
        xmin=0, xmax=12,
        ymin=-1.2, ymax=1.2,
        xtick={0,2,...,12},
        ytick={-1,-0.5,0,0.5,1},
        grid=major,
        grid style={dotted, black!25},
        legend pos=outer north east,
        axis lines=left,
        enlargelimits=false,
      ]
        \addplot[domain=0:12,samples=201,smooth,blue]
            {exp(-0.4*x)*cos(deg(3*x))};
        \addlegendentry{$\mathrm{e}^{-0.4t}\cos 3t$}
        \addplot[domain=0:12,samples=201,densely dashed,black!60]
            {exp(-0.4*x)};
        \addlegendentry{envelope}
        \addplot[only marks,mark=*,mark size=1.4pt,red!70!black]
          coordinates {(0.5,0.92) (2.1,-0.41) (4.0,0.12) (7.3,-0.05)};
        \addlegendentry{measured}
      \end{axis}
      \caption{Simulation against the four measured points.}
      \label{fig:decay}
    \end{figure}
    
    \end{document}

    数据文件、列映射与误差棒

    数据文件默认按空白分列:一行是 x y(或 x y z,也可以更多列),\addplot table {data.dat} 取头两列。想点名就写 \addplot table [x=time, y=flow] {data.csv},而分隔符是 table 的选项:col sep=comma|semicolon|tab|space|ampersand。逗号分隔的导出文件少了这一项会被当成一整列,报出来的错还看不出所以然,所以先查分隔符,再查文件。

    一个文件读一次,之后都引用那个句柄:\pgfplotstableread[col sep=comma]{flow.csv}\flowdata,随后在几个面板里写 table[x=time,y=flow]{\flowdata}。它更快,而且能保证两块面板用的确实是同一份数据。列集合还能在读入时扩张:\addplot table [create col/expr={\thisrow{a}/\thisrow{b}}] 现场算出一个派生列,不必先做预处理。

    误差棒是这条曲线自己的选项,而不是另起一条曲线:\addplot+[only marks,error bars/.cd,y dir=both,y explicit],后面跟一张带 y error 列的表(同一个值用 y const error,按百分比用 y relative*100)。改用逐点列出的写法时误差就直接跟在点后面,coordinates {(1,2) +- (0.1,0.05)},这里最容易混:+- 是相对该点的,+-* 才是绝对值。设了 y dir=both 的图会在棒的两端都画帽。

    缺值和越界值需要一个明确对策。空字段或 nan 默认就把这段折线截掉;想让曲线其余部分留着、只留一个看得见的缺口,用的是 unbounded coords=jump;而 restrict x to domain=0:10 筛的是数据,不是视野。阶梯函数 const plot 配上 const plot mark left|right,才让不等宽分箱的直方图说得的是实话。

    \varepsilon_{i} = \sqrt{\varepsilon_{\mathrm{stat},i}^{2} + \varepsilon_{\mathrm{syst},i}^{2}}
    \varepsilon_{i} = \sqrt{\varepsilon_{\mathrm{stat},i}^{2} + \varepsilon_{\mathrm{syst},i}^{2}}
    \documentclass[a4paper]{article}
    \usepackage{pgfplots}
    \pgfplotsset{compat=1.18}
    \usepackage{filecontents}
    
    \begin{filecontents*}{flow.csv}
    time,valve,flow,error
    0.0,0.0,1.02,0.04
    2.5,0.5,1.44,0.05
    5.0,1.0,1.98,0.06
    7.5,1.5,2.61,0.09
    10.0,2.0,3.40,0.15
    \end{filecontents*}
    
    \begin{document}
    
    % Read once, reuse in several plots; nothing is parsed at typeset time.
    \pgfplotstableread[col sep=comma]{flow.csv}\flowdata
    
    \begin{figure}[htbp]
      \centering
      \begin{axis}[
        xlabel={time [s]}, ylabel={flow [L/min]},
        xmin=0, xmax=10, ymin=0.8, ymax=3.8,
        grid=both, grid style={line width=0.2pt, draw=gray!30},
        tick align=outside, tick style={black},
        scaled ticks=false,
        yticklabel style={/pgf/number format/fixed},
        legend style={at={(0.03,0.97)},anchor=north west,draw=none},
      ]
        \addplot+[only marks,error bars/.cd,y dir=both,y explicit]
          table[x=time,y=flow,y error=error]{\flowdata};
        \addlegendentry{runs}
        \addplot+[thick,smooth] table[x=time,y=flow]{\flowdata};
        \addlegendentry{guide for the eye}
      \end{axis}
      \caption{Measured flow with the statistical error of each point.}
    \end{figure}
    
    \end{document}

    曲线、标记与配色循环

    绘图样式可以命名、可以复用:文档级写 \pgfplotsset{myline/.style={thick,blue!60!black,mark=*}},图上就是 \addplot[myline]。样式能套叠,所以 every axis plot post/.append style={thick} 这条全局风格会改到文档里每一张图,一张图都不用碰——四十张图画完才发现线宽该调,走的就是这条路。

    cycle list 负责自动派发颜色与标记。cycle list name=colorful(还有 mark list、group plot list、rgb)顶掉默认那条,自定义的则是一串样式片段。某条曲线想不参与循环,就给它显式的 color=,它便不再消耗下一个名额——「理论曲线一律黑色」这种约定就是这么守住的。

    smooth 值得单独警告一句:它是在算出来的点之间拟合样条,samples 给低了就会凭空生出本来不存在的弯曲。尖峰函数上写 samples=20,smooth,得到的不是更顺滑的曲线,而是另一个函数。该加的是 samples,不是对 smooth 的信任;测量点之间永远别用它——在两次实测之间插出来的线是一种主张。

    曲线错在区间中段时,去查 restrict expr to domain,查奇点(在 x=0 处除零的表达式会甩出一道穿过整张图的尖峰),再查峰附近的 samples:振荡函数每个周期都要有足够的采样点,domain=0:100 只给 samples=100 必然混叠。经验法则是每个看得见的振荡给上几百次求值。

    x_{i} = a + i\,\frac{b-a}{N-1}, \qquad i = 0,\dots,N-1
    x_{i} = a + i\,\frac{b-a}{N-1}, \qquad i = 0,\dots,N-1
    The same function plotted with five, fifteen and sixty samples: samples sets the spacing of the evaluated points, and a coarse value manufactures structure that is not in the data addplot[domain=0:6] {sin(deg(x))*exp(-0.3*x)} · ONE FUNCTION, THREE VALUES OF N samples=5 Delta x = 6/4 = 1.5 four straight segments: the peak is in the wrong place and its height is wrong samples=15 Delta x = 6/14 = 0.43 better, but smooth on top of this adds a spline through points you chose badly samples=60 Delta x = 6/59 = 0.10 indistinguishable from the dashed truth curve at normal print size x_i = a + i * (b - a) / (N - 1) i = 0 .. N-1 samples is about the evaluation grid, not about the picture quality of a data table data table → one point per row, no samples involved samples=201 for an expression, and raise it before ever using smooth A sharply peaked or oscillating function over a wide domain aliases: the curve then reports the grid rather than the function.
    同一个函数在五个、二十个、两百个采样点下各自的样子:采样误差看着像是函数的性质,其实它是 N 的性质。

    图例、标题与图上标注

    图例条目要紧跟在它所描述的那条曲线之后:\addplot ...; \addlegendentry{...}。\nextgroupplot 的面板里、\addplot+[] 的链式写法里都是同一套顺序,而 \addplot 末尾漏掉那个 ;,就是接下来一定会撞上的那个错。

    摆放要么给关键字——legend pos=north east、south west、outer north east(画到框外,正是让图例不再吃数据的选项);要么全权接管:legend style={at={(0.5,-0.18)},anchor=north,legend columns=-1,draw=none},其中坐标用的是轴自己的相对系,legend columns=-1 让条目横排。一行面板共用一个图例时,机制是每个轴里写 legend to name=legA、外层 TikZ 图里 \ref{legA}。

    标题和轴标签就是普通文字夹普通数学:xlabel={time $t$ [s]};标签非挪不可时用 xlabel style={at={(0.5,-0.2)},font=\small},或者更省事的 xlabel shift/ylabel shift。这套标签几何恰好归 compat 管,所以兼容级别没设时,最先冒出来的症状永远是「y 标签压到刻度上了」。

    标注才是一张图开始讲道理的地方。在轴里你可以直接拿轴坐标来画:\draw[gray,dashed] (axis cs:3.2,0) -- (axis cs:3.2,1.1);,把节点放在 (axis cs:3.2,1.1) {threshold},再用 \addplot 配 table [y expr={...}] 标一条回归线。在 groupplot 里、或者作用域内已经有 \tikzset 坐标系时,axis cs: 这个前缀不是可选的:裸写的 (3.2,0) 属于外面那张图而不是这个轴,节点就落到了别的图上。

    该绑在一起的那些面板

    并排两个轴、各写成一个 axis 环境塞进小页(minipage),你拿到的是两套互不相干的几何:刻度标签宽度不同,绘图框就对不齐,行间距全凭小页剩下多少。groupplots 库(\usepgfplotslibrary{groupplots})把这堆换成单个 groupplot 环境,它的 group style 知道格子怎么排:group size=2 by 2、horizontal sep=14mm、vertical sep=15mm,还有特别有用的 yticklabels at=edge left、xlabels at=edge bottom、ylabels at=edge left,标签因此只落在最外圈的面板上。

    每个面板以 \nextgroupplot[⟨options⟩] 开头,普通轴能吃的键它全能吃。公共范围写在 groupplot 的选项上、面板里再各自覆盖;稀疏布局交给 \nextgroupplot[group/inner pos=...] 与 \nextgroupplotempty;至于要横跨两格的面板,那是 group style 的几何问题,不该拿小页环境硬凑。

    分组也正是数据复用开始划算的那一点:环境之前把表读好,四个面板用不同的列映射去引用同一个句柄。两个面板必须同色时,请把颜色写死,别指望循环会跨过面板边界继续——某些配置下每个 \nextgroupplot 都会重置循环,这种耦合不值得留。

    在 TeX 里画图的代价是真实的,最好在审稿人抱怨之前就心里有数:pgfplots 是在 TeX 运行内逐点求值并排版的,所以一张十万个点的图、或者六十张曲线的文档,可能要跑掉几分钟。答案按顺序是:给数据文件降采样、把 samples 压到曲线还守得住的最低值、用 TikZ 的 external 库外置(\usetikzlibrary{external} 加 \tikzexternalize[prefix=tikz-cache/]),它把每张图缓存成自己的 PDF,只重画改动的那一张。至于百万点的图,去别处生成 PDF 再当图片引进正文——「一切都由源码画」这条规矩是给数字要进正文的图准备的,不是给压测数据准备的。

    \bar{y} = \frac{1}{n}\sum_{i=1}^{n} y_{i}, \qquad s^{2} = \frac{1}{n-1}\sum_{i=1}^{n}(y_{i} - \bar{y})^{2}
    \bar{y} = \frac{1}{n}\sum_{i=1}^{n} y_{i}, \qquad s^{2} = \frac{1}{n-1}\sum_{i=1}^{n}(y_{i} - \bar{y})^{2}
    \documentclass[a4paper]{article}
    \usepackage{pgfplots}
    \pgfplotsset{compat=1.18}
    \usepgfplotslibrary{groupplots}
    
    \begin{document}
    
    \begin{figure}[htbp]
      \centering
      \begin{groupplot}[
        group style={group size=2 by 2,
                     horizontal sep=14mm, vertical sep=15mm,
                     yticklabels at=edge left,
                     ylabels at=edge left,
                     xlabels at=edge bottom},
        width=0.42\textwidth, height=0.34\textwidth,
        grid=major, thick,
      ]
      \nextgroupplot[title={(a) linear}, xmin=0, xmax=5,
                     ylabel={$f$ [a.u.]}]
        \addplot {exp(-0.5*x)*cos(deg(2*x))};
      \nextgroupplot[title={(b) log scale}, xmin=0.1, xmax=100,
                     xmode=log, ymode=log,
                     ylabel={$|H(f)|$}]
        \addplot {1/(x+1)};
      \nextgroupplot[title={(c) cumulative}, xlabel={$x$ [mm]}]
        \addplot {0.5*(1+erf(x-1))};
      \nextgroupplot[title={(d) scatter}, xlabel={$x$ [mm]},
                     only marks, mark size=1pt]
        \addplot+[] {rnd + 0.2*x};
      \end{groupplot}
      \caption{Four views of the same model, drawn as one object.}
      \label{fig:group}
    \end{figure}
    
    % Compile cost is real: externalise if the document has many such figures.
    %   \usetikzlibrary{external}
    %   \tikzexternalize[prefix=tikz-cache/]
    % The first run after a change redraws only the affected figure.
    
    \end{document}

    对数轴、刻度,以及随之而来的报错

    xmode=log、ymode=log 把轴切成对数刻度,底数由 log basis x=10(或 2)给出,十倍一档的刻度自动生成;读者更想看裸数值时,log ticks with simply numbers 会顶掉 10ⁿ 那种记法。幂律 y = a x^b 在双对数纸上是一条直线,这才是诚实摊开指数的办法;衰减曲线后段还读得动,靠的也是 ymode=log 摊开的三个数量级。

    对数轴容不下零:最早的症状是日志里一句 "ymin=0" is not allowed in log coordinates,或者整个轴什么都不画。下限请设成你在意的最小正数,零用 restrict y to domain=1e-3: 在数据里筛掉,别放它们走到轴跟前。

    编译期会露面的三个报错都很自洽。Could not parse input 是表达式写坏了,或者数据文件与分隔符选项对不上。No valid input was found 说的是表的列并不符合 x=/y= 点到的名字。而 \begin{axis} 报出 Environment axis undefined,是宏包压根没载入——更常见的情形是 pgfplots 排在了某个本该在它之前的类或宏包之后,惯犯是 beamer 与 tikz 的覆盖层。

    沉默的那一类是尺度对不上:compat 没设,标签会跑;scale only axis 没设,面板对不齐;enlargelimits 留在默认值,数据就贴不到框,于是同一范围的两张图看着就是不一样。三样都在同一个 \pgfplotsset 块里定一次,往后每张图才真的能和前一张比。

    本课速查

    每节抽一行关键代码:点小节名跳到对应位置,代码一键复制。

    小节 关键代码
    \log_{10} y = \log_{10} a + b\,\log_{10} x \qquad (y = a\,x^{b})
    \documentclass[a4paper]{article}
    x_{i} = a + i\,\frac{b-a}{N-1}, \qquad i = 0,\dots,N-1

    常见错误

    • 不写 \pgfplotsset{compat=...},或者图省事写 compat=newest:标签几何从此取决于机器上装的版本,发行版一升级,老图就跟着挪位置。
    • 每条曲线都写 \addplot[blue]{...} 而不是 \addplot+[...]:让配色循环接着转的就是那个 +,没有它三条曲线挤成一个颜色。
    • 写下 cos(2*x) 却按赫兹去想:除非把参数裹进 deg(...),pgfplots 的三角函数吃的是弧度。
    • 把 domain 当成 xmin/xmax:前者是函数在哪一段被求值,后者是轴给你看哪一段,曲线画到半路停住就是它的典型症状。
    • samples 给得极少还配 smooth:样条只是在你给出的点之间插值,等于替数据编造它本身没有的结构。
    • 以为逗号分隔的文件自然读得进来:少了 col sep=comma,每一行都是一整列,图要么是空的要么错得离谱。
    • 在 ymode=log 的轴上设 ymin=0;或者用小页环境拼多面板图,然后再为对不齐的坐标轴较一晚上的劲。

    关于本课的常见问题

    怎么在 LaTeX 里画图,又不借助另一个程序?
    载入 pgfplots、把兼容版本那一行写上,然后在 axis 环境里给齐四个范围键,再画一句带 domain 与 samples 的 \addplot。表达式由 TeX 在编译期求值,所以曲线、它的标签和你的正文用的是同一套字体,源码一改图就跟着重生。
    \pgfplotsset 里那行 compat 到底管什么?
    它把指定版本的几何规则钉住:轴标签与刻度标签的摆放、图例默认值,以及若干对齐行为。不写它,pgfplots 会在日志里报警并按很老的标签规则画;跟着最新版走,你的图就会跟随今后每一次几何改动。选你正在用的那个版本号,在导言区写一次就好。
    怎么用 pgfplots 画 csv 文件里的数据?
    先用带 col sep=comma 的 \pgfplotstableread 把文件读成一个句柄,再在 \addplot table 里按列名取。列要点名字而不是数第几列,表头那行留着:pgfplots 把列名当键用。空白分隔的文件连分隔符选项都不必给。
    图例挡住数据了怎么办?
    把它挪出绘图区:legend pos 取 outer north east 就画到框外,图例不再吃数据;或者用 legend style 自己给坐标,把整条图例钉在轴的下方横排。有好几个面板时,给每个轴的图例各起一个名字,再统一排一个共用图例。
    pgfplots 的误差棒怎么加?
    给这条曲线加上 error bars 那组选项:方向取两端、数值取显式,表里补一列 y error(或者在逐点列出的写法里用 +- 那种相对形式)。所有点共用一个值有 const 那一列,按百分比画有 relative 那一列——比值图通常想要的正是后者。
    论文插图,该用 pgfplots 还是 matplotlib?
    图上的数字必须和正文里的数字对得上、标签要跟正文同字体时用 pgfplots;数据很大、要色表或大规模的三维视图、或者合作者用 Python 时用 matplotlib。无论哪一种,请把生成这张图的脚本留在源码旁边。

    实时演示:直接编辑 LaTeX,立刻看渲染结果

    预览随输入实时更新——不妨故意写坏一次,看看报错长什么样。

    KaTeX 错误
    试一个例子

    继续读

    同一个东西的三个入口:记法本身、讲它的那一课、以及真正用它写东西的一篇文章。