<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\chapter{æ’å›¾}
\label{sec:graphics}

\begin{quotation}
A picture says more than a thousand words.
\begin{flushright}
--- Shakespeare
\end{flushright}
\end{quotation}

å½“å¹´~Knuth~å¼€å‘~\TeX~æ—¶ï¼ŒGIFã€JPEGã€PNGã€EPS~ç­‰å›¾å½¢æ&nbsp;¼å¼è¿˜æ²¡æœ‰é—®ä¸–ï¼Œæ‰€ä»¥~DVI~ä¸èƒ½ç›´æŽ¥æ”¯æŒè¿™äº›æ&nbsp;¼å¼ã€‚ä½†æ˜¯é«˜æ‰‹å°±æ˜¯é«˜æ‰‹ï¼ŒKnuth~åœ¨~\TeX~ä¸Šç•™äº†ä¸€ä¸ªåŽé—¨ï¼š\verb|\special|~å‘½ä»¤ï¼Œè®©åŽé¢çš„~Driver~å†³å®šæ€Žæ&nbsp;·å¤„ç†å›¾å½¢ã€‚

è¿™å’Œå½“å¹´è€æ¯›æŠŠæ¸¯æ¾³å°ï¼Œè€é‚“æŠŠé’“é±¼å²›éƒ½â€œç•™ç»™åŽäººè§£å†³â€æœ‰å¼‚æ›²åŒå·¥ä¹‹å¦™ã€‚æ›¾ç»æœ‰ä½å‡ºç‰ˆç¤¾çš„ç¼–è¾‘çœ‹ä¸Šäº†åŒ…è€å¸ˆå†™çš„ä¸€ä¸ªç¨‹åºï¼Œè¦åŒ…è€å¸ˆæ”¹æ”¹å½“ä½œæ•™å­¦è¾…åŠ©è½¯ä»¶å‡ºç‰ˆï¼Œä½†æ˜¯åŒ…è€å¸ˆæ‰‹å¤´æ²¡æœ‰~DOS~ä¸­æ–­çš„èµ„æ–™æ²¡åŠžæ³•åŠ&nbsp;é¼&nbsp;æ&nbsp;‡æ“ä½œã€‚è¯¥ç¼–è¾‘è¯´ï¼šä½&nbsp;æŠŠé¼&nbsp;æ&nbsp;‡é©±åŠ¨æ‰“åŒ…åœ¨è½¯ä»¶é‡Œï¼Œè®©ç”¨æˆ·è‡ªå·±ç¢ç£¨æ˜¯æ€Žä¹ˆå›žäº‹ã€‚

ä¸‹é¢æˆ‘ä»¬ä¼šåœ¨~\ref{sec:graphics_format}~èŠ‚ä»‹ç»ä¸€ä¸‹~\LaTeX~æ‰€ç”¨å›¾å½¢æ&nbsp;¼å¼ï¼Œ\ref{sec:includegraphics}~èŠ‚ä»‹ç»æ€Žæ&nbsp;·æ’å…¥å·²æœ‰çš„å›¾å½¢ï¼Œ\ref{sec:mp}--\ref{sec:pgf}~èŠ‚è®¨è®ºæ€Žæ&nbsp;·åˆ¶ä½œçŸ¢é‡å›¾å½¢ã€‚

\section{å›¾å½¢æ&nbsp;¼å¼}
\label{sec:graphics_format}

\LaTeX~æ”¯æŒç‚¹é˜µå›¾å½¢æ&nbsp;¼å¼~JPEG~å’Œ~PNGï¼Œä¹Ÿæ”¯æŒçŸ¢é‡æ&nbsp;¼å¼~EPS~å’Œ~PDFã€‚å¯¹äºŽç¤ºæ„å›¾ï¼Œæˆ‘ä»¬åº”è¯¥é¦–é€‰çŸ¢é‡æ&nbsp;¼å¼ï¼›åŒ…å«å¤§é‡è‡ªç„¶è‰²å½©çš„å›¾åƒï¼ˆæ¯”å¦‚ç…§ç‰‡ï¼‰åº”è¯¥é€‰~JPEGï¼Œäººå·¥ç‚¹é˜µå›¾åƒåº”è¯¥é€‰~PNGã€‚

\subsection{EPS}
80~å¹´ä»£ä¸­åŽæœŸï¼ŒPS~é£Žå¤´ä¹‹åŠ²ä¸€æ—¶æ—&nbsp;ä¸¤ï¼Œäººä»¬è‡ªç„¶ä¼šè€ƒè™‘æŠŠå®ƒä½œä¸ºæ–‡æ¡£ä¸­åµŒå…¥å›¾å½¢çš„æ&nbsp;‡å‡†æ&nbsp;¼å¼ã€‚ç„¶è€Œ~PS~å®žåœ¨å¤ªå¼ºå¤§ï¼Œäººä»¬æ‹…å¿ƒåµŒå…¥æ–‡æ¡£çš„~PS~ä¼šæžç&nbsp;´åï¼ŒäºŽæ˜¯å°±äº§ç”Ÿäº†æˆ´ç€æ‰‹é“çš„~Encapsulated PostScriptï¼ˆEPSï¼‰ã€‚å‡ºäºŽåŒæ&nbsp;·çš„åŽŸå›&nbsp;ï¼Œäººä»¬ä¹Ÿæ‹…å¿ƒåµŒå…¥~HTML~çš„~ActiveXã€Java Appletã€JavaScript~ä¸­æ··å…¥æ¶æ„ä»£ç&nbsp;ï¼Œæ‰€ä»¥æ‰ä¼šå¯¹å®ƒä»¬ä¹Ÿæœ‰æ‰€é™åˆ¶ã€‚

æ—©å¹´é—´~DVI~ç»å¸¸è¢«è½¬æ¢ä¸º~PSï¼Œæ‰€ä»¥~EPS~å°±æˆäº†~\LaTeX~çš„æ&nbsp;‡å‡†å›¾å½¢æ&nbsp;¼å¼ã€‚

\subsection{Driver~ä»¬çš„å£å‘³}

\subsubsection{dvips}
\verb|dvips|~å–œæ¬¢~PSï¼Œæ‰€ä»¥å°±çˆ±å±‹åŠä¹Œåªæ”¯æŒåµŒå…¥~EPSã€‚MiKTeX~çœ‹ä¸æƒ¯è¿™ç§åž„æ–­è¡Œä¸ºï¼Œå°±æŠŠ~\verb|dvips|~ç&nbsp;´è§£ï¼Œæ·»åŠ&nbsp;äº†å¯¹~JPEG~å’Œ~PNG~çš„æ”¯æŒã€‚å¦‚æžœä½&nbsp;åå¯¹è¿™ç§é»‘å®¢ç&nbsp;´è§£è¡Œå¾„ï¼Œåªå¥½æ‰¾è½¯ä»¶æŠŠå…¶å®ƒå›¾å½¢æ&nbsp;¼å¼è½¬æ¢ä¸º~EPSã€‚

\subsubsection{pdf\LaTeX}
pdf\LaTeX~æ”¯æŒ~JPEGã€PNGå’ŒPDFï¼Œä¸æ”¯æŒ~EPSã€‚ä¼&nbsp;è¯´pdf\LaTeX~ä¸æ”¯æŒ~EPS~çš„åŽŸå›&nbsp;æ˜¯~PS~è§£é‡Šå™¨çš„ç‰ˆæƒé—®é¢˜ã€‚åŒ…è€å¸ˆè®¤ä¸ºè¿™ç§è¯´æ³•ä¸å¯ä¿¡ï¼Œå›&nbsp;ä¸º~1997~å¹´~HÃ&nbsp;n The ThÃ&nbsp;nh~å‘å¸ƒ~pdf\TeX~æ—¶~PS~å·²ç»è¢«~PDF~èµ¶è¶…ï¼ŒAdobe~ä¸Žå…¶ä¿æŠ¤~PS~è¿˜ä¸å¦‚ä¿æŠ¤~PDFã€‚

\LaTeX~æœ‰ä¸¤ä¸ªå®åŒ…~\verb|epstopdf|~å’Œ~\verb|pst-pdf|~å¯ä»¥å®žæ—¶åœ°ï¼ˆon the flyï¼‰æŠŠ~EPS~è½¬æ¢ä¸º~PDF\footnote{åœ¨è¿™é‡Œon the flyæ˜¯æŒ‡åœ¨åŽå°å¤„ç†ï¼Œç”¨æˆ·ä¸ç”¨æ“å¿ƒã€‚åŒ…è€å¸ˆä¸ç¡®å®šæŠŠå®ƒç¿»è¯‘ä¸ºâ€œå®žæ—¶â€æ˜¯å¦åˆé€‚ï¼Œå›&nbsp;ä¸º~real time~é€šå¸¸è¢«ç¿»è¯‘ä¸ºå®žæ—¶ã€‚å¯¹äºŽç”¨æˆ·æ—&nbsp;é¡»å¹²æ¶‰ã€çŸ¥æƒ…çš„æƒ…å†µï¼Œæœ‰äººè¯´~user transparentï¼Œä¹Ÿæœ‰äººè¯´~black boxï¼Œè¯­è¨€è¿˜çœŸå¥‡å¦™ã€‚}ã€‚ç„¶è€Œå‰è€…æœ‰å®‰å…¨æ¼æ´žï¼ŒåŽè€…ç”¨æ³•ç¹çï¼Œç”¨æˆ·æœ€å¥½è¿˜æ˜¯ç”¨å…¶å®ƒè½¯ä»¶äº‹å…ˆæŠŠ~EPS~è½¬ä¸º~PDFã€‚

\subsubsection{dvipdfm}
\verb|dvipdfm|~æ”¯æŒ~JPEGã€PNGã€PDFï¼Œä¸æ”¯æŒ~EPSï¼Œä½†æ˜¯å®ƒå¯ä»¥å®žæ—¶åœ°è°ƒç”¨~Ghostscript~æŠŠ~EPS~è½¬ä¸º~PDFã€‚æ‰€ä»¥ä»Žå›¾å½¢æ&nbsp;¼å¼æ”¯æŒçš„è§’åº¦æ¥è®²ï¼Œ\verb|dvipdfm|~æ¯”~\verb|dvips|~å’Œ~pdf\LaTeX~éƒ½å¥½ã€‚

é‚£ä½åŒå­¦è¯´äº†ï¼Œä½&nbsp;è¿™ä¹ˆå¤šåºŸè¯ä½œç”šï¼Œç›´æŽ¥å‘Šè¯‰æˆ‘ä»¬ç”¨~\verb|dvipdfm|~ä¸å°±å®Œäº†ã€‚ç„¶è€Œä½&nbsp;åˆ«å¿˜äº†~\verb|dvipdfm|~éœ€è¦~DVI~ä½œä¸ºè¾“å…¥ï¼Œä¸å¹¸çš„æ˜¯ç”¨æ¥ç”Ÿæˆ~DVI~çš„~\verb|latex|~å¯¹~JPEG~å’Œ~PNG~æœ‰æ„è§ã€‚

ç»¼ä¸Šæ‰€è¿°ï¼Œè¿™äº›~driver~éƒ½ä¸èƒ½æŠŠå›¾å½¢æ&nbsp;¼å¼ç—›å¿«åœ°é€šåƒï¼Œæ‰€ä»¥åŒå­¦ä»¬åˆ«ç€æ€¥ï¼Œä¸”å¬åŒ…è€å¸ˆæ…¢æ…¢å¿½æ‚&nbsp;æ€Žæ&nbsp;·è½¬æ¢å’Œå¤„ç†å›¾å½¢æ&nbsp;¼å¼ã€‚

\subsection{å›¾å½¢æ&nbsp;¼å¼è½¬æ¢}

æ³¨æ„æŠŠç‚¹é˜µå›¾å½¢è½¬æ¢ä¸ºçŸ¢é‡å›¾å½¢å¹¶ä¸èƒ½æé«˜å›¾å½¢æœ¬èº«çš„è´¨é‡ï¼Œæ­£æ‰€è°“â€œgarbage in, garbage outâ€ã€‚

\subsubsection{JPEG~å’Œ~PNG~çš„èŒƒå›´æ¡†}

ä½œä¸ºä¸­é—´æ&nbsp;¼å¼çš„~DVI~ä¸åŒ…å«å›¾å½¢æœ¬èº«ï¼Œå®ƒåªè®°å½•å›¾å½¢çš„å°ºå¯¸å’Œæ–‡ä»¶åï¼Œå›&nbsp;ä¸ºå…·ä½“çš„å›¾å½¢å¤„ç†ç”±åŽé¢çš„~driver~è´Ÿè´£ã€‚DVI~ä¸­å›¾å½¢çš„å°ºå¯¸æ¥è‡ªå®ƒçš„èŒƒå›´æ¡†ï¼ˆbounding boxï¼‰ï¼Œè€Œ~\verb|latex|~æ—&nbsp;æ³•ä»Žç‚¹é˜µå›¾å½¢æ–‡ä»¶ä¸­æå–è¿™ä¸€ä¿¡æ¯ï¼Œæ‰€ä»¥æˆ‘ä»¬éœ€è¦ä»¥æŸç§æ–¹å¼æŠŠèŒƒå›´æ¡†ä¿¡æ¯å‘Šè¯‰å®ƒã€‚

ä¸€ç§æ–¹æ³•æ˜¯æ‰“å¼€å›¾å½¢æ–‡ä»¶ï¼Œè®°ä¸‹å°ºå¯¸ï¼Œæ’å…¥å›¾å½¢æ—¶åŠ&nbsp;ä¸Šç›¸åº”çš„å‚æ•°ã€‚

å¦ä¸€ç§æ–¹æ³•ç”¨~\verb|ebb|~ç¨‹åºç”Ÿæˆä¸€ä¸ªå«èŒƒå›´æ¡†ä¿¡æ¯çš„æ–‡ä»¶ã€‚æ¯”å¦‚ä¸‹ä¾‹ä¼šç”Ÿæˆ~\verb|graph.bb|~æ–‡ä»¶ï¼Œæœ‰äº†å®ƒæ’å…¥å›¾å½¢æ—¶å°±ä¸éœ€è¦èŒƒå›´æ¡†å‚æ•°ã€‚æ³¨æ„æœ‰æ—¶æ­¤ç¨‹åºç®—å‡ºçš„èŒƒå›´æ¡†ä¸å‡†ï¼Œä¸çŸ¥é“æ˜¯å®ƒçš„~bug~è¿˜æ˜¯åŒ…è€å¸ˆçš„äººå“é—®é¢˜ã€‚
\begin{code}
ebb graph.jpg
\end{code}

\subsubsection{å…¶å®ƒæ&nbsp;¼å¼è½¬ä¸ºEPS}
æœ‰å¾ˆå¤šç¨‹åºéƒ½å¯ä»¥æŠŠç‚¹é˜µå›¾å½¢è½¬æ¢ä¸º~EPSï¼Œæ¯”å¦‚~\href{http://www.imagemagick.org/}{ImageMagick}ï¼Œä»¥åŠ~\href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=dvipsgraphics}{~a2ping/sam2pã€bmepsã€jpeg2psã€sam2p}~ç­‰ã€‚

PS~ä»Ž~Level 2~å¼€å§‹æ‰æ”¯æŒç‚¹é˜µå›¾å½¢åŽ‹ç¼©ï¼Œæ‰€ä»¥åœ¨æŠŠå…¶å®ƒæ&nbsp;¼å¼è½¬ä¸º~EPS~æ—¶åº”å°½é‡ä½¿ç”¨~Level 2~æˆ–~3ï¼Œå¦åˆ™è¾“å‡ºçš„~EPS~ä¼šå¾ˆå¤§ã€‚

ä¸‹é¢æ˜¯ä¸€ä¸ª~ImageMagick~ä¸­~\verb|convert|~ç¨‹åºçš„ä¾‹å­ã€‚
\begin{code}
convert photo.jpg eps2:photo.eps
\end{code}

å¦å¤–è¿˜æœ‰ä¸€ç§~PS~è™šæ‹Ÿæ‰“å°æœºçš„æ–¹æ³•ï¼Œä¼˜ç‚¹æ˜¯å¯ä»¥æŠŠå‡&nbsp;ä¹Žæ‰€æœ‰æ–‡ä»¶â€œæ‰“å°â€æˆ~EPSï¼Œç¼ºç‚¹æ˜¯è¾“å‡ºçš„æ˜¯~PS Level 1ï¼Œå³ä½¿é©±åŠ¨ç¨‹åºæä¾›äº†å…¶å®ƒ~Level~çš„é€‰é¡¹ã€‚

\begin{enumerate}
\item æ‰¾ä¸€ä¸ª~PS~æ‰“å°æœºé©±åŠ¨ç¨‹åºã€‚Windows~å®‰è£…ç›˜é™„å¸¦å¾ˆå¤šæ‰“å°æœºé©±åŠ¨ï¼Œå…¶ä¸­å¸¦~PS~å­—æ&nbsp;·çš„å°±æ˜¯~PS~é©±åŠ¨ã€‚åŒ…è€å¸ˆé€‰çš„æ˜¯â€œHP Color LaserJet 8550-PSâ€ï¼ŒAdobe~æä¾›çš„~PS~é©±åŠ¨æ•ˆæžœä¸å¤ªå¥½ã€‚å…¶å®ƒé©±åŠ¨å®‰è£…è¿‡ç¨‹å¯èƒ½ç¨æœ‰ä¸åŒã€‚
\item å®‰è£…æ—¶ç«¯å£é€‰â€œFILEâ€ï¼Œæˆ–è€…åŽé¢æ‰“å°æ—¶é€‰æ‹©â€œPrint to Fileâ€ã€‚é«˜çº§é€‰é¡¹é‡Œçš„~PS~é€‰é¡¹é€‰â€œEncapsulated PostScript (EPS)â€ã€‚
\item æ‰“å¼€ç‚¹é˜µå›¾å½¢æ–‡ä»¶ï¼Œæ‰“å°åˆ°ä¸Šé¢çš„è™šæ‹Ÿæ‰“å°æœºï¼Œè¾“å‡ºçš„æ–‡ä»¶å°±æ˜¯~EPSï¼Œä½†æ˜¯å®ƒæ²¡æœ‰èŒƒå›´æ¡†ã€‚
\item ç”¨~GSview~æ‰“å¼€ä¸Šé¢ç”Ÿæˆçš„~EPSï¼Œä¸ç”¨ç†ä¼šæ²¡èŒƒå›´æ¡†çš„è­¦å‘Šï¼ŒOptions~èœå•é‡Œé€‰ä¸Šâ€œEPS Clipâ€ï¼Œç”¨~File~èœå•çš„â€œPS to EPSâ€ç”Ÿæˆå«èŒƒå›´æ¡†çš„~EPSã€‚
\end{enumerate}

\subsubsection{å…¶å®ƒæ&nbsp;¼å¼è½¬ä¸º~PDF}

\LaTeX~é™„å¸¦çš„~\verb|epstopdf|~ç¨‹åº\footnote{è¿™ä¸ªå‘½ä»¤è¡Œç¨‹åºå’Œä¸Šé¢æåˆ°çš„~epstopdf~å®åŒ…æ˜¯ä¸¤æ&nbsp;·ä¸œè¥¿ã€‚}å¯ä»¥æŠŠ~EPS~è½¬ä¸º~PDFã€‚ç±»ä¼¼åœ°æˆ‘ä»¬ä¹Ÿå¯ä»¥å®‰è£…ä¸€ä¸ª~PDF~è™šæ‹Ÿæ‰“å°æœºï¼Œç”¨å®ƒæ¥æŠŠå…¶å®ƒå›¾å½¢æ–‡ä»¶è½¬ä¸º~PDFã€‚

\section{æ’å…¥å›¾å½¢}
\label{sec:includegraphics}

\subsection{æ’å…¥å‘½ä»¤}
å¦‚ä»Šä¸‡äº‹ä¿±å¤‡ï¼Œåªæ¬&nbsp;æ’å…¥ã€‚ä¸Šå›žè®²åˆ°å“ªå„¿æ¥ç€ï¼ŸYeahï¼Œ~Knuth~çš„åŽé—¨~\verb|\special|ã€‚

ç”¨ä½Žçº§å‘½ä»¤~\verb|\special|~æ¥æ’å…¥å›¾å½¢å¾ˆä¸çˆ½ï¼ŒäºŽæ˜¯~\LaTeX~v2.09~å¢žåŠ&nbsp;äº†~\verb|epsf|~å’Œ~\verb|psfig|~å®åŒ…ã€‚ä¹‹åŽ~\LaTeXe~æŽ¨å‡ºäº†æ›´å¥½çš„~\verb|graphics|~å’Œ~\verb|graphicx|~å®åŒ…ï¼Œè¿™ä¸¤ä¸ªå®åŒ…æœ‰ä¸ªå…±åŒçš„å‘½ä»¤ï¼š\verb|\includegraphics|ã€‚\verb|graphicx|~ç‰ˆæœ¬çš„è¯­æ³•æ›´ç®€å•ï¼ŒåŠŸèƒ½æ›´å¼ºå¤§ï¼Œæ‰€ä»¥ä¸€èˆ¬æŽ¨èç”¨å®ƒã€‚

æ’å…¥å›¾å½¢çš„å…·ä½“å‘½ä»¤å¦‚ä¸‹ï¼Œå¦‚æžœæ˜¯ç‚¹é˜µå›¾å½¢éœ€è¦åŠ&nbsp;èŒƒå›´æ¡†å‚æ•°ï¼ˆå·¦ä¸Šè§’å’Œå³ä¸‹è§’åæ&nbsp;‡ï¼‰ã€‚

\begin{code}
\includegraphics[bb=0 0 410 307]{photo.jpg}
\end{code}

è‹¥æƒ³çœç•¥æ–‡ä»¶åŽç¼€ï¼Œå¯åœ¨æ’å…¥å›¾å½¢å‰ä½¿ç”¨ä¸¤ä¸ªå‘½ä»¤ã€‚å‰è€…æŒ‡å®šä¸€ä¸ªåŽç¼€åˆ—è¡¨ï¼Œè®©~\LaTeX~è‡ªè¡ŒæŸ¥æ‰¾ï¼›åŽè€…å‘Šè¯‰~\LaTeX~æœªçŸ¥åŽç¼€çš„éƒ½æ˜¯~EPSã€‚
\begin{code}
\DeclareGraphicsExtensions{.eps,.mps,.pdf,.jpg,.png}
\DeclareGraphicsRule{*}{eps}{*}{}
\end{code}

\subsection{ç¼©æ”¾ã€æ—‹è½¬}
\Fref{tab:scale_angle}~å’Œ\Fref{tab:clip}~çš„é€‰é¡¹å¯ä»¥ç”¨æ¥ç¼©æ”¾ã€æ—‹è½¬å’Œè£å‰ªæ’å›¾ã€‚

\begin{table}[htbp]
\caption{includegraphics~å‘½ä»¤çš„ç¼©æ”¾å’Œæ—‹è½¬é€‰é¡¹}
\label{tab:scale_angle}
\centering
\begin{tabularx}{350pt}{lX}
    \toprule
    scale &amp; ç¼©æ”¾æ¯”ä¾‹ \\
    width &amp; å®½åº¦ \\
    height &amp; é«˜åº¦ \\
    totalheight &amp; èŒƒå›´æ¡†é«˜åº¦ï¼Œæ—‹è½¬æ—¶å®ƒä¸ç­‰äºŽé«˜åº¦ \\
    keepaspectratio &amp; å¦‚æžœä¸ä½¿ç”¨å®ƒè€ŒåŒæ—¶æŒ‡å®šæ’å›¾çš„å®½åº¦ã€é«˜åº¦ï¼Œé•¿å®½æ¯”å¯èƒ½ä¼šå¤±è°ƒï¼›ä½¿ç”¨å®ƒæ—¶é•¿å®½æ¯”ä¸å˜ï¼Œå®½åº¦ã€é«˜åº¦éƒ½ä¸è¶…è¿‡æŒ‡å®šå‚æ•° \\
    angle &amp; æ—‹è½¬è§’åº¦ \\
    origin &amp; æ—‹è½¬åŽŸç‚¹ \\
    \bottomrule
\end{tabularx}
\end{table}

\begin{table}[htbp]
\caption{includegraphics~å‘½ä»¤çš„è£å‰ªé€‰é¡¹}
\label{tab:clip}
\centering
\begin{tabularx}{350pt}{lX}
    \toprule
    viewport &amp; å¯è§†åŒºåŸŸçš„å·¦ä¸Šè§’å’Œå³ä¸‹è§’åæ&nbsp;‡ã€‚\\
    trim &amp; å·¦ã€ä¸‹ã€å³ã€ä¸Šå››è¾¹è£å‰ªçš„æ•°å€¼ã€‚\\
    clip &amp; æ˜¯å¦çœŸæ­£è£å‰ªã€‚ç¼ºçœä¸ºfalseï¼Œä¸æ‰§è¡Œè£å‰ªï¼Œå¤šå‡ºçš„éƒ¨åˆ†å°±é‚£æ&nbsp;·æ”¾ç€ï¼›è®¾ç½®ä¸ºtrueæ—¶æ‰§è¡Œè£å‰ªã€‚ä¼¼ä¹Žæ˜¯å¤šæ­¤ä¸€ä¸¾ã€‚\\
    \bottomrule
\end{tabularx}
\end{table}

è‹¥æƒ³æ·±å…¥äº†è§£~\LaTeX~æ’å…¥å›¾å½¢çš„åŠŸèƒ½ï¼Œè¯·å‚è€ƒ~Keith Reckdahl~çš„ã€ŠUsing Imported Graphics in \LaTeX~ and pdf\LaTeXã€‹\citep{Reckdahl_2006}ï¼ˆç®€ç§°epslatexï¼‰ã€‚

\subsection{figureçŽ¯å¢ƒ}
æ’å›¾é€šå¸¸éœ€è¦å&nbsp;æ®å¤§å—ç©ºç™½ï¼Œæ‰€ä»¥åœ¨æ–‡å­—å¤„ç†è½¯ä»¶ä¸­ç”¨æˆ·ç»å¸¸éœ€è¦è°ƒæ•´æ’å›¾çš„ä½ç½®ã€‚\LaTeX~æœ‰ä¸€ä¸ª~\verb|figure|~çŽ¯å¢ƒå¯ä»¥è‡ªåŠ¨å®Œæˆè¿™æ&nbsp;·çš„ä»»åŠ¡ï¼Œè¿™ç§è‡ªåŠ¨è°ƒæ•´ä½ç½®çš„çŽ¯å¢ƒç§°ä½œæµ®åŠ¨çŽ¯å¢ƒã€‚

\begin{code}
\begin{figure}[htbp]%ä½ç½®é€‰é¡¹
\centering
\includegraphics[bb=0 0 410 307,scale=.8]{photo}
\caption{10ä¸ªæœˆå¤§çš„Anna}
\label{fig:anna}
\end{figure}
\end{code}

\begin{figure}[htbp]
\centering
\includegraphics[bb=0 0 410 307,scale=.8]{dscf4684}
\caption{10ä¸ªæœˆå¤§çš„Anna}
\label{fig:anna}
\end{figure}

ä¸Šè¿°ä»£ç&nbsp;ä¸­ï¼Œ\verb|[htbp]|~é€‰é¡¹ç”¨æ¥æŒ‡å®šæ’å›¾æŽ’ç‰ˆçš„ç†æƒ³ä½ç½®ï¼Œè¿™å‡&nbsp;ä¸ªå­—æ¯åˆ†åˆ«ä»£è¡¨~hereã€topã€bottomã€float pageï¼Œä¹Ÿå°±æ˜¯å›ºå®šä½ç½®ã€é¡µé¡¶ã€é¡µå°¾ã€å•ç‹¬çš„æµ®åŠ¨é¡µã€‚æˆ‘ä»¬å¯ä»¥ä½¿ç”¨è¿™å‡&nbsp;ä¸ªå­—æ¯çš„ä»»æ„ç»„åˆï¼Œä¸€èˆ¬ä¸æŽ¨èå•ç‹¬ä½¿ç”¨~\verb|[h]|ï¼Œå›&nbsp;ä¸ºé‚£ä¸ªä½ç½®ä¹Ÿè®¸å¾ˆä¸åˆé€‚ï¼Œ\LaTeX~ä¼šå¾ˆç”Ÿæ°”ã€‚

\verb|\centering|~ç”¨æ¥ä½¿æ’å›¾å±…ä¸­ï¼Œ\verb|\caption|~å‘½ä»¤è®¾ç½®æ’å›¾æ&nbsp;‡é¢˜ï¼Œ\LaTeX~ä¼šè‡ªåŠ¨ç»™æµ®åŠ¨çŽ¯å¢ƒçš„æ&nbsp;‡é¢˜åŠ&nbsp;ä¸Šç¼–å·ã€‚æ³¨æ„~\verb|label|~åº”æ”¾åœ¨\verb|caption|~ä¹‹åŽï¼Œå¦åˆ™å¼•ç”¨æ—¶æŒ‡å‘çš„æ˜¯å‰ä¸€ä¸ªæ’å›¾ã€‚

\subsection{æ’å…¥å¤šå¹…å›¾å½¢}
\subsubsection{å¹¶æŽ’æ‘†æ”¾ï¼Œå…±äº«æ&nbsp;‡é¢˜}
å½“æˆ‘ä»¬éœ€è¦ä¸¤å¹…å›¾ç‰‡å¹¶æŽ’æ‘†æ”¾ï¼Œå¹¶å…±äº«æ&nbsp;‡é¢˜æ—¶ï¼Œå¯ä»¥åœ¨~\verb|figure|~çŽ¯å¢ƒä¸­ä½¿ç”¨ä¸¤ä¸ª~\verb|\includegraphics|~å‘½ä»¤ã€‚

\begin{fdemo}{
\centering
\includegraphics[scale=2]{examples/subfig_left.mps}
\includegraphics[scale=2]{examples/subfig_right.mps}
\captionof{figure}{åæ¸…å¤æ˜Ž}
}
\begin{figure}[htbp]
\centering
\includegraphics{left}
\includegraphics{right}
\caption{åæ¸…å¤æ˜Ž}
\end{figure}
\end{fdemo}

\subsubsection{å¹¶æŽ’æ‘†æ”¾ï¼Œå„æœ‰æ&nbsp;‡é¢˜}
å¦‚æžœæƒ³è¦ä¸¤å¹…å¹¶æŽ’çš„å›¾ç‰‡å„æœ‰è‡ªå·±çš„æ&nbsp;‡é¢˜ï¼Œå¯ä»¥åœ¨~\verb|figure|~çŽ¯å¢ƒä¸­ä½¿ç”¨ä¸¤ä¸ª~\verb|minipage|~çŽ¯å¢ƒï¼Œæ¯ä¸ªçŽ¯å¢ƒé‡Œæ’å…¥ä¸€ä¸ªå›¾ã€‚
\begin{code}
\begin{figure}[htbp]
\centering
\begin{minipage}[t]{0.3\textwidth}
    \centering
    \includegraphics{left}
    \caption{æ¸…æ˜Ž}
\end{minipage}
\end{code}
\begin{code}
\begin{minipage}[t]{0.3\textwidth}
    \centering
    \includegraphics{right}
    \caption{åå¤}
\end{minipage}
\end{figure}
\end{code}

\begin{figure}[htbp]
\centering
\begin{minipage}[t]{0.3\textwidth}
    \centering
    \includegraphics[scale=2]{examples/subfig_left.mps}
    \caption{æ¸…æ˜Ž}
\end{minipage}
\begin{minipage}[t]{0.3\textwidth}
    \centering
    \includegraphics[scale=2]{examples/subfig_right.mps}
    \caption{åå¤}
\end{minipage}
\end{figure}

\subsubsection{å¹¶æŽ’æ‘†æ”¾ï¼Œå…±äº«æ&nbsp;‡é¢˜ï¼Œå„æœ‰å­æ&nbsp;‡é¢˜}
å¦‚æžœæƒ³è¦ä¸¤å¹…å¹¶æŽ’çš„å›¾ç‰‡å…±äº«ä¸€ä¸ªæ&nbsp;‡é¢˜ï¼Œå¹¶å„æœ‰è‡ªå·±çš„å­æ&nbsp;‡é¢˜ï¼Œå¯ä»¥ä½¿ç”¨~\verb|subfig|~å®åŒ…æä¾›çš„~\verb|\subfloat|~å‘½ä»¤ã€‚

\verb|subfloat|~å‘½ä»¤ç¼ºå°‘å®½åº¦å‚æ•°ã€‚è™½ç„¶æˆ‘ä»¬å¯ä»¥ç”¨~\verb|\hspace|~å‘½ä»¤è°ƒæ•´å­å›¾çš„è·ç¦»ï¼Œå­æ&nbsp;‡é¢˜å´åªèƒ½å’Œå­å›¾æœ¬èº«ä¸€æ&nbsp;·å®½ï¼Œå°±ä¼šå‡ºçŽ°æŠ˜è¡Œã€‚
\begin{code}
\usepackage{subfig}
\begin{figure}[htbp]
\centering
\subfloat[æ¸…æ˜Ž]{
    \label{fig:subfig_a}
    \includegraphics{left}
}
\hspace{80pt}
\subfloat[åå¤]{
    \label{fig:subfig_b}
    \includegraphics{right}
}
\caption{åæ¸…å¤æ˜Ž}
\end{figure}
\end{code}

æ¯ä¸ªå­å›¾å¯ä»¥æœ‰å„è‡ªçš„å¼•ç”¨ï¼Œå°±è±¡è¿™ä¸ªæ&nbsp;·å­ï¼š\Fref{fig:subfig_a}ã€\Fref{fig:subfig_b}ã€‚
\begin{figure}[htbp]
\centering
\subfloat[æ¸…æ˜Ž]{
    \label{fig:subfig_a}
    \includegraphics[scale=2]{examples/subfig_left.mps}
}
\hspace{80pt}
\subfloat[åå¤]{
    \label{fig:subfig_b}
    \includegraphics[scale=2]{examples/subfig_right.mps}
}
\caption{åæ¸…å¤æ˜Ž}
\end{figure}

\subsubsection{æ”¹è¿›çš„å­å›¾æ–¹æ³•}
ä¸ºäº†é¿å…å­æ&nbsp;‡é¢˜æŠ˜è¡Œï¼Œæˆ‘ä»¬å¯ä»¥åœ¨~\verb|\subfloat|~é‡Œå†åµŒå¥—ä¸ª~\verb|minipage|ï¼Œå›&nbsp;ä¸ºåŽè€…æ˜¯æœ‰å®½åº¦çš„ã€‚
\begin{code}
\begin{figure}[htbp]
\centering
\subfloat[æ¸…æ˜Ž]{
\label{fig:improved_subfig_a}
\begin{minipage}[t]{0.3\textwidth}
    \centering
    \includegraphics{left}
\end{minipage}
}
\subfloat[åå¤]{
\label{fig:improved_subfig_b}
\begin{minipage}[t]{0.3\textwidth}
    \centering
    \includegraphics{right}
\end{minipage}
}
\caption{åæ¸…å¤æ˜Ž}
\end{figure}
\end{code}

\begin{figure}[htbp]
\centering
\subfloat[æ¸…æ˜Ž]{
\begin{minipage}[t]{0.3\textwidth}
    \centering
    \includegraphics[scale=2]{examples/subfig_left.mps}
\end{minipage}
}
\subfloat[åå¤]{
\begin{minipage}[t]{0.3\textwidth}
    \centering
    \includegraphics[scale=2]{examples/subfig_right.mps}
\end{minipage}
}
\caption{åæ¸…å¤æ˜Ž}
\end{figure}

\section{å›¾å½¢ç»˜åˆ¶å·¥å…·æ¯”è¾ƒ}
ä¸Ž~\LaTeX~é…å¥—ä½¿ç”¨çš„ç»˜å›¾å·¥å…·ä¸»è¦æœ‰ä¸‰ç§ï¼š\MPã€PSTricks~å’Œ~PGFï¼Œå®ƒä»¬çš„ç‰¹ç‚¹å¦‚ä¸‹ã€‚

\begin{itemize}
\item å·¥ä½œæ–¹å¼ã€‚\MP~ç¦»çº¿ç»˜å›¾ï¼Œç”Ÿæˆçš„~EPS~å¯ä»¥æ’å…¥~\LaTeX~æ–‡æ¡£ï¼›PSTricks~å’Œ~PGF~éƒ½é‡‡ç”¨åœ¨çº¿ç»˜å›¾çš„æ–¹å¼ï¼Œä¹Ÿå°±æ˜¯~\LaTeX~æ–‡æ¡£å†…ç›´æŽ¥ä½¿ç”¨ç»˜å›¾å‘½ä»¤ã€‚
\item å…¼å®¹æ€§ã€‚\MP~ç”Ÿæˆçš„~MPS~éœ€è¦å…ˆè½¬ä¸º~PDF~æ‰èƒ½è¢«~pdf\LaTeX~ä½¿ç”¨ï¼›PSTricks~ç”Ÿæˆçš„~EPSå’Œ~pdf\LaTeX~ä¸å…¼å®¹ï¼›PGF~æä¾›é’ˆå¯¹å„ç§~driver~çš„æŽ¥å£ï¼Œå…¼å®¹æ€§æœ€å¥½ã€‚
\item åŠŸèƒ½ã€‚PSTricks~æœ‰~PS~ä½œåŽç›¾ï¼ŒåŠŸèƒ½æœ€å¼ºï¼›\MP~æ“…é•¿å¤„ç†æ•°å­¦å†…å®¹ï¼›PGF~çš„æµç¨‹å›¾æœ‰ç‹¬åˆ°ä¹‹å¤„ã€‚
\end{itemize}

é™äºŽç¯‡å¹…ï¼Œæœ¬æ–‡åªå¯¹è¿™ä¸‰ç§å·¥å…·è¿›è¡Œç®€ä»‹ã€‚é™¤äº†å®ƒä»¬ï¼Œç”¨æˆ·ä¹Ÿå¯ä»¥è€ƒè™‘ä¸€äº›é¢å‘~\LaTeX~çš„ç»˜å›¾å‰ç«¯ï¼Œæ¯”å¦‚~Unix/Linux~ä¸‹çš„~xfig~å’Œ~Windows~ä¸‹çš„~TpXï¼›æˆ–å¯ä»¥è¾“å‡º~EPS~çš„ä¸“ç”¨è½¯ä»¶ï¼Œæ¯”å¦‚~gnuplot~å’Œ~Matlabã€‚

\section{\MP}
\label{sec:mp}

1989~å¹´~John D. Hobby\footnote{Hobby 1985å¹´ä»Žæ–¯å¦ç¦èŽ·åšå£«å­¦ä½ï¼Œå¯¼å¸ˆå°±æ˜¯Knuthï¼ŒçŽ°ä¾›èŒäºŽè´å°”å®žéªŒå®¤ã€‚}å¼€å§‹è®¾è®¡ä¸€ç§ç»˜å›¾è¯­è¨€åŠå…¶ç¼–è¯‘å™¨ï¼Œä¹Ÿå°±æ˜¯~\MPã€‚\MP~ä»Ž~\MF~é‚£é‡ŒèŽ·å¾—äº†å¤§é‡çµæ„Ÿå’Œæºä»£ç&nbsp;ï¼Œå­¦ç”Ÿä»Žå¯¼å¸ˆé‚£é‡Œé¡ºç‚¹ä¸œè¥¿è‡ªç„¶æ˜¯æ‰‹åˆ°æ“’æ¥ã€‚\MP~å’Œ~\MF~è¯­æ³•ç±»ä¼¼ï¼Œ\MP~çš„ä¸»è¦ä¼˜ç‚¹åœ¨äºŽæ˜¯å®ƒè¾“å‡ºçš„æ˜¯~EPSï¼Œè€Œä¸”æ”¯æŒå½©è‰²ï¼›\MF~è¾“å‡ºçš„æ˜¯ç‚¹é˜µæ&nbsp;¼å¼ï¼Œä¸æ”¯æŒå½©è‰²ã€‚Knuth~å£°ç§°è‡ªå·±ç”»å›¾æ—¶åªç”¨~\MPã€‚

ä»Ž~Hobby~ä¸»é¡µä¸Š~\MP~çš„æ›´æ–°è®°å½•çœ‹ï¼Œå®ƒçš„æœ€åŽç‰ˆæœ¬æ˜¯~0.63ï¼Œå¹´ä»½æ˜¯~1994ã€‚ç›®å‰~Taco Hoekwater\footnote{ä»–ä¹Ÿæ˜¯LuaTeXå¼€å‘è€…ä¹‹ä¸€ã€‚}ç»§ç»­~\MP~çš„å¼€å‘å·¥ä½œï¼Œæœ€æ–°ç‰ˆæœ¬æ˜¯~1.005ã€‚

æœ¬æ–‡åªå¯¹~\MP~ä½œç®€å•ä»‹ç»ï¼Œè‹¥æƒ³æ·±å…¥äº†è§£è¯·å‚é˜…~Hobby~çš„ã€ŠA User's Manual for MetaPostã€‹\citep{Hobby_2007}ã€‚

\subsection{å‡†å¤‡å·¥ä½œ}
ç”¨æˆ·ä¸€èˆ¬éœ€è¦æŠŠ~\MP~æºæ–‡ä»¶ï¼ˆ.mpï¼‰ç”¨ä¸€ä¸ªå‘½ä»¤è¡Œç¨‹åº~\verb|mpost|~ç¼–è¯‘ä¸ºä¸€ç§ç‰¹æ®Šçš„~EPSï¼Œä¹Ÿç§°ä½œ~MPSï¼Œç„¶åŽå†æŠŠ~MPS~æ’å…¥~\LaTeX~æºæ–‡ä»¶ä¸­ä½¿ç”¨ã€‚
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
    \node[box] (mp) {.mp};
    \node[box, right=5 of mp] (mps) {.mps};
    \path (mp) edge [arrow] node[auto] {mpost} (mps);
\end{tikzpicture}
\caption{MetaPost~çš„ç¼–è¯‘}
\label{fig:mp}
\end{figure}

ä¸€ä¸ª~\MP~æºæ–‡ä»¶å¯ä»¥åŒ…å«å¤šä¸ªå›¾å½¢ï¼Œä¸€èˆ¬å½¢å¼å¦‚ä¸‹ã€‚ä»£ç&nbsp;ä¸­æ¯è¡Œè¯­å¥ä»¥~\verb|;|~ç»“å°¾ï¼Œæ³¨é‡Šè¡Œä»¥~\verb|%|~èµ·å§‹ã€‚æ¯ä¸ªå›¾å½¢çš„ç»˜å›¾å‘½ä»¤åŒ…å«åœ¨ä¸€å¯¹èµ·å§‹å’Œç»“å°¾å£°æ˜Žä¹‹é—´ã€‚æ–‡ä»¶ç»“å°¾ä¹Ÿè¦æœ‰ä¸€ä¸ªç»“å°¾å£°æ˜Žã€‚
\begin{code}
beginfig(1); %å›¾å½¢èµ·å§‹
...          %ç»˜å›¾å‘½ä»¤
endfig;      %å›¾å½¢ç»“å°¾

beginfig(2);
...
endfig;
...
end;         %æ–‡ä»¶ç»“å°¾
\end{code}

å‡å¦‚ä¸Šé¢çš„æºæ–‡ä»¶åå­—æ˜¯~\verb|fig.mp|ï¼Œæˆ‘ä»¬å¯ä»¥æ‰§è¡Œä»¥ä¸‹ç¼–è¯‘å‘½ä»¤ã€‚
\begin{code}
mpost fig(.mp)
\end{code}

ç¼–è¯‘åŽå°±ä¼šç”Ÿæˆâ€œfig.1ã€fig.2ã€$\cdots$â€~ç­‰æ–‡ä»¶ï¼Œæ¯ä¸ªæ–‡ä»¶çš„åŽç¼€å°±æ˜¯ç›¸åº”çš„å›¾å½¢èµ·å§‹å£°æ˜Žçš„ç¼–å·ã€‚æ‰€ä»¥æ­¤ç¼–å·åœ¨ä¸€ä¸ªæºæ–‡ä»¶ä¸­åº”ä¿æŒå”¯ä¸€ï¼Œå¦åˆ™åŽç”Ÿæˆçš„æ–‡ä»¶å°±ä¼šè¦†ç›–å‰é¢çš„ã€‚

è¿™æ&nbsp;·çš„æ–‡ä»¶åç®¡ç†èµ·æ¥å¾ˆéº»çƒ¦ï¼Œæ’å…¥å®ƒä»¬æ—¶ä¹Ÿä¸èƒ½çœç•¥åŽç¼€ï¼Œå›&nbsp;ä¸º~\LaTeX~ä¸èƒ½è¯†åˆ«å®ƒä»¬ã€‚ç”¨~\verb|\DeclareGraphicsExtensions|~æ¥é€ä¸€å£°æ˜ŽåŽç¼€çœ‹èµ·æ¥å¾ˆå‚»ï¼Œè‡ªå·±æ”¹æ–‡ä»¶åæ›´å‚»ï¼Œ\verb|\DeclareGraphicsRule|~ä¹Ÿæ˜¾å¾—ä¸å¤Ÿä¸¥è°¨ã€‚

ç„¶è€Œ~\MP~å·²ç»è€ƒè™‘åˆ°è¿™ä¸ªé—®é¢˜ï¼Œä¸ºæ­¤æä¾›äº†ä¸€ä¸ªæ–‡ä»¶åæ¨¡æ¿å‘½ä»¤ã€‚æŠŠä¸‹é¢çš„ä»£ç&nbsp;åŠ&nbsp;åˆ°æºæ–‡ä»¶å¤´éƒ¨ï¼Œç¼–è¯‘è¾“å‡ºçš„æ–‡ä»¶åå°±ä¼šæ˜¯â€œfig-01.mpsã€fig-02.mpsã€$\cdots$â€ã€‚
\begin{code}
filenametemplate "%j-%2c.mps";   %åŠ&nbsp;åœ¨æºæ–‡ä»¶å¤´éƒ¨
\end{code}

æˆ‘ä»¬ä¹Ÿå¯ä»¥æŠŠè¿™ä¸ªå‘½ä»¤åŠ&nbsp;åœ¨æ¯ä¸ªå›¾å½¢çš„èµ·å§‹å£°æ˜Žä¹‹å‰ï¼ŒæŒ‡å®šä¸ªæ€§åŒ–çš„è¾“å‡ºæ–‡ä»¶åï¼Œè¿™æ&nbsp;·å¯èƒ½æ›´ä¾¿äºŽè®°å¿†ã€‚
\begin{code}
filenametemplate "flowchart.mps" %åŠ&nbsp;åœ¨æ¯ä¸ªå›¾å½¢å‰é¢
\end{code}

MPS~å¯ä»¥ç”¨~GSview~æŸ¥çœ‹ï¼Œæˆ‘ä»¬ä¹Ÿå¯ä»¥ç”¨ä»¥ä¸‹å‘½ä»¤æŠŠå®ƒè½¬ä¸º~PDF~å†ç”¨~Adobe Reader~æŸ¥çœ‹ã€‚

\begin{code}
epstopdf flowchart.mps
\end{code}

\subsection{åŸºæœ¬å›¾å½¢å¯¹è±¡}
ä¸ºäº†èŠ‚çœç©ºé—´ï¼Œæœ¬èŠ‚åŽé¢çš„ç¤ºä¾‹ä¼šç•¥åŽ»å›¾å½¢èµ·å§‹å£°æ˜Žå’Œç»“å°¾å£°æ˜Žç­‰ä¸é‡è¦çš„ç»†èŠ‚ã€‚

\subsubsection{ç›´çº¿}

ç»˜å›¾å‘½ä»¤~\verb|draw|~æŠŠå‡&nbsp;ä¸ªç‚¹ä»¥ç›´çº¿æ®µè¿žæŽ¥èµ·æ¥ã€‚\MP~ä¸­çš„ç¼ºçœé•¿åº¦å•ä½æ˜¯~bpï¼Œç”¨æˆ·ä¹Ÿå¯ä»¥ä½¿ç”¨\Fref{tab:unit}~ä¸­çš„å…¶å®ƒå•ä½ã€‚æˆ‘ä»¬è¿˜å¯ä»¥å®šä¹‰ä¸€ä¸ªç¼©æ”¾ç³»æ•°ï¼ŒæŠŠåæ&nbsp;‡éƒ½è½¬æ¢æˆæ­¤ç³»æ•°çš„å€æ•°ï¼Œè¿™æ&nbsp;·ä»¥åŽæƒ³ç¼©æ”¾å›¾å½¢æ—¶åªè¦æ”¹è¿™ä¸ªç³»æ•°å³å¯ã€‚

æ³¨æ„~\MP~ä¸­çš„å˜é‡èµ‹å€¼ç¬¦å·æ˜¯~\verb|:=|ï¼Œè€Œ~\verb|=|~ç”¨äºŽæ–¹ç¨‹å¼ã€‚å˜é‡åœ¨åŒä¸€æºæ–‡ä»¶ä¸­åªé¡»å®šä¹‰ä¸€æ¬¡ï¼Œå…¶åŽçš„å›¾å½¢ä¸­éƒ½å¯ä»¥ä½¿ç”¨ã€‚

\begin{fdemo}{\includegraphics{examples/line.mps}}
draw (0,0)--(40,0)--(20,20)--(0,0);
u:=10pt; %ç¼©æ”¾ç³»æ•°
draw (5u,0)--(9u,0)--(7u,2u)--cycle;
\end{fdemo}

å‡&nbsp;æ®µç›´çº¿æˆ–æ›²çº¿å¯ä»¥æž„æˆä¸€æ¡è·¯å¾„ï¼ˆpathï¼‰ï¼Œåœ¨è·¯å¾„æœ«å°¾åŠ&nbsp;ä¸ª~\verb|cycle|~å°±èƒ½æž„æˆå°é—­è·¯å¾„ï¼ˆclosed pathï¼‰ã€‚ä¸Šä¾‹ä¸­çš„ä¸¤ä¸ªä¸‰è§’å½¢çœ‹èµ·æ¥éƒ½æ˜¯å°é—­çš„ï¼Œä½†æ˜¯å‰é¢è¿™ä¸ªå…¶å®žä¸æ˜¯çœŸæ­£çš„å°é—­è·¯å¾„ã€‚

\subsection{ç‚¹å’Œçº¿å®½}
\verb|drawdot|~å‘½ä»¤å¯ä»¥åœ¨æŒ‡å®šåæ&nbsp;‡ç”»ä¸€ä¸ªç‚¹ï¼Œä¸ºäº†ä½¿å®ƒé†’ç›®äº›æˆ‘ä»¬å¯ä»¥æ¢æ”¯ç²—ä¸€ç‚¹çš„ç”»ç¬”ã€‚\MP~ä¸­çš„ç”»ç¬”ç¼ºçœæ˜¯ç›´å¾„~0.5pt~çš„åœ†å½¢ï¼Œæ‹¿å®ƒç”»å‡ºæ¥çš„çº¿å®½å°±æ˜¯~0.5ptã€‚

\begin{fdemo}{\includegraphics{examples/dot.mps}}
draw (0,0)--(10u,4u);
pickup pencircle scaled 2pt;
drawdot (0,0);
drawdot (10u,4u);
\end{fdemo}

ä¸Šé¢çš„~\verb|pickup|~æ˜¯ä¸€ç§å…¨å±€æ“ä½œï¼Œä¹Ÿå°±æ˜¯è¯´å®ƒä¼šå½±å“åˆ°ä¹‹åŽæ‰€æœ‰çš„ç»˜å›¾å‘½ä»¤ï¼Œæˆ‘ä»¬ä¹Ÿå¯ä»¥ç”¨~\verb|withpen|~ä¸ºå•ä¸ªç»˜å›¾å‘½ä»¤è®¾ç½®ç”»ç¬”ã€‚

\begin{code}
draw (0,0)--(10u,4u) withpen pencircle scaled 2pt;
\end{code}

\subsubsection{æ›²çº¿}
æ›²çº¿å’Œç›´çº¿çš„å‘½ä»¤ç›¸è¿‘ï¼Œåªæ˜¯æŠŠè¿žæŽ¥ä¸¤ä¸ªç‚¹çš„~\verb|--|~æ¢æˆäº†~\verb|..|ã€‚å¦‚æžœå…±ç”¨ä¸€äº›åæ&nbsp;‡ï¼Œç›´çº¿å’Œæ›²çº¿ä¹Ÿå¯ä»¥æ··åœ¨ä¸€æ¡è¯­å¥é‡Œç”»ã€‚

\begin{fdemo}{\includegraphics{examples/curve.mps}}
draw (0,.5u)..(5u,3u)..(10u,1.5u)..
    (7u,0)..(5u,1.5u)..(7u,1.5u);
\end{fdemo}

\MP~çš„æ›²çº¿ç”¨ä¸‰æ¬¡è´å¡žå°”ï¼ˆCubic B\'ezierï¼‰ç®—æ³•å®žçŽ°ã€‚ç”¨æˆ·å¯ä»¥åœ¨å‘½ä»¤ä¸­å¢žåŠ&nbsp;~directionï¼ˆæ–¹å‘ï¼‰ã€Tensionï¼ˆå¼&nbsp;åŠ›ï¼‰å’Œ~Curlï¼ˆæ›²çŽ‡ï¼‰ç­‰æŽ§åˆ¶ï¼Œé™äºŽç¯‡å¹…æœ¬æ–‡ä¸èµ˜è¿°ã€‚

\subsubsection{é¢„å®šä¹‰å›¾å½¢}
~\verb|fullcircle|~å‘½ä»¤ä»¥åŽŸç‚¹ä¸ºåœ†å¿ƒç”»ä¸€ä¸ªå•ä½åœ†ï¼Œç±»ä¼¼çš„é¢„å®šä¹‰å›¾å½¢è¿˜æœ‰~\verb|halfcircleã€quartercircleã€unitsquare|~ç­‰ã€‚æ³¨æ„å•ä½æ­£æ–¹å½¢çš„å‚è€ƒç‚¹åœ¨å·¦ä¸‹è€Œä¸åœ¨å…¶ä¸­å¿ƒã€‚

é€šè¿‡ä¸åŒçš„æ¨ªå‘å’Œçºµå‘ç¼©æ”¾ç³»æ•°ï¼Œæˆ‘ä»¬å¯ä»¥æŠŠåœ†å½¢å’Œæ­£æ–¹å½¢å˜æˆæ¤­åœ†å’Œé•¿æ–¹å½¢ã€‚

\begin{code}
draw fullcircle scaled 2u;
draw halfcircle scaled 2u shifted (3u,0);
draw quartercircle scaled 2u shifted (5u,0);
draw fullcircle xscaled 4u yscaled 2u shifted (9u,0);
draw unitsquare scaled 2u shifted (12u,-u);
draw unitsquare xscaled 4u yscaled 2u shifted (15u,-u);
\end{code}

\begin{out}
\includegraphics{examples/predefined.mps}
\end{out}

\subsection{å›¾å½¢æŽ§åˆ¶}

\subsubsection{çº¿åž‹å’Œç®­å¤´}
åœ¨ç»˜åˆ¶å›¾å½¢æ—¶ï¼Œæˆ‘ä»¬ä¸ä»…å¯ä»¥å˜æ¢çº¿å®½ï¼Œä¹Ÿå¯ä»¥ä½¿ç”¨å¤šç§çº¿åž‹ã€‚
\begin{code}
draw (0,0)--(10u,0) dashed withdots;
draw (0,1u)--(10u,1u) dashed withdots scaled 2;
draw (0,2u)--(10u,2u) dashed evenly;
draw (0,3u)--(10u,3u) dashed evenly scaled 2;
\end{code}

\begin{out}
\includegraphics{examples/dashed.mps}
\end{out}

ç®­å¤´å’Œç›´çº¿ã€æ›²çº¿çš„è¯­æ³•ç›¸è¿‘ï¼Œæ³¨æ„ç”»åå‘ç®­å¤´æ—¶éœ€è¦æŠŠä¸¤ä¸ªåæ&nbsp;‡ç”¨ä¸€å¯¹~\verb|()|~æ‹¬èµ·æ¥ã€‚

\begin{fdemo}{\includegraphics{examples/arrow.mps}}
drawarrow (0,4u)--(9u,4u);
drawarrow reverse ((0,2u)--(9u,2u));
drawdblarrow (0,0)--(9u,0);
\end{fdemo}

\subsubsection{é¢œè‰²å’Œå¡«å……}
\MP~é¢„å®šä¹‰çš„é¢œè‰²æœ‰é»‘ã€ç™½ã€çº¢ã€ç»¿ã€è“ï¼Œå®ƒä»¬çš„~RGB~å€¼åˆ†åˆ«ä¸º(0,0,0)ã€(1,1,1)ã€(1,0,0)ã€(0,1,0)ã€(0,0,1)ï¼Œç¼ºçœè‰²å°±æ˜¯é»‘è‰²ã€‚

ç»˜å›¾å‘½ä»¤ä¸€èˆ¬éƒ½å¯ä»¥é€šè¿‡~\verb|withcolor|~å‚æ•°æ¥ä½¿ç”¨å„ç§é¢œè‰²ã€‚å°é—­è·¯å¾„å¯ä»¥ç”¨~\verb|fill|~å‘½ä»¤å¡«å……ã€‚

\begin{fdemo}{\includegraphics{examples/color.mps}}
draw (0,4u)--(9u,4u) withcolor red;
draw (0,2u)--(9u,2u) withcolor green;
draw (0,0)--(9u,0) withcolor blue;
\end{fdemo}

\begin{code}
fill p scaled u;
fill p scaled u shifted (3u,0) withcolor red;
fill p scaled u shifted (6u,0) withcolor green;
fill p scaled u shifted (9u,0) withcolor blue;
\end{code}

\begin{out}
\includegraphics{examples/fill.mps}
\end{out}

å¦ä¸€ä¸ªå‘½ä»¤~\verb|filldraw|~å¯ä»¥çœ‹ä½œæ˜¯~\verb|fill+draw|ï¼Œå®ƒé™¤äº†å¡«å……å¤–è¿˜ä¼šæŠŠè·¯å¾„ç”¨æŒ‡å®šçš„ç”»ç¬”ç”»ä¸€éã€‚ç„¶è€Œä¸å¹¸çš„æ˜¯ç”»è¾¹ç¼˜å’Œå¡«å……å†…éƒ¨åªèƒ½ç”¨åŒä¸€ç§é¢œè‰²ï¼Œæ‰€ä»¥å®ƒçš„ç”¨å¤„ä¸å¤§ã€‚

é™¤äº†ä¸ºæ¯ä¸ªç»˜å›¾å‘½ä»¤å•ç‹¬æŒ‡å®šé¢œè‰²ï¼Œæˆ‘ä»¬ä¹Ÿå¯ä»¥ä½¿ç”¨ä¸€ä¸ªå…¨å±€å‘½ä»¤ï¼Œä½¿å¾—å…¶åŽçš„ç»˜å›¾å‘½ä»¤éƒ½ä½¿ç”¨æŸç§é¢œè‰²ã€‚
\begin{code}
drawoption(withcolor blue);
\end{code}

ä¸‹é¢çš„æ–¹æ³•å¯ä»¥ç”¨æ¥å®šä¹‰åŸºæœ¬è‰²ä»¥å¤–çš„é¢œè‰²ï¼Œç”¨åŸºæœ¬è‰²æ··è‰²æˆ–ç›´æŽ¥ç”¨RGBå€¼æ•ˆæžœæ˜¯ä¸€æ&nbsp;·çš„ã€‚

\begin{code}
color c[];
c1 := .9red + .6green + .3blue;
c2 := (.9,.6,.3);
\end{code}

\subsubsection{å›¾å½¢å˜æ¢}
æˆ‘ä»¬å¯ä»¥å¯¹è·¯å¾„è¿›è¡Œç¼©æ”¾ã€å¹³ç§»ã€æ—‹è½¬ç­‰å˜æ¢æ“ä½œï¼Œæ¨ªå‘å’Œçºµå‘ç¼©æ”¾å¯ä»¥åˆ†å¼€è¿›è¡Œã€‚ç”±äºŽæ—‹è½¬æ˜¯å›´ç»•åŽŸç‚¹è¿›è¡Œçš„ï¼Œæ‰€ä»¥è¦æ³¨æ„å¹³ç§»å’Œæ—‹è½¬çš„é¡ºåºã€‚ä¸‹ä¾‹ä¸­å®šä¹‰äº†ä¸€ä¸ª~\verb|path|~å˜é‡ï¼Œä»¥ä¾¿åŽé¢é‡ç”¨ã€‚

\begin{code}
path p;
p := (0,0)--(2,0)--(1,1.732)--cycle;
draw p scaled u;
draw p xscaled 2u yscaled u shifted (3u,0);
draw p scaled u rotated 60 shifted (8u,0);
\end{code}

\begin{out}
\includegraphics{examples/transform.mps}
\end{out}

\subsubsection{æ&nbsp;‡æ³¨}
\verb|\label|~å‘½ä»¤å¯ä»¥åœ¨æŒ‡å®šçš„ç‚¹é™„è¿‘åŠ&nbsp;æ–‡å­—æ&nbsp;‡æ³¨ã€‚\MP~ä¹Ÿå¯ä»¥ç”¨ä¸€å¯¹~\verb|btex|~å’Œ~\verb|etex|~æ¥åµŒå…¥ä¸€äº›~\TeX~å†…å®¹ï¼Œæ¯”å¦‚æ•°å­¦æ&nbsp;‡æ³¨ã€‚

\begin{code}
draw unitsquare xscaled 10u yscaled 4u;
label.top("top", (5u,4u));
label.bot("bottom", (5u,0));
label.lft("left", (0,2u));
label.rt("right", (10u,2u));
\end{code}
\begin{code}
label.ulft("upper left", (0,4u));
label.urt("upper right", (10u,4u));
label.llft("lower left", (0,0));
label.lrt("lower right", (10u,0));
label.rt(btex $E=mc^2$ etex, (3u,2u));
\end{code}

\begin{out}
\includegraphics{examples/label.mps}
\end{out}

å›&nbsp;ä¸ºç”¨ç¼ºçœæ–¹æ³•ç¼–è¯‘ç”Ÿæˆçš„~MPS~ä¸åµŒå…¥å­—ä½“ï¼Œå½“~\MP~åŒ…å«æ–‡å­—æ—¶ï¼ŒGSview~å°±ä¸èƒ½æ­£å¸¸æŸ¥çœ‹ã€‚è¿™æ—¶æˆ‘ä»¬å¯ä»¥ç»™ç¼–è¯‘å‘½ä»¤åŠ&nbsp;ä¸ªå‚æ•°ï¼Œç”Ÿæˆçš„~MPS~å°±ä¼šåŒ…å«å­—ä½“ä¿¡æ¯ã€‚æ³¨æ„è¿™ç§æ–¹æ³•ç”Ÿæˆçš„~MPS~è™½ç„¶~GSview~èƒ½æŸ¥çœ‹ï¼Œ\verb|dvipdfmx|~å´ä¸èƒ½æ­£å¸¸å¤„ç†ã€‚

\begin{code}
mpost \prologues:=2; input fig.mp
\end{code}

\subsection{ç¼–ç¨‹åŠŸèƒ½}

\subsubsection{æ•°æ®ç±»åž‹å’Œå˜é‡}
\MP~ä¸­æœ‰10~ç§åŸºæœ¬æ•°æ®ç±»åž‹ï¼šnumericã€pairã€pathã€penã€~color~ã€cmykcolorã€transformã€stringã€booleanã€pictureã€‚æˆ‘ä»¬å·²ç»æŽ¥è§¦è¿‡å…¶ä¸­å‡&nbsp;ç§ï¼Œæ¯”å¦‚ç¼©æ”¾ç³»æ•°~u~å°±æ˜¯ä¸€ä¸ª~numericï¼Œä¸€ä¸ªç‚¹çš„åæ&nbsp;‡æ˜¯ä¸€ä¸ª~pairï¼Œå‡&nbsp;ä¸ªç‚¹ç”¨ç›´çº¿æˆ–æ›²çº¿è¿žèµ·æ¥æ˜¯ä¸€ä¸ª~pathï¼Œpencircle~æ˜¯ä¸€ç§~penï¼Œblack~æ˜¯ä¸€ç§~colorï¼Œscaledã€rotatedã€shifted~éƒ½æ˜¯~transformã€‚

numeric~ç±»åž‹å˜é‡çš„ç²¾åº¦æ˜¯~1/65536ï¼Œå®ƒçš„ç»å¯¹å€¼ä¸èƒ½è¶…è¿‡~4096ï¼Œåœ¨è®¡ç®—è¿‡ç¨‹ä¸­æ•°å€¼å¯ä»¥è¾¾åˆ°~32768ã€‚è¿™æ&nbsp;·çš„è§„å®šä¹Ÿåº”å½’åŠŸäºŽå½“å¹´çš„ç”µè„‘ç¡¬ä»¶ï¼Œä¸è¿‡å¯¹äºŽç§‘æŠ€æ–‡æ¡£æ’å›¾è€Œè¨€ï¼Œ4096~ä¸€èˆ¬è¿˜æ˜¯å¤Ÿç”¨çš„ã€‚

é™¤äº†ç¼ºçœçš„~numericï¼Œå…¶å®ƒå˜é‡åœ¨ä½¿ç”¨ä¹‹å‰éƒ½éœ€è¦ç”¨æ•°æ®ç±»åž‹æ¥æ˜¾å¼å£°æ˜Žã€‚ç›¸åŒç±»åž‹çš„å˜é‡å¯ä»¥åœ¨ä¸€è¡Œè¯­å¥ä¸­å£°æ˜Žï¼Œä½†æ˜¯å¸¦ä¸‹æ&nbsp;‡çš„å˜é‡ä¸èƒ½æ”¾åœ¨åŒä¸€è¡Œï¼ˆè¿™ä¸ªè§„å®šå¾ˆè¹Šè··ï¼‰ã€‚
\begin{code}
numeric x,y,z;    %æ­£ç¡®
numeric x1,x2,x3; %é”™è¯¯
numeric x[];      %æ­£ç¡®
\end{code}

\subsubsection{æ•°å­¦è¿ç®—}
\MP~ä¸­å¯ä»¥ä½¿ç”¨æ™®é€šçš„è¿ç®—ç¬¦ï¼Œæ¯”å¦‚~\verb|+ - * /|ï¼›ä¹Ÿæä¾›ä¸€äº›ç‰¹æ®Šçš„è¿ç®—ç¬¦ï¼Œæ¯”å¦‚~\verb|a++b|~è¡¨ç¤º$\sqrt{a^2+b^2}$ï¼Œ\verb|a+-+b|~è¡¨ç¤º$\sqrt{a^2-b^2}$ï¼›å¦å¤–\Fref{tab:math_function}~åˆ—å‡ºä¸€äº›å¸¸ç”¨æ•°å­¦å‡½æ•°ã€‚

\begin{table}[htbp]
\caption{æ•°å­¦å‡½æ•°}
\label{tab:math_function}
\centering
\begin{tabular}{llll}
    \toprule
    abs     &amp; ç»å¯¹å€¼   &amp; mexp &amp; æŒ‡æ•° \\
    round   &amp; å››èˆäº”å…¥ &amp; mlog &amp; å¯¹æ•° \\
    ceiling &amp; å‘ä¸Šåœ†æ•´ &amp; sind &amp; æ­£å¼¦ \\
    floor   &amp; å‘ä¸‹åœ†æ•´ &amp; cosd &amp; ä½™å¼¦ \\
    mod     &amp; æ¨¡ä½™     &amp; normaldeviate &amp; æ­£æ€åˆ†å¸ƒéšæœºæ•° \\
    sqrt    &amp; å¼€æ–¹     &amp; uniformdeviate &amp; å‡åŒ€åˆ†å¸ƒéšæœºæ•° \\
    \bottomrule
\end{tabular}
\end{table}

\subsubsection{å¾ªçŽ¯}
å½“æ‰§è¡Œé‡å¤ä»»åŠ¡æ—¶ï¼Œå¾ªçŽ¯è¯­å¥å¯ä»¥è®©ç¨‹åºå˜å¾—ç®€æ´ã€‚æ³¨æ„ä¸‹ä¾‹ä¸­çš„å¾ªçŽ¯è¯­å¥æ˜¯ä¸€æ¡å‘½ä»¤ï¼Œä¹‹æ‰€ä»¥åˆ†æˆä¸‰è¡Œå†™æ˜¯ä¸ºäº†çœ‹èµ·æ¥æ¸…æ™°ç‚¹ã€‚

\begin{fdemo}{\includegraphics{examples/loop.mps}}
draw (0,0) %æ³¨æ„è¿™é‡Œæ²¡æœ‰åˆ†å·
for x=1 upto 3: 
    ..(x*x,x)*u 
endfor;
\end{fdemo}

å¾ªçŽ¯è¯­å¥ç¼ºçœæ­¥é•¿æ˜¯~1ï¼Œæˆ‘ä»¬ä¹Ÿå¯ä»¥æ”¹ç”¨å…¶å®ƒæ­¥é•¿ã€‚\verb|upto|~å…¶å®žå°±æ˜¯~\verb|step 1 until|~çš„ç¼©å†™æ–¹å¼ã€‚
\begin{code}
for x=1 step .5 until 3: 
\end{code}

\section{PSTricks}
\label{sec:pstricks}

PSTricks~æ˜¯ä¸€ä¸ªåŸºäºŽ~PS~çš„å®åŒ…ï¼Œæœ‰äº†å®ƒç”¨æˆ·å°±å¯ä»¥ç›´æŽ¥åœ¨~\LaTeX~æ–‡æ¡£ä¸­æ’å…¥ç»˜å›¾å‘½ä»¤ã€‚PSTricks~æ—©æœŸçš„ä½œè€…æ˜¯~Timothy Van Zandt\footnote{æ³•å›½Inseadå¤§å­¦ç»æµŽç³»æ•™æŽˆã€‚}ï¼Œåˆå§‹å¼€å‘å¹´æœˆä¸è¯¦ï¼Œä»–äºŽ~1997~å¹´é€€å±…äºŒçº¿ï¼Œä¹‹åŽç”±~Denis Girouã€Sebastian Rahtz\footnote{ç‰›æ´¥å¤§å­¦è®¡ç®—æœºç³»ç½‘ç®¡ã€‚}ã€Herbert VoÃŸ~ç­‰ç»´æŠ¤ã€‚

æœ¬æ–‡åªä»‹ç»~PSTricks~çš„åŸºæœ¬åŠŸèƒ½ï¼Œè‹¥æƒ³æ·±å…¥äº†è§£è¯·å‚é˜…~Van Zandt~çš„ã€ŠPSTricks User's Guideã€‹\citep{Zandt_2007}ã€‚å¦å¤–\Fref{tab:pst_add}~åˆ—å‡ºäº†ä¸€äº›å¯ä»¥å’Œ~PsTricks~é…åˆä½¿ç”¨çš„è¾…åŠ©å®åŒ…ã€‚

\begin{table}[htbp]
\caption{PSTricks~è¾…åŠ©å®åŒ…}
\label{tab:pst_add}
\centering
\begin{tabular}{llll}
    \toprule
    multido &amp; å¾ªçŽ¯è¯­å¥    &amp; pst-eucl &amp; å‡&nbsp;ä½•å‡½æ•° \\    
    pst-plot &amp; å‡½æ•°ç»˜å›¾   &amp; pst-math &amp; å¼§åº¦ä¸‰è§’å‡½æ•° \\
    pst-plot3d &amp; ä¸‰ç»´ç»˜å›¾ &amp; pstricks-add &amp; æžåæ&nbsp;‡ \\  
    \bottomrule
\end{tabular}
\end{table}

\subsection{å‡†å¤‡å·¥ä½œ}
é¦–å…ˆè¦å¼•å…¥~PSTricks~å®åŒ…ã€‚PSTricks~ä¸­ç¼ºçœé•¿åº¦å•ä½æ˜¯~1cmï¼Œæˆ‘ä»¬ä¹Ÿå¯ä»¥è®¾ç½®è‡ªå·±çš„å•ä½ã€‚
\psset{unit=10pt}
\begin{code}
\usepackage{pstricks}
\psset{unit=10pt}
\end{code}

ç»˜å›¾å‘½ä»¤ä¸€èˆ¬è¦æ”¾åœ¨~\verb|pspicture|~çŽ¯å¢ƒé‡Œï¼Œè¿™æ&nbsp;·~\LaTeX~å°±ä¼šç»™å›¾å½¢é¢„ç•™ä¸€ä¸ªçŸ©å½¢åŒºåŸŸï¼Œæ³¨æ„è¿™ä¸ªçŸ©å½¢è¦èƒ½å®¹çº³æ‰€æœ‰å›¾å½¢å¯¹è±¡ã€‚ä¸ºäº†èŠ‚çœç©ºé—´ï¼Œåœ¨æœ¬èŠ‚åŽé¢çš„ç¤ºä¾‹ä»£ç&nbsp;ä¸­ï¼Œ~\verb|pspicture|~çŽ¯å¢ƒå°†è¢«ç•¥åŽ»ã€‚

\begin{code}
\begin{pspicture}(0,0)(4,2)
...
\end{pspicture}
\end{code}

å¦å¤–éœ€è¦æ³¨æ„çš„æ˜¯ï¼ŒåµŒå…¥~\LaTeX~çš„~PSTricks~ç”Ÿæˆçš„æ˜¯~PSï¼Œ\verb|dvips|~å¯ä»¥å¤„ç†ï¼Œ\verb|dvipdfm|~å’Œpdf\LaTeX~åˆ™ä¸èƒ½ã€‚æ‰€ä»¥å¦‚æžœä½¿ç”¨åŽä¸¤ç§~driverï¼Œéœ€è¦å…ˆè¡Œç”Ÿæˆ~EPSã€‚

ç¬¬ä¸€ç§æ–¹æ³•æ˜¯æŠŠ~PSTricks~ä»£ç&nbsp;æ”¾è¿›ä¸€ä¸ªç©ºç™½çš„\LaTeX~é¡µé¢ï¼Œç”¨å®ƒç”Ÿæˆä¸€ä¸ªç®€å•çš„~DVIã€‚

\begin{code}
\documentclass{article}
\usepackage{pstricks}
\pagestyle{empty}   %é¡µé¢æ&nbsp;·å¼ä¸ºç©º

\begin{document}
\psset{unit=10pt}
\colorbox{white}{%
    \begin{pspicture}(0,0)(4,2)%
    \psdot(0,0)%
    \psdots(0,2)(2,2)(4,2)%
    \end{pspicture}%
}
\end{document}
\end{code}

ç„¶åŽç”¨ä»¥ä¸‹å‘½ä»¤æŠŠ~DVI~è½¬ä¸º~EPSï¼Œ\verb|-E|~å‚æ•°å³ä»£è¡¨~EPSã€‚ä¸Šé¢ä»£ç&nbsp;ä¸­çš„~colorbox~ä½¿å¾—ç”Ÿæˆçš„~EPS~æœ‰æ­£ç¡®çš„èŒƒå›´æ¡†ã€‚

\begin{code}
dvips pst_dots(.dvi) -E -o dots.eps
\end{code}

ç¬¬äºŒç§æ–¹æ³•æ˜¯ç”¨~\verb|pst-eps|~å®åŒ…ï¼Œå®ƒèƒ½å¤Ÿåœ¨çº¿å¤„ç†~PSTricks~ä»£ç&nbsp;å¹¶ç”Ÿæˆ~EPSï¼Œè¿™æ&nbsp;·ç”¨æˆ·å°±å¯ä»¥åœ¨åŒä¸€æ–‡ä»¶ä¸­ä½¿ç”¨è¯¥~EPSã€‚

ç„¶è€Œ~\verb|dvipdfmx|~ä¸èƒ½æ­£ç¡®å¤„ç†~\verb|pst-eps|~ç”Ÿæˆçš„~EPSã€‚å®ƒå’Œ~\verb|\rput|ã€\verb|\uput|~å‘½ä»¤ï¼Œ\verb|pst-plot|~å®åŒ…ä¸­çš„~\verb|\psaxes|~å‘½ä»¤éƒ½ä¸å…¼å®¹ã€‚ç±»ä¼¼çš„~\verb|ps4pdf|~å®åŒ…å’Œ~\verb|tabularx|~å®åŒ…ä¸å…¼å®¹ã€‚

\begin{comment}
\usepackage{pst-eps}
\PSTtoEPS[bbllx=0,bblly=0,bburx=4,bbury=2,makeeps=all]
{dots.eps}{
    \psdot(0,0)
    \psdots(0,2)(2,2)(4,2)
}
\includegraphics{dots.eps}
\end{comment}

\subsection{åŸºæœ¬å›¾å½¢å¯¹è±¡}
\subsubsection{ç‚¹}
æˆ‘ä»¬å¯ä»¥ç”¨ä»¥ä¸‹å‘½ä»¤ç”»ä¸€ä¸ªæˆ–å¤šä¸ªç‚¹ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=4,bbury=2,makeeps=all]
{examples/dot.eps}{
    \psdot(0,0)
    \psdots(0,2)(2,2)(4,2)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_dot.eps}}
\psdot(0,0)
\psdots(0,2)(2,2)(4,2)
\end{fdemo}

\subsubsection{ç›´çº¿ã€å¤šè¾¹å½¢ã€çŸ©å½¢}
\verb|\psline|~å‘½ä»¤æŠŠå¤šä¸ªç‚¹ç”¨ç›´çº¿æ®µè¿žæŽ¥èµ·æ¥ï¼Œçº¿æ®µä¹‹é—´çš„è¿žæŽ¥ç¼ºçœä¸ºå°–è§’ï¼Œä¹Ÿå¯ä»¥è®¾ç½®åœ†è§’ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=9,bbury=2,makeeps=all]
{examples/line.eps}{
    \psline(0,0)(2,2)(4,0)
    \psline[linearc=.3](5,0)(7,2)(9,0)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_line.eps}}
\psline(0,0)(2,2)(4,0)
\psline[linearc=.3](5,0)(7,2)(9,0)
\end{fdemo}

\verb|\pspolygon|~å‘½ä»¤å’Œ~\verb|\psline|~ç±»ä¼¼ï¼Œä½†æ˜¯å®ƒä¼šå½¢æˆå°é—­è·¯å¾„ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=9,bbury=2,makeeps=all]
{examples/polygon.eps}{
    \pspolygon(0,0)(2,2)(4,0)
    \pspolygon[linearc=.3](5,0)(7,2)(9,0)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_polygon.eps}}
\pspolygon(0,0)(2,2)(4,0)
\pspolygon[linearc=.3](5,0)(7,2)(9,0)
\end{fdemo}

çŸ©å½¢ç”¨~\verb|\psframe|~å‘½ä»¤ï¼Œå…¶å‚æ•°å°±æ˜¯çŸ©å½¢å·¦ä¸‹è§’å’Œå³ä¸Šè§’çš„åæ&nbsp;‡ã€‚çŸ©å½¢ä¹Ÿå¯ä»¥è®¾ç½®åœ†è§’ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=9,bbury=2,makeeps=all]
{examples/frame.eps}{
    \psframe(0,0)(4,2)
    \psframe[framearc=.3](5,0)(9,2)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_frame.eps}}
\psframe(0,0)(4,2)
\psframe[framearc=.3](5,0)(9,2)
\end{fdemo}

\subsubsection{åœ†ã€æ¤­åœ†ã€åœ†å¼§ã€æ‰‡å½¢}
åœ†å½¢ç”¨~\verb|\pscircle|~å‘½ä»¤ï¼Œå‚æ•°æ˜¯åœ†å¿ƒå’ŒåŠå¾„ã€‚æ¤­åœ†ç”¨~\verb|\psellipse|~å‘½ä»¤ï¼Œå‚æ•°æ˜¯ä¸­å¿ƒã€é•¿å¾„ã€çŸ­å¾„ã€‚æ³¨æ„è¿™ä¸¤ä¸ªå‘½ä»¤çš„åŠå¾„å‚æ•°ç”¨ä¸åŒçš„æ‹¬å·ï¼Œå¯èƒ½æ˜¯ä½œè€…çš„ç¬”è¯¯ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=7,bbury=2,makeeps=all]
{examples/circle.eps}{
    \pscircle(1,1){1}
    \psellipse(5,1)(2,1)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_circle.eps}}
\pscircle(1,1){1}
\psellipse(5,1)(2,1)
\end{fdemo}

åœ†å¼§ç”¨~\verb|\psarc|~å‘½ä»¤ï¼Œå…¶å‚æ•°æ˜¯åœ†å¿ƒã€åŠå¾„ã€èµ·æ­¢è§’åº¦ï¼Œé€†æ—¶é’ˆä½œå›¾ã€‚~\verb|\psarcn|~ç±»ä¼¼ï¼Œåªæ˜¯é¡ºæ—¶é’ˆä½œå›¾ã€‚æ‰‡å½¢ç”¨~\verb|\pswedge|~å‘½ä»¤ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=11,bbury=2,makeeps=all]
{examples/arc.eps}{
    \psarc(1,0){2}{0}{120}
    \psarcn(5,0){2}{120}{0}
    \pswedge(9,0){2}{0}{120}
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_arc.eps}}
\psarc(1,0){2}{0}{120}
\psarcn(5,0){2}{120}{0}
\pswedge(9,0){2}{0}{120}
\end{fdemo}

\subsubsection{æ›²çº¿}
\verb|\pscurve|~å‘½ä»¤æŠŠä¸€ç³»åˆ—ç‚¹ç”¨å¹³æ»‘æ›²çº¿è¿žæŽ¥èµ·æ¥ï¼›å®ƒçš„å˜å½¢ç‰ˆæœ¬~\verb|\psecurve|~å‘½ä»¤ä¸æ˜¾ç¤ºæ›²çº¿çš„ä¸¤ä¸ªç«¯ç‚¹ï¼›å¦ä¸€å˜å½¢å‘½ä»¤~\verb|\psccurve|~åˆ™æŠŠæ›²çº¿å°é—­èµ·æ¥ã€‚

å‚æ•°~\verb|showpoints=true|~ç”¨æ¥æ˜¾ç¤ºæ›²çº¿çš„æž„æˆç‚¹ï¼Œæ­¤å‚æ•°ä¹Ÿå¯ç”¨äºŽå…¶å®ƒç»˜å›¾å‘½ä»¤ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=15,bbury=2,makeeps=all]
{examples/curve.eps}{
    \pscurve[showpoints=true](0,1)(1,2)(3,0)(4,2)(1,0)
    \psecurve[showpoints=true](5,1)(6,2)(8,0)(9,2)(5,0)
    \psccurve[showpoints=true](11,1)(12,2)(14,0)(15,2)(12,0)
}
\end{comment}

\begin{code}
\pscurve[showpoints=true](0,1)(1,2)(3,0)(4,2)(1,0)
\psecurve[showpoints=true](5,1)(6,2)(8,0)(9,2)(5,0)
\psccurve[showpoints=true](11,1)(12,2)(14,0)(15,2)(12,0)
\end{code}
\begin{out}
\includegraphics{examples/pst_curve.eps}
\end{out}

\verb|\psbezier|~å‘½ä»¤è¾“å‡ºä¸€æ¡è´å¡žå°”æ›²çº¿ï¼Œå…¶å‚æ•°å°±æ˜¯æ›²çº¿çš„æŽ§åˆ¶ç‚¹ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=6,bbury=2,makeeps=all]
{examples/bezier.eps}{
    \psbezier[showpoints=true]
        (0,0)(2,2)(4,0)(6,2)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_bezier.eps}}
\psbezier[showpoints=true]
    (0,0)(2,2)(4,0)(6,2)
\end{fdemo}

æŠ›ç‰©çº¿ç”¨~\verb|\psparabola|~å‘½ä»¤ï¼Œå®ƒæœ‰ä¸¤ä¸ªå‚æ•°ï¼Œç¬¬ä¸€ä¸ªæ˜¯æŠ›ç‰©çº¿é€šè¿‡çš„ä¸€ç‚¹ï¼Œç¬¬äºŒä¸ªæ˜¯æŠ›ç‰©çº¿çš„é¡¶ç‚¹ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=2,bbury=2,makeeps=all]
{examples/parabola.eps}{
    \psparabola[showpoints=true]
        (2,2)(1,0)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_parabola.eps}}
\psparabola[showpoints=true]
    (2,2)(1,0)
\end{fdemo}

\subsubsection{ç½‘æ&nbsp;¼å’Œåæ&nbsp;‡}
ç§‘æŠ€åˆ¶å›¾é€šå¸¸ä¼šç”¨åˆ°åæ&nbsp;‡ç½‘æ&nbsp;¼ã€‚\verb|\psgrid|~å‘½ä»¤è¾“å‡ºä¸€ä¸ªçŸ©å½¢ç½‘æ&nbsp;¼ï¼Œå®ƒæœ‰ä¸‰ä¸ªå‚æ•°ç‚¹ã€‚ç½‘æ&nbsp;¼åæ&nbsp;‡æ&nbsp;‡æ³¨åœ¨é€šè¿‡ç¬¬ä¸€ä¸ªç‚¹çš„ä¸¤æ¡ç›´çº¿ä¸Šï¼Œç¬¬äºŒå’Œç¬¬ä¸‰ä¸ªç‚¹æ˜¯çŸ©å½¢çš„ä¸¤ä¸ªå¯¹è§’é¡¶ç‚¹ã€‚å½“ç¬¬ä¸€ä¸ªå‚æ•°çœç•¥æ—¶ï¼Œåæ&nbsp;‡æ&nbsp;‡æ³¨åœ¨é€šè¿‡ç¬¬ä¸€ä¸ªé¡¶ç‚¹çš„ä¸¤æ¡çŸ©å½¢è¾¹ä¸Šã€‚
\begin{comment}
\psset{unit=10pt}
\PSTtoEPS[bbllx=-1,bblly=-1,bburx=8.4,bbury=2.4,makeeps=all]
{examples/grid.eps}{
    \psgrid(0,0)(-1,-1)(3,2)
    \psgrid(5,0)(8,2)
}
\end{comment}

\begin{code}
\psgrid(0,0)(-1,-1)(3,2)
\psgrid(5,0)(8,2)
\end{code}
\begin{out}
\includegraphics{examples/pst_grid.eps}
\end{out}

\verb|pst-plot|~å®åŒ…æä¾›çš„~\verb|\psaxes|~å‘½ä»¤è¾“å‡ºåæ&nbsp;‡è½´ã€‚å®ƒçš„å‚æ•°å’Œ~\verb|\psgrid|~çš„ç±»ä¼¼ï¼Œåˆ»åº¦å’Œæ&nbsp;‡æ³¨éƒ½å¯ä»¥çµæ´»åœ°è®¾ç½®ï¼Œä¹Ÿå¯ä»¥æŠŠåæ&nbsp;‡è½´æ”¹æˆä¸€ä¸ªçŸ©å½¢æ¡†çš„å½¢å¼ã€‚
\begin{code}
\psset{unit=10pt}
\psaxes{&lt;-&gt;}(0,0)(-1,-1)(3,2)
\psaxes[tickstyle=top,labels=none]{-&gt;}(5,0)(8,2)
\psaxes[axesstyle=frame,tickstyle=top]{-&gt;}(10,0)(13,2)
\end{code}
\begin{out}
\includegraphics{examples/pst_axis.eps}
\end{out}

\subsection{å›¾å½¢æŽ§åˆ¶}
\subsubsection{çº¿åž‹å’Œç®­å¤´}
PSTricks~ä¸­çš„ç¼ºçœçº¿å®½æ˜¯~0.8ptï¼Œç¼ºçœçº¿åž‹æ˜¯å®žçº¿ã€‚ä»¥ä¸‹å‚æ•°å¯ä»¥æŽ§åˆ¶å•ä¸ªç»˜å›¾å‘½ä»¤çš„çº¿å®½å’Œçº¿åž‹ã€‚
\begin{comment}
\psset{unit=10pt}
\PSTtoEPS[bbllx=0,bblly=0,bburx=9,bbury=4,makeeps=all]
{examples/linestyle.eps}{
    \psline[linewidth=1.5pt](0,4)(9,4)
    \psline[linestyle=dotted](0,2)(9,2)
    \psline[linestyle=dashed](0,0)(9,0)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_linestyle.eps}}
\psline[linewidth=1.5pt](0,4)(9,4)
\psline[linestyle=dotted](0,2)(9,2)
\psline[linestyle=dashed](0,0)(9,0)
\end{fdemo}

æˆ‘ä»¬ä¹Ÿå¯ä»¥ç”¨å‘½ä»¤~\verb|\psset|~å‘½ä»¤æ¥è®¾ç½®å…¨å±€å‚æ•°ã€‚
\begin{code}
\psset{linewidth=1pt,linestyle=dashed}
\end{code}

ä»¥ä¸‹å‚æ•°å¯ä»¥æŽ§åˆ¶ç»˜å›¾å‘½ä»¤çš„ç®­å¤´ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=9,bbury=4,makeeps=all]
{examples/arrow.eps}{
    \psline{-&gt;}(0,4)(9,4)
    \psline{&lt;-}(0,2)(9,2)
    \psline{&lt;-&gt;}(0,0)(9,0)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_arrow.eps}}
\psline{-&gt;}(0,4)(9,4)
\psline{&lt;-}(0,2)(9,2)
\psline{&lt;-&gt;}(0,0)(9,0)
\end{fdemo}

\subsubsection{é¢œè‰²å’Œå¡«å……}
PSTricks~é¢„å®šä¹‰çš„é¢œè‰²æœ‰~blackã€darkgrayã€grayã€lightgrayã€white~ç­‰ç°åº¦é¢œè‰²ï¼Œä¹Ÿæœ‰~redã€greenã€blueã€cyanã€magentaã€yellow~ç­‰å½©è‰²ã€‚æˆ‘ä»¬ä¹Ÿå¯ä»¥è‡ªå®šä¹‰ç°åº¦é¢œè‰²å’Œå½©è‰²ã€‚

\begin{code}
\newgray{mygray}{.3}
\newrgbcolor{mycolor}{.3 .4 .5}
\end{code}

ä»¥ä¸‹å‚æ•°å¯ä»¥æŽ§åˆ¶å•ä¸ªç»˜å›¾å‘½ä»¤çš„é¢œè‰²ï¼Œæˆ‘ä»¬ä¹Ÿå¯ä»¥ç”¨~\verb|\psset|~å‘½ä»¤è®¾ç½®å…¨å±€å‚æ•°ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=9,bbury=4,makeeps=all]
{examples/color.eps}{
    \psline[linecolor=red](0,4)(9,4)
    \psline[linecolor=green](0,2)(9,2)
    \psline[linecolor=blue](0,0)(9,0)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_color.eps}}
\psline[linecolor=red](0,4)(9,4)
\psline[linecolor=green](0,2)(9,2)
\psline[linecolor=blue](0,0)(9,0)
\end{fdemo}

ä»¥ä¸‹å‚æ•°å¯ä»¥æŽ§åˆ¶å•ä¸ªç»˜å›¾å‘½ä»¤çš„å¡«å……æ¨¡å¼å’Œå¡«å……é¢œè‰²ï¼Œæ³¨æ„åªæœ‰å°é—­è·¯å¾„æ‰å¯ä»¥å¡«å……ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=11,bbury=2,makeeps=all]
{examples/fill.eps}{
    \pscircle[fillstyle=solid,fillcolor=red](1,1){1}
    \pscircle[fillstyle=vlines](4,1){1}
    \pscircle[fillstyle=hlines](7,1){1}
    \pscircle[fillstyle=crosshatch](10,1){1}
}
\end{comment}

\begin{code}
\pscircle[fillstyle=solid,fillcolor=red](1,1){1}
\pscircle[fillstyle=vlines](4,1){1}
\pscircle[fillstyle=hlines](7,1){1}
\pscircle[fillstyle=crosshatch](10,1){1}
\end{code}
\begin{out}
\includegraphics{examples/pst_fill.eps}
\end{out}

\subsection{å¯¹è±¡å¸ƒå±€}
\subsubsection{å¹³ç§»}
å‚æ•°~\verb|origin|~å¯ä»¥è®©ä¸€ä¸ªå›¾å½¢å¯¹è±¡å¹³ç§»åˆ°æŒ‡å®šçš„åæ&nbsp;‡ç‚¹ï¼Œæˆ‘ä»¬ä¹Ÿå¯ä»¥ç”¨~\verb|\psset|~å‘½ä»¤è®¾ç½®å…¨å±€å¹³ç§»å‚æ•°ã€‚
\begin{comment}
\PSTtoEPS[bbllx=0,bblly=0,bburx=7,bbury=2,makeeps=all]
{examples/origin.eps}{
    \psframe(0,0)(3,2)
    \psframe[origin={4,0}](0,0)(3,2)
}
\end{comment}

\begin{fdemo}{\includegraphics{examples/pst_origin.eps}}
\psframe(0,0)(3,2)
\psframe[origin={4,0}](0,0)(3,2)
\end{fdemo}

\subsubsection{æ—‹è½¬}
\verb|\rput|~å‘½ä»¤å¯ä»¥å¯¹ä¸€ä¸ªå›¾å½¢å¯¹è±¡åŒæ—¶è¿›è¡Œæ—‹è½¬å’Œå¹³ç§»æ“ä½œã€‚å®ƒæœ‰ä¸¤ä¸ªå‚æ•°ï¼Œç¬¬ä¸€ä¸ªæ˜¯æ—‹è½¬è§’åº¦ï¼Œç¬¬äºŒä¸ªæ˜¯å¹³ç§»åˆ°çš„åæ&nbsp;‡ç‚¹ã€‚
\begin{fdemo}{\includegraphics{examples/pst_rput.eps}}
\psframe(0,0)(3,2)
\rput{30}(5,0){\psframe(0,0)(3,2)}
\end{fdemo}

\subsubsection{æ–‡å­—æ&nbsp;‡æ³¨}
\verb|\rput|~å‘½ä»¤è¿˜å¯ä»¥åœ¨æŒ‡å®šçš„åæ&nbsp;‡ç‚¹æ&nbsp;‡æ³¨æ–‡å­—ï¼Œè¿™æ—¶å®ƒçš„ç¬¬ä¸€ä¸ªå‚æ•°æ˜¯åæ&nbsp;‡ç‚¹ç›¸å¯¹äºŽæ&nbsp;‡æ³¨çš„ä½ç½®ã€‚å…¶å–å€¼å¯ä»¥æ˜¯çºµå‘çš„~tã€bï¼ˆä¸Šä¸‹ï¼‰ï¼Œæˆ–æ¨ªå‘çš„~lã€rï¼ˆå·¦å³ï¼‰ï¼Œä¹Ÿå¯ä»¥æ˜¯çºµå‘å’Œæ¨ªå‘ä½ç½®çš„ç»„åˆã€‚
\begin{fdemo}{\includegraphics{examples/pst_label.eps}}
\pspolygon(0,0)(4,0)(2,3)
\rput[r](0,0){A}
\rput[l](4,0){B}
\rput[b](2,3){C}
\end{fdemo}

\verb|\rput|~ç”Ÿæˆçš„æ&nbsp;‡æ³¨å°±åœ¨åæ&nbsp;‡ç‚¹ä¸Šï¼Œæœ‰æ—¶ä¼šæ„Ÿè§‰ç¦»å›¾å½¢å¤ªè¿‘ã€‚å¦ä¸€ä¸ªå‘½ä»¤~\verb|\uput|~åˆ™ç”Ÿæˆç¼ºçœè·ç¦»æŒ‡å®šåæ&nbsp;‡ç‚¹~5ptçš„æ&nbsp;‡æ³¨ï¼Œå®ƒçš„ç¬¬ä¸€ä¸ªå‚æ•°æ˜¯æ&nbsp;‡æ³¨ç›¸å¯¹äºŽåæ&nbsp;‡ç‚¹çš„è§’åº¦ã€‚
\begin{fdemo}{\includegraphics{examples/pst_uput.eps}}
\pspolygon(0,0)(4,0)(2,3)
\uput[l](0,0){A}
\uput[r](4,0){B}
\uput[u](2,3){C}
\end{fdemo}

\verb|\uput|~çš„è§’åº¦å‚æ•°å¯ä»¥æ˜¯ä»»æ„è§’åº¦ï¼Œä¹Ÿå¯ä»¥æ˜¯å­—æ¯ï¼Œå‚è§ã€‚æ³¨æ„~\verb|\uput|~çš„è§’åº¦å‚æ•°å’Œ~\verb|\rput|~å‘½ä»¤çš„å‚è€ƒç‚¹ä½ç½®å‚æ•°çš„å®šä¹‰å‡&nbsp;ä¹Žæ­£å¥½ç›¸åï¼Œè¿™ä¹Ÿè®¸åæ˜&nbsp;äº†ä½œè€…æ´’è„±çš„é£Žæ&nbsp;¼ã€‚

\begin{table}[htbp]
\caption{uput~å‘½ä»¤çš„è§’åº¦å‚æ•°}
\label{tab:uput}
\centering
\begin{tabular}{lrlr}
    \toprule
    r &amp;   0$^\circ$ &amp; ur &amp;  45$^\circ$ \\
    u &amp;  90$^\circ$ &amp; ul &amp; 135$^\circ$ \\
    l &amp; 180$^\circ$ &amp; dl &amp; 225$^\circ$ \\
    d &amp; 270$^\circ$ &amp; dr &amp; 315$^\circ$ \\
    \bottomrule
\end{tabular}
\end{table}

\section{PGF}
\label{sec:pgf}
PGF~å’Œ~Beamer~çš„ä½œè€…éƒ½æ˜¯~Till Tantau\footnote{å¾·å›½LÃ¼beckå¤§å­¦è®¡ç®—æœºç&nbsp;”ç©¶æ‰€æ•™æŽˆã€‚}ã€‚Tantau~å½“åˆå¼€å‘~Beamer~æ˜¯ä¸ºäº†åº”ä»˜~2003~å¹´ä»–çš„åšå£«å­¦ä½è®ºæ–‡ç­”è¾©ï¼Œä¹‹åŽå®ƒåœ¨~CTAN~ä¸Šæµè¡Œå¼€æ¥ã€‚2005~å¹´~PGF~ä»Ž~Beamer~é¡¹ç›®ä¸­åˆ†ç¦»å‡ºæ¥ï¼Œæˆä¸ºä¸€ä¸ªç‹¬ç«‹çš„å®åŒ…ã€‚

æœ¬æ–‡åªå¯¹~PGF~ä½œç®€å•ä»‹ç»ï¼Œè‹¥æƒ³æ·±å…¥äº†è§£è¯·å‚é˜…~Tantau~çš„ã€ŠTikZ and PGF Manualã€‹\citep{Tantau_2008}ã€‚

\subsection{å‡†å¤‡å·¥ä½œ}
ä¸€èˆ¬äººä»¬å¹¶ä¸ç›´æŽ¥ä½¿ç”¨~PGF~å‘½ä»¤ï¼Œè€Œæ˜¯é€šè¿‡å®ƒå‰ç«¯~TikZ~æ¥è°ƒç”¨~PGFã€‚åœ¨å¼•ç”¨~\verb|tikz|~å®åŒ…ä¹‹å‰ï¼Œç”¨æˆ·éœ€è¦è®¾ç½®~PGF~ç³»ç»Ÿ~driverã€‚
\begin{code}
\def\pgfsysdriver{pgfsys-dvipdfmx.def}
\usepackage{tikz}
\end{code}

PGF~çš„ç¼ºçœé•¿åº¦å•ä½æ˜¯~1cmï¼Œæˆ‘ä»¬ä¹Ÿå¯ä»¥æ”¹ç”¨å…¶å®ƒå•ä½ã€‚æ³¨æ„è¿™æ&nbsp;·é¢„å®šä¹‰çš„é•¿åº¦å•ä½æœ‰æ—¶ä¼šå¤±æ•ˆï¼Œè¿™å¯èƒ½æ˜¯~PGF~çš„~bugã€‚
\begin{code}
\pgfsetxvec{\pgfpoint{10pt}{0}}
\pgfsetyvec{\pgfpoint{0}{10pt}}
\end{code}

TikZ~æä¾›ä¸€ä¸ª~\verb|tikz|~å‘½ä»¤å’Œä¸€ä¸ª~\verb|tikzpicture|~çŽ¯å¢ƒï¼Œå…·ä½“ç»˜å›¾æŒ‡ä»¤å¯ä»¥æ”¾åœ¨~\verb|tikz|~åŽé¢ï¼Œä¹Ÿå¯ä»¥æ”¾åœ¨~\verb|tikzpicture|~ä¸­é—´ã€‚ä¸¤ç§æ–¹æ³•æ•ˆæžœç›¸åŒï¼Œç”¨æˆ·å¯ä»¥ä»»æ„é€‰æ‹©ã€‚ä¸ºäº†èŠ‚çœç©ºé—´ï¼Œæœ¬èŠ‚çš„ç¤ºä¾‹å°†çœç•¥éƒ¨åˆ†çŽ¯å¢ƒä»£ç&nbsp;ã€‚
\begin{code}
\tikz ...   %ç»˜å›¾å‘½ä»¤
\begin{tikzpicture}
...         %ç»˜å›¾å‘½ä»¤
\end{tikzpicture}
\end{code}

\subsection{åŸºæœ¬å›¾å½¢å¯¹è±¡}
\subsubsection{ç›´çº¿ã€å¤šè¾¹å½¢ã€çŸ©å½¢}
TikZ~ä¸­ç›´çº¿çš„è¯­æ³•å’Œ~\MP~ç±»ä¼¼ï¼ŒåŠ&nbsp;~\verb|cycle|~å‚æ•°æ‰èƒ½æž„æˆçœŸæ­£çš„å°é—­è·¯å¾„ã€‚
\begin{fdemo}{
\begin{tikzpicture}
\draw (0,0)--(4,0)--(2,2)--(0,0);
\draw (5,0)--(9,0)--(7,2)--cycle;
\end{tikzpicture}
}
\draw (0,0)--(4,0)--(2,3)--(0,0);
\draw (5,0)--(9,0)--(7,3)--cycle;
\end{fdemo}

çŸ©å½¢å‘½ä»¤å¦‚ä¸‹ï¼Œå®ƒçš„ä¸¤ä¸ªå‚æ•°æ˜¯çŸ©å½¢çš„ä¸¤ä¸ªå¯¹è§’é¡¶ç‚¹ã€‚
\begin{fdemo}{
\begin{tikzpicture}
\draw (0,0) rectangle (4,2);
\end{tikzpicture}
}
\draw (0,0) rectangle (4,2);
\end{fdemo}

\subsubsection{åœ†ã€æ¤­åœ†ã€å¼§}
åœ†å’Œæ¤­åœ†å‘½ä»¤å¦‚ä¸‹ï¼Œåœ†çš„å‚æ•°æ˜¯åœ†å¿ƒå’ŒåŠå¾„ï¼Œæ¤­åœ†çš„å‚æ•°æ˜¯ä¸­å¿ƒã€é•¿å¾„ã€çŸ­å¾„ã€‚
\begin{fdemo}{
\begin{tikzpicture}
\draw (1,1) circle (1);
\draw (5,1) ellipse (2 and 1);
\end{tikzpicture}
}
\draw (1,1) circle (1);
\draw (5,1) ellipse (2 and 1);
\end{fdemo}

åœ†å¼§å’Œæ¤­åœ†å¼§å‘½ä»¤å¦‚ä¸‹ï¼Œåœ†å¼§çš„å‚æ•°æ˜¯èµ·å§‹ç‚¹ï¼Œèµ·å§‹è§’åº¦ã€ç»ˆæ­¢è§’åº¦ã€åŠå¾„ï¼›æ¤­åœ†å¼§åˆ™æŠŠåŠå¾„æ¢æˆäº†é•¿å¾„å’ŒçŸ­å¾„ã€‚
\begin{fdemo}{
\begin{tikzpicture}
\draw (2,1) arc (0:270:1);
\draw (7,1) arc (0:270:2 and 1);
\end{tikzpicture}
}
\draw (2,1) arc (0:270:1);
\draw (7,1) arc (0:270:2 and 1);
\end{fdemo}

\subsubsection{æ›²çº¿å’ŒæŠ›ç‰©çº¿}
æ›²çº¿å‘½ä»¤å¦‚ä¸‹ï¼Œä¸­é—´çš„å‚æ•°æ˜¯æŽ§åˆ¶ç‚¹ã€‚
\begin{fdemo}{
\begin{tikzpicture}
\draw (0,0) .. controls (2,2) 
    and (4,2) .. (4,0);
\filldraw (0,0) circle (.1)
    (2,2) circle (.1)
    (4,2) circle (.1)
    (4,0) circle (.1);
\end{tikzpicture}
}
\draw (0,0) .. controls (2,2) 
    and (4,2) .. (4,0);
\end{fdemo}

æŠ›ç‰©çº¿å‘½ä»¤å¦‚ä¸‹ï¼Œé™¤äº†èµ·æ­¢ç‚¹è¿˜å¯ä»¥æŒ‡å®šé¡¶ç‚¹ã€‚
\begin{fdemo}{
\begin{tikzpicture}
\draw (-1,1) parabola bend (0,0) (1.414,2);
\filldraw (-1,1) circle (.1)
    (0,0) circle (.1)
    (1.414,2) circle (.1);
\end{tikzpicture}
}
\draw (-1,1) parabola 
    bend (0,0) (1.414,2);
\end{fdemo}

\subsection{å›¾å½¢æŽ§åˆ¶}
\subsubsection{çº¿åž‹å’Œç®­å¤´}
ç»˜å›¾å‘½ä»¤å¯ä»¥è®¾ç½®çº¿åž‹å’Œç®­å¤´å‚æ•°ã€‚
\begin{fdemo}{
\begin{tikzpicture}
\draw[line width=2pt] (0,3)--(9,3);
\draw[-&gt;] (0,2)--(9,2);
\draw[&lt;-] (0,1)--(9,1);
\draw[&lt;-&gt;] (0,0)--(9,0);
\end{tikzpicture}
}
\draw[line width=2pt] (0,0)--(9,0);
\draw[-&gt;] (0,1)--(9,1);
\draw[&lt;-] (0,2)--(9,2);
\draw[&lt;-&gt;] (0,3)--(9,3);
\end{fdemo}

\subsubsection{é¢œè‰²ã€å¡«å……ã€é˜´å½±}
é¢œè‰²å‚æ•°çš„ç”¨æ³•å¦‚ä¸‹ã€‚PGF~å¯ä»¥ä½¿ç”¨~\verb|xcolor|~å®åŒ…\citep{Kern_2007}ä¸­å®šä¹‰çš„æ‰€æœ‰é¢œè‰²ã€‚
\begin{fdemo}{
\begin{tikzpicture}
\draw[red] (0,4)--(9,4);
\draw[green] (0,2)--(9,2);
\draw[blue] (0,0)--(9,0);
\end{tikzpicture}
}
\draw[red] (0,4)--(9,4);
\draw[green] (0,2)--(9,2);
\draw[blue] (0,0)--(9,0);
\end{fdemo}

å°é—­è·¯å¾„å¯ä»¥ç”¨é¢œè‰²å¡«å……ï¼Œ\verb|\filldraw|~å‘½ä»¤å¯ä»¥åˆ†åˆ«æŒ‡å®šè¾¹æ¡†è‰²å’Œå¡«å……è‰²ã€‚
\begin{fdemo}{
\begin{tikzpicture}
\fill[red] (1,1) circle (1);
\filldraw[fill=lightgray,draw=black] 
    (4,1) circle (1);
\end{tikzpicture}
}
\fill[red] (1,1) circle (1);
\filldraw[fill=lightgray,draw=black] 
    (4,1) circle (1);
\end{fdemo}

\verb|\shade|~å‘½ä»¤å¯ä»¥äº§ç”Ÿæ¸å˜å’Œå…‰å½±æ•ˆæžœï¼Œç¼ºçœæ˜¯ä»Žä¸Šåˆ°ä¸‹ï¼Œç°è‰²æ¸å˜ä¸ºç™½è‰²ã€‚æˆ‘ä»¬ä¹Ÿå¯ä»¥ä½¿ç”¨å…¶å®ƒæ–¹å‘å’Œé¢œè‰²çš„æ¸å˜ã€‚
\begin{code}
\shade (0,0) rectangle (2,2);
\shade[left color=red,right color=orange] (3,0) rectangle (5,2);
\shade[inner color=red,outer color=orange] (6,0) rectangle (8,2);
\shade[ball color=blue] (10,1) circle (1);
\end{code}

\begin{out}
\begin{tikzpicture}
\shade (0,0) rectangle (2,2);
\shade[left color=red,right color=orange] (3,0) rectangle (5,2);
\shade[inner color=red,outer color=orange] (6,0) rectangle (8,2);
\shade[ball color=blue] (10,1) circle (1);
\end{tikzpicture}
\end{out}

\subsubsection{å›¾å½¢å˜æ¢}
å¯¹å›¾å½¢å¯¹è±¡å¯ä»¥è¿›è¡Œå¹³ç§»å’Œæ—‹è½¬æ“ä½œï¼Œæ³¨æ„å¦‚æžœä¸¤ç§æ“ä½œåŒæ—¶è¿›è¡Œï¼Œå®ƒä»¬æ˜¯æœ‰é¡ºåºçš„ã€‚æ³¨æ„é¢„å®šä¹‰çš„é•¿åº¦å•ä½åœ¨è¿™é‡Œå¯¹å¹³ç§»å‚æ•°å¤±æ•ˆã€‚
\begin{code}
\draw (0,0) rectangle (2,2);
\draw[xshift=30pt] (0,0) rectangle (2,2);
\draw[xshift=75pt,rotate=45] (0,0) rectangle (2,2);
\end{code}

\begin{out}
\begin{tikzpicture}
\draw (0,0) rectangle (2,2);
\draw[xshift=30pt] (0,0) rectangle (2,2);
\draw[xshift=75pt,rotate=45] (0,0) rectangle (2,2);
\end{tikzpicture}
\end{out}

\subsection{æ&nbsp;·å¼}
PGF~æ¯”~\MP~å’Œ~PSTricks~å¤šäº†ä¸€ä¸ªæœ‰è¶£çš„æ¦‚å¿µï¼šæ&nbsp;·å¼ï¼ˆstyleï¼‰ï¼Œå®ƒçš„æ€è·¯å’Œ~HTML~çš„~CSS~ç›¸è¿‘ã€‚æˆ‘ä»¬å¯ä»¥å…ˆå®šä¹‰ä¸¤ç§æ&nbsp;·å¼ï¼Œ
\tikzset{
    myline/.style={line width=2pt},
    myblueline/.style={myline,blue}
}
\begin{code}
\tikzset{
    myline/.style={line width=2pt},
    myblueline/.style={myline,blue}
}
\end{code}

ç„¶åŽå°±å¯ä»¥åœ¨ç»˜å›¾å‘½ä»¤ä¸­è¿™æ&nbsp;·ä½¿ç”¨æ&nbsp;·å¼ã€‚
\begin{fdemo}{
\begin{tikzpicture}
\draw[myline] (0,2)--(9,2);
\draw[myblueline] (0,0)--(9,0);
\end{tikzpicture}
}
\draw[myline] (0,2)--(9,2);
\draw[myblueline] (0,0)--(9,0);
\end{fdemo}

é™¤äº†ç”¨~\verb|\tikzset|~å‘½ä»¤å®šä¹‰æ&nbsp;·å¼ï¼Œæˆ‘ä»¬ä¹Ÿå¯ä»¥åœ¨~\verb|tikzpicture|~çŽ¯å¢ƒå¤´éƒ¨å£°æ˜Žæ&nbsp;·å¼ã€‚å‰è€…æ˜¯å…¨å±€æ€§çš„ï¼ŒåŽè€…åˆ™æ˜¯å±€éƒ¨æ€§çš„ã€‚
\begin{code}
\begin{tikzpicture}[
    thickline/.style=2pt,
    bluethickline/.style={thickline,color=blue}
]
...
\end{tikzpicture}
\end{code}

æ³¨æ„åœ¨æ&nbsp;·å¼ä¸­é¢„å®šä¹‰é•¿åº¦å•ä½æœ‰æ—¶ä¼šå¤±æ•ˆï¼Œæ‰€ä»¥æœ€å¥½ä½¿ç”¨ç»å¯¹å•ä½ã€‚

\subsection{æµç¨‹å›¾}
\subsubsection{èŠ‚ç‚¹}
PGF~ä¸­çš„èŠ‚ç‚¹ï¼ˆnodeï¼‰å¯ä»¥æ˜¯ç®€å•çš„æ&nbsp;‡ç­¾ï¼Œä¹Ÿå¯ä»¥æœ‰å„ç§å½¢çŠ¶çš„è¾¹æ¡†ï¼Œè¿˜å¯ä»¥æœ‰å„ç§å¤æ‚çš„å±žæ€§ã€‚æ¯”å¦‚ä¸‹ä¾‹ä¸­çš„èŠ‚ç‚¹æ&nbsp;·å¼ï¼š\verb|box|ï¼Œå®ƒçš„è¾¹æ¡†æ˜¯çŸ©å½¢ï¼Œæœ‰åœ†è§’ï¼›å®ƒæœ‰æœ€å°å®½åº¦ã€é«˜åº¦ã€æ–‡å­—å’Œè¾¹æ¡†çš„è·ç¦»ï¼Œè¾¹æ¡†å’Œå¡«å……é¢œè‰²ç­‰å±žæ€§ã€‚

\begin{code}
\tikzset{
    box/.style={rectangle, rounded corners=6pt, 
        minimum width=50pt, minimum height=20pt, inner sep=6pt, 
        draw=gray,thick, fill=lightgray}
}
\end{code}

é™¤äº†ä¸Šè¿°ç±»åˆ«å±žæ€§ï¼ŒèŠ‚ç‚¹è¿˜å¯ä»¥æœ‰åå­—ã€ä½ç½®ç­‰å±žæ€§ã€‚åœ¨ä¸‹ä¾‹ä¸­ï¼Œæˆ‘ä»¬å…ˆç”»äº†ä¸‰ä¸ªæœ‰åå­—çš„æ–‡æœ¬æ¡†ï¼›ç„¶åŽç”¨ç®­å¤´æŠŠæ–‡æœ¬æ¡†è¿žæŽ¥èµ·æ¥ï¼Œæ³¨æ„è¿žæŽ¥æ—¶è¦å¼•ç”¨æ–‡æœ¬æ¡†çš„åå­—ï¼›æŽ¥ç€åœ¨ç®­å¤´ä¸ŠåŠ&nbsp;äº†æ&nbsp;‡ç­¾ã€‚
\begin{code}
\node[box] (tex) at(0,0) {.tex};  %æ–‡æœ¬æ¡†
\node[box] (dvi) at(10,0) {.dvi}; %æ–‡æœ¬æ¡†
\node[box] (pdf) at(20,0) {.pdf}; %æ–‡æœ¬æ¡†
\draw[-&gt;] (tex)--(dvi);           %ç®­å¤´
\draw[-&gt;] (dvi)--(pdf);           %ç®­å¤´
\node at (5,1) {latex};           %æ&nbsp;‡ç­¾
\node at (15,1) {dvipdfmx};       %æ&nbsp;‡ç­¾
\end{code}

\begin{out}
\begin{tikzpicture}
\node[box] (tex) at(0,0) {.tex};
\node[box] (dvi) at(10,0) {.dvi};
\node[box] (pdf) at(20,0) {.pdf};
\draw[-&gt;] (tex)--(dvi);
\draw[-&gt;] (dvi)--(pdf);
\node at (5,1) {latex};
\node at (15,1) {dvipdfmx};
\end{tikzpicture}
\end{out}

åœ¨ä¸Šä¾‹ä¸­çš„èŠ‚ç‚¹éƒ½ä½¿ç”¨äº†ç»å¯¹ä½ç½®ï¼ŒPGF~ä¸­è¿˜å¯ä»¥ä½¿ç”¨æ›´çµæ´»ä¸€ç‚¹çš„ç›¸å¯¹ä½ç½®ã€‚æ¯”å¦‚åœ¨ä¸‹ä¾‹ä¸­ï¼Œdvi~èŠ‚ç‚¹åœ¨~tex~èŠ‚ç‚¹å³è¾¹~50pt~å¤„ï¼ˆæˆ‘ä»¬å‰é¢å®šä¹‰çš„åŸºæœ¬é•¿åº¦å•ä½æ˜¯~10ptï¼‰ï¼Œè€Œ~pdf~èŠ‚ç‚¹åˆåœ¨~dvi~èŠ‚ç‚¹å³è¾¹~50pt~å¤„ã€‚

ç®­å¤´å¯ä»¥æ¢ä¸ºä¸“é—¨ç”¨æ¥è¿žæŽ¥èŠ‚ç‚¹çš„~\verb|edge|~ï¼›æ&nbsp;‡ç­¾ä¹Ÿæ”¹æˆç›¸å¯¹ä½ç½®ï¼Œç®­å¤´ä¸Šæ–¹~5pt~å¤„ã€‚
\begin{code}
\node[box] (tex) {.tex};
\node[box,right=5 of tex] (dvi) {.dvi};
\node[box,right=6 of dvi] (pdf) {.pdf};
\path (tex) edge[-&gt;]  node[above=.5] {latex} (dvi)
    (dvi) edge[-&gt;] node[above=.5] {dvipdfmx} (pdf);
\end{code}

\begin{out}
\begin{tikzpicture}
\node[box] (tex) {.tex};
\node[box,right=5 of tex] (dvi) {.dvi};
\node[box,right=6 of dvi] (pdf) {.pdf};
\path (tex) edge[-&gt;]  node[above=.5] {latex} (dvi)
    (dvi) edge[-&gt;] node[above=.5] {dvipdfmx} (pdf);
\end{tikzpicture}
\end{out}

\subsubsection{æ&nbsp;‘}
ä¸‹é¢æ˜¯ä¸€æ£µç®€å•çš„æ&nbsp;‘ã€‚æˆ‘ä»¬å¯ä»¥ç”¨ä¸€ä¸ªå‚æ•°æŽ§åˆ¶ç›¸é‚»èŠ‚ç‚¹çš„è·ç¦»ï¼Œé¢„å®šä¹‰é•¿åº¦å•ä½å¯¹æ­¤å‚æ•°ä¹Ÿä¼šå¤±æ•ˆã€‚
\begin{code}
\begin{tikzpicture}[sibling distance=80pt]
\node[box] {TeX}
    child {node[box] {Plain\TeX}}
    child {node[box] {\LaTeX}
        child {node[box] {MiKTeX}}
        child {node[box] {TeX Live}}
        child {node[box] {MacTeX}}
    };
\end{tikzpicture}
\end{code}

\begin{out}
\begin{tikzpicture}[sibling distance=80pt]
\node[box] {TeX}
    child {node[box] {Plain\TeX}}
    child {node[box] {\LaTeX}
        child {node[box] {MiKTeX}}
        child {node[box] {TeX Live}}
        child {node[box] {MacTeX}}
    };
\end{tikzpicture}
\end{out}

\bibliographystyle{unsrtnat}
\bibliography{reading}
\newpage
</pre></body></html>