Debian Codegraph @

texmf-dist/doc/metapost/base/source-tutorial/mpintro.ltx

raw
1 % This document is in the public domain.
2 % Originally written 2007, 2008 Troy Henderson.
3 \documentclass[11pt]{article}
4 \usepackage[T1]{fontenc}
5 \usepackage[charter]{mathdesign}
6 \renewcommand*{\ttdefault}{lmtt}
7 \linespread{1.05}
8 \usepackage{textcomp}
9 \usepackage{mflogo}
10 \usepackage{microtype}
11 \usepackage{ifpdf}
12 \ifpdf\microtypesetup{expansion=true}\fi
13 \usepackage[margin=1.25in,letterpaper]{geometry}
14 \usepackage[rgb,x11names]{xcolor}
15 \usepackage{graphicx}
16 \usepackage{listings}
17 \lstloadlanguages{MetaPost, [LaTeX]TeX}
18 \lstdefinelanguage[ext]{MetaPost}[]{MetaPost}{
19 morekeywords={verbatimtex},
20 morekeywords=[2]{blackpart, cmykcolor, colormodel, colorpart,
21 cyanpart, greypart, magentapart, rgbcolor, yellowpart},
22 morekeywords=[3]{filenametemplate, withcmykcolor, withgreyscale,
23 withoutcolor, withpostscript, withprescript, withrgbcolor},
24 morekeywords=[5]{defaultcolormodel, mpprocset, outputformat,
25 outputtemplate},
26 morekeywords=[6]{mpversion},
27 morecomment=[s][basicstyle]{\%}{&},
28 deletekeywords=[4]{z}
29 }
30 \lstset{
31 basicstyle=\normalfont\ttfamily,
32 columns=flexible, breaklines=true, breakatwhitespace=true,
33 escapechar=|,
34 aboveskip=8pt, belowskip=8pt,
35 frame=leftline, framerule=32pt, framesep=16pt, xleftmargin=48pt
36 }
37 \colorlet{mpcolor}{Chartreuse3!50!white!95!black}
38 % \colorlet{testcolor}{mpcolor!90!black}
39 % \extractcolorspec{testcolor}{\testcol}
40 % \show\testcol
41 \lstdefinestyle{MP}{
42 language=[ext]MetaPost,
43 keywordstyle=\bfseries\color{mpcolor!75!black},
44 commentstyle=\itshape,
45 rulecolor=\color{mpcolor}
46 }
47 \lstdefinestyle{LaTeX}{
48 language=[LaTeX]TeX, keywordstyle={}, commentstyle=\itshape,
49 rulecolor=\color{PeachPuff2}
50 }
51 \lstdefinestyle{text}{
52 keywordstyle={}, commentstyle={},
53 rulecolor=\color{Snow2!95!black}
54 }
55 \lstMakeShortInline[style=MP, keywordstyle={}, commentstyle={}]|
56 \newcommand*{\File}[1]{\texttt{#1}}
57 \usepackage{float}
58 \floatplacement{figure}{htp}
59 \floatplacement{table}{tp}
60 \usepackage{hyperxmp}
61 \usepackage{hyperref}
62 \hypersetup{
63 pdfencoding=unicode,
64 pdfstartview=FitH,
65 pdfpagemode=UseNone,
66 colorlinks=true,
67 linkcolor=RoyalBlue3,
68 urlcolor=Chocolate4,
69 citecolor=DeepPink2
70 }
71 \usepackage{attachfile2}
72 \attachfilesetup{
73 mimetype={text/plain}
74 }
75 \newcommand*{\paperclip}[1][]{\includegraphics[#1]{paperclip.mps}}
76 \newcommand*{\attach}[2][]{%
77 \textattachfile[description={#2},#1]{#2}{\paperclip}%
78 }
79 \newlength{\attachmentraise}
80 \newenvironment{withattachment}[2][0pt]
81 {%
82 \setlength{\attachmentraise}{#1}%
83 \addtolength{\attachmentraise}{6pt}%
84 \makebox[0pt][l]{%
85 \raisebox{\attachmentraise}[0pt][0pt]{%
86 \makebox[32pt][c]{%
87 \attach[subject={MetaPost source file}]{#2}%
88 }%
89 }%
90 }%
91 \begin{minipage}[b]{\linewidth}%
92 }{%
93 \end{minipage}%
94 }
95
96 %%% Definitions copied from ltugboat.cls.
97 \makeatletter
98 \DeclareRobustCommand\SMC{%
99 \ifx\@currsize\normalsize\small\else
100 \ifx\@currsize\small\footnotesize\else
101 \ifx\@currsize\footnotesize\scriptsize\else
102 \ifx\@currsize\large\normalsize\else
103 \ifx\@currsize\Large\large\else
104 \ifx\@currsize\LARGE\Large\else
105 \ifx\@currsize\scriptsize\tiny\else
106 \ifx\@currsize\tiny\tiny\else
107 \ifx\@currsize\huge\LARGE\else
108 \ifx\@currsize\Huge\huge\else
109 \small\SMC@unknown@warning
110 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
111 }
112 \newcommand\SMC@unknown@warning{\TBWarning{\string\SMC: nonstandard
113 text font size command -- using \string\small}}
114 \newcommand\textSMC[1]{{\SMC #1}}
115 \newcommand\acro[1]{\textSMC{#1}\@}
116 \def\endash{--}
117 \def\emdash{\endash-}
118 \def\thinskip{\hskip 0.16667em\relax}
119 \def\d@sh#1#2{\unskip#1\thinskip#2\thinskip\ignorespaces}
120 \def\Dash{\d@sh\nobreak\emdash}
121 \def\JPEG{\acro{JPEG}}
122 \def\PiC{P\kern-.05em\lower.5ex\hbox{I}\kern-.07emC\@}
123 \def\PNG{\acro{PNG}}
124 \def\PS{\acro{PS}}
125 \def\SVG{\acro{SVG}}
126 \makeatother
127
128 \def\EPS{\acro{EPS}}
129 \def\PDF{\acro{PDF}}
130 \def\SVG{\acro{SVG}}
131 \def\Xy{\leavevmode
132 \hbox{\kern-.1em X\kern-.15em\lower.4ex\hbox{Y\kern-.05em}}}
133 \def\textdegree{$^\circ$}% real \textdegree is too small
134 \def\RGB{\acro{RGB}}
135 \def\CMYK{\acro{CMYK}}
136
137 \iffalse
138 % workaround for acrobat 7+8 bugs in printing
139 \let\origtextattachfile=\textattachfile
140 \renewcommand{\textattachfile}[3][]{%
141 {\notextattachfile[#1]{#3}}%
142 \origtextattachfile[#1]{#2}{#3}%
143 }
144 \fi
145
146 \newcommand*{\showcol}[2][named]{%
147 \begingroup%
148 \setlength{\fboxsep}{0pt}%
149 \setlength{\fboxrule}{0.2pt}%
150 % \raisebox{1pt}{%
151 \fcolorbox{gray}[#1]{#2}{%
152 \makebox[1.5em]{\rule{0pt}{1.25ex}}%
153 }%
154 % }%
155 \endgroup%
156 }
157
158 \begin{document}
159
160 \hypersetup{
161 pdftitle={A Beginner's Guide to MetaPost for Creating High-Quality Graphics},
162 pdfauthor={Troy Henderson, Stephan Hennig},
163 pdfsubject={MetaPost},
164 pdfkeywords={graphics, MetaPost, TeX, LaTeX, PostScript},
165 pdfcopyright={Public Domain}
166 }
167
168 \title{A Beginner's Guide to \MP{}\\for Creating High-Quality Graphics}
169 \author{Troy Henderson \and Stephan Hennig}
170 \maketitle
171
172 \input{abstract}
173 \input{intro}
174 \input{compilation}
175 \input{data}
176 \input{commands}
177 \input{graph}
178 \input{inclusion}
179 \input{conclusion}
180 \input{biblio}
181
182 \end{document}