在寫 LaTeX 文稿的時候,我們常常會需要測試某一種功能的實際效果,但有時候臨時找不到適合的短文及圖檔,這裡使用 macro 定義一些短文章及圖檔備用,這樣測試就很方便了。
\newcommand{\mypic}{
\unitlength=1mm
\begin{picture}(40, 30)
\multiput(5, 0)(5, 0){8}{\line(0, 1){30}}
\multiput(0, 5)(0, 5){6}{\line(1, 0){40}}
\thicklines
\put(0, 0){\vector(0, 1){30}}
\put(0, 0){\vector(1, 0){40}}
\put(0, 0){\circle*{1}}
\end{picture}
}
\newcommand{\mytext}{
\count255=0
\loop
\advance\count255 by 1
\ifnum\count255 < 6
Bash is an sh-compatible command language interpreter that executes
commands read from the standard input or from a file. Bash also
incor porates useful features from the Korn and C shells (ksh and csh).
\repeat}
需要短文時只要下 \mytext 指令就成了,需要圖檔時就下 \mypic 指令。