Debian Codegraph @

texmf-dist/doc/metapost/mp-gears/mp-gears-preamble.tex

raw
1
2 %\tcbuselibrary{documentation}
3 \usepackage{enumitem}
4 \usepackage[tikz]{bclogo}
5 \usepackage{mflogo}
6 \usepackage{hologo}
7 \usepackage[svgnames]{xcolor}
8 \usepackage{luamplib}
9 \mplibtextextlabel{enable}
10 \usepackage{biblatex}
11 \usepackage{wrapfig}
12 \usepackage{accsupp}
13 \usepackage{siunitx}
14 \usepackage{imakeidx}
15
16 \usepackage{pdflscape}
17 %\usepackage{csquotes}
18 \usepackage{fancyvrb,xparse,xargs}
19 \usepackage[sfdefault]{FiraSans}
20 \usepackage[mathrm=sym]{firamath-otf}
21 \setmonofont{Fira Mono}
22 %\setmonofont{FiraCode-Regular.ttf}[BoldFont= FiraCode-Bold.ttf,ItalicFont= FiraCode-RegularItalic.otf,BoldItalicFont= FiraCode-BoldItalic.otf,Ligatures={NoCommon, NoDiscretionary, NoHistoric, NoRequired, NoContextual}]
23
24 \usepackage{xspace}
25 \usepackage{animate}
26 \newcommand{\ctan}{\textsc{ctan}}
27 \NewDocumentCommand{\package}{ m }{%
28 \href{https://ctan.org/pkg/#1}{#1}\xspace
29 }
30
31 \definecolor{darkred}{rgb}{0.6,0.1,0.1}
32 \definecolor{vert}{rgb}{0.1,0.4,0.1}
33 \definecolor{bleu}{rgb}{0.2,0.2,0.6}
34 \definecolor{orange}{rgb}{0.6,0.4,0.}
35 \colorlet{code}{blue!80!black}
36
37 \usepackage[colorlinks=true,urlcolor=orange,linkcolor=orange,menucolor=black,citecolor=orange]{hyperref}
38
39 \newcommand \file {\nolinkurl}
40 \renewcommand \cmd {\texttt}
41 \renewcommand \code [1] {\texorpdfstring {\texttt{\color{code}#1}} {#1}}
42 \renewcommand*\cs [1] {\code{\textbackslash #1}}
43
44
45
46 \newcommand*\commande{\par\bigskip\noindent\hspace{-30pt}%
47 \SaveVerb[aftersave={%
48 \UseVerb{Vitem}%
49 }%
50 ]{Vitem}%
51 }
52 \newcommand\vitem[1][]{\SaveVerb[%
53 aftersave={\item[\textnormal{\UseVerb[#1]{vsave}}]}]{vsave}}
54
55
56 \newcommand*\textme[1]{\textcolor{black}{\rmfamily\textit{#1}}}
57 %\renewcommand*\meta[1]{% % meta
58 % \textme{\ensuremath{\langle}#1\ensuremath{\rangle}}}
59 \newcommand*\optstar{% % optional star
60 \meta{\ensuremath{*}}\xspace}
61 \DefineShortVerb{\|}
62 \newcommand\R{\mathbf{R}}
63 \setlength{\fboxsep}{2pt}
64 \fvset{%
65 codes={\catcode`\«\active \catcode`\×\active },
66 defineactive={\makefancyog\makefancytimes},
67 formatcom=\color{darkred},
68 frame=single
69 }
70 % rendre «...» équivalent à \meta{...}
71 {\catcode`\«\active
72 \newcommandx\makefancyog[0][addprefix=\global]{%
73 \def«##1»{\meta{##1}}}}
74 % rendre × équivalent à \optstar
75 {\catcode`\×\active
76 \newcommandx\makefancytimes[0][addprefix=\global]{%
77 \def×{\optstar{}}}}
78
79
80 \newcommand\mpgears{\texttt{mp-gears}\xspace}
81
82 \usepackage[most]{tcolorbox}
83 \tcbuselibrary{listings,breakable}
84
85
86 \lstset{
87 numberstyle=\footnotesize\color{vert},
88 keywordstyle=\ttfamily\bfseries\color{bleu},
89 basicstyle=\ttfamily,
90 commentstyle=\itshape\color{vert},
91 stringstyle=\ttfamily\color{orange},
92 showstringspaces=false,
93 language=MetaPost,
94 breaklines=true,
95 breakindent=30pt,
96 defaultdialect=MetaPost,
97 classoffset=1,% frame=tb
98 morekeywords={
99 baseCircle,
100 baseLine,
101 bottomCircle,
102 bottomLine,
103 buildCompoundGear,
104 buildExternalGear,
105 buildExternalGearPair,
106 buildExternalGearFor,
107 buildInternalGear,
108 buildInternalGearPair,
109 buildInternalGearFor,
110 buildRack,
111 buildGearRackPair,
112 buildRackFor,
113 cycloidCurve,
114 drawGear,
115 drawRack,
116 getBottomRadius,
117 getCenter,
118 getModule,
119 getPressureAngle,
120 getPrimitivePitch,
121 getPrimitiveRadius,
122 getRadialPoint,
123 getRotation,
124 getSpirographPoint,
125 getSpirographPointNbr,
126 getSpirographPointSize,
127 getTeethNbr,
128 getToothHeight,
129 getTopRadius,
130 getTranslation,
131 getUnit,
132 primitiveCircle,
133 primitiveLine,
134 setAxisColor,
135 setKeyColor,
136 setLineColor,
137 setSpirographPointSize,
138 setUnit,
139 spirographCurve,
140 topCircle,
141 topLine,
142 },
143 keywordstyle=\color{darkred},
144 classoffset=3,% frame=tb
145 morekeywords={},
146 keywordstyle=\color{vert},
147 classoffset=0,% frame=tb
148 morekeywords={},
149 keywordstyle=\color{bleu},
150 classoffset=4,% frame=tb
151 morekeywords={withtransparency},
152 keywordstyle=\color{blue!40}
153 }
154
155
156 \extractcolorspecs{darkred!3}\modelcmd\colorcmd
157 \makeatletter
158 \tcbset{%
159 listing metapost/.code={%
160 \def\tcbuselistingtext@input{\begin{mplibcode} verbatimtex
161 \leavevmode etex;input gears; background:=(\colorcmd); input \jobname.listing;
162 \end{mplibcode}}%
163 }
164 }
165 \makeatother
166 \newtcblisting[auto counter,]{ExempleMP}[1][]{%
167 arc=0pt,outer arc=0pt,
168 colback=darkred!3,
169 colframe=darkred,
170 breakable,fontupper=\small,
171 boxsep=0pt,left=5pt,right=5pt,top=5pt,bottom=5pt, bottomtitle =
172 3pt, toptitle=3pt,
173 boxrule=0pt,bottomrule=0.5pt,toprule=0.5pt, toprule at break =
174 0pt, bottomrule at break = 0pt,
175 %listing side text,
176 listing metapost,
177 title=Exemple~\thetcbcounter,
178 listing options={breaklines},#1
179 }
180
181 \newtcblisting{commandshell}{colback=black,colupper=white,colframe=black,
182 arc=0pt,
183 listing only,boxsep=0pt,listing
184 options={style=tcblatex,language=sh},
185 every listing line={\BeginAccSupp{ActualText={}}\textcolor{red}{\small\ttfamily\bfseries user \$> }}\EndAccSupp{}}
186
187
188 \newtcblisting{mpcode}[1][]{
189 arc=0pt,outer arc=0pt,
190 colback=darkred!3,
191 colframe=darkred,
192 breakable,
193 boxsep=0pt,left=5pt,right=5pt,top=5pt,bottom=5pt, bottomtitle =
194 3pt, toptitle=3pt,
195 boxrule=0pt,bottomrule=0.5pt,toprule=0.5pt, toprule at break =
196 0pt, bottomrule at break = 0pt,
197 listing only,boxsep=0pt,listing
198 options={breaklines},#1
199 }
200
201 \newtcblisting{latexcode}{
202 arc=0pt,outer arc=0pt,
203 colback=darkred!3,
204 colframe=darkred,
205 breakable,
206 boxsep=0pt,left=5pt,right=5pt,top=5pt,bottom=5pt, bottomtitle =
207 3pt, toptitle=3pt,
208 boxrule=0pt,bottomrule=0.5pt,toprule=0.5pt, toprule at break =
209 0pt, bottomrule at break = 0pt,
210 listing only,boxsep=0pt,listing
211 options={breaklines,language={[LaTeX]TeX}}
212 }
213
214
215 \newcommand\pdf{\textsc{pdf}}
216 \newcommand\typeMP[1]{\texorpdfstring{\texttt{\color{Tomato}#1}}{#1}}
217
218 \newcommand{\return}[1]{~$\rightarrow$~#1}
219 \newcommand{\indication}[1]{\hfill(\itshape #1)}
220
221
222 \newcommand{\gearsVersion}{0.2}
223 \newcommand{\gearsDate}{2026-05-05}
224
225 \usepackage{array,booktabs}
226 \usepackage{collcell}
227
228 \newcolumntype{H}{>{\collectcell\lstinline}l<{\endcollectcell}}
229
230 \newtcolorbox{colourband}[1][]{%
231 arc=0pt,outer arc=0pt,enhanced, breakable, spread sidewards, left*=0pt, right*=0pt, boxrule=0pt, colback=LightSteelBlue!10, #1}
232
233
234 \addbibresource{biblio.bib}
235 \addbibresource{ctan.bib}
236