├── .gitignore ├── GALLERY.jinja2 ├── GALLERY.md ├── LICENSE ├── README.md ├── gallery ├── 3d │ ├── 3dtest1.pdf │ ├── 3dtest1.png │ ├── 3dtest1.tex │ ├── 3dtest2.pdf │ ├── 3dtest2.png │ ├── 3dtest2.tex │ ├── test3d.pdf │ ├── test3d.png │ └── test3d.tex ├── Galileo │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ └── example2.tex ├── app_icon │ ├── app_icon.pdf │ ├── app_icon.png │ ├── app_icon.tex │ ├── app_icon2.pdf │ ├── app_icon2.png │ └── app_icon2.tex ├── avatar │ ├── README.md │ ├── avatar.pdf │ ├── avatar.png │ └── avatar.tex ├── balance │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ ├── example2.tex │ ├── example3.pdf │ ├── example3.png │ ├── example3.tex │ ├── example4.pdf │ ├── example4.png │ ├── example4.tex │ ├── example5.pdf │ ├── example5.png │ ├── example5.tex │ ├── example6.pdf │ ├── example6.png │ └── example6.tex ├── banner43.pdf ├── banner43.png ├── banner43.tex ├── basic │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ ├── example2.tex │ ├── example3.pdf │ ├── example3.png │ ├── example3.tex │ ├── example4.pdf │ ├── example4.png │ ├── example4.tex │ ├── example5.pdf │ ├── example5.png │ ├── example5.tex │ ├── example6.pdf │ ├── example6.png │ ├── example6.tex │ ├── example7.pdf │ ├── example7.png │ └── example7.tex ├── ceph_cluster.pdf ├── ceph_cluster.png ├── ceph_cluster.tex ├── circuit │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ ├── example2.tex │ ├── example3.pdf │ ├── example3.png │ └── example3.tex ├── clock │ ├── clock.pdf │ ├── clock.png │ ├── clock.tex │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ └── example2.tex ├── convex_lens │ ├── example.pdf │ ├── example.png │ ├── example.tex │ └── 动态凸透镜原理演示.pdf ├── falling_body │ ├── example.pdf │ ├── example.png │ └── example.tex ├── fibonacci_circle.pdf ├── fibonacci_circle.png ├── fibonacci_circle.tex ├── gravity │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ └── example2.tex ├── mandala │ ├── mandala.pdf │ ├── mandala.png │ └── mandala.tex ├── measuring_cylinder │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ ├── example2.tex │ ├── example3.pdf │ ├── example3.png │ ├── example3.tex │ ├── example4.pdf │ ├── example4.png │ └── example4.tex ├── mindmap │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ ├── example2.tex │ ├── example4.pdf │ ├── example4.png │ ├── example4.tex │ ├── mindmap_3.pdf │ ├── mindmap_3.png │ ├── mindmap_3.tex │ ├── simple.pdf │ ├── simple.png │ └── simple.tex ├── other │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ ├── example2.tex │ ├── example3.pdf │ ├── example3.png │ ├── example3.tex │ ├── example4.pdf │ ├── example4.png │ ├── example4.tex │ ├── example5.pdf │ ├── example5.png │ ├── example5.tex │ ├── example6.pdf │ ├── example6.png │ ├── example6.tex │ ├── example7.pdf │ ├── example7.png │ ├── example7.tex │ ├── example8.pdf │ ├── example8.png │ ├── example8.tex │ ├── example9.pdf │ ├── example9.png │ └── example9.tex ├── patterns │ ├── example_one.pdf │ ├── example_one.png │ ├── example_one.tex │ ├── example_two.pdf │ ├── example_two.png │ └── example_two.tex ├── pgfplots │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ ├── example2.tex │ ├── example3.pdf │ ├── example3.png │ ├── example3.tex │ ├── example_one.pdf │ ├── example_one.png │ └── example_one.tex ├── polygon │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ ├── example2.tex │ ├── example3.pdf │ ├── example3.png │ └── example3.tex ├── random_walk │ ├── example.pdf │ ├── example.png │ └── example.tex ├── refraction │ ├── refraction.pdf │ ├── refraction.png │ └── refraction.tex ├── ruler │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ ├── example2.tex │ ├── example3.pdf │ ├── example3.png │ └── example3.tex ├── spring │ ├── example.pdf │ ├── example.png │ ├── example.tex │ ├── example2.pdf │ ├── example2.png │ ├── example2.tex │ ├── example3.pdf │ ├── example3.png │ ├── example3.tex │ ├── example6.pdf │ ├── example6.png │ ├── example6.tex │ ├── example7.pdf │ ├── example7.png │ └── example7.tex ├── thermometer │ ├── example.pdf │ ├── example.png │ └── example.tex └── venn_diagram │ ├── example.pdf │ ├── example.png │ └── example.tex ├── generate_gallery.py ├── images ├── 点的相对偏移.png ├── 画圆.png ├── 画弧线.png ├── 画椭圆.png ├── 画直线.png ├── 画长方形.png └── 直线带箭头.png └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | ## Core latex/pdflatex auxiliary files: 2 | *.aux 3 | *.lof 4 | *.log 5 | *.lot 6 | *.fls 7 | *.out 8 | *.toc 9 | *.fmt 10 | *.fot 11 | *.cb 12 | *.cb2 13 | .*.lb 14 | 15 | ## Intermediate documents: 16 | *.dvi 17 | *.xdv 18 | *-converted-to.* 19 | # these rules might exclude image files for figures etc. 20 | # *.ps 21 | # *.eps 22 | # *.pdf 23 | 24 | ## Generated if empty string is given at "Please type another file name for output:" 25 | .pdf 26 | 27 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 28 | *.bbl 29 | *.bcf 30 | *.blg 31 | *-blx.aux 32 | *-blx.bib 33 | *.run.xml 34 | 35 | ## Build tool auxiliary files: 36 | *.fdb_latexmk 37 | *.synctex 38 | *.synctex(busy) 39 | *.synctex.gz 40 | *.synctex.gz(busy) 41 | *.pdfsync 42 | 43 | ## Auxiliary and intermediate files from other packages: 44 | # algorithms 45 | *.alg 46 | *.loa 47 | 48 | # achemso 49 | acs-*.bib 50 | 51 | # amsthm 52 | *.thm 53 | 54 | # beamer 55 | *.nav 56 | *.pre 57 | *.snm 58 | *.vrb 59 | 60 | # changes 61 | *.soc 62 | 63 | # cprotect 64 | *.cpt 65 | 66 | # elsarticle (documentclass of Elsevier journals) 67 | *.spl 68 | 69 | # endnotes 70 | *.ent 71 | 72 | # fixme 73 | *.lox 74 | 75 | # feynmf/feynmp 76 | *.mf 77 | *.mp 78 | *.t[1-9] 79 | *.t[1-9][0-9] 80 | *.tfm 81 | 82 | #(r)(e)ledmac/(r)(e)ledpar 83 | *.end 84 | *.?end 85 | *.[1-9] 86 | *.[1-9][0-9] 87 | *.[1-9][0-9][0-9] 88 | *.[1-9]R 89 | *.[1-9][0-9]R 90 | *.[1-9][0-9][0-9]R 91 | *.eledsec[1-9] 92 | *.eledsec[1-9]R 93 | *.eledsec[1-9][0-9] 94 | *.eledsec[1-9][0-9]R 95 | *.eledsec[1-9][0-9][0-9] 96 | *.eledsec[1-9][0-9][0-9]R 97 | 98 | # glossaries 99 | *.acn 100 | *.acr 101 | *.glg 102 | *.glo 103 | *.gls 104 | *.glsdefs 105 | 106 | # gnuplottex 107 | *-gnuplottex-* 108 | 109 | # gregoriotex 110 | *.gaux 111 | *.gtex 112 | 113 | # htlatex 114 | *.4ct 115 | *.4tc 116 | *.idv 117 | *.lg 118 | *.trc 119 | *.xref 120 | 121 | # hyperref 122 | *.brf 123 | 124 | # knitr 125 | *-concordance.tex 126 | # TODO Comment the next line if you want to keep your tikz graphics files 127 | *.tikz 128 | *-tikzDictionary 129 | 130 | # listings 131 | *.lol 132 | 133 | # makeidx 134 | *.idx 135 | *.ilg 136 | *.ind 137 | *.ist 138 | 139 | # minitoc 140 | *.maf 141 | *.mlf 142 | *.mlt 143 | *.mtc[0-9]* 144 | *.slf[0-9]* 145 | *.slt[0-9]* 146 | *.stc[0-9]* 147 | 148 | # minted 149 | _minted* 150 | *.pyg 151 | 152 | # morewrites 153 | *.mw 154 | 155 | # nomencl 156 | *.nlg 157 | *.nlo 158 | *.nls 159 | 160 | # pax 161 | *.pax 162 | 163 | # pdfpcnotes 164 | *.pdfpc 165 | 166 | # sagetex 167 | *.sagetex.sage 168 | *.sagetex.py 169 | *.sagetex.scmd 170 | 171 | # scrwfile 172 | *.wrt 173 | 174 | # sympy 175 | *.sout 176 | *.sympy 177 | sympy-plots-for-*.tex/ 178 | 179 | # pdfcomment 180 | *.upa 181 | *.upb 182 | 183 | # pythontex 184 | *.pytxcode 185 | pythontex-files-*/ 186 | 187 | # thmtools 188 | *.loe 189 | 190 | # TikZ & PGF 191 | *.dpth 192 | *.md5 193 | *.auxlock 194 | 195 | # todonotes 196 | *.tdo 197 | 198 | # easy-todo 199 | *.lod 200 | 201 | # xmpincl 202 | *.xmpi 203 | 204 | # xindy 205 | *.xdy 206 | 207 | # xypic precompiled matrices 208 | *.xyc 209 | 210 | # endfloat 211 | *.ttt 212 | *.fff 213 | 214 | # Latexian 215 | TSWLatexianTemp* 216 | 217 | ## Editors: 218 | # WinEdt 219 | *.bak 220 | *.sav 221 | 222 | # Texpad 223 | .texpadtmp 224 | 225 | # Kile 226 | *.backup 227 | 228 | # KBibTeX 229 | *~[0-9]* 230 | 231 | # auto folder when using emacs and auctex 232 | ./auto/* 233 | *.el 234 | 235 | # expex forward references with \gathertags 236 | *-tags.tex 237 | 238 | # standalone packages 239 | *.sta 240 | 241 | # generated if using elsarticle.cls 242 | *.spl 243 | 244 | 245 | .idea/ 246 | *.pyc 247 | 248 | venv/ -------------------------------------------------------------------------------- /GALLERY.jinja2: -------------------------------------------------------------------------------- 1 | ## tikz_gallery 2 | 3 | {% for item in link_data %} 4 | ### {{ item['name'] }} 5 | ![img]({{ item['png'] }}) 6 | 7 | 8 | [source code]({{ item['tex'] }}) 9 | 10 | --- 11 | 12 | {% endfor %} -------------------------------------------------------------------------------- /GALLERY.md: -------------------------------------------------------------------------------- 1 | ## tikz_gallery 2 | 3 | 4 | ### .\banner43 5 | ![img](gallery/./banner43.png) 6 | 7 | 8 | [source code](gallery/./banner43.tex) 9 | 10 | --- 11 | 12 | 13 | ### .\ceph_cluster 14 | ![img](gallery/./ceph_cluster.png) 15 | 16 | 17 | [source code](gallery/./ceph_cluster.tex) 18 | 19 | --- 20 | 21 | 22 | ### .\fibonacci_circle 23 | ![img](gallery/./fibonacci_circle.png) 24 | 25 | 26 | [source code](gallery/./fibonacci_circle.tex) 27 | 28 | --- 29 | 30 | 31 | ### 3d\3dtest1 32 | ![img](gallery/3d/3dtest1.png) 33 | 34 | 35 | [source code](gallery/3d/3dtest1.tex) 36 | 37 | --- 38 | 39 | 40 | ### 3d\3dtest2 41 | ![img](gallery/3d/3dtest2.png) 42 | 43 | 44 | [source code](gallery/3d/3dtest2.tex) 45 | 46 | --- 47 | 48 | 49 | ### 3d\test3d 50 | ![img](gallery/3d/test3d.png) 51 | 52 | 53 | [source code](gallery/3d/test3d.tex) 54 | 55 | --- 56 | 57 | 58 | ### app_icon\app_icon 59 | ![img](gallery/app_icon/app_icon.png) 60 | 61 | 62 | [source code](gallery/app_icon/app_icon.tex) 63 | 64 | --- 65 | 66 | 67 | ### app_icon\app_icon2 68 | ![img](gallery/app_icon/app_icon2.png) 69 | 70 | 71 | [source code](gallery/app_icon/app_icon2.tex) 72 | 73 | --- 74 | 75 | 76 | ### avatar\avatar 77 | ![img](gallery/avatar/avatar.png) 78 | 79 | 80 | [source code](gallery/avatar/avatar.tex) 81 | 82 | --- 83 | 84 | 85 | ### balance\example 86 | ![img](gallery/balance/example.png) 87 | 88 | 89 | [source code](gallery/balance/example.tex) 90 | 91 | --- 92 | 93 | 94 | ### balance\example2 95 | ![img](gallery/balance/example2.png) 96 | 97 | 98 | [source code](gallery/balance/example2.tex) 99 | 100 | --- 101 | 102 | 103 | ### balance\example3 104 | ![img](gallery/balance/example3.png) 105 | 106 | 107 | [source code](gallery/balance/example3.tex) 108 | 109 | --- 110 | 111 | 112 | ### balance\example4 113 | ![img](gallery/balance/example4.png) 114 | 115 | 116 | [source code](gallery/balance/example4.tex) 117 | 118 | --- 119 | 120 | 121 | ### balance\example5 122 | ![img](gallery/balance/example5.png) 123 | 124 | 125 | [source code](gallery/balance/example5.tex) 126 | 127 | --- 128 | 129 | 130 | ### balance\example6 131 | ![img](gallery/balance/example6.png) 132 | 133 | 134 | [source code](gallery/balance/example6.tex) 135 | 136 | --- 137 | 138 | 139 | ### basic\example 140 | ![img](gallery/basic/example.png) 141 | 142 | 143 | [source code](gallery/basic/example.tex) 144 | 145 | --- 146 | 147 | 148 | ### basic\example2 149 | ![img](gallery/basic/example2.png) 150 | 151 | 152 | [source code](gallery/basic/example2.tex) 153 | 154 | --- 155 | 156 | 157 | ### basic\example3 158 | ![img](gallery/basic/example3.png) 159 | 160 | 161 | [source code](gallery/basic/example3.tex) 162 | 163 | --- 164 | 165 | 166 | ### basic\example4 167 | ![img](gallery/basic/example4.png) 168 | 169 | 170 | [source code](gallery/basic/example4.tex) 171 | 172 | --- 173 | 174 | 175 | ### basic\example5 176 | ![img](gallery/basic/example5.png) 177 | 178 | 179 | [source code](gallery/basic/example5.tex) 180 | 181 | --- 182 | 183 | 184 | ### basic\example6 185 | ![img](gallery/basic/example6.png) 186 | 187 | 188 | [source code](gallery/basic/example6.tex) 189 | 190 | --- 191 | 192 | 193 | ### basic\example7 194 | ![img](gallery/basic/example7.png) 195 | 196 | 197 | [source code](gallery/basic/example7.tex) 198 | 199 | --- 200 | 201 | 202 | ### book_cover\book_cover 203 | ![img](gallery/book_cover/book_cover.png) 204 | 205 | 206 | [source code](gallery/book_cover/book_cover.tex) 207 | 208 | --- 209 | 210 | 211 | ### circuit\example 212 | ![img](gallery/circuit/example.png) 213 | 214 | 215 | [source code](gallery/circuit/example.tex) 216 | 217 | --- 218 | 219 | 220 | ### circuit\example2 221 | ![img](gallery/circuit/example2.png) 222 | 223 | 224 | [source code](gallery/circuit/example2.tex) 225 | 226 | --- 227 | 228 | 229 | ### circuit\example3 230 | ![img](gallery/circuit/example3.png) 231 | 232 | 233 | [source code](gallery/circuit/example3.tex) 234 | 235 | --- 236 | 237 | 238 | ### clock\clock 239 | ![img](gallery/clock/clock.png) 240 | 241 | 242 | [source code](gallery/clock/clock.tex) 243 | 244 | --- 245 | 246 | 247 | ### clock\example 248 | ![img](gallery/clock/example.png) 249 | 250 | 251 | [source code](gallery/clock/example.tex) 252 | 253 | --- 254 | 255 | 256 | ### clock\example2 257 | ![img](gallery/clock/example2.png) 258 | 259 | 260 | [source code](gallery/clock/example2.tex) 261 | 262 | --- 263 | 264 | 265 | ### convex_lens\example 266 | ![img](gallery/convex_lens/example.png) 267 | 268 | 269 | [source code](gallery/convex_lens/example.tex) 270 | 271 | --- 272 | 273 | 274 | ### falling_body\example 275 | ![img](gallery/falling_body/example.png) 276 | 277 | 278 | [source code](gallery/falling_body/example.tex) 279 | 280 | --- 281 | 282 | 283 | ### Galileo\example 284 | ![img](gallery/Galileo/example.png) 285 | 286 | 287 | [source code](gallery/Galileo/example.tex) 288 | 289 | --- 290 | 291 | 292 | ### Galileo\example2 293 | ![img](gallery/Galileo/example2.png) 294 | 295 | 296 | [source code](gallery/Galileo/example2.tex) 297 | 298 | --- 299 | 300 | 301 | ### gravity\example 302 | ![img](gallery/gravity/example.png) 303 | 304 | 305 | [source code](gallery/gravity/example.tex) 306 | 307 | --- 308 | 309 | 310 | ### gravity\example2 311 | ![img](gallery/gravity/example2.png) 312 | 313 | 314 | [source code](gallery/gravity/example2.tex) 315 | 316 | --- 317 | 318 | 319 | ### mandala\mandala 320 | ![img](gallery/mandala/mandala.png) 321 | 322 | 323 | [source code](gallery/mandala/mandala.tex) 324 | 325 | --- 326 | 327 | 328 | ### measuring_cylinder\example 329 | ![img](gallery/measuring_cylinder/example.png) 330 | 331 | 332 | [source code](gallery/measuring_cylinder/example.tex) 333 | 334 | --- 335 | 336 | 337 | ### measuring_cylinder\example2 338 | ![img](gallery/measuring_cylinder/example2.png) 339 | 340 | 341 | [source code](gallery/measuring_cylinder/example2.tex) 342 | 343 | --- 344 | 345 | 346 | ### measuring_cylinder\example3 347 | ![img](gallery/measuring_cylinder/example3.png) 348 | 349 | 350 | [source code](gallery/measuring_cylinder/example3.tex) 351 | 352 | --- 353 | 354 | 355 | ### measuring_cylinder\example4 356 | ![img](gallery/measuring_cylinder/example4.png) 357 | 358 | 359 | [source code](gallery/measuring_cylinder/example4.tex) 360 | 361 | --- 362 | 363 | 364 | ### mindmap\example 365 | ![img](gallery/mindmap/example.png) 366 | 367 | 368 | [source code](gallery/mindmap/example.tex) 369 | 370 | --- 371 | 372 | 373 | ### mindmap\example2 374 | ![img](gallery/mindmap/example2.png) 375 | 376 | 377 | [source code](gallery/mindmap/example2.tex) 378 | 379 | --- 380 | 381 | 382 | ### mindmap\example4 383 | ![img](gallery/mindmap/example4.png) 384 | 385 | 386 | [source code](gallery/mindmap/example4.tex) 387 | 388 | --- 389 | 390 | 391 | ### mindmap\mindmap_3 392 | ![img](gallery/mindmap/mindmap_3.png) 393 | 394 | 395 | [source code](gallery/mindmap/mindmap_3.tex) 396 | 397 | --- 398 | 399 | 400 | ### mindmap\simple 401 | ![img](gallery/mindmap/simple.png) 402 | 403 | 404 | [source code](gallery/mindmap/simple.tex) 405 | 406 | --- 407 | 408 | 409 | ### other\example 410 | ![img](gallery/other/example.png) 411 | 412 | 413 | [source code](gallery/other/example.tex) 414 | 415 | --- 416 | 417 | 418 | ### other\example2 419 | ![img](gallery/other/example2.png) 420 | 421 | 422 | [source code](gallery/other/example2.tex) 423 | 424 | --- 425 | 426 | 427 | ### other\example3 428 | ![img](gallery/other/example3.png) 429 | 430 | 431 | [source code](gallery/other/example3.tex) 432 | 433 | --- 434 | 435 | 436 | ### other\example4 437 | ![img](gallery/other/example4.png) 438 | 439 | 440 | [source code](gallery/other/example4.tex) 441 | 442 | --- 443 | 444 | 445 | ### other\example5 446 | ![img](gallery/other/example5.png) 447 | 448 | 449 | [source code](gallery/other/example5.tex) 450 | 451 | --- 452 | 453 | 454 | ### other\example6 455 | ![img](gallery/other/example6.png) 456 | 457 | 458 | [source code](gallery/other/example6.tex) 459 | 460 | --- 461 | 462 | 463 | ### other\example7 464 | ![img](gallery/other/example7.png) 465 | 466 | 467 | [source code](gallery/other/example7.tex) 468 | 469 | --- 470 | 471 | 472 | ### other\example8 473 | ![img](gallery/other/example8.png) 474 | 475 | 476 | [source code](gallery/other/example8.tex) 477 | 478 | --- 479 | 480 | 481 | ### other\example9 482 | ![img](gallery/other/example9.png) 483 | 484 | 485 | [source code](gallery/other/example9.tex) 486 | 487 | --- 488 | 489 | 490 | ### patterns\example_one 491 | ![img](gallery/patterns/example_one.png) 492 | 493 | 494 | [source code](gallery/patterns/example_one.tex) 495 | 496 | --- 497 | 498 | 499 | ### patterns\example_two 500 | ![img](gallery/patterns/example_two.png) 501 | 502 | 503 | [source code](gallery/patterns/example_two.tex) 504 | 505 | --- 506 | 507 | 508 | ### pgfplots\example 509 | ![img](gallery/pgfplots/example.png) 510 | 511 | 512 | [source code](gallery/pgfplots/example.tex) 513 | 514 | --- 515 | 516 | 517 | ### pgfplots\example2 518 | ![img](gallery/pgfplots/example2.png) 519 | 520 | 521 | [source code](gallery/pgfplots/example2.tex) 522 | 523 | --- 524 | 525 | 526 | ### pgfplots\example3 527 | ![img](gallery/pgfplots/example3.png) 528 | 529 | 530 | [source code](gallery/pgfplots/example3.tex) 531 | 532 | --- 533 | 534 | 535 | ### pgfplots\example_one 536 | ![img](gallery/pgfplots/example_one.png) 537 | 538 | 539 | [source code](gallery/pgfplots/example_one.tex) 540 | 541 | --- 542 | 543 | 544 | ### polygon\example 545 | ![img](gallery/polygon/example.png) 546 | 547 | 548 | [source code](gallery/polygon/example.tex) 549 | 550 | --- 551 | 552 | 553 | ### polygon\example2 554 | ![img](gallery/polygon/example2.png) 555 | 556 | 557 | [source code](gallery/polygon/example2.tex) 558 | 559 | --- 560 | 561 | 562 | ### polygon\example3 563 | ![img](gallery/polygon/example3.png) 564 | 565 | 566 | [source code](gallery/polygon/example3.tex) 567 | 568 | --- 569 | 570 | 571 | ### random_walk\example 572 | ![img](gallery/random_walk/example.png) 573 | 574 | 575 | [source code](gallery/random_walk/example.tex) 576 | 577 | --- 578 | 579 | 580 | ### refraction\refraction 581 | ![img](gallery/refraction/refraction.png) 582 | 583 | 584 | [source code](gallery/refraction/refraction.tex) 585 | 586 | --- 587 | 588 | 589 | ### ruler\example 590 | ![img](gallery/ruler/example.png) 591 | 592 | 593 | [source code](gallery/ruler/example.tex) 594 | 595 | --- 596 | 597 | 598 | ### ruler\example2 599 | ![img](gallery/ruler/example2.png) 600 | 601 | 602 | [source code](gallery/ruler/example2.tex) 603 | 604 | --- 605 | 606 | 607 | ### ruler\example3 608 | ![img](gallery/ruler/example3.png) 609 | 610 | 611 | [source code](gallery/ruler/example3.tex) 612 | 613 | --- 614 | 615 | 616 | ### spring\example 617 | ![img](gallery/spring/example.png) 618 | 619 | 620 | [source code](gallery/spring/example.tex) 621 | 622 | --- 623 | 624 | 625 | ### spring\example2 626 | ![img](gallery/spring/example2.png) 627 | 628 | 629 | [source code](gallery/spring/example2.tex) 630 | 631 | --- 632 | 633 | 634 | ### spring\example3 635 | ![img](gallery/spring/example3.png) 636 | 637 | 638 | [source code](gallery/spring/example3.tex) 639 | 640 | --- 641 | 642 | 643 | ### spring\example6 644 | ![img](gallery/spring/example6.png) 645 | 646 | 647 | [source code](gallery/spring/example6.tex) 648 | 649 | --- 650 | 651 | 652 | ### spring\example7 653 | ![img](gallery/spring/example7.png) 654 | 655 | 656 | [source code](gallery/spring/example7.tex) 657 | 658 | --- 659 | 660 | 661 | ### thermometer\example 662 | ![img](gallery/thermometer/example.png) 663 | 664 | 665 | [source code](gallery/thermometer/example.tex) 666 | 667 | --- 668 | 669 | 670 | ### venn_diagram\example 671 | ![img](gallery/venn_diagram/example.png) 672 | 673 | 674 | [source code](gallery/venn_diagram/example.tex) 675 | 676 | --- 677 | 678 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 萬澤 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TIKZ制图简要教程 2 | 3 | **请查看更多[tikz制图样例](GALLERY.md) **。 4 | 5 | ## beginning 6 | 7 | ### 准备工作 8 | 9 | 这里所谓的准备工作当然指你的 LaTeX 编译环境配置好,然后tikz宏包的加载是必须的。 10 | 11 | tikz有两种使用方法,一种命令式的,一种环境式的。命令式用tikz命令包围起来,命令式是inline模式的。环境式用tikzpicture环境命令包围起来。如下所示: 12 | 13 | ```latex 14 | \tikz{\draw (1,0) -- (0,1) -- (-1,0) -- (0,-1) -- cycle;} 15 | 16 | \begin{tikzpicture} 17 | \draw (1,0) -- (0,1) -- (-1,0) -- (0,-1) -- cycle; 18 | \end{tikzpicture} 19 | ``` 20 | 21 | ### 使用standalone类 22 | 23 | 用tikz绘制某个单独的图片而不是一般的A4页面推荐使用 **standalone** 类。如下所示: 24 | 25 | ```tex 26 | \documentclass[tikz,border=2pt]{standalone} 27 | \begin{document} 28 | \begin{tikzpicture} 29 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 30 | \draw[->] (-3,0) -- (3,0); 31 | \draw[->] (0,-3) -- (0,3); 32 | \draw (0,0) circle (1); 33 | \end{tikzpicture} 34 | \end{document} 35 | ``` 36 | 37 | ### 中文字显示问题 38 | 39 | 设置好中文环境即可,具体就是加入类似下面的代码: 40 | 41 | ``` 42 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 43 | \xeCJKsetup{PunctStyle=plain} 44 | \setCJKmainfont[ItalicFont=方正楷体简体]{思源宋体 CN} 45 | \setCJKsansfont{思源黑体 CN} 46 | \setCJKmonofont{方正楷体简体} 47 | ``` 48 | 49 | 50 | 51 | 52 | 53 | ### 画网格 54 | 55 | 画网格主要用于辅助绘图,其中 `help lines` 是个不错的参数设置。此外 `step` 用来控制网格之间的间距,可以color来设置网格的颜色,不过一般没那个必要。然后接下来第一个坐标点是网格的左底点,第二个坐标点是网格的右定点。 56 | 57 | ```latex 58 | \begin{tikzpicture} 59 | \draw[help lines] ( -5,-5 ) grid ( 5, 5); 60 | \end{tikzpicture} 61 | ``` 62 | 63 | 我们看到tikz的每一条命令最后都要跟一个分号“;”。 64 | 65 | ### 画直线 66 | 67 | ```latex 68 | \begin{tikzpicture} 69 | \draw[help lines] ( -5,-5 ) grid ( 5, 5); 70 | \draw[red] (-3,0) -- (3,0); 71 | \draw[red] (0,-3) -- (0,3); 72 | \end{tikzpicture} 73 | ``` 74 | 75 | 画直线就是两个坐标点相连,中间 `--` 符号表示直线的意思。之前网格是grid表示网格的意思。如果几个点用 `--` 符号连接起来,表示这几个点连着来画几条折线,有多个画直线命令依次执行的意思。 76 | 77 | 具体显示效果如下: 78 | 79 | ![img](images/画直线.png) 80 | 81 | ### 直线带上箭头 82 | 83 | draw命令可以跟上可选项 `->` ,这样直线的右端就有一个箭头了。此外还有: `->>` , `->|` , `-to` , `-latex` , `-stealth` 。 84 | 85 | 他们的效果从上到下依次演示如下: 86 | 87 | \begin{tikzpicture} 88 | \draw[->] (-3,3) -- (3,3); 89 | \draw[->>] (-3,2) -- (3,2); 90 | \draw[->|] (-3,1) -- (3,1); 91 | \draw[-to] (-3,0) -- (3,0); 92 | \draw[-latex] (-3,-1) -- (3,-1); 93 | \draw[-stealth] (-3,-2) -- (3,-2); 94 | \end{tikzpicture} 95 | 96 | ![img](images/直线带箭头.png) 97 | 98 | 类似的还有左端比如 `<-` ,或者两端比如 `latex-latex` ,这里就不多说了。 99 | 100 | ### 画圆 101 | 102 | ```latex 103 | \begin{tikzpicture} 104 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 105 | \draw[->] (-3,0) -- (3,0); 106 | \draw[->] (0,-3) -- (0,3); 107 | \draw (0,0) circle (1); 108 | \end{tikzpicture} 109 | ``` 110 | 111 | 其中第一个点是圆中心,circle表示画圆,第二个参数是半径大小。 112 | 113 | ![img](images/画圆.png) 114 | 115 | ### 画椭圆 116 | 117 | ```latex 118 | \begin{tikzpicture} 119 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 120 | \draw[->] (-3,0) -- (3,0); 121 | \draw[->] (0,-3) -- (0,3); 122 | \draw (0,0) ellipse (1 and 0.5); 123 | \end{tikzpicture} 124 | ``` 125 | 126 | 这里第一个点是椭圆的中心点,ellipse表示画椭圆,后面参数两个值第一个是a也就是椭圆的半长轴,第二个是b也就是椭圆的半短轴。 127 | 128 | ![img](images/画椭圆.png) 129 | 130 | ### 画弧线 131 | 132 | ```latex 133 | \begin{tikzpicture} 134 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 135 | \draw[->] (-3,0) -- (3,0); 136 | \draw[->] (0,-3) -- (0,3); 137 | \draw[color=gray!40] (0,0) circle (1); % 138 | \draw[color=red] (1,0) arc (0:45:1); 139 | \draw[color=gray!40] (0,0) ellipse (1 and 0.5); 140 | \draw[color=green] (1,0) arc (0:60:1 and 0.5); 141 | \end{tikzpicture} 142 | ``` 143 | 144 | 最基本的画弧线的命令如上代码第5行,其中第一个点是弧线的起点,然后arc表示画弧线,接下来括号里面的三个参数:第一个参数是开始的角度,第二个参数是结束时的角度,第三个参数是弧线对应圆的半径。对比第4行画的浅灰色的圆可以看出他们之间的关系。 145 | 146 | 上面代码第7行画弧线增加了一个and 和一个参数,这个时候画的弧线是根据椭圆来的,其中1是椭圆的半长轴,0.5是椭圆的半短轴。对比第6行画的浅灰色的椭圆可以看出他们的关系。 147 | 148 | ![img](images/画弧线.png) 149 | 150 | ### 画长方形 151 | 152 | ```latex 153 | \begin{tikzpicture}[scale=2] 154 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 155 | \draw[color=red] (-1,-1) rectangle (1,1); 156 | \end{tikzpicture} 157 | ``` 158 | 159 | 这里使用了可选项 **color=red** 来控制线条的颜色,然后画长方形的第一个点是左底点,rectangle表示画长方形,第二个点表示右顶点。 160 | 161 | ![img](images/画长方形.png) 162 | 163 | ### 放大图形 164 | 165 | 在tikzpicture环境后面跟上可选项 `[scale=2]` ,即将图形放大两倍。 166 | 167 | ## 确定点 168 | 169 | ### 点的定义 170 | 171 | 使用coordinate命令或者path命令附带coordinate来定义一个点。 172 | 173 | ```latex 174 | \begin{tikzpicture} 175 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 176 | \path (1,1) coordinate (p1); 177 | \coordinate (p2) at ( 2, 0); 178 | \draw[dotted, red] (p1) -- (p2) ; 179 | \end{tikzpicture} 180 | ``` 181 | 182 | ### 点的相对偏移 183 | 184 | 现在加上这样两行代码: 185 | 186 | ```latex 187 | \begin{tikzpicture}[scale=2] 188 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 189 | \draw[latex-latex, red] (0,-2) -- ++(-1,1) -- ++(-1,-1); 190 | \draw[dashed, blue] (0,1) -- +(-1,1) -- +(-2,0); 191 | \end{tikzpicture} 192 | ``` 193 | 194 | ![img](images/点的相对偏移.png) 195 | 196 | tikz中有一个重要的概念,当前点,然后点可以通过当前点根据相对偏移来确定一个新的点。上面代码第9行的 `++` 符号和第10行的 `+` 符号都根据当前点然后进行了 $\Delta x$ 和 $\Delta y$ 的相对偏移从而确定了一个新的点。这两个符号的区别在于是不是更新当前点数据。`++`符号更新当前点,而`+`符号不更新。 197 | 198 | `++`适合描述一连串逐渐变化的点,`+`适合描述多个点围绕着一个点变化的情况。 199 | 200 | ### 极座标 201 | 202 | tikz中的点也支持极座标表示,(30:1cm),第一个参数是极座标里面的角度,第二个参数是半径。 203 | 204 | 205 | 206 | ### node命令中点的定义 207 | 208 | ```latex 209 | \begin{tikzpicture} 210 | \node (node001) at (0,2) [draw] {test}; 211 | \end{tikzpicture} 212 | ``` 213 | 214 | 从这里可以看到只要写上draw选项外面就会加上一个长方形,也就是shape的默认选项是rectangle。如果你不希望外面有长方形,不写draw选项即可。 215 | 216 | 这里通过node命令定义了一个点,node001,在(0,2)那里。后面是可以使用的。 217 | ```latex 218 | \begin{tikzpicture} 219 | \node (node001) at (0,2) [draw] {node001}; 220 | \node (node002) at (-2,0) [draw] {node002}; 221 | \node (node003) at (2,0) [draw] {node003}; 222 | \draw (node cs:name=node003,anchor=north) |- (0,1); 223 | \draw (node002.north) |- (0,1) -| (node cs:name=node001,anchor=south); 224 | \end{tikzpicture} 225 | ``` 226 | 这里通过 `node cs:name=node003` 来获取之前那个node所在的点,然后通过 `anchor=north` 来定义那个node的接口在北边。除此之外的选项还有: `south` ,`east` ,`west` 。这里 `|-` 似乎是画垂直拐线的意思。上面的语法简写为可以node002.north。 227 | 228 | 此外还有 `angle` 选项控制node接口的开口角度。 229 | 230 | ### 两个点定义出一个点 231 | 232 | ```latex 233 | \begin{tikzpicture} 234 | \node (p1) at (30:1) {$p_1$} ; 235 | \node (p2) at (75:1) {$p_2$} ; 236 | \draw (-0.2,0) -- (1.2,0) node[right] (xline) {$q_1$}; 237 | \draw (2,-0.2) -- (2,1.2) node[above] (yline) {$q_2$}; 238 | 239 | \draw[->] (p1) -- (p1 |- xline); 240 | \end{tikzpicture} 241 | ``` 242 | 243 | 这种形式 `(p1 |- xline)` 表示取第一个点的x和第二个点的y组成一个新的点。如果是 `(p1 -| xline)` 表示取第二个点的x和第一个点的y组成一个新的点。 244 | ``` 245 | \begin{tikzpicture} 246 | \node (p1) at (30:1) {$p_1$} ; 247 | \node (p2) at (75:1) {$p_2$} ; 248 | \draw (-0.2,0) -- (1.2,0) node[right] (xline) {$q_1$}; 249 | \draw (2,-0.2) -- (2,1.2) node[above] (yline) {$q_2$}; 250 | 251 | \draw[->] (p1) -- (p1 |- xline); 252 | \end{tikzpicture} 253 | ``` 254 | 255 | ### 两个path的交点 256 | 257 | ```latex 258 | \begin{tikzpicture}[scale=3] 259 | \draw[help lines] (0,0) grid (2,2); 260 | \coordinate (A) at (0,0); 261 | \coordinate (B) at (2,0.5); 262 | \coordinate (C) at (2,0); 263 | \coordinate (D) at (0,2); 264 | \shade[ball color=red](A) circle (0.025) node[below] {A}; 265 | \shade[ball color=red](B) circle (0.025) node[below] {B}; 266 | \shade[ball color=red](C) circle (0.025) node[below] {C}; 267 | \shade[ball color=red](D) circle (0.025) node[below] {D}; 268 | \draw[name path=AB] (A) -- (B); 269 | \draw[name path=CD] (C) -- (D); 270 | \path[name intersections={of=AB and CD}] (intersection-1) coordinate (P); 271 | \shade[ball color=red](P) circle (0.025) node[below] {P}; 272 | \end{tikzpicture} 273 | ``` 274 | 275 | 这个例子用到了点的定义,点的标出,以及path交点的定义,要用到library: `intersections` 。有时候有些路径你不希望显示出来那么就用path命令来定义路径。 276 | 277 | ### 给新交点取名字 278 | 用 `by` 选项可以给画出来的交点取一个名字,默认的 `intersection-1` 之类的也可以使用。此外还可以加上选项: 279 | ```latex 280 | \begin{Verbatim} 281 | \path [name intersections={of=D and E, 282 | by={[label=above:$C$]C, [label=below:$C'$]C'}}]; 283 | \end{Verbatim} 284 | ``` 285 | 286 | 287 | ## 确定路径 288 | 289 | ### 线条 290 | 291 | path路径是最基本的命令,draw命令等价于 `\path[draw]` ,fill命令等价于 `\path[fill]` ,filldraw命令等价于 `\path[draw,fill]` ,其他clip,shade命令情况类似。 292 | 293 | ### 虚线和点线 294 | 线条除了之前说的dashed和dotted两种样式之外,还有loosely dashed,densely dashed和loosely dotted, densely dotted。 295 | 296 | ### 线条的粗细 297 | ```latex 298 | \begin{tikzpicture} 299 | \draw [ultra thick] (0,1) -- (2,1); 300 | \draw [thick] (0,0.5) -- (2,0.5); 301 | \draw [thin] (0,0) -- (2,0); 302 | \end{tikzpicture} 303 | ``` 304 | 其他选项还有 ultra thin , very thin, thin, semithick, very thick, ultra thick 305 | 306 | 或者直接通过可选项line width来定义。 307 | ```latex 308 | \begin{tikzpicture} 309 | \draw [line width=0.4pt] (0,0) -- (2,0); 310 | \draw[red] (0,1) -- (2,1); 311 | \draw [line width=0.2cm] (4,.75) -- (5,.25); 312 | \end{tikzpicture} 313 | ``` 314 | 315 | 316 | 317 | ### 贝塞尔曲线 318 | 贝塞尔曲线是四个点画出一个曲线。其中第一个点是起点,第四个点终点,然后另外两个点是控制点。 319 | 320 | ```latex 321 | \begin{tikzpicture}[scale=3] 322 | \draw[help lines] (0,0) grid (2,2); 323 | \draw[color=red] (0,0) .. controls (1,1) and (2,1) .. (2,0); 324 | \shade[ball color=gray!10] (0,0) circle (0.1); 325 | \shade[ball color=gray!40] (1,1) circle (0.1); 326 | \shade[ball color=gray!70] (2,1) circle (0.1); 327 | \shade[ball color=gray] (2,0) circle (0.1); 328 | \end{tikzpicture} 329 | ``` 330 | 331 | 上面第2行代码就是画贝塞尔曲线的代码。 332 | 333 | 334 | 335 | ## 自定义样式 336 | 337 | 前面提到的 `help lines` 就是tikz内部定义的一个样式,你也可以定义自己的样式。具体定义语法如下所示: 338 | 339 | ``` 340 | style001/.style={color=red,fill=red!20} 341 | ``` 342 | 343 | 上面定义了style001样式,原有的样式修改如下: 344 | 345 | ``` 346 | help lines/.style={color=blue!50} 347 | ``` 348 | 349 | 我们来看看效果: 350 | 351 | ```latex 352 | \documentclass[tikz,border=2pt]{standalone} 353 | 354 | \begin{document} 355 | 356 | \tikzset{help lines/.style={color=blue!50}} 357 | 358 | \begin{tikzpicture} 359 | \draw[help lines] (-5,-5) grid (5,5); 360 | 361 | \draw[->] (-3,0) -- (3,0); 362 | \draw[->] (0,-3) -- (0,3); 363 | \draw (0,0) circle (1); 364 | 365 | \end{tikzpicture} 366 | 367 | \end{document} 368 | ``` 369 | 370 | 371 | 372 | ### 样式带参数 373 | 374 | 自定义的样式还可以带上参数,这个可以了解下【下面还演示了设置该参数的默认值的方法】。 375 | 376 | ```latex 377 | \documentclass[tikz,border=2pt]{standalone} 378 | 379 | \begin{document} 380 | 381 | \tikzset{outline/.style={help lines, color=#1!50}} 382 | \tikzset{outline/.default=gray} 383 | 384 | \begin{tikzpicture} 385 | \draw[outline=red] (-5,-5) grid (5,5); 386 | 387 | \draw[->] (-3,0) -- (3,0); 388 | \draw[->] (0,-3) -- (0,3); 389 | \draw (0,0) circle (1); 390 | 391 | \end{tikzpicture} 392 | 393 | \end{document} 394 | ``` 395 | 396 | 397 | 398 | ## node 399 | 400 | 我们经常遇到那种思维导图绘图或者描述某些节点关系的图形其核心就是用好node命令。因为node命令很常用,我应该会在这块多花点心思。即使是node命令其也是建立在path命令之上的,其等于 `\path node ...` ,node命令的执行是你首先要定义一个path路径,然后在这个路径上加上去的节点。 401 | 402 | 一个简单的节点定义如下: 403 | 404 | ```latex 405 | \tikzset{nodestyle/.style={draw, fill=blue!50, text=black, 406 | minimum height=1cm, minimum width=2cm, font=\large, 407 | }} 408 | 409 | \node (node1) at (-2.5,0)[nodestyle] {osd}; 410 | ``` 411 | 412 | 上面对node的样式进行了一些调整好让节点格子好看一点: 413 | 414 | - draw 绘制的意思,默认shape=rectangle 415 | - fill 设置填充颜色 416 | - text 设置文本颜色 417 | - minimum height 设置格子的最小高度 418 | - minimum width 设置格子的最小宽度 419 | - font 设置格子里面文本的大小 类似的有 `\small` `\Large` 等。 420 | 421 | 422 | 423 | ### 多个node连接 424 | 425 | ```latex 426 | \usetikzlibrary{positioning} 427 | \tikzset{place/.style={circle,draw=blue!50,fill=blue!20, 428 | thick,inner sep=0pt,minimum size=6mm}} 429 | \tikzset{transition/.style={rectangle,draw=black!50, 430 | fill=black!20,thick,inner sep=0pt,minimum size=4mm}} 431 | \tikzset{every label/.style=red} 432 | \begin{tikzpicture}[bend angle=45] 433 | \node[place] (waiting) {}; 434 | \node[place] (critical) [below=of waiting] {}; 435 | \node[place](semaphore) [below=of critical,label=above:$s\le3$] {}; 436 | \node[transition](leave critical) [right=of critical]{}; 437 | \node[transition] (enter critical)[left=of critical]{}; 438 | \draw [->] (enter critical) to (critical); 439 | \draw [->] (waiting) to [bend right] (enter critical); 440 | \draw [->] (enter critical) to [bend right] (semaphore); 441 | \draw [->] (semaphore) to [bend right] (leave critical); 442 | \draw [->] (critical) to (leave critical); 443 | \draw [->] (leave critical) to [bend right] (waiting); 444 | \end{tikzpicture} 445 | ``` 446 | 447 | 这个例子需要加载positioning包,这个例子很好地展示了多个node和用箭头连接来表示他们关系的图形如何绘制。 448 | 449 | 450 | 451 | ## 小红球 452 | 453 | ``` 454 | \begin{tikzpicture} 455 | 456 | \shade[ball color=red] (1,2) circle (1); 457 | 458 | \end{tikzpicture} 459 | 460 | ``` 461 | 462 | 463 | 464 | ## tikz中的随机数 465 | 466 | `rand` 产生一个随机数,范围在-1~1之间。 467 | 468 | 469 | 470 | ## 画正多边形 471 | 472 | ```latex 473 | \begin{tikzpicture} 474 | \draw (0,0) circle (4) ; 475 | \coordinate (O) at (0,0); 476 | \shade[ball color=red](O) circle (0.1) node[below] {O}; 477 | \def\n{5} 478 | \pgfmathsetmacro\i{\n-1} 479 | \foreach \x in {0,...,\i} 480 | { 481 | \def\pointname{\x} 482 | \coordinate (\pointname) at ($(0,0) +(\x*360/\n:4cm)$) ; 483 | \shade[ball color=red](\pointname) circle (0.05) node[below] {\small \x}; 484 | } 485 | 486 | \draw (0) 487 | \foreach \x in {0,...,\i} 488 | { -- (\x) } -- cycle; 489 | 490 | \end{tikzpicture} 491 | \end{Verbatim} 492 | 493 | \begin{tikzpicture} 494 | \draw (0,0) circle (4) ; 495 | \coordinate (O) at (0,0); 496 | \shade[ball color=red](O) circle (0.1) node[below] {O}; 497 | \def\n{5} 498 | \pgfmathsetmacro\i{\n-1} 499 | \foreach \x in {0,...,\i} 500 | { 501 | \def\pointname{\x} 502 | \coordinate (\pointname) at ($(0,0) +(\x*360/\n:4cm)$) ; 503 | \shade[ball color=red](\pointname) circle (0.05) node[below] {\small \x}; 504 | } 505 | 506 | \draw (0) 507 | \foreach \x in {0,...,\i} 508 | { -- (\x) } -- cycle; 509 | ``` 510 | 511 | 512 | 这个例子核心内容是批量定义点和点的运算,把这个弄懂了,后面tikz的核心大门就为你打开了,然后很多图形都可以用简洁的命令生成出来了。 513 | 514 | 515 | 516 | ## scope环境 517 | 518 | scope环境就是作用域控制,一个局域环境,参数只影响内部,外部的参数也影响不进来,不过值得一提的是,定义的点外面也可以用。 519 | 520 | scope环境一个有用的特性的里面的clip命令不会影响到外面。 521 | 522 | ## 迭代语句 523 | 524 | ```latex 525 | \begin{tikzpicture} 526 | \draw[help lines] (0,0) grid (3,2); 527 | \foreach \x in {0,1,...,4} 528 | \draw[xshift=\x cm] (0,-1) -- (0,1); 529 | \end{tikzpicture} 530 | ``` 531 | 532 | 其中 `...` 表示一直这样有规律下去生成迭代列表。迭代语句有很多用法,详见后面的具体例子。 533 | 534 | ## 平移 535 | 536 | `xshift` ,x坐标轴平移。 `yshift` ,y坐标轴平移。 `rotate` ,旋转 。 注意xshift默认的单位并不是cm,如果要单位是cm需要写出来。 537 | 538 | ```latex 539 | \begin{tikzpicture} 540 | \draw[help lines] (0,0) grid (3,2); 541 | \draw (0,0) -- (1,1); 542 | \draw[red] (0,0) -- ([xshift=1cm] 1,1); 543 | \end{tikzpicture} 544 | ``` 545 | 546 | ## 旋转 547 | 548 | 后面加上可选项 `rotate=30` 即可,意思是图形逆时针旋转30度。 549 | 550 | ```latex 551 | \begin{tikzpicture} 552 | \draw (0,0)[rotate=30] ellipse (2 and 1); 553 | \end{tikzpicture} 554 | ``` 555 | 556 | ## 反对称 557 | 558 | xscale=-1或者yscale=-1就刚好相对y轴或x轴反对称。 559 | 560 | 561 | 562 | ## 电路图 563 | 564 | 用tikz绘制一般电路图的解决方案可以说是完美,首先需要加载宏包: 565 | 566 | \usetikzlibrary{circuits.ee.IEC} 567 | 568 | 然后电路基本的组成单元是以node的某个特定样式的形式引入的,比如电池: 569 | 570 | \node[battery] (battery) at(0,3) {}; 571 | 572 | 下面列出常用的符号列表 573 | 574 | ### 电路基本符号 575 | 576 | - **battery :** 电池 `\tikz[circuit ee IEC]{\node[battery] {};}` 577 | - **bulb :** 灯泡 `\tikz[circuit ee IEC]{\node[bulb] {};}` 578 | - **make contact :** 开关 `\tikz[circuit ee IEC]{\node[make contact] {};}` 579 | - **make contact :** 开关另一种形式 额外选项[set make contact graphic= var make contact IEC graphic]} `\tikz[circuit ee IEC,set make contact graphic= var make contact IEC graphic]{\node[make contact] {};}` 580 | - resistor 电阻 (加上选项[ohm=20k]则上面写上电阻数值) ` \tikz[circuit ee IEC]{\node[resistor] {};}` 581 | 582 | - contact 电线交点 ` \tikz[circuit ee IEC]{\node[contact] {};} ` 583 | - current direction to路径上加上电流方向(如果是`[\textbf{current direction'}]`则方向反向。) `\tikz[circuit ee IEC]{\draw (0,0) to[current direction] (1,0);} ` 584 | 585 | ### 连线问题 586 | 587 | 各个元器件之间的连线除了一般的 `--` 连直线外,还可以通过 `-|` 或者 `|-` 来处理垂直拐线的问题,其中 `-|` 你可以理解为从第一个点先横着走再竖着走,而 `|-` 你可以理解为先从第一个点竖着走再横着走。 588 | 589 | ### 翻转问题 590 | 591 | 四个基本的选项[ `point up ,point down, point left, point right`],分别是朝上,朝下,朝左和朝 右。 592 | 593 | 其他复杂的角度的处理方法不是用rotate选项,而是在路径上加上上面的电路符号选项,这样那些元器件会自动跟随路径对齐的。 594 | 595 | ### 电压表和电流表 596 | 597 | 电压表电流表实际上 `circuit ee IEC` 里面也有,不过不是我们(中国大陆)初高中物理书上常见的那种,而我们其实可以很简单的用node命令就画出了类似书本上的那种符号: 598 | 599 | ```latex 600 | \node[draw,circle,inner sep =1pt] (A) at (-2,1.5) {\footnotesize A}; 601 | \node[draw,circle,inner sep =1pt] (V) at (1,4) {\footnotesize V}; 602 | ``` 603 | 604 | 605 | 606 | ## 附录 607 | 608 | ### 单位 609 | 610 | tikz的单位继承自tex的单位系统,然后其默认的长度单位是cm。 611 | 612 | 613 | 614 | ### pgfplots宏包 615 | 616 | 坐标轴相关绘图或某些简单的函数绘图可以看看pgfplots宏包。 617 | 618 | #### 直接画函数 619 | 620 | ```latex 621 | \begin{tikzpicture} 622 | \begin{axis} 623 | \addplot {x^2}; 624 | \end{axis} 625 | \end{tikzpicture} 626 | ``` 627 | 628 | #### 根据数据点来 629 | 630 | ```latex 631 | \begin{tikzpicture} 632 | \begin{axis} 633 | \addplot coordinates 634 | {(0,0) 635 | (1,1) 636 | (2,3) 637 | (3,9)}; 638 | \end{axis} 639 | \end{tikzpicture} 640 | ``` 641 | 642 | ### 参考资料 643 | 644 | 1. Graphics with TikZ Andrew Mertz and William Slough 645 | 646 | 2. A very minimal introduction to TikZ Jacques Crémer 647 | 648 | 3. the tikz 官方文档,如果用texdoc命令调不出官方文档,用google搜索“tikz pdf”吧 649 | 650 | -------------------------------------------------------------------------------- /gallery/3d/3dtest1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/3d/3dtest1.pdf -------------------------------------------------------------------------------- /gallery/3d/3dtest1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/3d/3dtest1.png -------------------------------------------------------------------------------- /gallery/3d/3dtest1.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{tikz-3dplot} 4 | \begin{document} 5 | \begin{tikzpicture} 6 | [cube/.style={very thick,black}, 7 | grid/.style={very thin,gray}, 8 | axis/.style={->,blue,thick}] 9 | 10 | %draw a grid in the x-y plane 11 | \foreach \x in {-0.5,0,...,2.5} 12 | \foreach \y in {-0.5,0,...,2.5} 13 | { 14 | \draw[grid] (\x,-0.5) -- (\x,2.5); 15 | \draw[grid] (-0.5,\y) -- (2.5,\y); 16 | } 17 | 18 | %draw the axes 19 | \draw[axis] (0,0,0) -- (3,0,0) node[anchor=west]{$x$}; 20 | \draw[axis] (0,0,0) -- (0,3,0) node[anchor=west]{$y$}; 21 | \draw[axis] (0,0,0) -- (0,0,3) node[anchor=west]{$z$}; 22 | 23 | %draw the top and bottom of the cube 24 | \draw[cube] (0,0,0) -- (0,2,0) -- (2,2,0) -- (2,0,0) -- cycle; 25 | \draw[cube] (0,0,2) -- (0,2,2) -- (2,2,2) -- (2,0,2) -- cycle; 26 | 27 | %draw the edges of the cube 28 | \draw[cube] (0,0,0) -- (0,0,2); 29 | \draw[cube] (0,2,0) -- (0,2,2); 30 | \draw[cube] (2,0,0) -- (2,0,2); 31 | \draw[cube] (2,2,0) -- (2,2,2); 32 | 33 | \end{tikzpicture} 34 | 35 | 36 | \tdplotsetmaincoords{60}{125} 37 | \begin{tikzpicture} 38 | [tdplot_main_coords, 39 | cube/.style={very thick,black}, 40 | grid/.style={very thin,gray}, 41 | axis/.style={->,blue,thick}] 42 | 43 | %draw a grid in the x-y plane 44 | \foreach \x in {-0.5,0,...,2.5} 45 | \foreach \y in {-0.5,0,...,2.5} 46 | { 47 | \draw[grid] (\x,-0.5) -- (\x,2.5); 48 | \draw[grid] (-0.5,\y) -- (2.5,\y); 49 | } 50 | 51 | 52 | %draw the axes 53 | \draw[axis] (0,0,0) -- (3,0,0) node[anchor=west]{$x$}; 54 | \draw[axis] (0,0,0) -- (0,3,0) node[anchor=west]{$y$}; 55 | \draw[axis] (0,0,0) -- (0,0,3) node[anchor=west]{$z$}; 56 | 57 | %draw the top and bottom of the cube 58 | \draw[cube] (0,0,0) -- (0,2,0) -- (2,2,0) -- (2,0,0) -- cycle; 59 | \draw[cube] (0,0,2) -- (0,2,2) -- (2,2,2) -- (2,0,2) -- cycle; 60 | 61 | %draw the edges of the cube 62 | \draw[cube] (0,0,0) -- (0,0,2); 63 | \draw[cube] (0,2,0) -- (0,2,2); 64 | \draw[cube] (2,0,0) -- (2,0,2); 65 | \draw[cube] (2,2,0) -- (2,2,2); 66 | 67 | \end{tikzpicture} 68 | 69 | 70 | \end{document} -------------------------------------------------------------------------------- /gallery/3d/3dtest2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/3d/3dtest2.pdf -------------------------------------------------------------------------------- /gallery/3d/3dtest2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/3d/3dtest2.png -------------------------------------------------------------------------------- /gallery/3d/3dtest2.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | 4 | \begin{document} 5 | \begin{tikzpicture} 6 | %draw the axes 7 | \draw[->] (0,0,0) -- (3,0,0) node[anchor=west]{$x$}; 8 | \draw[->] (0,0,0) -- (0,3,0) node[anchor=west]{$y$}; 9 | \draw[->] (0,0,0) -- (0,0,3) node[anchor=west]{$z$}; 10 | %draw the top and bottom of the cube 11 | \draw (0,0,0) -- (0,2,0) -- (2,2,0) -- (2,0,0) -- cycle; 12 | \draw[] (0,0,2) -- (0,2,2) -- (2,2,2) -- (2,0,2) -- cycle; 13 | 14 | %draw the edges of the cube 15 | \draw[] (0,0,0) -- (0,0,2); 16 | \draw[] (0,2,0) -- (0,2,2); 17 | \draw[] (2,0,0) -- (2,0,2); 18 | \draw (2,2,0) -- (2,2,2); 19 | \end{tikzpicture} 20 | 21 | 22 | \begin{tikzpicture} 23 | %draw the axes 24 | \draw[->] (0,0,0) -- (6,0,0) node[anchor=west]{$x$}; 25 | \draw[->] (0,0,0) -- (0,6,0) node[anchor=west]{$y$}; 26 | \draw[->] (0,0,0) -- (0,0,6) node[anchor=west]{$z$}; 27 | 28 | \newcommand\cube[4][]{ 29 | \begin{scope}[#1]%长方体2 30 | \def\x{#2} 31 | \def\y{#3} 32 | \def\z{#4} 33 | \fill[gray!30] (0,0,\z) -- (\x,0,\z) -- (\x,\y,\z) -- (0,\y,\z); 34 | \fill[gray!10] (0,\y,\z)-- (0,\y,0) -- (\x,\y,0) -- (\x,\y,\z) ; 35 | \fill[gray!50] (\x,0,\z) -- (\x,0,0) -- (\x,\y,0) --(\x,\y,\z); 36 | \end{scope}} 37 | 38 | 39 | \cube[xshift=3cm]{3}{2}{3} 40 | 41 | \cube[yshift=4cm,xshift=2cm]{1}{1}{1} 42 | 43 | 44 | \end{tikzpicture} 45 | 46 | 47 | \begin{tikzpicture} 48 | %draw the axes 49 | \draw[->] (0,0,0) -- (6,0,0) node[anchor=west]{$x$}; 50 | \draw[->] (0,0,0) -- (0,6,0) node[anchor=west]{$y$}; 51 | \draw[->] (0,0,0) -- (0,0,6) node[anchor=west]{$z$}; 52 | 53 | \shade[ball color=red,opacity=0.9] (0,0,0) circle (1); 54 | 55 | \shade[ball color=blue,opacity=0.6] (0,0,1) circle (1); 56 | 57 | \shade[ball color=yellow,opacity=0.5] (0,0,2) circle (1); 58 | \end{tikzpicture} 59 | 60 | \end{document} -------------------------------------------------------------------------------- /gallery/3d/test3d.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/3d/test3d.pdf -------------------------------------------------------------------------------- /gallery/3d/test3d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/3d/test3d.png -------------------------------------------------------------------------------- /gallery/3d/test3d.tex: -------------------------------------------------------------------------------- 1 | %参考网站:http://tex.stackexchange.com/questions/42812/3d-bodies-in-tikz 2 | \documentclass[tikz,border=2pt]{standalone} 3 | 4 | \usetikzlibrary{3d,calc} 5 | 6 | \begin{document} 7 | 8 | \begin{tikzpicture} 9 | \draw (-1,0) arc (180:360:1cm and 0.5cm); 10 | \draw[dashed] (-1,0) arc (180:0:1cm and 0.5cm); 11 | \draw (0,1) arc (90:270:0.5cm and 1cm); 12 | \draw[dashed] (0,1) arc (90:-90:0.5cm and 1cm); 13 | \draw (0,0) circle (1cm); 14 | \shade[ball color=blue!10!white,opacity=0.20] (0,0) circle (1cm); 15 | \end{tikzpicture} 16 | 17 | \begin{tikzpicture} 18 | \draw (-1,0) arc (180:360:1cm and 0.5cm) -- (0,3) -- cycle; 19 | \draw[dashed] (-1,0) arc (180:0:1cm and 0.5cm); 20 | \shade[left color=blue!5!white,right color=blue!40!white,opacity=0.3] (-1,0) arc (180:360:1cm and 0.5cm) -- (0,3) -- cycle; 21 | \end{tikzpicture} 22 | 23 | \begin{tikzpicture} 24 | \draw (-1,0) arc (180:360:1cm and 0.5cm); 25 | \draw (-1,0) arc (180:0:1cm and 0.5cm); 26 | \draw (-2,-3) arc (180:370:2cm and 1cm); 27 | \draw[dashed] (-2,-3) arc (180:10:2cm and 1cm); 28 | \draw(-2,-2.9) -- (-1,0); 29 | \draw(2,-2.9) -- (1,0); 30 | \shade[left color=blue!5!white,right color=blue!60!white,opacity=0.3] (-1,0) arc (180:360:1cm and 0.5cm) -- (2,-3) arc (360:180:2cm and 1cm) -- cycle; 31 | \shade[left color=blue!5!white,right color=blue!60!white,opacity=0.3] (0,0) circle (1cm and 0.5cm); 32 | \end{tikzpicture} 33 | 34 | \end{document} 35 | -------------------------------------------------------------------------------- /gallery/Galileo/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/Galileo/example.pdf -------------------------------------------------------------------------------- /gallery/Galileo/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/Galileo/example.png -------------------------------------------------------------------------------- /gallery/Galileo/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | 7 | \usepackage{pgfplots} 8 | \usepackage{fontspec} 9 | \usepackage{xeCJK} 10 | \setCJKmainfont[ItalicFont=方正楷体简体]{思源宋体 CN} 11 | \setCJKsansfont{思源黑体 CN} 12 | \setCJKmonofont{方正楷体简体} 13 | 14 | 15 | \usetikzlibrary{intersections,calc,positioning} 16 | 17 | \begin{document} 18 | 19 | \begin{tikzpicture} 20 | \draw (0,0) to[out=-50 ,in=180] (2,-2) -- (5,-2); 21 | \fill[gray!50,rotate=-50] (0,0) rectangle (0.5,0.4); 22 | \node[below] at (2.5,-2) {水平毛巾表面}; 23 | 24 | \begin{scope}[xshift=5cm] 25 | \draw (0,0) to[out=-50 ,in=180] (2,-2) -- (5,-2); 26 | \fill[gray!50,rotate=-50] (0,0) rectangle (0.5,0.4); 27 | \node[below] at (2.5,-2) {水平棉布表面}; 28 | \end{scope} 29 | 30 | \begin{scope}[xshift=10cm] 31 | \draw (0,0) to[out=-50 ,in=180] (2,-2) -- (5,-2); 32 | \fill[gray!50,rotate=-50] (0,0) rectangle (0.5,0.4); 33 | \node[below] at (2.5,-2) {水平木板表面}; 34 | \end{scope} 35 | 36 | 37 | \end{tikzpicture} 38 | 39 | 40 | \end{document} -------------------------------------------------------------------------------- /gallery/Galileo/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/Galileo/example2.pdf -------------------------------------------------------------------------------- /gallery/Galileo/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/Galileo/example2.png -------------------------------------------------------------------------------- /gallery/Galileo/example2.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | \usetikzlibrary{intersections,calc,positioning,patterns,backgrounds} 7 | % 反剪切配置 8 | \tikzstyle{reverseclip}=[insert path={(current page.north east) -- 9 | (current page.south east) -- 10 | (current page.south west) -- 11 | (current page.north west) -- 12 | (current page.north east)} 13 | ] 14 | 15 | \begin{document} 16 | \begin{tikzpicture}[] 17 | %第一个例子 18 | \begin{scope}[] 19 | \begin{pgfonlayer}{background} 20 | \fill[pattern = crosshatch] (2,0) -- (6,0) -- (6.5,0.8) --(2.5,0.8) --cycle; 21 | \end{pgfonlayer} 22 | \draw (0,0) -- (2,0)--(0,1)--cycle; 23 | \draw (2.5,0.8) -- (0.5,1.8) -- (0,1); 24 | 25 | %小车 26 | \begin{scope}[densely dashed,xshift=0.5cm,yshift=1.2cm,rotate=-27] 27 | \draw (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle; 28 | \draw (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3)--cycle; 29 | \draw (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle; 30 | \draw (0,0) circle (0.1); 31 | \draw (0.5,0) circle (0.1); 32 | 33 | \begin{scope}%反剪切 34 | \begin{pgfinterruptboundingbox} 35 | \clip (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle [reverseclip]; 36 | \clip (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 37 | \clip (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 38 | \end{pgfinterruptboundingbox} 39 | \draw (0.7,0.15) circle (0.1); 40 | \draw (0.2,0.15) circle (0.1); 41 | \end{scope} 42 | \end{scope} 43 | %小车复制 44 | \begin{scope}[xshift=3cm,yshift=0.4cm,rotate=0] 45 | \draw[fill=white] (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle; 46 | \draw[fill=white] (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3)--cycle; 47 | \draw[fill=white] (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle; 48 | \draw[fill=white] (0,0) circle (0.1); 49 | \draw[fill=white] (0.5,0) circle (0.1); 50 | 51 | \begin{scope}%反剪切 52 | \begin{pgfinterruptboundingbox} 53 | \clip (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle [reverseclip]; 54 | \clip (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 55 | \clip (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 56 | \end{pgfinterruptboundingbox} 57 | \draw[fill=white] (0.7,0.15) circle (0.1); 58 | \draw[fill=white] (0.2,0.15) circle (0.1); 59 | \end{scope} 60 | \end{scope} 61 | \end{scope} 62 | 63 | 64 | %第二个例子 65 | \begin{scope}[yshift=-2cm] 66 | \begin{pgfonlayer}{background} 67 | \fill[pattern = grid] (2,0) -- (6,0) -- (6.5,0.8) --(2.5,0.8) --cycle; 68 | \end{pgfonlayer} 69 | \draw (0,0) -- (2,0)--(0,1)--cycle; 70 | \draw (2.5,0.8) -- (0.5,1.8) -- (0,1); 71 | 72 | %小车 73 | \begin{scope}[densely dashed,xshift=0.5cm,yshift=1.2cm,rotate=-27] 74 | \draw (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle; 75 | \draw (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3)--cycle; 76 | \draw (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle; 77 | \draw (0,0) circle (0.1); 78 | \draw (0.5,0) circle (0.1); 79 | 80 | \begin{scope}%反剪切 81 | \begin{pgfinterruptboundingbox} 82 | \clip (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle [reverseclip]; 83 | \clip (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 84 | \clip (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 85 | \end{pgfinterruptboundingbox} 86 | \draw (0.7,0.15) circle (0.1); 87 | \draw (0.2,0.15) circle (0.1); 88 | \end{scope} 89 | \end{scope} 90 | %小车复制 91 | \begin{scope}[xshift=4cm,yshift=0.4cm,rotate=0] 92 | \draw[fill=white] (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle; 93 | \draw[fill=white] (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3)--cycle; 94 | \draw[fill=white] (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle; 95 | \draw[fill=white] (0,0) circle (0.1); 96 | \draw[fill=white] (0.5,0) circle (0.1); 97 | 98 | \begin{scope}%反剪切 99 | \begin{pgfinterruptboundingbox} 100 | \clip (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle [reverseclip]; 101 | \clip (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 102 | \clip (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 103 | \end{pgfinterruptboundingbox} 104 | \draw[fill=white] (0.7,0.15) circle (0.1); 105 | \draw[fill=white] (0.2,0.15) circle (0.1); 106 | \end{scope} 107 | \end{scope} 108 | \end{scope} 109 | 110 | 111 | 112 | %第三个例子 113 | \begin{scope}[yshift=-4cm] 114 | \begin{pgfonlayer}{background} 115 | \fill[pattern = horizontal lines] (2,0) -- (6,0) -- (6.5,0.8) --(2.5,0.8) --cycle; 116 | \end{pgfonlayer} 117 | \draw (0,0) -- (2,0)--(0,1)--cycle; 118 | \draw (2.5,0.8) -- (0.5,1.8) -- (0,1); 119 | 120 | %小车 121 | \begin{scope}[densely dashed,xshift=0.5cm,yshift=1.2cm,rotate=-27] 122 | \draw (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle; 123 | \draw (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3)--cycle; 124 | \draw (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle; 125 | \draw (0,0) circle (0.1); 126 | \draw (0.5,0) circle (0.1); 127 | 128 | \begin{scope}%反剪切 129 | \begin{pgfinterruptboundingbox} 130 | \clip (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle [reverseclip]; 131 | \clip (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 132 | \clip (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 133 | \end{pgfinterruptboundingbox} 134 | \draw (0.7,0.15) circle (0.1); 135 | \draw (0.2,0.15) circle (0.1); 136 | \end{scope} 137 | \end{scope} 138 | %小车复制 139 | \begin{scope}[xshift=5cm,yshift=0.4cm,rotate=0] 140 | \draw[fill=white] (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle; 141 | \draw[fill=white] (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3)--cycle; 142 | \draw[fill=white] (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle; 143 | \draw[fill=white] (0,0) circle (0.1); 144 | \draw[fill=white] (0.5,0) circle (0.1); 145 | 146 | \begin{scope}%反剪切 147 | \begin{pgfinterruptboundingbox} 148 | \clip (-0.2,0.1) -- (0.7,0.1) --(0.7,0.3) -- (-0.2,0.3) --cycle [reverseclip]; 149 | \clip (-0.2,0.3) -- (0,0.5) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 150 | \clip (0.7,0.1)-- (0.9,0.3) -- (0.9,0.5) -- (0.7,0.3) --cycle [reverseclip]; 151 | \end{pgfinterruptboundingbox} 152 | \draw[fill=white] (0.7,0.15) circle (0.1); 153 | \draw[fill=white] (0.2,0.15) circle (0.1); 154 | \end{scope} 155 | \end{scope} 156 | \end{scope} 157 | \end{tikzpicture} 158 | 159 | 160 | \end{document} -------------------------------------------------------------------------------- /gallery/app_icon/app_icon.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/app_icon/app_icon.pdf -------------------------------------------------------------------------------- /gallery/app_icon/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/app_icon/app_icon.png -------------------------------------------------------------------------------- /gallery/app_icon/app_icon.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=0pt]{standalone} 2 | 3 | 4 | 5 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 6 | \xeCJKsetup{PunctStyle=plain} 7 | \setCJKmainfont[ItalicFont=KaiTi]{Source Han Serif CN} 8 | \setCJKsansfont{Source Han Sans CN} 9 | \setCJKmonofont{KaiTi} 10 | 11 | 12 | \begin{document} 13 | 14 | \tikzset{outline/.style={help lines, color=#1!50}} 15 | \tikzset{outline/.default=gray} 16 | \tikzset{nodestyle/.style={text=brown!50, 17 | minimum height=1cm, minimum width=1cm, font=\Huge, 18 | scale=2 19 | }} 20 | 21 | \pagecolor{blue!50} 22 | 23 | \begin{tikzpicture} 24 | 25 | 26 | %\draw[outline] (-2,-2) grid (2,2); 27 | 28 | \node (node1) at (-1,1)[nodestyle] {周}; 29 | \node (node1) at (1,1)[nodestyle] {易}; 30 | \node (node1) at (-1,-1)[nodestyle] {摇}; 31 | \node (node1) at (1,-1)[nodestyle] {卦}; 32 | 33 | 34 | \end{tikzpicture} 35 | 36 | 37 | \end{document} -------------------------------------------------------------------------------- /gallery/app_icon/app_icon2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/app_icon/app_icon2.pdf -------------------------------------------------------------------------------- /gallery/app_icon/app_icon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/app_icon/app_icon2.png -------------------------------------------------------------------------------- /gallery/app_icon/app_icon2.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=0pt]{standalone} 2 | 3 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 4 | \xeCJKsetup{PunctStyle=plain} 5 | \setCJKmainfont[ItalicFont=KaiTi]{Source Han Serif CN} 6 | \setCJKsansfont{Source Han Sans CN} 7 | \setCJKmonofont{KaiTi} 8 | 9 | \begin{document} 10 | \definecolor{OutlineColor}{HTML}{ffffff} 11 | \definecolor{PageColor}{HTML}{ffffff} 12 | 13 | \tikzset{outline/.style={ 14 | color=OutlineColor, 15 | line width = 0.5pt, 16 | xstep = 1, 17 | ystep = 1 18 | }} 19 | 20 | \tikzset{nodestyle/.style={ 21 | text=brown!50, 22 | minimum height=1cm, minimum width=1cm, 23 | font=\Huge\ttfamily\bfseries, 24 | scale=2, 25 | % anchor =base, 26 | % fill = gray, 27 | }} 28 | 29 | 30 | \pagecolor{blue!50} 31 | 32 | \begin{tikzpicture} 33 | 34 | 35 | %\draw[outline] (-2,-2) grid (2,2); 36 | %\fill[color=red] (0,0) circle (0.1) ; 37 | 38 | \node (node1) at (-1,1)[nodestyle] {公}; 39 | \node (node1) at (1,1)[nodestyle] {式}; 40 | \node (node1) at (-1,-1)[nodestyle] {助}; 41 | \node (node1) at (1,-1)[nodestyle] {手}; 42 | 43 | 44 | \end{tikzpicture} 45 | 46 | 47 | \end{document} -------------------------------------------------------------------------------- /gallery/avatar/README.md: -------------------------------------------------------------------------------- 1 | 本avatar由本人创造,代表个本人的形象,请勿乱用。 -------------------------------------------------------------------------------- /gallery/avatar/avatar.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/avatar/avatar.pdf -------------------------------------------------------------------------------- /gallery/avatar/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/avatar/avatar.png -------------------------------------------------------------------------------- /gallery/avatar/avatar.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=0pt]{standalone} 2 | 3 | 4 | 5 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 6 | \xeCJKsetup{PunctStyle=plain} 7 | \setCJKmainfont[ItalicFont=KaiTi]{Source Han Serif CN} 8 | \setCJKsansfont{Source Han Sans CN} 9 | \setCJKmonofont{KaiTi} 10 | 11 | 12 | \begin{document} 13 | 14 | \tikzset{outline/.style={help lines, color=#1!50}} 15 | \tikzset{outline/.default=gray} 16 | \tikzset{nodestyle/.style={text=brown!50, 17 | minimum height=1cm, minimum width=1cm, font=\Huge, 18 | scale=2 19 | }} 20 | 21 | %\pagecolor{blue!50} 22 | 23 | 24 | 25 | \begin{tikzpicture}[scale=4] 26 | %\draw[step=1,color=gray!40] (-2,-2) grid (2,2); 27 | 28 | 29 | \begin{scope}[rotate=245] 30 | \def\linewidth{6} 31 | \def\linecolor{black!50} 32 | %\draw (0,0) circle (1); 33 | \draw[color=\linecolor, line width=\linewidth] (0,-1) arc (-90:90:1); 34 | 35 | 36 | %\draw[black] (0,0.5) circle (0.5); 37 | \draw[color=\linecolor, line width=\linewidth] (0,0) arc (-90:90:0.5); 38 | 39 | 40 | %\draw[black] (0,-0.5) circle (0.5cm); 41 | \draw[color=\linecolor, line width=\linewidth] (0,0) arc (90:270:0.5); 42 | 43 | \fill[\linecolor] (0,-0.5) circle (0.05); 44 | 45 | \end{scope} 46 | 47 | 48 | 49 | \end{tikzpicture} 50 | 51 | 52 | \end{document} -------------------------------------------------------------------------------- /gallery/balance/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example.pdf -------------------------------------------------------------------------------- /gallery/balance/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example.png -------------------------------------------------------------------------------- /gallery/balance/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usepackage{pgfplots} 5 | \pgfplotsset{compat=newest} 6 | \usetikzlibrary{intersections,calc,positioning,backgrounds} 7 | 8 | 9 | \begin{document} 10 | 11 | \begin{tikzpicture} 12 | 13 | 14 | %刻度尺 15 | \begin{scope}[xscale=0.5] 16 | 17 | %显示的数值多少g 18 | \def\gnum{3.2} 19 | \pgfmathsetmacro{\gmove}{10*\gnum/2} 20 | %主线轴 21 | \def\startx{0} 22 | \def\endx{25} 23 | \pgfmathsetmacro{\stepx}{\startx+1} 24 | \pgfmathsetmacro{\stepxfive}{\startx+5} 25 | \pgfmathsetmacro{\stepxten}{\startx+10} 26 | 27 | \coordinate (startpoint) at (\startx,0) ; 28 | \coordinate (endpoint) at (\endx,0) ; 29 | \draw [](startpoint) -- (endpoint); 30 | 31 | \draw ($(startpoint) + (-3,-3.5)$) rectangle ($(endpoint) + (3,0)$); 32 | 33 | %细小刻度 34 | \foreach \x in {\startx,\stepx,...,\endx} 35 | \draw [](\x,0) -- (\x,-1); 36 | 37 | %5分之一刻度 38 | %\foreach \y in {\startx,\stepxfive,...,\endx} 39 | % \draw [] (\y,-1.6) -- (\y,0); 40 | 41 | 42 | %10分之一刻度 43 | \foreach \i in {\startx,\stepxfive,...,\endx} 44 | \draw [] (\i,-1.6) -- (\i,0) 45 | node[below=1.8cm] {\Huge \pgfmathprint{int(\i/5)}}; 46 | 47 | %unit 48 | \node at ($(endpoint) +(1,-2.3)$) {\Huge g}; 49 | 50 | 51 | %额外的修改 52 | \draw[line width =0.5cm,yshift=-0.25cm] (\gmove,0)-- +(2,0); 53 | \begin{scope}[yshift=-3cm] 54 | \draw[line width =0.5cm,yshift=-0.25cm] (\gmove,0)-- +(2,0); 55 | \end{scope} 56 | 57 | \end{scope} 58 | 59 | %刻度尺之外的修改 60 | \begin{pgfonlayer}{background} 61 | 62 | \begin{scope}[xshift=6.25cm,yshift=-4cm,xscale=1] 63 | \fill[gray!80] (0,0) -- (6.25,0) -- ++(3,0) -- ++(2,-2) -- ++(-3,0) -- ++(-1,1) -- (1,-1) -- (0.5,-2) -- (0,-2) ; 64 | \fill[gray!30] (0,0)-- (1.5,0) -- (1,8)-- (0,9) ; 65 | \fill[gray!50] (7.7,2) rectangle (10,3); 66 | \fill[gray!90] (9,1.5) rectangle (9.5,3.5); 67 | \fill[gray!80] (7.7,0) rectangle (8.5,6); 68 | \draw[line width=2pt] (2,7)--(3,6) -- (12,6)--(13,7); 69 | \end{scope} 70 | 71 | 72 | %反对称 73 | \begin{scope}[xshift=6.25cm,yshift=-4cm,xscale=-1] 74 | \fill[gray!80] (0,0) -- (6.25,0) -- ++(3,0) -- ++(2,-2) -- ++(-3,0) -- ++(-1,1) -- (1,-1) -- (0.5,-2) -- (0,-2) ; 75 | \fill[gray!30] (0,0)-- (1.5,0) -- (1,8)-- (0,9) ; 76 | \fill[gray!50] (7.7,2) rectangle (10,3); 77 | \fill[gray!90] (9,1.5) rectangle (9.5,3.5); 78 | \fill[gray!80] (7.7,0) rectangle (8.5,6); 79 | \draw[line width=2pt] (2,7)--(3,6) -- (12,6)--(13,7); 80 | \end{scope} 81 | 82 | \end{pgfonlayer} 83 | 84 | %简单非定量表盘 85 | \fill (6.25,1) circle (0.08); 86 | \fill[gray!30] (8.5,4) -- ++(1,1) to[out=90,in=90] ++(-6.5,0) -- +(1,-1); 87 | 88 | \begin{scope}[xshift=6.25cm,yshift=1cm] 89 | \foreach \x in {60,65,...,120} \draw[thick] (\x:5.5) -- (\x:4.8); 90 | \end{scope} 91 | 92 | \draw[ultra thick,->] (6.25,1) -- ++(80:5); 93 | 94 | %砝码1 95 | \begin{scope}[xshift=12cm,yshift=2cm] 96 | \fill[gray!50] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3) -- (-0.5,3) -- (-0.5,2.5) -- (-0.3,2.5) -- (-0.3,2) -- (-1,2) -- (-1,0) --cycle; 97 | \coordinate (weight-top) at (0,3); 98 | 99 | \node [above =0cm of weight-top]{\Huge 50g}; 100 | \end{scope} 101 | 102 | %砝码2 103 | \begin{scope}[xshift=14cm,yshift=2cm] 104 | \begin{scope}[scale=0.6] 105 | \fill[gray!50] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3) -- (-0.5,3) -- (-0.5,2.5) -- (-0.3,2.5) -- (-0.3,2) -- (-1,2) -- (-1,0) --cycle; 106 | \coordinate (weight-top) at (0,3); 107 | \end{scope} 108 | \node [above =0cm of weight-top]{\Huge 20g}; 109 | \end{scope} 110 | 111 | %砝码3 112 | \begin{scope}[xshift=16cm,yshift=2cm] 113 | \begin{scope}[scale=0.3] 114 | \fill[gray!50] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3) -- (-0.5,3) -- (-0.5,2.5) -- (-0.3,2.5) -- (-0.3,2) -- (-1,2) -- (-1,0) --cycle; 115 | \coordinate (weight-top) at (0,3); 116 | \end{scope} 117 | \node [above =0cm of weight-top]{\Huge 10g}; 118 | \end{scope} 119 | 120 | %待测物体 121 | 122 | 123 | 124 | \end{tikzpicture} 125 | 126 | 127 | \end{document} -------------------------------------------------------------------------------- /gallery/balance/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example2.pdf -------------------------------------------------------------------------------- /gallery/balance/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example2.png -------------------------------------------------------------------------------- /gallery/balance/example2.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usepackage{pgfplots} 5 | \pgfplotsset{compat=newest} 6 | \usetikzlibrary{intersections,calc,positioning,backgrounds} 7 | 8 | 9 | \begin{document} 10 | 11 | \begin{tikzpicture} 12 | 13 | 14 | %刻度尺 15 | \begin{scope}[xscale=0.5] 16 | 17 | %显示的数值多少g 18 | \def\gnum{3.4} 19 | \pgfmathsetmacro{\gmove}{10*\gnum/2} 20 | %主线轴 21 | \def\startx{0} 22 | \def\endx{25} 23 | \pgfmathsetmacro{\stepx}{\startx+1} 24 | \pgfmathsetmacro{\stepxfive}{\startx+5} 25 | \pgfmathsetmacro{\stepxten}{\startx+10} 26 | 27 | \coordinate (startpoint) at (\startx,0) ; 28 | \coordinate (endpoint) at (\endx,0) ; 29 | \draw [](startpoint) -- (endpoint); 30 | 31 | \draw ($(startpoint) + (-3,-3.5)$) rectangle ($(endpoint) + (3,0)$); 32 | 33 | %细小刻度 34 | \foreach \x in {\startx,\stepx,...,\endx} 35 | \draw [](\x,0) -- (\x,-1); 36 | 37 | %5分之一刻度 38 | %\foreach \y in {\startx,\stepxfive,...,\endx} 39 | % \draw [] (\y,-1.6) -- (\y,0); 40 | 41 | 42 | %10分之一刻度 43 | \foreach \i in {\startx,\stepxfive,...,\endx} 44 | \draw [] (\i,-1.6) -- (\i,0) 45 | node[below=1.8cm] {\Huge \pgfmathprint{int(\i/5)}}; 46 | 47 | %unit 48 | \node at ($(endpoint) +(1,-2.3)$) {\Huge g}; 49 | 50 | 51 | %额外的修改 52 | \draw[line width =0.5cm,yshift=-0.25cm] (\gmove,0)-- +(2,0); 53 | \begin{scope}[yshift=-3cm] 54 | \draw[line width =0.5cm,yshift=-0.25cm] (\gmove,0)-- +(2,0); 55 | \end{scope} 56 | 57 | \end{scope} 58 | 59 | %刻度尺之外的修改 60 | 61 | %简单非定量表盘 62 | 63 | 64 | \begin{scope}[xshift=2cm,yshift=1cm] 65 | \fill (0,0) circle (0.08); 66 | \fill[gray!30] (2.25,3) -- ++(1,1) to[out=90,in=90] ++(-6.5,0) -- +(1,-1); 67 | \foreach \x in {60,65,...,120} \draw[thick] (\x:5.5) -- (\x:4.8); 68 | \draw[ultra thick,->] (0,0) -- ++(100:5); 69 | \end{scope} 70 | 71 | 72 | 73 | %砝码1 74 | \begin{scope}[xshift=7cm,yshift=1cm] 75 | \fill[gray!50] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3) -- (-0.5,3) -- (-0.5,2.5) -- (-0.3,2.5) -- (-0.3,2) -- (-1,2) -- (-1,0) --cycle; 76 | \coordinate (weight-top) at (0,3); 77 | 78 | \node [above =0cm of weight-top]{\Huge 50g}; 79 | \end{scope} 80 | 81 | %砝码2 82 | \begin{scope}[xshift=9cm,yshift=1cm] 83 | \begin{scope}[scale=0.6] 84 | \fill[gray!50] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3) -- (-0.5,3) -- (-0.5,2.5) -- (-0.3,2.5) -- (-0.3,2) -- (-1,2) -- (-1,0) --cycle; 85 | \coordinate (weight-top) at (0,3); 86 | \end{scope} 87 | \node [above =0cm of weight-top]{\Huge 20g}; 88 | \end{scope} 89 | 90 | %砝码3 91 | \begin{scope}[xshift=11cm,yshift=1cm] 92 | \begin{scope}[scale=0.3] 93 | \fill[gray!50] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3) -- (-0.5,3) -- (-0.5,2.5) -- (-0.3,2.5) -- (-0.3,2) -- (-1,2) -- (-1,0) --cycle; 94 | \coordinate (weight-top) at (0,3); 95 | \end{scope} 96 | \node [above =0cm of weight-top]{\Huge 10g}; 97 | \end{scope} 98 | 99 | 100 | 101 | 102 | 103 | %待测物体 104 | 105 | 106 | 107 | \end{tikzpicture} 108 | 109 | 110 | \end{document} -------------------------------------------------------------------------------- /gallery/balance/example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example3.pdf -------------------------------------------------------------------------------- /gallery/balance/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example3.png -------------------------------------------------------------------------------- /gallery/balance/example3.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usepackage{pgfplots} 5 | \pgfplotsset{compat=newest} 6 | 7 | 8 | \begin{document} 9 | \begin{tikzpicture}[scale=4] 10 | 11 | \fill[gray!50] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3) -- (-0.5,3) -- (-0.5,2.5) -- (-0.3,2.5) -- (-0.3,2) -- (-1,2) --(-1,0) --cycle; 12 | 13 | 14 | 15 | \end{tikzpicture} 16 | \end{document} -------------------------------------------------------------------------------- /gallery/balance/example4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example4.pdf -------------------------------------------------------------------------------- /gallery/balance/example4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example4.png -------------------------------------------------------------------------------- /gallery/balance/example4.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | 7 | \usepackage{pgfplots} 8 | 9 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 10 | \xeCJKsetup{PunctStyle=plain} 11 | \setCJKmainfont[ItalicFont=KaiTi]{Source Han Serif CN} 12 | \setCJKsansfont{Source Han Sans CN} 13 | \setCJKmonofont{KaiTi} 14 | 15 | \usetikzlibrary{intersections,calc,positioning} 16 | 17 | \begin{document} 18 | 19 | \begin{tikzpicture}[xscale=0.5] 20 | 21 | %主线轴 22 | \def\startx{0} 23 | \def\endx{25} 24 | \pgfmathsetmacro{\stepx}{\startx+1} 25 | \pgfmathsetmacro{\stepxfive}{\startx+5} 26 | \pgfmathsetmacro{\stepxten}{\startx+10} 27 | 28 | \coordinate (startpoint) at (\startx,0) ; 29 | \coordinate (endpoint) at (\endx,0) ; 30 | \draw [](startpoint) -- (endpoint); 31 | 32 | \draw ($(startpoint) + (-3,-3.5)$) rectangle ($(endpoint) + (3,0)$); 33 | 34 | %细小刻度 35 | \foreach \x in {\startx,\stepx,...,\endx} 36 | \draw [](\x,0) -- (\x,-1); 37 | 38 | %5分之一刻度 39 | %\foreach \y in {\startx,\stepxfive,...,\endx} 40 | % \draw [] (\y,-1.6) -- (\y,0); 41 | 42 | 43 | %10分之一刻度 44 | \foreach \i in {\startx,\stepxfive,...,\endx} 45 | \draw [] (\i,-1.6) -- (\i,0) 46 | node[below=1.8cm] {\Huge \pgfmathprint{int(\i/5)}}; 47 | 48 | %unit 49 | \node at ($(endpoint) +(1,-2.3)$) {\Huge g}; 50 | 51 | 52 | %额外的修改 53 | \draw[line width =0.5cm,yshift=-0.25cm] (6,0)-- (8,0); 54 | \begin{scope}[yshift=-3cm] 55 | \draw[line width =0.5cm,yshift=-0.25cm] (6,0)-- (8,0); 56 | \end{scope} 57 | 58 | 59 | 60 | \end{tikzpicture} 61 | 62 | 63 | \end{document} -------------------------------------------------------------------------------- /gallery/balance/example5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example5.pdf -------------------------------------------------------------------------------- /gallery/balance/example5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example5.png -------------------------------------------------------------------------------- /gallery/balance/example5.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usepackage{pgfplots} 5 | \pgfplotsset{compat=newest} 6 | \usetikzlibrary{intersections,calc,positioning,backgrounds} 7 | 8 | 9 | \begin{document} 10 | 11 | \begin{tikzpicture} 12 | 13 | 14 | %刻度尺 15 | \begin{scope}[xscale=0.5] 16 | 17 | %显示的数值多少g 18 | \def\gnum{1.4} 19 | \pgfmathsetmacro{\gmove}{10*\gnum/2} 20 | %主线轴 21 | \def\startx{0} 22 | \def\endx{25} 23 | \pgfmathsetmacro{\stepx}{\startx+1} 24 | \pgfmathsetmacro{\stepxfive}{\startx+5} 25 | \pgfmathsetmacro{\stepxten}{\startx+10} 26 | 27 | \coordinate (startpoint) at (\startx,0) ; 28 | \coordinate (endpoint) at (\endx,0) ; 29 | \draw [](startpoint) -- (endpoint); 30 | 31 | \draw ($(startpoint) + (-3,-3.5)$) rectangle ($(endpoint) + (3,0)$); 32 | 33 | %细小刻度 34 | \foreach \x in {\startx,\stepx,...,\endx} 35 | \draw [](\x,0) -- (\x,-1); 36 | 37 | %5分之一刻度 38 | %\foreach \y in {\startx,\stepxfive,...,\endx} 39 | % \draw [] (\y,-1.6) -- (\y,0); 40 | 41 | 42 | %10分之一刻度 43 | \foreach \i in {\startx,\stepxfive,...,\endx} 44 | \draw [] (\i,-1.6) -- (\i,0) 45 | node[below=1.8cm] {\Huge \pgfmathprint{int(\i/5)}}; 46 | 47 | %unit 48 | \node at ($(endpoint) +(1,-2.3)$) {\Huge g}; 49 | 50 | 51 | %额外的修改 52 | \draw[line width =0.5cm,yshift=-0.25cm] (\gmove,0)-- +(2,0); 53 | \begin{scope}[yshift=-3cm] 54 | \draw[line width =0.5cm,yshift=-0.25cm] (\gmove,0)-- +(2,0); 55 | \end{scope} 56 | 57 | \end{scope} 58 | 59 | %刻度尺之外的修改 60 | \begin{pgfonlayer}{background} 61 | 62 | \begin{scope}[xshift=6.25cm,yshift=-4cm,xscale=1] 63 | \fill[gray!80] (0,0) -- (6.25,0) -- ++(3,0) -- ++(2,-2) -- ++(-3,0) -- ++(-1,1) -- (1,-1) -- (0.5,-2) -- (0,-2) ; 64 | \fill[gray!30] (0,0)-- (1.5,0) -- (1,8)-- (0,9) ; 65 | \fill[gray!50] (7.7,2) rectangle (10,3); 66 | \fill[gray!90] (9,1.5) rectangle (9.5,3.5); 67 | \fill[gray!80] (7.7,0) rectangle (8.5,6); 68 | \draw[line width=2pt] (2,7)--(3,6) -- (12,6)--(13,7); 69 | \end{scope} 70 | 71 | 72 | %反对称 73 | \begin{scope}[xshift=6.25cm,yshift=-4cm,xscale=-1] 74 | \fill[gray!80] (0,0) -- (6.25,0) -- ++(3,0) -- ++(2,-2) -- ++(-3,0) -- ++(-1,1) -- (1,-1) -- (0.5,-2) -- (0,-2) ; 75 | \fill[gray!30] (0,0)-- (1.5,0) -- (1,8)-- (0,9) ; 76 | \fill[gray!50] (7.7,2) rectangle (10,3); 77 | \fill[gray!90] (9,1.5) rectangle (9.5,3.5); 78 | \fill[gray!80] (7.7,0) rectangle (8.5,6); 79 | \draw[line width=2pt] (2,7)--(3,6) -- (12,6)--(13,7); 80 | \end{scope} 81 | 82 | \end{pgfonlayer} 83 | 84 | %简单非定量表盘 85 | \fill (6.25,1) circle (0.08); 86 | \fill[gray!30] (8.5,4) -- ++(1,1) to[out=90,in=90] ++(-6.5,0) -- +(1,-1); 87 | 88 | \begin{scope}[xshift=6.25cm,yshift=1cm] 89 | \foreach \x in {60,65,...,120} \draw[thick] (\x:5.5) -- (\x:4.8); 90 | \end{scope} 91 | 92 | \draw[ultra thick,->] (6.25,1) -- ++(90:5); 93 | 94 | %砝码1 95 | \begin{scope}[xshift=12cm,yshift=2cm] 96 | \fill[gray!50] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3) -- (-0.5,3) -- (-0.5,2.5) -- (-0.3,2.5) -- (-0.3,2) -- (-1,2) -- (-1,0) --cycle; 97 | \coordinate (weight-top) at (0,3); 98 | 99 | \node [above =0cm of weight-top]{\Huge 50g}; 100 | \end{scope} 101 | 102 | %砝码2 103 | \begin{scope}[xshift=14cm,yshift=2cm] 104 | \begin{scope}[scale=0.6] 105 | \fill[gray!50] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3) -- (-0.5,3) -- (-0.5,2.5) -- (-0.3,2.5) -- (-0.3,2) -- (-1,2) -- (-1,0) --cycle; 106 | \coordinate (weight-top) at (0,3); 107 | \end{scope} 108 | \node [above =0cm of weight-top]{\Huge 20g}; 109 | \end{scope} 110 | 111 | %砝码3 112 | \begin{scope}[xshift=16cm,yshift=2cm] 113 | \begin{scope}[scale=0.3] 114 | \fill[gray!50] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3) -- (-0.5,3) -- (-0.5,2.5) -- (-0.3,2.5) -- (-0.3,2) -- (-1,2) -- (-1,0) --cycle; 115 | \coordinate (weight-top) at (0,3); 116 | \end{scope} 117 | \node [above =0cm of weight-top]{\Huge 10g}; 118 | \end{scope} 119 | 120 | %待测物体 121 | \begin{scope}[scale=0.5,xshift=-2cm,yshift=3.7cm] 122 | \def\ml{7} 123 | \pgfmathsetmacro{\mlnum}{\ml+0.13} 124 | \definecolor{cf3a7bc2}{RGB}{58,123,194} 125 | \path[fill=cf3a7bc2!50] (-5,0.4) -- (5,0.4) --(5,\mlnum) .. controls ($(0.8,\mlnum) + (0,-0.2)$) and ($(-0.8,\mlnum) + (0,-0.2)$) .. (-5,\mlnum) --cycle ; 126 | 127 | \draw (-5,0.4) -- (5,0.4) --(5,12) -- (-5.4,12) -- (-5,11.5) --cycle ; 128 | \end{scope} 129 | 130 | \end{tikzpicture} 131 | 132 | 133 | \end{document} -------------------------------------------------------------------------------- /gallery/balance/example6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example6.pdf -------------------------------------------------------------------------------- /gallery/balance/example6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/balance/example6.png -------------------------------------------------------------------------------- /gallery/balance/example6.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usepackage{pgfplots} 5 | \pgfplotsset{compat=newest} 6 | \usetikzlibrary{intersections,calc,positioning,backgrounds} 7 | 8 | 9 | \begin{document} 10 | 11 | \begin{tikzpicture} 12 | 13 | 14 | %刻度尺 15 | \begin{scope}[xscale=0.5] 16 | 17 | %显示的数值多少g 18 | \def\gnum{3.2} 19 | \pgfmathsetmacro{\gmove}{10*\gnum/2} 20 | %主线轴 21 | \def\startx{0} 22 | \def\endx{25} 23 | \pgfmathsetmacro{\stepx}{\startx+1} 24 | \pgfmathsetmacro{\stepxfive}{\startx+5} 25 | \pgfmathsetmacro{\stepxten}{\startx+10} 26 | 27 | \coordinate (startpoint) at (\startx,0) ; 28 | \coordinate (endpoint) at (\endx,0) ; 29 | \draw [](startpoint) -- (endpoint); 30 | 31 | \draw ($(startpoint) + (-3,-3.5)$) rectangle ($(endpoint) + (3,0)$); 32 | 33 | %细小刻度 34 | \foreach \x in {\startx,\stepx,...,\endx} 35 | \draw [](\x,0) -- (\x,-1); 36 | 37 | %5分之一刻度 38 | %\foreach \y in {\startx,\stepxfive,...,\endx} 39 | % \draw [] (\y,-1.6) -- (\y,0); 40 | 41 | 42 | %10分之一刻度 43 | \foreach \i in {\startx,\stepxfive,...,\endx} 44 | \draw [] (\i,-1.6) -- (\i,0) 45 | node[below=1.8cm] {\Huge \pgfmathprint{int(\i/5)}}; 46 | 47 | %unit 48 | \node at ($(endpoint) +(1,-2.3)$) {\Huge g}; 49 | 50 | 51 | %额外的修改 52 | \draw[line width =0.5cm,yshift=-0.25cm] (\gmove,0)-- +(2,0); 53 | \begin{scope}[yshift=-3cm] 54 | \draw[line width =0.5cm,yshift=-0.25cm] (\gmove,0)-- +(2,0); 55 | \end{scope} 56 | 57 | \end{scope} 58 | 59 | %刻度尺之外的修改 60 | \begin{pgfonlayer}{background} 61 | 62 | \begin{scope}[xshift=6.25cm,yshift=-4cm,xscale=1] 63 | \fill[gray!80] (0,0) -- (6.25,0) -- ++(3,0) -- ++(2,-2) -- ++(-3,0) -- ++(-1,1) -- (1,-1) -- (0.5,-2) -- (0,-2) ; 64 | \fill[gray!30] (0,0)-- (1.5,0) -- (1,8)-- (0,9) ; 65 | \fill[gray!50] (7.7,2) rectangle (10,3); 66 | \fill[gray!90] (9,1.5) rectangle (9.5,3.5); 67 | \fill[gray!80] (7.7,0) rectangle (8.5,6); 68 | \draw[line width=2pt] (2,7)--(3,6) -- (12,6)--(13,7); 69 | \end{scope} 70 | 71 | 72 | %反对称 73 | \begin{scope}[xshift=6.25cm,yshift=-4cm,xscale=-1] 74 | \fill[gray!80] (0,0) -- (6.25,0) -- ++(3,0) -- ++(2,-2) -- ++(-3,0) -- ++(-1,1) -- (1,-1) -- (0.5,-2) -- (0,-2) ; 75 | \fill[gray!30] (0,0)-- (1.5,0) -- (1,8)-- (0,9) ; 76 | \fill[gray!50] (7.7,2) rectangle (10,3); 77 | \fill[gray!90] (9,1.5) rectangle (9.5,3.5); 78 | \fill[gray!80] (7.7,0) rectangle (8.5,6); 79 | \draw[line width=2pt] (2,7)--(3,6) -- (12,6)--(13,7); 80 | \end{scope} 81 | 82 | \end{pgfonlayer} 83 | 84 | %简单非定量表盘 85 | \fill (6.25,1) circle (0.08); 86 | \fill[gray!30] (8.5,4) -- ++(1,1) to[out=90,in=90] ++(-6.5,0) -- +(1,-1); 87 | 88 | \begin{scope}[xshift=6.25cm,yshift=1cm] 89 | \foreach \x in {60,65,...,120} \draw[thick] (\x:5.5) -- (\x:4.8); 90 | \end{scope} 91 | 92 | \draw[ultra thick,->] (6.25,1) -- ++(80:5); 93 | 94 | %砝码1 95 | \begin{scope}[xshift=12cm,yshift=2cm] 96 | \draw[line width=2pt] (0,0) node[above=3cm] {\Huge 20g} -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3); 97 | \begin{scope}[xscale=-1] 98 | \draw[line width=2pt] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3); 99 | \end{scope} 100 | \end{scope} 101 | 102 | %砝码2 103 | \begin{scope}[scale=0.5,xshift=30cm,yshift=4cm] 104 | \draw[line width=2pt] (0,0) node[above=1.5cm] {\Huge 10g} -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3); 105 | \begin{scope}[xscale=-1] 106 | \draw[line width=2pt] (0,0) -- (1,0) -- (1,2) -- (0.3,2) -- (0.3,2.5) -- (0.5,2.5) -- (0.5,3)--(0,3); 107 | \end{scope} 108 | \end{scope} 109 | 110 | %待测物体 111 | \begin{scope}[xshift=-1.5cm,yshift=2cm] 112 | \fill[gray!30] (0,0) rectangle (2,3); 113 | \fill[gray!50] (2,0) -- (2.8,0.0) -- (2.8,3.4) -- (2,3); 114 | \fill[gray!10] (0,3)-- (1,3.4) -- (2.8,3.4) -- (2,3); 115 | \end{scope} 116 | 117 | 118 | \end{tikzpicture} 119 | 120 | 121 | \end{document} -------------------------------------------------------------------------------- /gallery/banner43.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/banner43.pdf -------------------------------------------------------------------------------- /gallery/banner43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/banner43.png -------------------------------------------------------------------------------- /gallery/banner43.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=0pt]{standalone} 2 | 3 | 4 | 5 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 6 | \xeCJKsetup{PunctStyle=plain} 7 | \setCJKmainfont[ItalicFont=KaiTi]{Source Han Serif CN} 8 | \setCJKsansfont{Source Han Sans CN} 9 | \setCJKmonofont{KaiTi} 10 | 11 | 12 | \begin{document} 13 | 14 | \tikzset{outline/.style={help lines, color=red!90, dotted}} 15 | \tikzset{outline/.default=gray} 16 | 17 | \tikzset{nodestyle/.style={text=black!90, 18 | minimum height=1cm, minimum width=1cm, font=\Huge, 19 | scale=1.8 20 | }} 21 | 22 | \tikzset{nodestyle2/.style={text=black!90, 23 | minimum height=1cm, minimum width=1cm, font=\Huge, 24 | scale=1.5 25 | }} 26 | 27 | \pagecolor{white} 28 | 29 | \begin{tikzpicture} 30 | 31 | 32 | \draw[outline] (-4,-3) grid (4,3); 33 | 34 | \node (node1) at (-2,1)[nodestyle] {Web}; 35 | \node (node1) at (0.6,1)[nodestyle] {应}; 36 | \node (node1) at (2.2,1)[nodestyle] {用}; 37 | \node (node1) at (0,-1)[nodestyle2] {开发总论}; 38 | 39 | 40 | \end{tikzpicture} 41 | 42 | 43 | \end{document} -------------------------------------------------------------------------------- /gallery/basic/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example.pdf -------------------------------------------------------------------------------- /gallery/basic/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example.png -------------------------------------------------------------------------------- /gallery/basic/example.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \begin{document} 3 | 4 | \begin{tikzpicture} 5 | 6 | 7 | 8 | \draw[help lines] ( -5,-5 ) grid ( 5, 5); 9 | \draw[red] (-3,0) -- (3,0); 10 | \draw[red] (0,-3) -- (0,3); 11 | 12 | 13 | \end{tikzpicture} 14 | 15 | 16 | \end{document} -------------------------------------------------------------------------------- /gallery/basic/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example2.pdf -------------------------------------------------------------------------------- /gallery/basic/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example2.png -------------------------------------------------------------------------------- /gallery/basic/example2.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \begin{document} 3 | 4 | \begin{tikzpicture}[scale=2] 5 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 6 | \draw[latex-latex, red] (0,-2) -- ++(-1,1) -- ++(-1,-1); 7 | \draw[dashed, blue] (0,1) -- +(-1,1) -- +(-2,0); 8 | \end{tikzpicture} 9 | 10 | \end{document} -------------------------------------------------------------------------------- /gallery/basic/example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example3.pdf -------------------------------------------------------------------------------- /gallery/basic/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example3.png -------------------------------------------------------------------------------- /gallery/basic/example3.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \begin{document} 3 | 4 | \begin{tikzpicture} 5 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 6 | \draw[->] (-3,0) -- (3,0); 7 | \draw[->] (0,-3) -- (0,3); 8 | \draw[color=gray!40] (0,0) circle (1); % 9 | \draw[color=red] (1,0) arc (0:45:1); 10 | \draw[color=gray!40] (0,0) ellipse (1 and 0.5); 11 | \draw[color=green] (1,0) arc (0:60:1 and 0.5); 12 | \end{tikzpicture} 13 | 14 | \end{document} -------------------------------------------------------------------------------- /gallery/basic/example4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example4.pdf -------------------------------------------------------------------------------- /gallery/basic/example4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example4.png -------------------------------------------------------------------------------- /gallery/basic/example4.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \begin{document} 3 | 4 | \begin{tikzpicture} 5 | 6 | 7 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 8 | \draw[->] (-3,0) -- (3,0); 9 | \draw[->] (0,-3) -- (0,3); 10 | \draw (0,0) ellipse (1 and 0.5); 11 | 12 | 13 | \end{tikzpicture} 14 | \end{document} -------------------------------------------------------------------------------- /gallery/basic/example5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example5.pdf -------------------------------------------------------------------------------- /gallery/basic/example5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example5.png -------------------------------------------------------------------------------- /gallery/basic/example5.tex: -------------------------------------------------------------------------------- 1 | 2 | 3 | \documentclass[tikz,border=2pt]{standalone} 4 | \begin{document} 5 | 6 | \begin{tikzpicture} 7 | 8 | 9 | 10 | \draw[help lines] ( -5,-5 ) grid ( 5, 5); 11 | \draw[red] (-3,0) -- (3,0); 12 | \draw[red] (0,-3) -- (0,3); 13 | 14 | \draw (0,0) circle (1); 15 | 16 | \end{tikzpicture} 17 | 18 | 19 | \end{document} 20 | -------------------------------------------------------------------------------- /gallery/basic/example6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example6.pdf -------------------------------------------------------------------------------- /gallery/basic/example6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example6.png -------------------------------------------------------------------------------- /gallery/basic/example6.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \begin{document} 3 | 4 | \begin{tikzpicture}[scale=2] 5 | \draw[step=1,color=gray!40] (-2,-2) grid (2,2); 6 | \draw[color=red] (-1,-1) rectangle (1,1); 7 | \end{tikzpicture} 8 | 9 | \end{document} -------------------------------------------------------------------------------- /gallery/basic/example7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example7.pdf -------------------------------------------------------------------------------- /gallery/basic/example7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/basic/example7.png -------------------------------------------------------------------------------- /gallery/basic/example7.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \begin{document} 3 | 4 | \begin{tikzpicture} 5 | \draw[->] (-3,3) -- (3,3); 6 | \draw[->>] (-3,2) -- (3,2); 7 | \draw[->|] (-3,1) -- (3,1); 8 | \draw[-to] (-3,0) -- (3,0); 9 | \draw[-latex] (-3,-1) -- (3,-1); 10 | \draw[-stealth] (-3,-2) -- (3,-2); 11 | \end{tikzpicture} 12 | 13 | 14 | \end{document} -------------------------------------------------------------------------------- /gallery/ceph_cluster.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/ceph_cluster.pdf -------------------------------------------------------------------------------- /gallery/ceph_cluster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/ceph_cluster.png -------------------------------------------------------------------------------- /gallery/ceph_cluster.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | 3 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 4 | \xeCJKsetup{PunctStyle=plain} 5 | \setCJKmainfont[ItalicFont=方正楷体简体]{思源宋体 CN} 6 | \setCJKsansfont{思源黑体 CN} 7 | \setCJKmonofont{方正楷体简体} 8 | 9 | \begin{document} 10 | 11 | 12 | \tikzset{outline/.style={help lines, color=#1!50}} 13 | \tikzset{outline/.default=gray} 14 | \tikzset{nodestyle/.style={draw, fill=blue!50, text=black, 15 | minimum height=1cm, minimum width=2cm, font=\large, 16 | }} 17 | \tikzset{text-nodestyle/.style={draw, text=black, font=\large, 18 | }} 19 | 20 | 21 | 22 | \begin{tikzpicture} 23 | %\draw[outline] (-8,-5) grid (6,8); 24 | 25 | 26 | \draw[color=red] (-4,1) rectangle (4,-4); 27 | 28 | \node at (-6,-1.5) [text-nodestyle] {ceph存储集群}; 29 | 30 | % origin three box 31 | \node (node1) at (-2.5,0)[nodestyle] {osd}; 32 | 33 | \node (node2) at (0,0)[nodestyle] {mon/mgr}; 34 | 35 | \node (node3) at (2.5,0)[nodestyle] {osd}; 36 | 37 | % y-1.5 38 | \node (node3) at (-2.5,-1.5)[nodestyle] {osd}; 39 | 40 | \node (node4) at (0,-1.5)[nodestyle] {mon/mgr}; 41 | 42 | \node (node5) at (2.5,-1.5)[nodestyle] {osd}; 43 | 44 | % y-3 45 | \node (node6) at (-2.5,-3)[nodestyle] {osd}; 46 | 47 | \node (node7) at (0,-3)[nodestyle] {mon/mgr}; 48 | 49 | \node (node8) at (2.5,-3)[nodestyle] {osd}; 50 | 51 | % ceph client cluster y+6 52 | \draw[color=red] (-4,7) rectangle (4,2); 53 | 54 | \node at (-6,4.5) [text-nodestyle] {ceph客户端集群}; 55 | 56 | % origin three box 57 | \node (node1) at (-2.5,6)[nodestyle] {}; 58 | 59 | \node (node2) at (0,6)[nodestyle] {}; 60 | 61 | \node (node3) at (2.5,6)[nodestyle] {}; 62 | 63 | % y-1.5 64 | \node (node3) at (-2.5,4.5)[nodestyle] {}; 65 | 66 | \node (node4) at (0,4.5)[nodestyle] {}; 67 | 68 | \node (node5) at (2.5,4.5)[nodestyle] {}; 69 | 70 | % y-3 71 | \node (node6) at (-2.5,3)[nodestyle] {}; 72 | 73 | \node (node7) at (0,3)[nodestyle] {}; 74 | 75 | \node (node8) at (2.5,3)[nodestyle] {}; 76 | 77 | 78 | 79 | 80 | 81 | \end{tikzpicture} 82 | 83 | \end{document} -------------------------------------------------------------------------------- /gallery/circuit/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/circuit/example.pdf -------------------------------------------------------------------------------- /gallery/circuit/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/circuit/example.png -------------------------------------------------------------------------------- /gallery/circuit/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \usetikzlibrary{circuits.ee.IEC} 6 | \begin{document} 7 | \begin{tikzpicture}[circuit ee IEC, 8 | set make contact graphic= var make contact IEC graphic] 9 | \node[battery] (battery) at(0,3) {}; 10 | \node[bulb] (bulb1) at(-2,2) {}; 11 | \node[make contact] (contact1) at(2,3) {}; 12 | \node[resistor,ohm=20k] (R1) at (0,0){}; 13 | \node[resistor,ohm=5,point up] (R2) at (3,1) {}; 14 | \draw (battery) -| (bulb1) ; 15 | \draw (bulb1) |- (R1) ; 16 | \draw (R1) -| (R2); 17 | \draw (battery) -- (contact1); 18 | \draw (contact1) -| (R2); 19 | \end{tikzpicture} 20 | \end{document} -------------------------------------------------------------------------------- /gallery/circuit/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/circuit/example2.pdf -------------------------------------------------------------------------------- /gallery/circuit/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/circuit/example2.png -------------------------------------------------------------------------------- /gallery/circuit/example2.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \begin{document} 6 | \usetikzlibrary{circuits.ee.IEC} 7 | 8 | \begin{tikzpicture}[circuit ee IEC] 9 | \node[battery] (battery) at(0,3) {}; 10 | \node[make contact,info=S] (contact1) at(2,3) {}; 11 | \draw (battery) -- (contact1); 12 | \node[draw,circle,inner sep =1pt] (A) at (3,1.5) {\footnotesize A}; 13 | \draw (contact1) -| (A); 14 | \node[bulb,info=L1] (L1) at (-1,0){}; 15 | \node[bulb,info=L2] (L2) at (1.5,0){}; 16 | \node[contact,info=c] (c) at (2.5,0) {}; 17 | \draw (L2) -| (A); 18 | \draw (L1) -- (L2); 19 | \node[contact,info'=b] (b) {}; 20 | \node[contact,info=180:a] (a) at(-2,1.5) {}; 21 | \node[draw,circle,inner sep =1pt] (V) at (-1,1.5) {\footnotesize V}; 22 | \draw (a) -- (V); 23 | \draw (V) -| (b); 24 | \draw (L1) -| (a); 25 | \draw (a) |- (battery); 26 | \end{tikzpicture} 27 | \end{document} -------------------------------------------------------------------------------- /gallery/circuit/example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/circuit/example3.pdf -------------------------------------------------------------------------------- /gallery/circuit/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/circuit/example3.png -------------------------------------------------------------------------------- /gallery/circuit/example3.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \begin{document} 6 | \usetikzlibrary{circuits.ee.IEC} 7 | 8 | \begin{tikzpicture}[circuit ee IEC, 9 | set make contact graphic= var make contact IEC graphic] 10 | \node[battery] (battery) at(0,0) {}; 11 | \node[make contact,info=S] (S) at(-2,0) {}; 12 | \draw (battery) -- (S); 13 | \node[draw,circle,inner sep =1pt] (A) at (-2,1.5) {\footnotesize A}; 14 | \node[bulb,info=L1] (L1) at (0,1.5){}; 15 | \draw (A) -- (L1); 16 | \node[resistor] (R) at (0,3) {}; 17 | \node[bulb,info=L2] (L2) at (-2,3){}; 18 | \draw (L2) -- (R); 19 | \node[contact] (a) at(-4,1.5) {}; 20 | \node[contact] (b) at(2,1.5) {}; 21 | \draw (S) -| (a); 22 | \draw (battery) -| (b); 23 | \draw (a) |- (L2); 24 | \draw (a) -- (A); 25 | \node[draw,circle,inner sep =1pt] (V) at (1,4) {\footnotesize V}; 26 | \draw[-latex] (V) -| (R.north); 27 | \draw (L1) -- (b); 28 | \draw (b) |- (R); 29 | \draw (b) |- (V) ; 30 | 31 | \end{tikzpicture} 32 | \end{document} -------------------------------------------------------------------------------- /gallery/clock/clock.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/clock/clock.pdf -------------------------------------------------------------------------------- /gallery/clock/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/clock/clock.png -------------------------------------------------------------------------------- /gallery/clock/clock.tex: -------------------------------------------------------------------------------- 1 | \documentclass[dvipsnames]{standalone} 2 | \usepackage{tikz} 3 | 4 | \begin{document} 5 | \newcommand\clock[4][2]{% 6 | \begin{tikzpicture}[scale=#1,line cap=round,line width=#1*3pt] 7 | \filldraw [fill=Goldenrod!20] (0,0) circle (2cm); 8 | \foreach \angle / \label in 9 | {0/3, 30/2, 60/1, 90/12, 120/11, 150/10, 180/9, 10 | 210/8, 240/7, 270/6, 300/5, 330/4} 11 | { 12 | \draw[line width=#1*1pt] (\angle:1.8cm) -- (\angle:2cm); 13 | \draw (\angle:1.4cm) node[scale=#1]{\textsf{\label}}; 14 | } 15 | \foreach \angle in {0,90,180,270} 16 | \draw[line width=#1*2pt] (\angle:1.6cm) -- (\angle:2cm); 17 | %\node[draw=none,font=\tiny,text=red,scale=#1] at (0,.9cm) {TICK-TOCK}; 18 | %\draw[rotate=90,line width=#1*2pt] (0,0) -- (-#2*30-#3*30/60:0.7cm); % hours 19 | %\draw[rotate=90,line width=#1*1.5pt] (0,0) -- (-#3*6:1cm); % minutes 20 | %\draw[rotate=90,line width=#1*.6pt,red] (0,0) -- (-#4*6:1.2cm); % seconds 21 | %\path [fill=black] (0,0) circle (3pt); 22 | %\path [fill=red] (0,0) circle (1.5pt); 23 | % 24 | \end{tikzpicture}% 25 | } 26 | %%\syntax 27 | %% \clock[]{}{}{} 28 | \noindent\clock[3]{9}{35}{55} 29 | 30 | 31 | \end{document} -------------------------------------------------------------------------------- /gallery/clock/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/clock/example.pdf -------------------------------------------------------------------------------- /gallery/clock/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/clock/example.png -------------------------------------------------------------------------------- /gallery/clock/example.tex: -------------------------------------------------------------------------------- 1 | % A simple compass 2 | % Author: Dario Orescanin 3 | 4 | \documentclass{standalone} 5 | \usepackage{tikz} 6 | \usetikzlibrary{calc} 7 | \begin{document} 8 | 9 | \begin{tikzpicture}[scale=2] 10 | % Define a few constants for easy configuration 11 | \def\radius{2cm} 12 | \def\onedegrad{1.8cm} 13 | \def\fivedegrad{1.75cm} 14 | \def\tendegrad{1.7cm} 15 | \def\labelrad{1.58cm} 16 | \def\nfivetick{33} 17 | \def\ntentick{17} 18 | \pgfmathsetmacro{\stepfivedegree}{180/(\nfivetick-1)} 19 | \pgfmathsetmacro{\steptendegree}{180-180/(\ntentick-1)} 20 | \def\startnum{20} 21 | \def\stepnum{10} 22 | \def\pointerp{65}%指针具体指的数值 23 | \pgfmathsetmacro{\pointerdegree}{180-((\pointerp-\stepnum)/\stepnum -1)*(180/(\ntentick-1))} 24 | 25 | % adding a subtle gray tone to add a bit of "personality" 26 | \shade[shading=radial, inner color=white, outer color=gray!15] (0,0) circle (\radius); 27 | 28 | \draw (0,0) circle (\radius); 29 | 30 | \draw[fill=black] (0,0) circle (0.8mm); 31 | \node[draw, circle, inner sep=.2mm] (a) at (0,0) {}; 32 | 33 | %指针 34 | \draw[rotate=\pointerdegree,line width=1.5pt] ($(0,0)!1.40cm!(0:1.5cm)$) -- ($(0,0)!-0.3cm!(0:1.5cm)$); 35 | 36 | % main lines 37 | \foreach \x in {0,\stepfivedegree,...,180} \draw (\x:\onedegrad) -- (\x:\radius); 38 | 39 | 40 | % labels and longer lines at every 10 degrees 41 | \foreach \x [count = \i] in {180,\steptendegree,...,0} 42 | { 43 | \draw (\x:\tendegrad) -- (\x:\radius); 44 | \pgfmathsetmacro{\labelnum}{\startnum + (\i-1)*\stepnum} 45 | \node[] at (\x:\labelrad) {\pgfmathprint{int(\labelnum)}}; 46 | }; 47 | 48 | 49 | %额外的修改 50 | \node (unit) at (0,1cm) {\LARGE km/h}; 51 | \node[draw] (nodea) at (0,-0.5cm) {\LARGE 13601}; 52 | \node[draw] (nodeb) at (0,-0.9cm) {\LARGE 0768}; 53 | \node[] (nodec) at (0.7cm,-0.7cm) {\LARGE km}; 54 | 55 | \end{tikzpicture} 56 | 57 | 58 | 59 | \end{document} -------------------------------------------------------------------------------- /gallery/clock/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/clock/example2.pdf -------------------------------------------------------------------------------- /gallery/clock/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/clock/example2.png -------------------------------------------------------------------------------- /gallery/clock/example2.tex: -------------------------------------------------------------------------------- 1 | % A simple compass 2 | % Author: Dario Orescanin 3 | 4 | \documentclass{standalone} 5 | \usepackage{tikz} 6 | \usetikzlibrary{calc} 7 | 8 | \begin{document} 9 | 10 | \begin{tikzpicture}[scale=2] 11 | % Define a few constants for easy configuration 12 | \def\radius{2cm} 13 | \def\onedegrad{1.8cm} 14 | \def\fivedegrad{1.75cm} 15 | \def\tendegrad{1.7cm} 16 | \def\labelrad{1.58cm} 17 | \def\nfivetick{33} 18 | \def\ntentick{17} 19 | \pgfmathsetmacro{\stepfivedegree}{180/(\nfivetick-1)} 20 | \pgfmathsetmacro{\steptendegree}{180-180/(\ntentick-1)} 21 | \def\startnum{20} 22 | \def\stepnum{10} 23 | \def\pointerp{80}%指针具体指的数值 24 | \pgfmathsetmacro{\pointerdegree}{180-((\pointerp-\stepnum)/\stepnum -1)*(180/(\ntentick-1))} 25 | 26 | % adding a subtle gray tone to add a bit of "personality" 27 | \shade[shading=radial, inner color=white, outer color=gray!15] (0,0) circle (\radius); 28 | 29 | \draw (0,0) circle (\radius); 30 | 31 | \draw[fill=black] (0,0) circle (0.8mm); 32 | \node[draw, circle, inner sep=.2mm] (a) at (0,0) {}; 33 | 34 | %指针 35 | \draw[rotate=\pointerdegree,line width=1.5pt] ($(0,0)!1.40cm!(0:1.5cm)$) -- ($(0,0)!-0.3cm!(0:1.5cm)$); 36 | 37 | % main lines 38 | \foreach \x in {0,\stepfivedegree,...,180} \draw (\x:\onedegrad) -- (\x:\radius); 39 | 40 | 41 | % labels and longer lines at every 10 degrees 42 | \foreach \x [count = \i] in {180,\steptendegree,...,0} 43 | { 44 | \draw (\x:\tendegrad) -- (\x:\radius); 45 | \pgfmathsetmacro{\labelnum}{\startnum + (\i-1)*\stepnum} 46 | \node[] at (\x:\labelrad) {\pgfmathprint{int(\labelnum)}}; 47 | }; 48 | 49 | 50 | \end{tikzpicture} 51 | 52 | 53 | 54 | \end{document} -------------------------------------------------------------------------------- /gallery/convex_lens/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/convex_lens/example.pdf -------------------------------------------------------------------------------- /gallery/convex_lens/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/convex_lens/example.png -------------------------------------------------------------------------------- /gallery/convex_lens/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \begin{document} 6 | \usetikzlibrary{calc,intersections,through} 7 | \begin{tikzpicture}[inner sep=3pt,scale=0.5] 8 | \newcommand{\convexlens}[2][]{ 9 | \begin{scope}[#1] 10 | \def\lensr{#2} 11 | 12 | \draw (0,0.5*\lensr) arc (90+60:270-60:\lensr) arc (270+60:360-60+90:\lensr); 13 | \end{scope}} 14 | 15 | %\convexlens[color=blue!50,ultra thick,fill=gray!10]{4cm} 16 | 17 | 18 | \def\ulen{4.7} 19 | 20 | \draw[name path=VW] (-6,0) -- (10,0); 21 | \coordinate[label=below:$U$] (U) at (-3,0) {}; 22 | \fill (U) circle (0.05); 23 | \coordinate[label=below:$V$] (V) at (-\ulen,0) {}; 24 | \coordinate[label=above:$R$] (R) at (3,0) {} ; 25 | \fill (R) circle (0.05); 26 | \fill (0,0) circle (0.05); 27 | \draw (V) -- node[below] {$x$} (U); 28 | 29 | \draw(U) -- node[above] {$f$} (0,0); 30 | \draw(0,0) -- node[below] {$f$} (R); 31 | 32 | \coordinate[label=above left:$P$] (P) at ($(V) + (0,1)$) {}; 33 | \draw (V) -- node[left] {$h$} (P); 34 | \coordinate[label=below left:$Q$] (Q) at (0,1) {}; 35 | \draw (P) -- (Q); 36 | \draw[name path=QS] (Q) -- ($(R)!-8cm!(Q)$); 37 | \draw[name path=PT] (P) -- ($(U)!-8cm!(P)$); 38 | \draw[name path=QT] (0,-3) -- (0,3); 39 | \path [name intersections={of=PT and QT,by=T}]; 40 | \coordinate[label=below left:$T$] (T) at (T) {}; 41 | 42 | \draw[name path=TS] (T) -- (10,0 |- T); 43 | \path [name intersections={of=QS and TS,by=S}]; 44 | \coordinate[label=below:$S$] (S) at (S) {}; 45 | \draw[name path=SW] (S) -- node[right] {$h'$} (S |- 10,0); 46 | 47 | \path [name intersections={of=SW and VW,by=W}]; 48 | \coordinate[label=above:$W$] (W) at (W) {}; 49 | \path (R) --node[above] {$x'$} (W); 50 | \path (0,0) --node[right] {$h$} (Q); 51 | \path (0,0) --node[right] {$h'$} (T); 52 | 53 | \draw[red] (P) -- (S); 54 | \end{tikzpicture} 55 | \end{document} -------------------------------------------------------------------------------- /gallery/convex_lens/动态凸透镜原理演示.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/convex_lens/动态凸透镜原理演示.pdf -------------------------------------------------------------------------------- /gallery/falling_body/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/falling_body/example.pdf -------------------------------------------------------------------------------- /gallery/falling_body/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/falling_body/example.png -------------------------------------------------------------------------------- /gallery/falling_body/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass{standalone} 3 | \usepackage{tikz} 4 | \usepackage{pgfplots} 5 | \pgfplotsset{compat=newest} 6 | \usetikzlibrary{decorations.pathreplacing} 7 | 8 | \begin{document} 9 | \begin{tikzpicture} 10 | 11 | \fill[fill=black!40] (0,0) rectangle (2,-9); 12 | 13 | \foreach \x [count=\i] in {0,0.5,1.5,3,5,7.5}{ 14 | \shade[ball color=gray!50,yshift=-\x cm] (1,-0.5) circle (0.25); 15 | \draw[color=gray!10,line width =1pt,yshift=-\x cm] (0,-0.5) node[left,color=black] {\pgfmathprint{int(\i-1)}} -- (2,-0.5) node (\i) {}; 16 | } 17 | 18 | \draw [decorate,decoration={brace,amplitude=4}] (1.base) to node[right] {\small $s_1=5cm$} (2.base); 19 | \draw [decorate,decoration={brace,amplitude=4}] (2.base) to node[right] {\small $s_2=15cm$} (3.base); 20 | \draw [decorate,decoration={brace,amplitude=4}] (3.base) to node[right] {\small $s_3=25cm$} (4.base); 21 | \draw [decorate,decoration={brace,amplitude=4}] (4.base) to node[right] {\small $s_4=35cm$} (5.base); 22 | \draw [decorate,decoration={brace,amplitude=4}] (5.base) to node[right] {\small $s_5=45cm$} (6.base); 23 | 24 | \end{tikzpicture} 25 | \end{document} -------------------------------------------------------------------------------- /gallery/fibonacci_circle.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/fibonacci_circle.pdf -------------------------------------------------------------------------------- /gallery/fibonacci_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/fibonacci_circle.png -------------------------------------------------------------------------------- /gallery/fibonacci_circle.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \usetikzlibrary{backgrounds,calc} 6 | 7 | \begin{document} 8 | \begin{tikzpicture}[background rectangle/.style={fill=blue!70},show background rectangle] 9 | % Create some counters for holding the Fibonacci numbers 10 | \newcounter{a} 11 | \newcounter{b} 12 | \newcounter{temp} 13 | 14 | \def\n{4} 15 | \foreach \i in {1,...,\n} 16 | { 17 | \begin{scope}[rotate=\i*360/\n] 18 | % Initialize the counters 19 | \setcounter{a}{0} 20 | \setcounter{b}{1} 21 | 22 | % The spiral will start at the origin 23 | \coordinate (0) at (0,0); 24 | 25 | % This loop defines the number of turns in the spiral. Note that we 26 | % will have to be careful not to overflow our counters or make the 27 | % spiral too large for TeX to handle. This is easy to do as the 28 | % Fibonacci sequence grows exponentially. 29 | \foreach \i in {1,...,18} 30 | { 31 | % Get the "name" of the last point on the spiral 32 | \pgfmathsetmacro{\lastpoint}{\i-1} 33 | 34 | % Compute the angle for this turn of the spiral 35 | \pgfmathsetmacro{\startangle}{mod(\i-1,4) * 90} 36 | 37 | % Draw this turn of the spiral and remember the point where we end 38 | \draw[color=white] (\lastpoint) arc 39 | (\startangle : \startangle + 90 : \value{b}/10.0pt) coordinate (\i); 40 | % Compute the next Fibonacci number 41 | \setcounter{temp}{\value{b}} 42 | \addtocounter{b}{\value{a}} 43 | \setcounter{a}{\value{temp}} 44 | } 45 | 46 | \end{scope} 47 | } 48 | 49 | \end{tikzpicture} 50 | \end{document} -------------------------------------------------------------------------------- /gallery/gravity/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/gravity/example.pdf -------------------------------------------------------------------------------- /gallery/gravity/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/gravity/example.png -------------------------------------------------------------------------------- /gallery/gravity/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8 2 | \documentclass[border=2pt]{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | 7 | \usepackage{pgfplots} 8 | \usepackage{fontspec} 9 | \usepackage{xeCJK} 10 | \setCJKmainfont[ItalicFont=方正楷体简体]{思源宋体 CN} 11 | \setCJKsansfont{思源黑体 CN} 12 | \setCJKmonofont{方正楷体简体} 13 | 14 | \usetikzlibrary{intersections,calc,positioning,arrows} 15 | 16 | \begin{document} 17 | 18 | \begin{tikzpicture} 19 | \draw (0,0) node {\Huge 地球} circle (2) ; 20 | 21 | %人 22 | \begin{scope}[yshift=3cm] 23 | \node[circle,fill,minimum size=5mm] (head) {}; 24 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 25 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 26 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 27 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0,-1cm); 28 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 29 | \end{scope} 30 | %人旋转90 31 | \begin{scope}[xshift=-3cm,yshift=0cm,rotate=90,every node/.style={transform shape}] 32 | \node[circle,fill,minimum size=5mm] (head) {}; 33 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 34 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 35 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 36 | \draw[ultra thick,dashed] (body.north west) ++(135:5.5mm) -- ++(-1cm,0cm); 37 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 38 | \end{scope} 39 | %人旋转180 40 | \begin{scope}[xshift=0cm,yshift=-3cm,rotate=180,every node/.style={transform shape}] 41 | \node[circle,fill,minimum size=5mm] (head) {}; 42 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 43 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 44 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 45 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0cm,1cm); 46 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 47 | \end{scope} 48 | %人旋转270 49 | \begin{scope}[xshift=3cm,yshift=0cm,rotate=270,every node/.style={transform shape}] 50 | \node[circle,fill,minimum size=5mm] (head) {}; 51 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 52 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 53 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 54 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(1,0cm); 55 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 56 | \end{scope} 57 | \node at(0,-5) {\Huge A}; 58 | 59 | 60 | 61 | 62 | %第二个 63 | \begin{scope}[xshift=8cm] 64 | \draw (0,0) node {\Huge 地球} circle (2) ; 65 | 66 | %人 67 | \begin{scope}[yshift=3cm] 68 | \node[circle,fill,minimum size=5mm] (head) {}; 69 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 70 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 71 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 72 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0,-1cm); 73 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 74 | \end{scope} 75 | %人旋转90 76 | \begin{scope}[xshift=-3cm,yshift=0cm,rotate=90,every node/.style={transform shape}] 77 | \node[circle,fill,minimum size=5mm] (head) {}; 78 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 79 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 80 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 81 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0,-1cm); 82 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 83 | \end{scope} 84 | %人旋转180 85 | \begin{scope}[xshift=0cm,yshift=-3cm,rotate=180,every node/.style={transform shape}] 86 | \node[circle,fill,minimum size=5mm] (head) {}; 87 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 88 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 89 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 90 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0,-1cm); 91 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 92 | \end{scope} 93 | %人旋转270 94 | \begin{scope}[xshift=3cm,yshift=0cm,rotate=270,every node/.style={transform shape}] 95 | \node[circle,fill,minimum size=5mm] (head) {}; 96 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 97 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 98 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 99 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0,-1cm); 100 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 101 | \end{scope} 102 | \node at(0,-5) {\Huge B}; 103 | \end{scope} 104 | 105 | 106 | %第三个 107 | \begin{scope}[xshift=16cm] 108 | \draw (0,0) node {\Huge 地球} circle (2) ; 109 | 110 | %人 111 | \begin{scope}[yshift=3cm] 112 | \node[circle,fill,minimum size=5mm] (head) {}; 113 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 114 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 115 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 116 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0,-1cm); 117 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 118 | \end{scope} 119 | %人旋转90 120 | \begin{scope}[xshift=-3cm,yshift=0cm,rotate=90,every node/.style={transform shape}] 121 | \node[circle,fill,minimum size=5mm] (head) {}; 122 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 123 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 124 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 125 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(-1cm,0cm); 126 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 127 | \end{scope} 128 | %人旋转180 129 | \begin{scope}[xshift=0cm,yshift=-3cm,rotate=180,every node/.style={transform shape}] 130 | \node[circle,fill,minimum size=5mm] (head) {}; 131 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 132 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 133 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 134 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0,-1cm); 135 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 136 | \end{scope} 137 | %人旋转270 138 | \begin{scope}[xshift=3cm,yshift=0cm,rotate=270,every node/.style={transform shape}] 139 | \node[circle,fill,minimum size=5mm] (head) {}; 140 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 141 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 142 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 143 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(1cm,0cm); 144 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 145 | \end{scope} 146 | \node at(0,-5) {\Huge C}; 147 | \end{scope} 148 | 149 | 150 | 151 | %第四个 152 | \begin{scope}[xshift=24cm] 153 | \draw (0,0) node {\Huge 地球} circle (2) ; 154 | 155 | %人 156 | \begin{scope}[yshift=3cm] 157 | \node[circle,fill,minimum size=5mm] (head) {}; 158 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 159 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 160 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 161 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0,-1cm); 162 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 163 | \end{scope} 164 | %人旋转90 165 | \begin{scope}[xshift=-3cm,yshift=0cm,rotate=90,every node/.style={transform shape}] 166 | \node[circle,fill,minimum size=5mm] (head) {}; 167 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 168 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 169 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 170 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0,-1cm); 171 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 172 | \end{scope} 173 | %人旋转180 174 | \begin{scope}[xshift=0cm,yshift=-3cm,rotate=180,every node/.style={transform shape}] 175 | \node[circle,fill,minimum size=5mm] (head) {}; 176 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 177 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 178 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 179 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0cm,1cm); 180 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 181 | \end{scope} 182 | %人旋转270 183 | \begin{scope}[xshift=3cm,yshift=0cm,rotate=270,every node/.style={transform shape}] 184 | \node[circle,fill,minimum size=5mm] (head) {}; 185 | \node[rounded corners=2pt,minimum height=1.3cm,minimum width=0.4cm,fill,below = 1pt of head] (body) {}; 186 | \draw[line width=1mm,round cap-round cap] ([shift={(2pt,-1pt)}]body.north east) --++(-90:6mm); 187 | \draw[line width=1mm,round cap-round cap] ([shift={(-2pt,-1pt)}]body.north west)--++(127:6mm) ++(-1pt,-5pt) [fill] circle (0.15) ; 188 | \draw[ultra thick,dashed] (body.north west) ++(135:6.5mm) -- ++(0,-1cm); 189 | \draw[thick,white,-round cap] (body.south) --++(90:5.5mm); 190 | \end{scope} 191 | \node at(0,-5) {\Huge D}; 192 | \end{scope} 193 | 194 | 195 | \end{tikzpicture} 196 | 197 | 198 | \end{document} -------------------------------------------------------------------------------- /gallery/gravity/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/gravity/example2.pdf -------------------------------------------------------------------------------- /gallery/gravity/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/gravity/example2.png -------------------------------------------------------------------------------- /gallery/gravity/example2.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \usepackage{pgfplots} 3 | \pgfplotsset{compat=newest} 4 | \begin{document} 5 | 6 | 7 | \begin{tikzpicture}[thick] 8 | \newcommand{\ground}[2][]{ 9 | \begin{scope}[#1] 10 | \usetikzlibrary{patterns,calc} 11 | \def\groundlen{#2} 12 | \fill[pattern = north east lines] (-#2,0) rectangle (#2,0.2); 13 | \fill[color=black!50] (-#2,0.2) rectangle (#2,0.3); 14 | \end{scope}} 15 | \fill (0,0) circle (0.1); 16 | \draw (0,0) circle (5); 17 | 18 | \ground[yshift=-5.3cm]{4cm} 19 | 20 | \draw[-latex] (0,0) -- (0,-8) node[right] {\Huge $G$=4N}; 21 | 22 | \end{tikzpicture} 23 | 24 | \end{document} -------------------------------------------------------------------------------- /gallery/mandala/mandala.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mandala/mandala.pdf -------------------------------------------------------------------------------- /gallery/mandala/mandala.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mandala/mandala.png -------------------------------------------------------------------------------- /gallery/mandala/mandala.tex: -------------------------------------------------------------------------------- 1 | % Mandala 2 | % Author: Elena Botoeva 3 | \documentclass{standalone} 4 | \usepackage{tikz} 5 | \usetikzlibrary{shadows} 6 | \usetikzlibrary{fadings} 7 | 8 | \tikzfading[name=fade out, inner color=transparent!0, 9 | outer color=transparent!100] 10 | 11 | \def\linecolor{yellow} 12 | 13 | \def\petal { 14 | [rounded corners=0.5] % 15 | (-1,0)% 16 | .. controls (-1,0.6) and (-0.07,0.8).. (0,1)% 17 | .. controls (0.07,0.8) and (1,0.6).. (1,0)% 18 | .. controls (0.7,-1) and (-0.7,-1).. (-1,0)% 19 | } 20 | 21 | %%%%% circles in the background %%%%% 22 | \def\background[#1,#2]{ 23 | \fill[#1] (0,0) circle (3.9); 24 | \fill[#2] (0,0) circle (1); 25 | } 26 | 27 | %%%%% star and small circle in the center %%%%% 28 | \def\center[#1]{ 29 | \foreach \a in {51.4285,102.857,...,360} { % 30 | \draw[color=\linecolor,rotate=\a,fill=#1] 31 | (-0.08,0) -- (0,0.46) -- (0.08,0); % 32 | } 33 | \draw[color=\linecolor,fill=#1] (0,0) circle (0.1); 34 | } 35 | 36 | %%%%%%%%%% Mandala with fixed colouring %%%%%%%%%% 37 | \def \mandala { 38 | \background[red!30!blue!70!black,blue!70!yellow!50]; 39 | 40 | % ysh - yshift 41 | % xs - xscale 42 | % ys - yscale 43 | % af - first angle in foreach 44 | % as - second angle in foreach 45 | % y - number in the color specification after yellow 46 | % b - number in the color specification before blue 47 | % r - number in the color specification of the shading after red 48 | % bl - number in the color specification of the shading before black 49 | \foreach \ysh/\xs/\ys/\af/\as/\y/\b/\w/\r/\bl in {% 50 | 3.06/0.72/0.8/ 25.71425/51.4285/ 70/100/100/ 100/100,% 51 | 2.34/1/0.9/ 25.71425/77.14275/ 6/90/92/ 80/80,% 52 | 1.8/0.8/0.9/ 51.4285/102.857/ 0/75/100/ 60/70,% 53 | 1.5/0.6/0.6/ 25.71425/77.14275/ 0/55/100/ 40/60,% 54 | 1.1/0.53/0.58/ 51.4285/102.857/ 0/40/100/ 20/50,% 55 | 0.8/0.37/0.45/ 25.71425/77.14275/ 0/45/85/ 20/40,% 56 | 0.53/0.1/0.24/ 25.71425/77.14275/ 0/10/100/ 0/30,% 57 | 0.49/0.22/0.32/ 51.4285/102.857/ 0/10/100/ 0/50% 58 | } 59 | { 60 | \foreach \a in {\af,\as,...,360} 61 | { 62 | \begin{scope}[rotate=\a,shift={(0,\ysh)},xscale=\xs,yscale=\ys] 63 | \draw[color=yellow,fill=yellow!\y!red!\b!blue!\w] % 64 | [drop shadow={shadow xshift=0.5pt, shadow yshift=-0.5pt}] 65 | \petal; 66 | \end{scope} 67 | 68 | \begin{scope}[transform canvas={rotate=\a},shift={(0,\ysh)},xscale=\xs,yscale=\ys] 69 | \clip \petal; % 70 | \fill[path fading=fade out,fill=red!\r!blue!\bl!black, opacity=0.7]% 71 | (0,-0.35) ellipse (1.2 and 0.75); 72 | \fill[path fading=fade out,fill=red!\r!blue!\bl!black, opacity=0.3]% 73 | (0,-0.2) ellipse (1.2 and 0.4); 74 | 75 | \fill[path fading=fade out,fill=red!\r!blue,opacity=0.2] % 76 | (-0.4,0.6) -- (0,0.9) -- (0.4,0.6); 77 | \end{scope} 78 | } 79 | } 80 | 81 | \center[blue] 82 | } 83 | %%%%%%%%%% End of Mandala with fixed colouring %%%%%%%%%% 84 | 85 | %%%%% one layer of petals %%%%% 86 | %线条部分 87 | 88 | \def\mainbody{ 89 | \foreach \a in {\af,\as,...,360} 90 | { 91 | \begin{scope}[rotate=\a,shift={(0,\ysh)},xscale=\xs,yscale=\ys] 92 | \draw[color=\linecolor,fill=\c] % 93 | [drop shadow={shadow xshift=0.5pt, shadow yshift=-0.5pt}] 94 | \petal; 95 | \end{scope} 96 | 97 | % fadings 98 | \begin{scope}[transform canvas={rotate=\a}, shift={(0,\ysh)},xscale=\xs,yscale=\ys] 99 | \clip \petal; % 100 | \fill[path fading=fade out,fill=\fc, opacity=0.7]% 101 | (0,-0.35) ellipse (1.2 and 0.75); 102 | \fill[path fading=fade out,fill=\fc, opacity=0.3]% 103 | (0,-0.2) ellipse (1.2 and 0.4); 104 | \fill[path fading=fade out,fill=\fc,opacity=0.2] % 105 | (-0.4,0.6) -- (0,0.9) -- (0.4,0.6); 106 | \end{scope} 107 | } 108 | } 109 | 110 | %%%%%%%%%%% Mandalas with parametrized colouring %%%%%%%%%% 111 | % #1 - the color of the outer most (first) layer 112 | % #2 - the color of the third layer 113 | % #3 - the color of the fifth layer 114 | % #4 - the color of the seventh layer 115 | % #5 - the color of the fading, gets denser closer to the center 116 | \def \mandalac[#1,#2,#3,#4,#5]{ 117 | \background[#3!30!#4!70!#5,#4!70!#2!50]; 118 | 119 | % ysh - yshift 120 | % xs - xscale 121 | % ys - yscale 122 | % af - first angle in foreach 123 | % as - second angle in foreach 124 | % c - color of the petal 125 | % fc - color of the fading 126 | \foreach \ysh/\xs/\ys/\af/\as/\c/\fc in {% 127 | 3.06/0.72/0.8/ 25.71425/51.4285 /#1/#1!50!#2!90!#5,% 128 | 2.34/1/0.9/ 25.71425/77.14275/#1!50!#2/#2!80!#5,% 129 | 1.8/0.8/0.9/ 51.4285/102.857 /#2/#2!50!#3!70!#5,% 130 | 1.5/0.6/0.6/ 25.71425/77.14275/#2!50!#3/#3!60!#5,% 131 | 1.1/0.53/0.58/ 51.4285/102.857 /#3/#3!50!#4!50!#5,% 132 | 0.8/0.37/0.45/ 25.71425/77.14275/#3!50!#4/#4!40!#5,% 133 | 0.53/0.1/0.24/ 25.71425/77.14275/#4/#4!50!#5,% 134 | 0.49/0.22/0.32/ 51.4285/102.857 /#4/#4!50!#5% 135 | } 136 | { 137 | \mainbody 138 | } 139 | \center[#4] 140 | } 141 | 142 | % #1 - the color of the outer most (first) layer 143 | % #2 - the color of the second layer 144 | % #3 - the color of the third layer 145 | % #4 - the color of the forth layer 146 | % #5 - the color of the fifth layer 147 | % #6 - the color of the sixth layer 148 | % #7 - the color of the seventh layer 149 | % #8 - the color of the fading, gets denser closer to the center 150 | \def \mandalab[#1,#2,#3,#4,#5,#6,#7,#8]{ 151 | \background[#6!30!#7!70!#8,#7!70!#4!50]; 152 | 153 | % ysh - yshift 154 | % xs - xscale 155 | % ys - yscale 156 | % af - first angle in foreach 157 | % as - second angle in foreach 158 | % c - color of the petal 159 | % fc - color of the fading 160 | \foreach \ysh/\xs/\ys/\af/\as/\c/\fc in {% 161 | 3.06/0.72/0.8/ 25.71425/51.4285 /#1/#2!90!#8,% 162 | 2.34/1/0.9/ 25.71425/77.14275/#2/#3!90!#8,% 163 | 1.8/0.8/0.9/ 51.4285/102.857 /#3/#4!80!#8,% 164 | 1.5/0.6/0.6/ 25.71425/77.14275/#4/#5!80!#8,% 165 | 1.1/0.53/0.58/ 51.4285/102.857 /#5/#6!70!#8,% 166 | 0.8/0.37/0.45/ 25.71425/77.14275/#6/#7!70!#8,% 167 | 0.53/0.1/0.24/ 25.71425/77.14275/#7/#7!50!#8,% 168 | 0.49/0.22/0.32/ 51.4285/102.857 /#7/#7!50!#8% 169 | } 170 | { 171 | \mainbody 172 | } 173 | \center[#7] 174 | } 175 | 176 | 177 | \begin{document} 178 | 179 | 180 | \begin{tikzpicture}[scale=2] 181 | \mandalab[green!50!black, green!60!black, green!70!black!80!, green!50!, 182 | green!10!, pink!40!, red!40!,]; 183 | \end{tikzpicture} 184 | 185 | 186 | 187 | 188 | \end{document} -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/measuring_cylinder/example.pdf -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/measuring_cylinder/example.png -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usetikzlibrary{calc} 5 | \usepackage{pgfplots} 6 | \pgfplotsset{compat=newest} 7 | 8 | \definecolor{cf3a7bc2}{RGB}{58,123,194} 9 | 10 | 11 | \begin{document} 12 | \begin{tikzpicture} 13 | 14 | \def\ml{4} 15 | 16 | \pgfmathsetmacro{\mlnum}{\ml+0.65} 17 | 18 | \path[fill=cf3a7bc2!50] (-1,0.4) -- (1,0.4) --(1,\mlnum) .. controls ($(0.8,\mlnum) + (0,-0.2)$) and ($(-0.8,\mlnum) + (0,-0.2)$) .. (-1,\mlnum) --cycle ; 19 | 20 | \draw (-1.2,0) -- (1.2,0)-- (1,0.2)-- (-1,0.2) --cycle ; 21 | \draw (-1,0.2) rectangle (1,0.4); 22 | %外线框 100ml 12-12-11.9 50ml 7-7-5.9 23 | \draw (-1,0.4) -- (1,0.4) --(1,7) -- (-1.1,7) -- (-1,6.9) --cycle ; 24 | 25 | \begin{scope}[yshift=0.5cm]%50ml shift 26 | \foreach \y/\x in {1/10,2/20,3/30,4/40,5/50} 27 | { 28 | \draw (-0.2,\y) to[bend right=10](0.2,\y) node[right,yslant=0.15](\x){\x}; 29 | 30 | \foreach \z in {0.2,0.4,0.6,0.8} 31 | \draw ($(-0.1,\z) + (0,\y)$)to[bend right=5]($(0.1,\z)+(0,\y)$); 32 | }; 33 | \end{scope} 34 | 35 | \node[above=1cm] at (50) {mL}; 36 | 37 | 38 | 39 | \end{tikzpicture} 40 | \end{document} -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/measuring_cylinder/example2.pdf -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/measuring_cylinder/example2.png -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example2.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usetikzlibrary{calc} 5 | \usepackage{pgfplots} 6 | \pgfplotsset{compat=newest} 7 | 8 | \definecolor{cf3a7bc2}{RGB}{58,123,194} 9 | 10 | 11 | \begin{document} 12 | \begin{tikzpicture} 13 | 14 | \def\ml{7.6} 15 | 16 | \pgfmathsetmacro{\mlnum}{\ml+0.15} 17 | 18 | \path[fill=cf3a7bc2!50] (-1,0.4) -- (1,0.4) --(1,\mlnum) .. controls ($(0.8,\mlnum) + (0,-0.2)$) and ($(-0.8,\mlnum) + (0,-0.2)$) .. (-1,\mlnum) --cycle ; 19 | \draw (-1.2,0) -- (1.2,0)-- (1,0.2)-- (-1,0.2) --cycle ; 20 | \draw (-1,0.2) rectangle (1,0.4); 21 | 22 | \draw (-1,0.4) -- (1,0.4) --(1,12) -- (-1.1,12) -- (-1,11.9) --cycle ; 23 | 24 | \begin{scope} 25 | \foreach \y/\x in {1/10,2/20,3/30,4/40,5/50,6/60,7/70,8/80,9/90,10/100} 26 | { 27 | \draw (-0.2,\y) to[bend right=10](0.2,\y) node[right,yslant=0.15](\x){\x}; 28 | 29 | \foreach \z in {0.2,0.4,0.6,0.8} 30 | \draw ($(-0.1,\z) + (0,\y)$)to[bend right=5]($(0.1,\z)+(0,\y)$); 31 | }; 32 | \end{scope} 33 | 34 | \node[above=1cm] at (100) {mL}; 35 | 36 | 37 | 38 | \end{tikzpicture} 39 | \end{document} -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/measuring_cylinder/example3.pdf -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/measuring_cylinder/example3.png -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example3.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usetikzlibrary{calc} 5 | \usepackage{pgfplots} 6 | \pgfplotsset{compat=newest} 7 | 8 | \definecolor{cf3a7bc2}{RGB}{58,123,194} 9 | 10 | 11 | \begin{document} 12 | \begin{tikzpicture} 13 | 14 | \def\ml{5} 15 | 16 | \pgfmathsetmacro{\mlnum}{\ml+0.13} 17 | 18 | \path[fill=cf3a7bc2!50] (-5,0.4) -- (5,0.4) --(5,\mlnum) .. controls ($(0.8,\mlnum) + (0,-0.2)$) and ($(-0.8,\mlnum) + (0,-0.2)$) .. (-5,\mlnum) --cycle ; 19 | 20 | \draw (-5,0.4) -- (5,0.4) --(5,12) -- (-5.4,12) -- (-5,11.5) --cycle ; 21 | 22 | \begin{scope} 23 | \foreach \y/\x in {1/10,2/20,3/30,4/40,5/50,6/60,7/70,8/80,9/90,10/100} 24 | { 25 | \draw (-0.2,\y) to[bend right=10](0.2,\y) node[right,yslant=0.15](\x){\Large \x}; 26 | 27 | \foreach \z in {0.2,0.4,0.6,0.8} 28 | \draw ($(-0.1,\z) + (0,\y)$)to[bend right=5]($(0.1,\z)+(0,\y)$); 29 | }; 30 | \end{scope} 31 | 32 | \node[above=1cm] at (100) {\Large mL}; 33 | 34 | 35 | \end{tikzpicture} 36 | \end{document} -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/measuring_cylinder/example4.pdf -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/measuring_cylinder/example4.png -------------------------------------------------------------------------------- /gallery/measuring_cylinder/example4.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass{standalone} 3 | \usepackage{tikz} 4 | \usetikzlibrary{calc} 5 | \usepackage{pgfplots} 6 | \pgfplotsset{compat=newest} 7 | \begin{document} 8 | \begin{tikzpicture} 9 | \shade[left color=red,right color=red!40] 10 | (-1,-2)--(-1,-5) arc (180:360:1) -- (1,-2) arc (0:180:1 and 0.3); 11 | \draw (0,0) ellipse (1 and .3); 12 | \draw (-1,0)--(-1,-5) arc (180:360:1) --(1,-5) -- (1,0); 13 | \draw[red!90!black!70] (0,-2) ellipse (1 and .3); 14 | 15 | \foreach \y/\x in {-5/1,-4/2,-3/3,-2/4} 16 | { 17 | \draw (-0.2,\y) to[bend right=10](0.2,\y) node[right,yslant=0.15](\x){\x}; 18 | 19 | \foreach \z in {0.2,0.4,0.6,0.8} 20 | \draw ($(-0.1,\z) + (0,\y)$)to[bend right=5]($(0.1,\z)+(0,\y)$); 21 | }; 22 | 23 | \end{tikzpicture} 24 | \end{document} -------------------------------------------------------------------------------- /gallery/mindmap/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mindmap/example.pdf -------------------------------------------------------------------------------- /gallery/mindmap/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mindmap/example.png -------------------------------------------------------------------------------- /gallery/mindmap/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \usetikzlibrary{positioning,calc} 6 | \begin{document} 7 | \begin{tikzpicture} 8 | \node[right] (a) {test}; 9 | \node[right] (b) [above right = of a] {test}; 10 | \node[right] (b0) [below right = of a] {test}; 11 | \coordinate (amidb) at ($(a)!0.5!(a -| b)$); 12 | 13 | \draw[->] (a) -- (amidb) |- (b.west) ; 14 | \draw[->] (amidb) |- (b0.west); 15 | 16 | 17 | \node[right] (c) [above right = of b0] {test}; 18 | \node[right] (c0) [below right = of b0] {test}; 19 | \coordinate (b0midc) at ($(b0)!0.5!(b0 -| c)$); 20 | 21 | \draw[->] (b0) -- (b0midc) |- (c.west) ; 22 | \draw[->] (b0midc) |- (c0.west); 23 | \end{tikzpicture} 24 | \end{document} -------------------------------------------------------------------------------- /gallery/mindmap/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mindmap/example2.pdf -------------------------------------------------------------------------------- /gallery/mindmap/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mindmap/example2.png -------------------------------------------------------------------------------- /gallery/mindmap/example2.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \usetikzlibrary{trees} 6 | \begin{document} 7 | \begin{tikzpicture}[text width=2.7cm, align=flush center, 8 | grow cyclic, 9 | level 1/.style={level distance=2.5cm,sibling angle=90}, 10 | level 2/.style={text width=2cm, font=\footnotesize, level distance=3cm,sibling angle=30}] 11 | \node[font=\bfseries] {Computational Complexity} % root 12 | child { 13 | node {Computational Problems} 14 | child { node {Problem Measures} } 15 | child { node {Problem Aspects} } 16 | child { node {Problem Domains} } 17 | child { node {Key Problems} } 18 | } 19 | child { node {Computational Models} 20 | child { node {Turing Machines} } 21 | child { node {Random-Access Machines} } 22 | child { node {Circuits} } 23 | child { node {Binary Decision Diagrams} } 24 | child { node {Oracle Machines} } 25 | child { node {Programming in Logic} } 26 | } 27 | child { node {Measuring Complexity} 28 | child { node {Complexity Measures} } 29 | child { node {Classifying Complexity} } 30 | child { node {Comparing Complexity} } 31 | child { node {Describing Complexity} } 32 | } 33 | child { node {Solving Problems} 34 | child { node {Exact Algorithms} } 35 | child { node {Randomization} } 36 | child { node {Fixed-Parameter Algorithms} } 37 | child { node {Parallel Computation} } 38 | child { node {Partial Solutions} } 39 | child { node {Approximation} } 40 | }; 41 | \end{tikzpicture} 42 | \end{document} -------------------------------------------------------------------------------- /gallery/mindmap/example4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mindmap/example4.pdf -------------------------------------------------------------------------------- /gallery/mindmap/example4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mindmap/example4.png -------------------------------------------------------------------------------- /gallery/mindmap/example4.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=12pt,12pt]{standalone} 3 | \usepackage{graphicx} 4 | \usepackage{pgfplots} 5 | \usepackage{fontspec} 6 | 7 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 8 | \xeCJKsetup{PunctStyle=plain} 9 | \setCJKmainfont[ItalicFont=方正楷体简体]{思源宋体 CN} 10 | \setCJKsansfont{思源黑体 CN} 11 | \setCJKmonofont{方正楷体简体} 12 | 13 | \usetikzlibrary{mindmap,trees} 14 | \begin{document} 15 | %配色建议 主要是三层 父层统一黑色(白字) 自己层(根据学科内容不同和黑色混) 子层和自己层相同方案 red blue orange green olive brown purple teal violet lime pink cyan magenta gray 16 | 17 | \begin{tikzpicture}[scale=1] 18 | \path[mindmap,grow cyclic,align=flush center,text=white] 19 | node[concept,font=\huge,concept color=black] (shuxue){数学} 20 | child[concept color=red!50!black]{ 21 | node[concept,font=\Large] (wuli) { 物理} 22 | child[concept color=orange!50!black] { node[concept] (huaxue) {化学} } 23 | child[concept color=olive!50!black] { node[concept](shengwu) {生物} } 24 | } 25 | child[concept color=blue!50!black] {node[concept,font=\Large] (jisuanji) { 计算机} 26 | child[] {node[concept] (shujuchuli) { 数据处理} } 27 | child[] {node[concept] (paibanzhitu) {排版制图} } 28 | } 29 | node[concept,concept color=green!50!black,font=\huge] (sixiang) at(-6,2) {思想} 30 | child[grow=180,concept color=cyan!75!black] {node[concept,font=\Large] (xinlixue) {心理学} } 31 | child[grow=-90,concept color=brown!50!black] {node[concept,font=\Large] (guojiazhengzhi) {国家政治}} 32 | node[concept,concept color=magenta,font=\huge] (yishu) at(0,6) {艺术} 33 | node[concept,concept color=gray,font=\huge] (gongyejishu) at(0,-6) {工业技术} 34 | child[grow=-160,concept color=purple!50!black] {node[concept,concept color=purple!50!black] (jingjixue) {经济学}} ; 35 | 36 | 37 | 38 | 39 | %物理到数据处理 40 | \path (wuli) to[circle connection bar switch color=from (red!50!black) to (blue!50!black)] (shujuchuli); 41 | %艺术到排版制图 42 | \path (yishu) to[circle connection bar switch color=from (magenta) to (blue!50!black)] (paibanzhitu); 43 | %工业技术到国家政治 44 | \path (gongyejishu) to[circle connection bar switch color=from (gray) to (brown!50!black)] (guojiazhengzhi); 45 | %工业技术到物理 46 | \path (gongyejishu) to[circle connection bar switch color=from (gray) to (red!50!black)] (wuli); 47 | \path (gongyejishu) to[circle connection bar switch color=from (gray) to (orange!50!black)] (huaxue); 48 | %化学到生物 49 | \path (huaxue) to[circle connection bar switch color=from (orange!50!black) to (olive!50!black)] (shengwu); 50 | %物理到计算机 51 | \path (wuli) to[circle connection bar switch color=from (red!50!black) to (blue!50!black)] (jisuanji); 52 | %思想到数学到艺术 53 | \path (sixiang) to[circle connection bar switch color=from (green!50!black) to (black)] (shuxue); 54 | \path (sixiang) to[circle connection bar switch color=from (green!50!black) to (magenta)] (yishu); 55 | \path (sixiang) to[circle connection bar switch color=from (green!50!black) to (brown!50!black)] (guojiazhengzhi); 56 | %国家政治到经济学 57 | \path (jingjixue) to[circle connection bar switch color=from (purple!50!black) to (brown!50!black)] (guojiazhengzhi); 58 | \path (jingjixue) to[circle connection bar switch color=from (purple!50!black) to (gray)] (gongyejishu); 59 | \path (sixiang) to[circle connection bar switch color=from (green!50!black) to (cyan!75!black)] (xinlixue); 60 | 61 | \end{tikzpicture} 62 | 63 | 64 | \end{document} -------------------------------------------------------------------------------- /gallery/mindmap/mindmap_3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mindmap/mindmap_3.pdf -------------------------------------------------------------------------------- /gallery/mindmap/mindmap_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mindmap/mindmap_3.png -------------------------------------------------------------------------------- /gallery/mindmap/mindmap_3.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \usetikzlibrary{decorations.pathreplacing} 6 | \begin{document} 7 | \begin{tikzpicture} 8 | \draw [decorate,decoration={brace,amplitude=8}] (0,0) -- (0,2); 9 | \node[right] at (0,0) {test}; 10 | \node[right] at (0,2) {test}; 11 | \node[right] at (0,1) {test}; 12 | 13 | \begin{scope}[xshift=1.1cm,yshift=-1cm] 14 | \draw [decorate,decoration={brace,amplitude=8}] (0,0) -- (0,2); 15 | \node[right] at (0,0) {test}; 16 | \node[right] at (0,2) {test}; 17 | \node[right] at (0,1) {test}; 18 | \end{scope} 19 | 20 | \begin{scope}[xshift=2.2cm,yshift=-2cm] 21 | \draw [decorate,decoration={brace,amplitude=8}] (0,0) -- (0,2); 22 | \node[right] at (0,0) {test}; 23 | \node[right] at (0,2) {test}; 24 | \node[right] at (0,1) {test}; 25 | \end{scope} 26 | 27 | \end{tikzpicture} 28 | \end{document} -------------------------------------------------------------------------------- /gallery/mindmap/simple.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mindmap/simple.pdf -------------------------------------------------------------------------------- /gallery/mindmap/simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/mindmap/simple.png -------------------------------------------------------------------------------- /gallery/mindmap/simple.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | 6 | \begin{document} 7 | 8 | \begin{tikzpicture}[grow =right, 9 | edge from parent/.style={draw,-latex}] 10 | \node[rectangle,draw] (a) {a} 11 | child{ node[rectangle,draw] (b) {b} 12 | child{node[rectangle,draw] (e) {e}} 13 | child{node[rectangle,draw] (f) {f}} 14 | } 15 | child {node[rectangle,draw] (b) {c} 16 | } 17 | ; 18 | 19 | \end{tikzpicture} 20 | \end{document} -------------------------------------------------------------------------------- /gallery/other/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example.pdf -------------------------------------------------------------------------------- /gallery/other/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example.png -------------------------------------------------------------------------------- /gallery/other/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \definecolor{cf0f0f0}{RGB}{240,240,240} 6 | \begin{document} 7 | \begin{tikzpicture} 8 | 9 | \draw (0,0) circle (1); 10 | \filldraw[fill=cf0f0f0] (0,0) circle (0.85); 11 | 12 | 13 | \filldraw[fill=white] (-0.2,-1.2) rectangle (0.2,1.2); 14 | 15 | \fill (0,0) circle (0.05); 16 | 17 | \draw (0,1.2) -- (0,1.3) arc (90:-180:-0.18); 18 | \draw (0,-1.2) -- (0,-1.3) arc (90:-180:0.18); 19 | 20 | \end{tikzpicture} 21 | \end{document} -------------------------------------------------------------------------------- /gallery/other/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example2.pdf -------------------------------------------------------------------------------- /gallery/other/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example2.png -------------------------------------------------------------------------------- /gallery/other/example2.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \begin{document} 6 | \begin{tikzpicture} 7 | \begin{axis}[ 8 | axis x line=bottom, 9 | axis y line =left, 10 | legend pos=outer north east, 11 | minor tick num=1, 12 | tick align=inside, 13 | xlabel=$h$, 14 | ylabel=$F$] 15 | 16 | \addplot[mark=x] coordinates {(0,0) (1,1) (2,2) 17 | }; 18 | \addlegendentry{B} 19 | \addplot[mark=*] coordinates {(0,0) (1,2) (2,4) 20 | }; 21 | \addlegendentry{A} 22 | \end{axis} 23 | \end{tikzpicture} 24 | \end{document} -------------------------------------------------------------------------------- /gallery/other/example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example3.pdf -------------------------------------------------------------------------------- /gallery/other/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example3.png -------------------------------------------------------------------------------- /gallery/other/example3.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8 2 | \documentclass[border=2pt]{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \begin{tikzpicture} 10 | \newcommand{\ground}[2][]{ 11 | \begin{scope}[#1] 12 | \usetikzlibrary{patterns,calc} 13 | \def\groundlen{#2} 14 | \fill[pattern = north east lines] (-#2,0) rectangle (#2,0.2); 15 | \fill[color=black!50] (-#2,0.2) rectangle (#2,0.3); 16 | \end{scope}} 17 | 18 | \ground[yshift=-9]{2cm} 19 | 20 | \draw[thick] (0,0) rectangle (1,1); 21 | \draw[thick,-latex] (0,0.5) -- (-1,0.5) node[left] {$F$}; 22 | 23 | 24 | \end{tikzpicture} 25 | \end{document} 26 | 27 | -------------------------------------------------------------------------------- /gallery/other/example4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example4.pdf -------------------------------------------------------------------------------- /gallery/other/example4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example4.png -------------------------------------------------------------------------------- /gallery/other/example4.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8 2 | \documentclass[border=2pt]{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | \begin{tikzpicture} 9 | \newcommand{\rbox}[3][]{ 10 | \begin{scope}[#1] 11 | \def\boxlen{#2} 12 | \def\boxhei{#3} 13 | %\draw[color=black!70,fill = black!40,ultra thick] (0,0) -- (\boxlen,0) -- (\boxlen,\boxlen) -- (0,\boxlen) --cycle; 14 | \draw[color=black!70,fill = black!40,ultra thick] (0,0) rectangle (\boxlen,\boxhei); 15 | \end{scope}} 16 | 17 | \newcommand{\ball}[2][]{ 18 | \begin{scope}[#1] 19 | \def\ballradius{#2} 20 | \shade (0,0) circle (\ballradius); 21 | \end{scope}} 22 | 23 | 24 | 25 | 26 | \draw[ultra thick] (0,0) arc (180:270:10cm); 27 | \ball[ball color=gray,xshift=1cm]{1cm} 28 | 29 | 30 | \draw[ultra thick] (10,-10) -- (25,-10); 31 | \ball[ball color=gray,xshift=4cm,yshift=-6.7cm]{1cm} 32 | 33 | \rbox[xshift=11cm,yshift=-10cm]{2cm}{2cm} 34 | \ball[ball color=gray,xshift=10cm,yshift=-9cm]{1cm} 35 | 36 | \begin{scope}[xshift=10cm] 37 | \rbox[xshift=11cm,yshift=-10cm]{2cm}{2cm} 38 | \ball[ball color=gray,xshift=10cm,yshift=-9cm]{1cm} 39 | \end{scope} 40 | 41 | 42 | 43 | 44 | \end{tikzpicture} 45 | 46 | \end{document} -------------------------------------------------------------------------------- /gallery/other/example5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example5.pdf -------------------------------------------------------------------------------- /gallery/other/example5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example5.png -------------------------------------------------------------------------------- /gallery/other/example5.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | 3 | \begin{document} 4 | 5 | 6 | \usetikzlibrary{patterns,calc} 7 | \begin{tikzpicture} 8 | 9 | \begin{scope}[rope/.style={thick}] 10 | 11 | 12 | \fill[pattern = north east lines] (-2,2) rectangle (2,2.2); 13 | \fill[color=black!50] (-2,1.9) rectangle (2,2); 14 | 15 | \coordinate (top) at ($(0,2) + (0,-0.1)$); 16 | \coordinate (mid) at (0,0); 17 | 18 | \begin{scope} 19 | \draw[rope] (mid) circle (1) ; 20 | \end{scope} 21 | 22 | \draw[rope] (top) -- (mid); 23 | 24 | \coordinate (left) at (-1,0); 25 | \coordinate (right) at (1,0); 26 | 27 | \coordinate (rope-bottom) at (-1,-2.5); 28 | \coordinate (rope-top) at (1,-1.5); 29 | 30 | \draw[rope] (rope-bottom) -- (left); 31 | \draw[rope,-latex] (right) -- (rope-top) node[right] {$F$}; 32 | 33 | \draw[thick] ($(rope-bottom) + (-0.5,-1)$) rectangle ($(rope-bottom) + (0.5,0)$); 34 | 35 | \end{scope} 36 | 37 | \coordinate (box-mid) at ($(rope-bottom) + (0,-0.5)$); 38 | \node at (box-mid) {A}; 39 | \end{tikzpicture} 40 | 41 | \end{document} -------------------------------------------------------------------------------- /gallery/other/example6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example6.pdf -------------------------------------------------------------------------------- /gallery/other/example6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example6.png -------------------------------------------------------------------------------- /gallery/other/example6.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | 4 | \usepackage{pgfplots} 5 | 6 | 7 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 8 | \xeCJKsetup{PunctStyle=plain} 9 | \setCJKmainfont[ItalicFont=KaiTi]{Source Han Serif CN} 10 | \setCJKsansfont{Source Han Sans CN} 11 | \setCJKmonofont{KaiTi} 12 | 13 | \usetikzlibrary{intersections,calc,positioning} 14 | 15 | \begin{document} 16 | 17 | \begin{tikzpicture} 18 | \draw (-2,0) -- (5,0); 19 | 20 | % 21 | \draw (-1,0) -- (1,0); 22 | \foreach \y in{0,0.1,...,1}{ 23 | \draw[dashed] (-1,\y) -- (1,\y); 24 | } 25 | \draw (-1,0) -- (-1,3)-- (1,3)--(1,0); 26 | \draw (-1,1) -- (1,1); 27 | \node[below] at (0,0) {A}; 28 | \node[above] at (0,1) {甲}; 29 | 30 | \begin{scope}[xshift=3cm,xscale=1.2] 31 | \draw (-1,0) -- (1,0); 32 | \foreach \y in{0,0.1,...,1}{ 33 | \draw[dashed] (-1,\y) -- (1,\y); 34 | } 35 | \draw (-1,0) -- (-1,3)-- (1,3)--(1,0); 36 | \draw (-1,1) -- (1,1); 37 | \node[below] at (0,0) {B}; 38 | \node[above] at (0,1) {乙}; 39 | \end{scope} 40 | 41 | 42 | \end{tikzpicture} 43 | 44 | 45 | 46 | \end{document} -------------------------------------------------------------------------------- /gallery/other/example7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example7.pdf -------------------------------------------------------------------------------- /gallery/other/example7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example7.png -------------------------------------------------------------------------------- /gallery/other/example7.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \usepackage{pgfplots} 3 | \pgfplotsset{compat=newest} 4 | \begin{document} 5 | 6 | 7 | \usetikzlibrary{patterns,calc} 8 | \begin{tikzpicture} 9 | \newcommand{\ground}[2][]{ 10 | \begin{scope}[#1] 11 | 12 | \def\groundlen{#2} 13 | \fill[pattern = north east lines] (-#2,0) rectangle (#2,0.2); 14 | \fill[color=black!50] (-#2,0.2) rectangle (#2,0.3); 15 | \end{scope}} 16 | 17 | \ground[yshift=-1cm]{8cm} 18 | 19 | \node[above,inner sep=1pt] (A) at (-4,0) {A}; 20 | \node[above,inner sep=1pt] (B) at (6,0) {B}; 21 | 22 | \draw[-latex] (1,5) -- (A); 23 | \draw[-latex] (A) -- (1,-5); 24 | 25 | \draw[-latex] (-4,5) -- (B); 26 | \draw[latex-] (-4,-5) -- (B); 27 | 28 | \draw (A) -- (B) ; 29 | \end{tikzpicture} 30 | 31 | \end{document} -------------------------------------------------------------------------------- /gallery/other/example8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example8.pdf -------------------------------------------------------------------------------- /gallery/other/example8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example8.png -------------------------------------------------------------------------------- /gallery/other/example8.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \usepackage{pgfplots} 3 | \pgfplotsset{compat=newest} 4 | \begin{document} 5 | 6 | 7 | \begin{tikzpicture} 8 | \newcommand{\ground}[2][]{ 9 | \begin{scope}[#1] 10 | \usetikzlibrary{patterns,calc} 11 | \def\groundlen{#2} 12 | \fill[pattern = north east lines] (-#2,0) rectangle (#2,0.2); 13 | \fill[color=black!50] (-#2,0.2) rectangle (#2,0.3); 14 | \end{scope}} 15 | 16 | \ground[yshift=-9]{2cm} 17 | 18 | \draw[thick] (0,0) rectangle (1,1); 19 | \draw[thick,-latex] (0,0.5) -- (-1,0.5) node[left] {$F$}; 20 | 21 | 22 | \end{tikzpicture} 23 | 24 | 25 | \end{document} -------------------------------------------------------------------------------- /gallery/other/example9.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example9.pdf -------------------------------------------------------------------------------- /gallery/other/example9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/other/example9.png -------------------------------------------------------------------------------- /gallery/other/example9.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \usepackage{pgfplots} 3 | \pgfplotsset{compat=newest} 4 | \begin{document} 5 | 6 | 7 | \usetikzlibrary{decorations.pathreplacing} 8 | 9 | 10 | \begin{tikzpicture} 11 | \newcommand{\sun}[2][]{ 12 | \begin{scope}[#1] 13 | \def\sunr{#2} 14 | \draw (0,0) circle (\sunr); 15 | 16 | \foreach \angle in { 0,45,...,360 }{ 17 | \draw [rotate around={\angle:(0,0)}] 18 | (\sunr+\sunr,0) -- +(\sunr,0); 19 | } 20 | \end{scope} 21 | } 22 | 23 | \draw (5,0) rectangle (6,5); 24 | 25 | \draw (3,0) -- (3,3); 26 | 27 | 28 | 29 | \draw (0,0) -- (10,0); 30 | \draw[thick] (0,0) -- (10,10); 31 | 32 | \sun[xshift=10cm,yshift=10cm,ultra thick]{0.2} 33 | 34 | \draw[decorate,decoration={brace,amplitude=8},rotate=180,xshift=-3cm] (0,0) to node[below = 8] {$l1$} (3,0) ; 35 | 36 | \draw[decorate,decoration={brace,amplitude=8},rotate=180,xshift=-8cm] (3,0) to node[below = 8] {$l2$} (5,0) ; 37 | 38 | 39 | \end{tikzpicture} 40 | 41 | 42 | \end{document} -------------------------------------------------------------------------------- /gallery/patterns/example_one.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/patterns/example_one.pdf -------------------------------------------------------------------------------- /gallery/patterns/example_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/patterns/example_one.png -------------------------------------------------------------------------------- /gallery/patterns/example_one.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \usetikzlibrary{patterns,calc} 6 | \begin{document} 7 | \begin{tikzpicture} 8 | \draw (0,0) node[above right] {$A$} rectangle (1.2,2); 9 | 10 | \draw (2,0) node[above right] {$B$} rectangle (3,2); 11 | 12 | 13 | \begin{scope} 14 | \fill[pattern = north east lines] (0,0) rectangle (3,-0.2); 15 | \fill[color=black!50] (0,0) rectangle (3,-0.1); 16 | \end{scope} 17 | 18 | 19 | 20 | \end{tikzpicture} 21 | \end{document} -------------------------------------------------------------------------------- /gallery/patterns/example_two.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/patterns/example_two.pdf -------------------------------------------------------------------------------- /gallery/patterns/example_two.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/patterns/example_two.png -------------------------------------------------------------------------------- /gallery/patterns/example_two.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass{standalone} 3 | \usepackage{tikz} 4 | \usepackage{pgfplots} 5 | \usetikzlibrary{patterns} 6 | \pgfplotsset{compat=newest} 7 | \begin{document} 8 | \begin{tikzpicture} 9 | %横线%竖线 10 | \fill[pattern = horizontal lines] (-8,0) rectangle (0,2); 11 | \fill[pattern = vertical lines] (0,0) rectangle (8,2); 12 | 13 | %斜线 14 | \begin{scope}[yshift=-2cm] 15 | \fill[pattern = north east lines] (-8,0) rectangle (0,2); 16 | \fill[pattern = north west lines] (0,0) rectangle (8,2); 17 | \end{scope} 18 | 19 | %网格线 交叉线 20 | \begin{scope}[yshift=-4cm] 21 | \fill[pattern = grid] (-8,0) rectangle (0,2); 22 | \fill[pattern = crosshatch] (0,0) rectangle (8,2); 23 | \end{scope} 24 | 25 | 26 | 27 | 28 | \end{tikzpicture} 29 | \end{document} -------------------------------------------------------------------------------- /gallery/pgfplots/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/pgfplots/example.pdf -------------------------------------------------------------------------------- /gallery/pgfplots/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/pgfplots/example.png -------------------------------------------------------------------------------- /gallery/pgfplots/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \begin{document} 6 | \begin{tikzpicture} 7 | \begin{axis}[grid=major, 8 | xtick={0,0.1,0.2,0.3,0.4}, 9 | ytick={0,10,20,30,40}, 10 | %extra x ticks={1.5}, 11 | axis x line=bottom, 12 | axis y line =left, 13 | %legend pos=outer north east, 14 | xmin=0,xmax=0.4,ymin=0,ymax=45, 15 | minor tick num=1, 16 | tick align=inside, 17 | xlabel=$t$/s, 18 | ylabel=$s$/cm, 19 | grid=both] 20 | 21 | \end{axis} 22 | \end{tikzpicture} 23 | \end{document} -------------------------------------------------------------------------------- /gallery/pgfplots/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/pgfplots/example2.pdf -------------------------------------------------------------------------------- /gallery/pgfplots/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/pgfplots/example2.png -------------------------------------------------------------------------------- /gallery/pgfplots/example2.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | 7 | \usepackage{pgfplots} 8 | \usepackage{fontspec} 9 | \usepackage{xeCJK} 10 | \setCJKmainfont[ItalicFont=方正楷体简体]{思源宋体 CN} 11 | \setCJKsansfont{思源黑体 CN} 12 | \setCJKmonofont{方正楷体简体} 13 | 14 | 15 | \begin{document} 16 | \begin{tikzpicture} 17 | \usetikzlibrary{intersections,calc,positioning} 18 | \pgfplotsset{width=7cm,compat=newest} 19 | 20 | 21 | \begin{axis}[ 22 | axis x line=bottom, 23 | axis y line =left, 24 | legend pos=outer north east, 25 | xmin=0,xmax=8.9,ymin=0,ymax=34.9, 26 | minor tick num=1, 27 | tick align=inside, 28 | xlabel=$t$/s, 29 | ylabel=$s$/m, 30 | xtick={0,2,4,6,8}, 31 | ytick={0,10,20,30},grid=both] 32 | \addplot+[sharp plot,mark=triangle*] coordinates { 33 | (0,0) (5,20) 34 | }; 35 | \addlegendentry{甲} 36 | \end{axis} 37 | \end{tikzpicture} 38 | 39 | 40 | 41 | \end{document} -------------------------------------------------------------------------------- /gallery/pgfplots/example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/pgfplots/example3.pdf -------------------------------------------------------------------------------- /gallery/pgfplots/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/pgfplots/example3.png -------------------------------------------------------------------------------- /gallery/pgfplots/example3.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | 7 | \usepackage{pgfplots} 8 | \usepackage{fontspec} 9 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 10 | \xeCJKsetup{PunctStyle=plain} 11 | \setCJKmainfont[ItalicFont=方正楷体简体]{思源宋体 CN} 12 | \setCJKsansfont{思源黑体 CN} 13 | \setCJKmonofont{方正楷体简体} 14 | 15 | 16 | \begin{document} 17 | \begin{tikzpicture} 18 | \usetikzlibrary{intersections,calc,positioning} 19 | \pgfplotsset{width=7cm,compat=newest} 20 | 21 | 22 | \begin{axis}[ 23 | axis x line=bottom, 24 | axis y line =left, 25 | legend pos=outer north east, 26 | xmin=0,xmax=10,ymin=0,ymax=8, 27 | minor tick num=1, 28 | tick align=inside, 29 | xlabel=$t$/s, 30 | ylabel=$v$/m/s, 31 | xtick={0,2,4,6,8}, 32 | ytick={0,2,4,6}] 33 | \addplot+[sharp plot] coordinates { 34 | (0,6) (2,6) (4,6) (6,6) (8,6) 35 | }; 36 | \addlegendentry{乙} 37 | \addplot+[sharp plot] coordinates { 38 | (0,4) (2,4) (4,4) (6,4) (8,4) 39 | }; 40 | \addlegendentry{丙} 41 | \end{axis} 42 | 43 | \end{tikzpicture} 44 | 45 | 46 | 47 | \end{document} -------------------------------------------------------------------------------- /gallery/pgfplots/example_one.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/pgfplots/example_one.pdf -------------------------------------------------------------------------------- /gallery/pgfplots/example_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/pgfplots/example_one.png -------------------------------------------------------------------------------- /gallery/pgfplots/example_one.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usepackage{pgfplots} 4 | \pgfplotsset{compat=newest} 5 | \begin{document} 6 | \begin{tikzpicture} 7 | \begin{axis} 8 | \addplot+[const plot] 9 | coordinates 10 | {(0,0.1) (0.1,0.15) (0.2,0.5) (0.3,0.62) 11 | (0.4,0.56) (0.5,0.58) (0.6,0.65) (0.7,0.6) 12 | (0.8,0.58) (0.9,0.55) (1,0.52)}; 13 | \end{axis} 14 | \end{tikzpicture} 15 | 16 | \begin{tikzpicture} 17 | \begin{axis} 18 | \addplot+[sharp plot] coordinates 19 | {(0,0) (1,2) (2,3)}; 20 | \end{axis} 21 | \end{tikzpicture} 22 | 23 | 24 | \begin{tikzpicture} 25 | \begin{axis}[ 26 | xlabel=x/min, 27 | ylabel=y/, 28 | xmin=0, 29 | xmax=8, 30 | ymin=40, 31 | ymax=55, 32 | grid=major, 33 | xtick={0,1,2,3,4,5,6,7,8}, 34 | ytick={40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55}] 35 | \addplot[mark=x] coordinates { 36 | }; 37 | \end{axis} 38 | \end{tikzpicture} 39 | 40 | 41 | \usepgfplotslibrary{polar} 42 | 43 | \begin{tikzpicture} 44 | \begin{polaraxis} 45 | \addplot coordinates {(0,1) (90,1) 46 | (180,1) (270,1)}; 47 | \end{polaraxis} 48 | \end{tikzpicture} 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | \usepgfplotslibrary{ternary} 60 | 61 | \begin{tikzpicture} 62 | \begin{ternaryaxis}[ 63 | title=Want--be--Stainless Steel, 64 | xlabel=Weight Percent Chromium, 65 | ylabel=Weight Percent Iron, 66 | zlabel=Weight Percent Nickel, 67 | label style=sloped, 68 | area style, 69 | ] 70 | \addplot3 table { 71 | A B C 72 | 1 0 0 73 | 0.5 0.4 0.1 74 | 0.45 0.52 0.03 75 | 0.36 0.6 0.04 76 | 0.1 0.9 0 77 | }; 78 | \addlegendentry{Cr} 79 | 80 | \addplot3 table { 81 | A B C 82 | 1 0 0 83 | 0.5 0.4 0.1 84 | 0.28 0.35 0.37 85 | 0.4 0 0.6 86 | }; 87 | \addlegendentry{Cr+$\gamma$FeNi} 88 | 89 | \addplot3 table { 90 | 0.4 0 0.6 91 | 0.28 0.35 0.37 92 | 0.25 0.6 0.15 93 | 0.1 0.9 0 94 | 0 1 0 95 | 0 0 1 96 | }; 97 | \addlegendentry{$\gamma$FeNi} 98 | 99 | \addplot3 table { 100 | 0.1 0.9 0 101 | 0.36 0.6 0.04 102 | 0.25 0.6 0.15 103 | }; 104 | \addlegendentry{Cr+$\gamma$FeNi} 105 | 106 | \addplot3 table { 107 | 0.5 0.4 0.1 108 | 0.45 0.52 0.03 109 | 0.36 0.6 0.04 110 | 0.25 0.6 0.15 111 | 0.28 0.35 0.37 112 | }; 113 | \addlegendentry{$\sigma$+$\gamma$FeNi} 114 | 115 | \node[inner sep=0.5pt,circle,draw,fill=white,pin=-15:\footnotesize Stainless Steel] 116 | at (axis cs:0.18,0.74,0.08) {}; 117 | 118 | \end{ternaryaxis} 119 | \end{tikzpicture} 120 | 121 | 122 | 123 | 124 | \begin{tikzpicture} 125 | \begin{axis} 126 | \addplot+[smooth] coordinates 127 | {(0,0) (1,2) (2,3)}; 128 | \end{axis} 129 | \end{tikzpicture} 130 | 131 | 132 | 133 | 134 | \usepgfplotslibrary{units} 135 | \begin{tikzpicture} 136 | \begin{axis}[change x base, 137 | x SI prefix=kilo,x unit=m, 138 | y SI prefix=milli,y unit=N, 139 | xlabel=Distance,ylabel=Force] 140 | \addplot coordinates { 141 | (1000,1) 142 | (2000,1.1) 143 | (3000,1.2) 144 | (4000,1.3) 145 | }; 146 | \end{axis} 147 | \end{tikzpicture} 148 | 149 | 150 | 151 | 152 | 153 | 154 | \end{document} -------------------------------------------------------------------------------- /gallery/polygon/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/polygon/example.pdf -------------------------------------------------------------------------------- /gallery/polygon/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/polygon/example.png -------------------------------------------------------------------------------- /gallery/polygon/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8" 2 | \documentclass[tikz,border=2pt]{standalone} 3 | \usetikzlibrary{calc} 4 | \begin{document} 5 | \begin{tikzpicture} 6 | %\draw (0,0) circle (4) ; 7 | %\coordinate (O) at (0,0); 8 | %\shade[ball color=red](O) circle (0.1) node[below] {O}; 9 | \def\n{7}%边数 10 | \pgfmathsetmacro\i{\n-1} 11 | \foreach \x in {0,...,\i} 12 | { 13 | \def\pointname{\x} 14 | \coordinate (\pointname) at ($(0,0) +(\x*360/\n:4cm)$) ; 15 | %\shade[ball color=red](\pointname) circle (0.05) node[below] {\small \x}; 16 | } 17 | 18 | \draw (0) 19 | \foreach \x in {0,...,\i} 20 | { -- (\x) } -- cycle; 21 | 22 | \end{tikzpicture} 23 | \end{document} -------------------------------------------------------------------------------- /gallery/polygon/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/polygon/example2.pdf -------------------------------------------------------------------------------- /gallery/polygon/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/polygon/example2.png -------------------------------------------------------------------------------- /gallery/polygon/example2.tex: -------------------------------------------------------------------------------- 1 | \documentclass[12pt]{standalone} 2 | \usepackage{mathptmx} 3 | \usepackage{tikz} 4 | %\usepackage{color} 5 | \usepackage[active,pdflatex,tightpage]{preview} 6 | \PreviewEnvironment[]{tikzpicture} 7 | \PreviewEnvironment[]{pgfpicture} 8 | \DeclareSymbolFont{symbolsb}{OMS}{cmsy}{m}{n} 9 | \SetSymbolFont{symbolsb}{bold}{OMS}{cmsy}{b}{n} 10 | \DeclareSymbolFontAlphabet{\mathcal}{symbolsb} 11 | 12 | 13 | 14 | \usepackage{pgfplots} 15 | 16 | 17 | \usepackage{fontspec} 18 | \usepackage{xeCJK} 19 | \setCJKmainfont[ItalicFont=方正楷体简体]{思源宋体 CN} 20 | \setCJKsansfont{思源黑体 CN} 21 | \setCJKmonofont{方正楷体简体} 22 | 23 | 24 | \begin{document} 25 | 26 | 27 | \usetikzlibrary{intersections,calc,positioning} 28 | 29 | \begin{tikzpicture}[scale=1] 30 | \begin{scope}[rotate=18] 31 | \def\n{5} 32 | \pgfmathsetmacro\i{\n-1} 33 | \foreach \x in {0,...,\i} 34 | { 35 | \def\pointname{\x} 36 | \coordinate (\pointname) at ($(0,0) +(\x*360/\n:4cm)$) ; 37 | } 38 | \end{scope} 39 | 40 | \node[circle,draw] (huo) at (0) {火}; 41 | \node[circle,draw] (mu) at (1) {木}; 42 | \node[circle,draw] (shui) at (2) {水}; 43 | \node[circle,draw] (jin) at (3) {金}; 44 | \node[circle,draw] (tu) at (4) {土}; 45 | 46 | \draw [-latex] (mu) to [bend left] node[above] {生} (huo); 47 | \draw [-latex] (huo) to [bend left=15] node[right] {生} (tu); 48 | \draw [-latex] (tu) to [bend left=5] node[below] {生} (jin); 49 | \draw [-latex] (jin) to [bend left=15] node[left] {生} (shui); 50 | \draw [-latex] (shui) to [bend left] node[above] {生} (mu); 51 | 52 | \draw [-latex] (mu) to node[right] {克} (tu); 53 | \draw [-latex] (huo) to node[below] {克} (jin); 54 | \draw [-latex] (tu) to node[below] {克} (shui); 55 | \draw [-latex] (jin) to node[left] {克} (mu); 56 | \draw [-latex] (shui) to node[above] {克} (huo); 57 | 58 | \end{tikzpicture} 59 | 60 | 61 | \end{document} -------------------------------------------------------------------------------- /gallery/polygon/example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/polygon/example3.pdf -------------------------------------------------------------------------------- /gallery/polygon/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/polygon/example3.png -------------------------------------------------------------------------------- /gallery/polygon/example3.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \usepackage{tikz} 3 | \usetikzlibrary{shapes.geometric} 4 | 5 | \newcommand\score[2]{ 6 | \pgfmathsetmacro\pgfxa{#1+1} 7 | \tikzstyle{scorestars}=[star, star points=5, star point ratio=2.25, draw,inner sep=1.3pt,anchor=outer point 3] 8 | \begin{tikzpicture}[baseline] 9 | \foreach \i in {1,...,#2} { 10 | \pgfmathparse{(\i<=#1?"yellow":"gray")} 11 | \edef\starcolor{\pgfmathresult} 12 | \draw (\i*1.75ex,0) node[name=star\i,scorestars,fill=\starcolor] {}; 13 | } 14 | \end{tikzpicture} 15 | } 16 | 17 | \begin{document} 18 | \score{4}{5} 19 | \end{document} -------------------------------------------------------------------------------- /gallery/random_walk/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/random_walk/example.pdf -------------------------------------------------------------------------------- /gallery/random_walk/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/random_walk/example.png -------------------------------------------------------------------------------- /gallery/random_walk/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8 2 | \documentclass[border=2pt]{standalone} 3 | 4 | \usepackage{tikz} 5 | \usetikzlibrary{calc} 6 | 7 | \begin{document} 8 | 9 | \begin{tikzpicture} 10 | \coordinate (-1) at (-1,0) ; 11 | \pgfmathsetmacro\i{500} 12 | \draw[color=gray!50] (0,0) -- (\i,0); 13 | \foreach \x in {0,...,\i} 14 | { 15 | \def\pointname{\x} 16 | \pgfmathsetmacro{\prepoint}{\x-1} 17 | \pgfmathrandominteger{ \rint }{ -1 }{ 1 } 18 | \coordinate (\pointname) at ($(\prepoint) + (1,\rint)$) ; 19 | %\shade[ball color=red](\pointname) circle (0.05) node[below] {\small \x}; 20 | } 21 | \draw (0) 22 | \foreach \x in {0,...,\i} 23 | { -- (\x) }; 24 | \end{tikzpicture} 25 | 26 | 27 | \end{document} -------------------------------------------------------------------------------- /gallery/refraction/refraction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/refraction/refraction.pdf -------------------------------------------------------------------------------- /gallery/refraction/refraction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/refraction/refraction.png -------------------------------------------------------------------------------- /gallery/refraction/refraction.tex: -------------------------------------------------------------------------------- 1 | % Refraction 2 | % Author: Jimi Oke 3 | \documentclass[11pt]{standalone} 4 | \usepackage{tikz} 5 | \usetikzlibrary{arrows,shapes,positioning} 6 | \usetikzlibrary{decorations.markings} 7 | \tikzstyle arrowstyle=[scale=1] 8 | \tikzstyle directed=[postaction={decorate,decoration={markings, 9 | mark=at position .65 with {\arrow[arrowstyle]{stealth}}}}] 10 | \tikzstyle reverse directed=[postaction={decorate,decoration={markings, 11 | mark=at position .65 with {\arrowreversed[arrowstyle]{stealth};}}}] 12 | \begin{document} 13 | \begin{tikzpicture} 14 | 15 | % define coordinates 16 | \coordinate (O) at (0,0) ; 17 | \coordinate (A) at (0,4) ; 18 | \coordinate (B) at (0,-4) ; 19 | 20 | % media 21 | \fill[blue!25!,opacity=.3] (-4,0) rectangle (4,4); 22 | \fill[blue!60!,opacity=.3] (-4,0) rectangle (4,-4); 23 | \node[right] at (2,2) {Air}; 24 | \node[left] at (-2,-2) {Water}; 25 | 26 | % axis 27 | \draw[dash pattern=on5pt off3pt] (A) -- (B) ; 28 | 29 | % rays 30 | \draw[red,ultra thick,reverse directed] (O) -- (130:5.2); 31 | \draw[blue,directed,ultra thick] (O) -- (-70:4.24); 32 | 33 | % angles 34 | \draw (0,1) arc (90:130:1); 35 | \draw (0,-1.4) arc (270:290:1.4) ; 36 | \node[] at (280:1.8) {$\theta_{2}$}; 37 | \node[] at (110:1.4) {$\theta_{1}$}; 38 | \end{tikzpicture} 39 | \end{document} -------------------------------------------------------------------------------- /gallery/ruler/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/ruler/example.pdf -------------------------------------------------------------------------------- /gallery/ruler/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/ruler/example.png -------------------------------------------------------------------------------- /gallery/ruler/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | 7 | \usepackage{pgfplots} 8 | \usepackage{fontspec} 9 | \usepackage{xeCJK} 10 | \setCJKmainfont[BoldFont=Adobe 黑体 Std,ItalicFont=Adobe 楷体 Std] 11 | {Adobe 宋体 Std}%影響rmfamily字體 12 | \setCJKsansfont{Adobe 黑体 Std}%影響sffamily字體 13 | \setCJKmonofont{Adobe 楷体 Std}%影響ttfamily字體 14 | 15 | \usetikzlibrary{intersections,calc,positioning} 16 | 17 | \begin{document} 18 | 19 | \begin{tikzpicture} 20 | 21 | \begin{scope}[xscale=0.2] 22 | %主线轴 23 | \def\startx{0} 24 | \def\endx{100} 25 | \pgfmathsetmacro{\stepx}{\startx+1} 26 | \pgfmathsetmacro{\stepxfive}{\startx+5} 27 | \pgfmathsetmacro{\stepxten}{\startx+10} 28 | 29 | \coordinate (startpoint) at (\startx,0) ; 30 | \coordinate (endpoint) at (\endx,0) ; 31 | \draw [](startpoint) -- (endpoint); 32 | 33 | %外边框 34 | \draw ($(startpoint) + (-3,-4)$) rectangle ($(endpoint) + (12,0)$); 35 | 36 | %细小刻度 37 | \foreach \x in {\startx,\stepx,...,\endx} 38 | \draw [](\x,0) -- (\x,-1) ; 39 | 40 | 5分之一刻度 41 | \foreach \y in {\startx,\stepxfive,...,\endx} 42 | \draw [] (\y,-1.6) -- (\y,0); 43 | 44 | 45 | %10分之一刻度 46 | \foreach \i in {\startx,\stepxten,...,\endx} 47 | \draw [] (\i,-2.2) -- (\i,0) 48 | node[below=2.5cm] {\Huge \pgfmathprint{int(\i/1)}}; 49 | 50 | %unit 51 | \node at ($(endpoint) +(6,-3)$) {\Huge cm}; 52 | \end{scope} 53 | 54 | %额外的修改 55 | 56 | 57 | \end{tikzpicture} 58 | 59 | 60 | \end{document} -------------------------------------------------------------------------------- /gallery/ruler/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/ruler/example2.pdf -------------------------------------------------------------------------------- /gallery/ruler/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/ruler/example2.png -------------------------------------------------------------------------------- /gallery/ruler/example2.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[]{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | 7 | \usepackage{pgfplots} 8 | 9 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 10 | \xeCJKsetup{PunctStyle=plain} 11 | \setCJKmainfont[ItalicFont=KaiTi]{Source Han Serif CN} 12 | \setCJKsansfont{Source Han Sans CN} 13 | \setCJKmonofont{KaiTi} 14 | 15 | \usetikzlibrary{intersections,calc,positioning} 16 | 17 | 18 | \begin{document} 19 | \begin{tikzpicture} 20 | \begin{scope} 21 | \tikzset{every node/.style={align=left}} 22 | 23 | \begin{scope}[xscale=0.5] 24 | 25 | %主线轴 26 | \def\startx{0} 27 | \def\endx{100} 28 | \pgfmathsetmacro{\stepx}{\startx+1} 29 | \pgfmathsetmacro{\stepxfive}{\startx+5} 30 | \pgfmathsetmacro{\stepxten}{\startx+10} 31 | 32 | \coordinate (startpoint) at (\startx,0) ; 33 | \coordinate (endpoint) at (\endx,0) ; 34 | \draw [](startpoint) -- (endpoint); 35 | 36 | %外边框 37 | \draw ($(startpoint) + (-3,-4)$) rectangle ($(endpoint) + (12,0)$); 38 | 39 | %细小刻度 40 | \foreach \x in {\startx,\stepx,...,\endx} 41 | \draw [](\x,0) -- (\x,-1) ; 42 | 43 | 5分之一刻度 44 | \foreach \y in {\startx,\stepxfive,...,\endx} 45 | \draw [] (\y,-1.6) -- (\y,0); 46 | 47 | 48 | %10分之一刻度 49 | \foreach \i in {\startx,\stepxten,...,\endx} 50 | \draw [] (\i,-2.2) -- (\i,0) 51 | node[below=2.5cm] {\Huge \pgfmathprint{int(\i/1)}}; 52 | 53 | %unit 54 | \node at ($(endpoint) +(2,-3)$) {\Huge cm}; 55 | \end{scope} 56 | 57 | %额外的修改 58 | \begin{scope}[yshift=0.5cm,xshift=1cm] 59 | \draw (0,0) circle (0.5); 60 | \draw (3,0) circle (0.5); 61 | \draw[xshift=-1cm,yshift=0.5cm] (0,0) rectangle (5,2); 62 | \node[xshift=-1cm,yshift=0.5cm] (carbing) at ($(0,0)!0.5!(5,2)$) {\Huge 丙}; 63 | \node[draw] (textbing) [above =2cm of carbing] {\Huge 03 \\[5pt] \Huge 00:05:10}; 64 | \end{scope} 65 | 66 | \begin{scope}[xshift=30cm,yshift=0.5cm] 67 | \draw (0,0) circle (0.5); 68 | \draw (3,0) circle (0.5); 69 | \draw[xshift=-1cm,yshift=0.5cm] (0,0) rectangle (5,2); 70 | \node[xshift=-1cm,yshift=0.5cm] (caryi) at ($(0,0)!0.5!(5,2)$) {\Huge 乙}; 71 | \node[draw] (textyi) [above =2cm of caryi] {\Huge 02 \\[5pt] \Huge 00:05:06}; 72 | \end{scope} 73 | 74 | 75 | \begin{scope}[xshift=40cm,yshift=0.5cm] 76 | \draw (0,0) circle (0.5); 77 | \draw (3,0) circle (0.5); 78 | \draw[xshift=-1cm,yshift=0.5cm] (0,0) rectangle (5,2); 79 | \node[xshift=-1cm,yshift=0.5cm] (carjia) at ($(0,0)!0.5!(5,2)$) {\Huge 甲}; 80 | \node[draw] (textjia) [above =2cm of carjia] {\Huge 01 \\[5pt] \Huge 00:05:04}; 81 | \end{scope} 82 | 83 | \end{scope} 84 | 85 | 86 | 87 | 88 | \end{tikzpicture} 89 | 90 | \end{document} -------------------------------------------------------------------------------- /gallery/ruler/example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/ruler/example3.pdf -------------------------------------------------------------------------------- /gallery/ruler/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/ruler/example3.png -------------------------------------------------------------------------------- /gallery/ruler/example3.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass{standalone} 3 | 4 | \usepackage{tikz} 5 | 6 | 7 | \usepackage{pgfplots} 8 | 9 | \RequirePackage[CJKecglue={\hskip 0pt}]{xeCJK} 10 | \xeCJKsetup{PunctStyle=plain} 11 | \setCJKmainfont[ItalicFont=KaiTi]{Source Han Serif CN} 12 | \setCJKsansfont{Source Han Sans CN} 13 | \setCJKmonofont{KaiTi} 14 | 15 | \usetikzlibrary{intersections,calc,positioning} 16 | 17 | \begin{document} 18 | 19 | \begin{tikzpicture}[xscale=0.5] 20 | 21 | %主线轴 22 | \def\startx{10} 23 | \def\endx{50} 24 | \pgfmathsetmacro{\stepx}{\startx+1} 25 | \pgfmathsetmacro{\stepxfive}{\startx+5} 26 | \pgfmathsetmacro{\stepxten}{\startx+10} 27 | 28 | \coordinate (startpoint) at (\startx,0) ; 29 | \coordinate (endpoint) at (\endx,0) ; 30 | \draw [](startpoint) -- (endpoint); 31 | 32 | \draw ($(startpoint) + (-3,-4)$) rectangle ($(endpoint) + (3,0)$); 33 | 34 | %细小刻度 35 | \foreach \x in {\startx,\stepx,...,\endx} 36 | \draw [](\x,0) -- (\x,-1) ; 37 | 38 | 5分之一刻度 39 | \foreach \y in {\startx,\stepxfive,...,\endx} 40 | \draw [] (\y,-1.6) -- (\y,0); 41 | 42 | 43 | %10分之一刻度 44 | \foreach \i in {\startx,\stepxten,...,\endx} 45 | \draw [] (\i,-2.2) -- (\i,0) 46 | node[below=2.5cm] {\Huge \pgfmathprint{int(\i/10)}}; 47 | 48 | %unit 49 | \node at ($(endpoint) +(1.5,-3)$) {\Huge cm}; 50 | 51 | 52 | %额外的修改 53 | \begin{scope}[yscale=0.5] 54 | \draw (13,0) -- (20,0) -- (20,7) -- cycle; 55 | \draw (29,0) -- (29,8) -- (40,0) -- cycle; 56 | 57 | 58 | 59 | \draw[xshift=-2cm,yshift=2cm] (20.45,0.45) circle (0.45) ; 60 | 61 | \begin{scope}[xshift=14cm] 62 | \draw[xshift=-2cm,yshift=2cm] (20.45,0.45) circle (0.45) ; 63 | \end{scope} 64 | 65 | \draw (24.5,4.5) circle (4.5) ; 66 | \end{scope} 67 | 68 | \end{tikzpicture} 69 | 70 | 71 | \end{document} -------------------------------------------------------------------------------- /gallery/spring/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/spring/example.pdf -------------------------------------------------------------------------------- /gallery/spring/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/spring/example.png -------------------------------------------------------------------------------- /gallery/spring/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usepackage{pgfplots} 5 | \usetikzlibrary{intersections,calc,positioning} 6 | \usetikzlibrary{shapes.geometric}%菱形 7 | \pgfplotsset{compat=newest} 8 | 9 | 10 | \begin{document} 11 | \begin{tikzpicture} 12 | %力的数值 13 | \def\forcenum{0.4} 14 | \def\forcepoint{-10*\forcenum/4} 15 | \pgfmathsetmacro{\coilsegmentlen}{1+\forcenum/5} 16 | %刻度 17 | \begin{scope}[scale=0.5] 18 | %主线轴 19 | \def\starty{0} 20 | \def\endy{-25} 21 | \pgfmathsetmacro{\stepy}{\starty-1} 22 | \pgfmathsetmacro{\stepyfive}{\starty-5} 23 | \pgfmathsetmacro{\stepyten}{\starty-10} 24 | 25 | \coordinate (startpoint) at (1.5,\starty) ; 26 | \coordinate (endpoint) at (1.5,\endy) ; 27 | \draw [](startpoint) -- (endpoint); 28 | 29 | 30 | %细小刻度 31 | \foreach \x in {\starty,\stepy,...,\endy} 32 | \draw [](1.5,\x) -- (2.5,\x) ; 33 | 34 | %5分之一刻度 35 | %\foreach \y in {\starty,\stepyfive,...,\endy} 36 | % \draw [] (1.6,\y) -- (0,\y); 37 | 38 | 39 | %10分之一刻度 40 | \foreach \i in {\starty,\stepyfive,...,\endy} 41 | \draw [] (3.1,\i) -- (1.5,\i)%2.2 42 | node[right=1cm] {\Huge \pgfmathprint{int(-\i/5)}}; 43 | \end{scope} 44 | 45 | 46 | 47 | 48 | %翻转 49 | \begin{scope}[scale=0.5,xscale=-1] 50 | 51 | %主线轴 52 | \def\starty{0} 53 | \def\endy{-25} 54 | \pgfmathsetmacro{\stepy}{\starty-1} 55 | \pgfmathsetmacro{\stepyfive}{\starty-5} 56 | \pgfmathsetmacro{\stepyten}{\starty-10} 57 | 58 | \coordinate (startpoint) at (1.5,\starty) ; 59 | \coordinate (endpoint) at (1.5,\endy) ; 60 | \draw [](startpoint) -- (endpoint); 61 | 62 | 63 | %细小刻度 64 | \foreach \x in {\starty,\stepy,...,\endy} 65 | \draw [](1.5,\x) -- (2.5,\x) ; 66 | 67 | %5分之一刻度 68 | %\foreach \y in {\starty,\stepyfive,...,\endy} 69 | % \draw [] (1.6,\y) -- (0,\y); 70 | 71 | 72 | %10分之一刻度 73 | \foreach \i in {\starty,\stepyfive,...,\endy} 74 | \draw [] (3.1,\i) -- (1.5,\i)%2.2 75 | node[left=1cm] {\Huge \pgfmathprint{int(-\i/5)}}; 76 | \end{scope} 77 | 78 | 79 | 80 | %额外的修改 81 | %外边框 82 | \draw (-3,-14) rectangle (3,4); 83 | \fill (0,4) circle (0.2); 84 | \fill[gray!50] (-3,4) rectangle (3,4.2); 85 | %unit 86 | \node [above right=1cm] {\Huge N}; 87 | %上面的弹簧 88 | \draw[decoration={aspect=0.3, segment length=\coilsegmentlen mm, amplitude=2mm,coil},decorate] (0,4) -- (0,\forcepoint); 89 | 90 | %菱形指针和下面的钩子 91 | \draw (0,\forcepoint) -- +(0,-15) arc (90:-180:0.6); 92 | \node [draw,scale=2,diamond,fill=orange!50,aspect=2] at (0,\forcepoint) {}; 93 | 94 | 95 | 96 | 97 | \end{tikzpicture} 98 | \end{document} -------------------------------------------------------------------------------- /gallery/spring/example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/spring/example2.pdf -------------------------------------------------------------------------------- /gallery/spring/example2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/spring/example2.png -------------------------------------------------------------------------------- /gallery/spring/example2.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usepackage{pgfplots} 5 | \usetikzlibrary{intersections,calc,positioning} 6 | \usetikzlibrary{shapes.geometric}%菱形 7 | \usetikzlibrary{patterns} 8 | \pgfplotsset{compat=newest} 9 | \usepackage{fontspec} 10 | \usepackage{xeCJK} 11 | \setCJKmainfont[ItalicFont=方正楷体简体]{思源宋体 CN} 12 | \setCJKsansfont{思源黑体 CN} 13 | \setCJKmonofont{方正楷体简体} 14 | 15 | 16 | \begin{document} 17 | \begin{tikzpicture} 18 | %力的数值 19 | \def\forcenum{0.6} 20 | \def\forcepoint{-10*\forcenum/4} 21 | \pgfmathsetmacro{\coilsegmentlen}{1+\forcenum/5} 22 | %刻度 23 | \begin{scope}[scale=0.5] 24 | %主线轴 25 | \def\starty{0} 26 | \def\endy{-25} 27 | \pgfmathsetmacro{\stepy}{\starty-1} 28 | \pgfmathsetmacro{\stepyfive}{\starty-5} 29 | \pgfmathsetmacro{\stepyten}{\starty-10} 30 | 31 | \coordinate (startpoint) at (1.5,\starty) ; 32 | \coordinate (endpoint) at (1.5,\endy) ; 33 | \draw [](startpoint) -- (endpoint); 34 | 35 | 36 | %细小刻度 37 | \foreach \x in {\starty,\stepy,...,\endy} 38 | \draw [](1.5,\x) -- (2.5,\x) ; 39 | 40 | %5分之一刻度 41 | %\foreach \y in {\starty,\stepyfive,...,\endy} 42 | % \draw [] (1.6,\y) -- (0,\y); 43 | 44 | 45 | %10分之一刻度 46 | \foreach \i in {\starty,\stepyfive,...,\endy} 47 | \draw [] (3.1,\i) -- (1.5,\i)%2.2 48 | node[right=1cm] {\Huge \pgfmathprint{int(-\i/5)}}; 49 | \end{scope} 50 | 51 | 52 | 53 | 54 | %翻转 55 | \begin{scope}[scale=0.5,xscale=-1] 56 | 57 | %主线轴 58 | \def\starty{0} 59 | \def\endy{-25} 60 | \pgfmathsetmacro{\stepy}{\starty-1} 61 | \pgfmathsetmacro{\stepyfive}{\starty-5} 62 | \pgfmathsetmacro{\stepyten}{\starty-10} 63 | 64 | \coordinate (startpoint) at (1.5,\starty) ; 65 | \coordinate (endpoint) at (1.5,\endy) ; 66 | \draw [](startpoint) -- (endpoint); 67 | 68 | 69 | %细小刻度 70 | \foreach \x in {\starty,\stepy,...,\endy} 71 | \draw [](1.5,\x) -- (2.5,\x) ; 72 | 73 | %5分之一刻度 74 | %\foreach \y in {\starty,\stepyfive,...,\endy} 75 | % \draw [] (1.6,\y) -- (0,\y); 76 | 77 | 78 | %10分之一刻度 79 | \foreach \i in {\starty,\stepyfive,...,\endy} 80 | \draw [] (3.1,\i) -- (1.5,\i)%2.2 81 | node[left=1cm] {\Huge \pgfmathprint{int(-\i/5)}}; 82 | \end{scope} 83 | 84 | 85 | 86 | %额外的修改 87 | %外边框 88 | \draw (-3,-14) rectangle (3,4); 89 | \fill (0,4) circle (0.2); 90 | \fill[gray!50] (-3,4) rectangle (3,4.2); 91 | %unit 92 | \node [above right=1cm] {\Huge N}; 93 | %上面的弹簧 94 | \draw[decoration={aspect=0.3, segment length=\coilsegmentlen mm, amplitude=2mm,coil},decorate] (0,4) -- (0,\forcepoint); 95 | 96 | %菱形指针和下面的钩子 97 | \draw (0,\forcepoint) -- +(0,-15) arc (90:-180:0.6); 98 | \node [draw,scale=2,diamond,fill=orange!50,aspect=2] at (0,\forcepoint) {}; 99 | %立方体 100 | \begin{scope}[yshift=-22cm,xshift=-1.2cm] 101 | \fill[gray!30] (0,0) rectangle (2,2.4); 102 | \fill[gray!50] (2,0) -- (2.8,0.4) -- (2.8,2.8) -- (2,2.4); 103 | \fill[gray!10] (0,2.4)-- (1,2.8) -- (2.8,2.8) -- (2,2.4); 104 | \draw[ultra thick] (1.2,2.4) -- (1.2,4.3); 105 | \end{scope} 106 | \node at (0,-25) {\Huge 甲}; 107 | %烧杯和定滑轮 108 | \begin{scope}[xshift=10cm,yshift=-20cm] 109 | \draw (0,3) circle (1) ; 110 | \draw[ultra thick] (-1,0.4) -- (1,0.4); 111 | \draw (-0.2,3) rectangle (0.2,0.4); 112 | \draw (-5,0.4) -- (5,0.4) --(5,12) -- (-5.4,12) -- (-5,11.5) --cycle ; 113 | \node at (0,-5) {\Huge 乙}; 114 | \end{scope} 115 | 116 | %烧杯,定滑轮和水 117 | \begin{scope}[xshift=25cm] 118 | %力的数值 119 | \def\forcenum{0.4} 120 | \def\forcepoint{-10*\forcenum/4} 121 | \pgfmathsetmacro{\coilsegmentlen}{1+\forcenum/5} 122 | %刻度 123 | \begin{scope}[scale=0.5] 124 | %主线轴 125 | \def\starty{0} 126 | \def\endy{-25} 127 | \pgfmathsetmacro{\stepy}{\starty-1} 128 | \pgfmathsetmacro{\stepyfive}{\starty-5} 129 | \pgfmathsetmacro{\stepyten}{\starty-10} 130 | 131 | \coordinate (startpoint) at (1.5,\starty) ; 132 | \coordinate (endpoint) at (1.5,\endy) ; 133 | \draw [](startpoint) -- (endpoint); 134 | 135 | 136 | %细小刻度 137 | \foreach \x in {\starty,\stepy,...,\endy} 138 | \draw [](1.5,\x) -- (2.5,\x) ; 139 | 140 | %5分之一刻度 141 | %\foreach \y in {\starty,\stepyfive,...,\endy} 142 | % \draw [] (1.6,\y) -- (0,\y); 143 | 144 | 145 | %10分之一刻度 146 | \foreach \i in {\starty,\stepyfive,...,\endy} 147 | \draw [] (3.1,\i) -- (1.5,\i)%2.2 148 | node[right=1cm] {\Huge \pgfmathprint{int(-\i/5)}}; 149 | \end{scope} 150 | 151 | 152 | 153 | 154 | %翻转 155 | \begin{scope}[scale=0.5,xscale=-1] 156 | 157 | %主线轴 158 | \def\starty{0} 159 | \def\endy{-25} 160 | \pgfmathsetmacro{\stepy}{\starty-1} 161 | \pgfmathsetmacro{\stepyfive}{\starty-5} 162 | \pgfmathsetmacro{\stepyten}{\starty-10} 163 | 164 | \coordinate (startpoint) at (1.5,\starty) ; 165 | \coordinate (endpoint) at (1.5,\endy) ; 166 | \draw [](startpoint) -- (endpoint); 167 | 168 | 169 | %细小刻度 170 | \foreach \x in {\starty,\stepy,...,\endy} 171 | \draw [](1.5,\x) -- (2.5,\x) ; 172 | 173 | %5分之一刻度 174 | %\foreach \y in {\starty,\stepyfive,...,\endy} 175 | % \draw [] (1.6,\y) -- (0,\y); 176 | 177 | 178 | %10分之一刻度 179 | \foreach \i in {\starty,\stepyfive,...,\endy} 180 | \draw [] (3.1,\i) -- (1.5,\i)%2.2 181 | node[left=1cm] {\Huge \pgfmathprint{int(-\i/5)}}; 182 | \end{scope} 183 | 184 | 185 | 186 | %额外的修改 187 | %外边框 188 | \draw (-3,-14) rectangle (3,4); 189 | \fill (0,4) circle (0.2); 190 | \fill[gray!50] (-3,4) rectangle (3,4.2); 191 | %unit 192 | \node [above right=1cm] {\Huge N}; 193 | %上面的弹簧 194 | \draw[decoration={aspect=0.3, segment length=\coilsegmentlen mm, amplitude=2mm,coil},decorate] (0,4) -- (0,\forcepoint); 195 | 196 | %菱形指针和下面的钩子 197 | \draw (0,\forcepoint) -- +(0,-15) arc (90:-180:0.6); 198 | \node [draw,scale=2,diamond,fill=orange!50,aspect=2] at (0,\forcepoint) {}; 199 | %立方体 200 | \begin{scope}[yshift=-20cm,xshift=-3.25cm] 201 | \fill[gray!30] (0,0) rectangle (2,2.4); 202 | \fill[gray!50] (2,0) -- (2.8,0.4) -- (2.8,2.8) -- (2,2.4); 203 | \fill[gray!10] (0,2.4)-- (1,2.8) -- (2.8,2.8) -- (2,2.4); 204 | \draw[ultra thick] (1.2,0) -- ++(0,-1) arc (180:360:1) -- ++(0,3.8) ; 205 | \end{scope} 206 | \node at (0,-25) {\Huge 丙}; 207 | %烧杯和定滑轮 208 | \def\ml{8} 209 | \pgfmathsetmacro{\mlnum}{\ml+0.13} 210 | \begin{scope}[xshift=-1cm,yshift=-24cm] 211 | \path[draw,dashed] (-5,0.4) -- (5,0.4) --(5,\mlnum) .. controls ($(0.8,\mlnum) + (0,-0.2)$) and ($(-0.8,\mlnum) + (0,-0.2)$) .. (-5,\mlnum) --cycle ; 212 | \draw (0,3) circle (1) ; 213 | \draw[ultra thick] (-1,0.4) -- (1,0.4); 214 | \draw (-0.2,3) rectangle (0.2,0.4); 215 | \draw (-5,0.4) -- (5,0.4) --(5,12) -- (-5.4,12) -- (-5,11.5) --cycle ; 216 | \end{scope} 217 | \end{scope} 218 | 219 | 220 | \end{tikzpicture} 221 | \end{document} -------------------------------------------------------------------------------- /gallery/spring/example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/spring/example3.pdf -------------------------------------------------------------------------------- /gallery/spring/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/spring/example3.png -------------------------------------------------------------------------------- /gallery/spring/example3.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass[border=2pt]{standalone} 3 | \usepackage{tikz} 4 | \usepackage{pgfplots} 5 | \usetikzlibrary{intersections,calc,positioning,spy} 6 | \usetikzlibrary{shapes.geometric}%菱形 7 | \pgfplotsset{compat=newest} 8 | 9 | 10 | \begin{document} 11 | \begin{tikzpicture}[spy using outlines={ lens={scale=4},width=18cm,height=18cm}] 12 | %局部放大效果 13 | \spy[opacity=100,circle] on (-4,-4) in node [right] at (8,-5.5); 14 | 15 | %力的数值 16 | \def\forcenum{2.6} 17 | \pgfmathsetmacro\forcepoint{-10*\forcenum/4} 18 | \pgfmathsetmacro{\coilsegmentlen}{1+\forcenum/5} 19 | 20 | %刻度 21 | \begin{scope}[scale=0.5] 22 | %主线轴 23 | \def\starty{0} 24 | \def\endy{-25} 25 | \pgfmathsetmacro{\stepy}{\starty-1} 26 | \pgfmathsetmacro{\stepyfive}{\starty-5} 27 | \pgfmathsetmacro{\stepyten}{\starty-10} 28 | 29 | \coordinate (startpoint) at (1.5,\starty) ; 30 | \coordinate (endpoint) at (1.5,\endy) ; 31 | \draw [](startpoint) -- (endpoint); 32 | 33 | 34 | %细小刻度 35 | \foreach \x in {\starty,\stepy,...,\endy} 36 | \draw [](1.5,\x) -- (2.5,\x) ; 37 | 38 | %5分之一刻度 39 | %\foreach \y in {\starty,\stepyfive,...,\endy} 40 | % \draw [] (1.6,\y) -- (0,\y); 41 | 42 | 43 | %10分之一刻度 44 | \foreach \i in {\starty,\stepyfive,...,\endy} 45 | \draw [] (3.1,\i) -- (1.5,\i)%2.2 46 | node[right=1cm] {\Huge \pgfmathprint{int(-\i/5)}}; 47 | \end{scope} 48 | 49 | 50 | 51 | 52 | %翻转 53 | \begin{scope}[scale=0.5,xscale=-1] 54 | 55 | %主线轴 56 | \def\starty{0} 57 | \def\endy{-25} 58 | \pgfmathsetmacro{\stepy}{\starty-1} 59 | \pgfmathsetmacro{\stepyfive}{\starty-5} 60 | \pgfmathsetmacro{\stepyten}{\starty-10} 61 | 62 | \coordinate (startpoint) at (1.5,\starty) ; 63 | \coordinate (endpoint) at (1.5,\endy) ; 64 | \draw [](startpoint) -- (endpoint); 65 | 66 | 67 | %细小刻度 68 | \foreach \x in {\starty,\stepy,...,\endy} 69 | \draw [](1.5,\x) -- (2.5,\x) ; 70 | 71 | %5分之一刻度 72 | %\foreach \y in {\starty,\stepyfive,...,\endy} 73 | % \draw [] (1.6,\y) -- (0,\y); 74 | 75 | 76 | %10分之一刻度 77 | \foreach \i in {\starty,\stepyfive,...,\endy} 78 | \draw [] (3.1,\i) -- (1.5,\i)%2.2 79 | node[left=1cm] {\Huge \pgfmathprint{int(-\i/5)}}; 80 | \end{scope} 81 | 82 | 83 | 84 | %额外的修改 85 | %外边框 86 | \draw (-3,-14) rectangle (3,4); 87 | \fill (0,4) circle (0.2); 88 | \fill[gray!50] (-3,4) rectangle (3,4.2); 89 | %unit 90 | \node [above right=1cm] {\Huge N}; 91 | %上面的弹簧 92 | \draw[decoration={aspect=0.3, segment length=\coilsegmentlen mm, amplitude=2mm,coil},decorate] (0,4) -- (0,\forcepoint); 93 | 94 | %菱形指针和下面的钩子 95 | \draw (0,\forcepoint) -- +(0,-15) arc (90:-180:0.6); 96 | \node [draw,scale=2,diamond,fill=orange!50,aspect=2] at (0,\forcepoint) {}; 97 | 98 | 99 | 100 | 101 | 102 | 103 | \end{tikzpicture} 104 | \end{document} -------------------------------------------------------------------------------- /gallery/spring/example6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/spring/example6.pdf -------------------------------------------------------------------------------- /gallery/spring/example6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/spring/example6.png -------------------------------------------------------------------------------- /gallery/spring/example6.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \usepackage{pgfplots} 3 | \pgfplotsset{compat=newest} 4 | \begin{document} 5 | \begin{tikzpicture} 6 | 7 | \usetikzlibrary{decorations.pathmorphing,patterns} 8 | 9 | \node[circle,fill=blue,inner sep=2.5mm] (a) at (0,0) {}; 10 | \node[circle,fill=blue,inner sep=2.5mm] (b) at (2,2) {}; 11 | \draw[decoration={aspect=0.3, segment length=3mm, amplitude=3mm,coil},decorate] (0,5) -- (a); 12 | \draw[decoration={aspect=0.3, segment length=1.5mm, amplitude=3mm,coil},decorate] (2,5) -- (b); 13 | \fill [pattern = north east lines] (-1,5) rectangle (3,5.2); 14 | \draw[thick] (-1,5) -- (3,5); 15 | 16 | 17 | \end{tikzpicture} 18 | \end{document} -------------------------------------------------------------------------------- /gallery/spring/example7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/spring/example7.pdf -------------------------------------------------------------------------------- /gallery/spring/example7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/spring/example7.png -------------------------------------------------------------------------------- /gallery/spring/example7.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz,border=2pt]{standalone} 2 | \usepackage{pgfplots} 3 | \pgfplotsset{compat=newest} 4 | \begin{document} 5 | 6 | \begin{tikzpicture}[thick] 7 | \newcommand{\ground}[2][]{ 8 | \begin{scope}[#1] 9 | \usetikzlibrary{patterns,calc} 10 | \def\groundlen{#2} 11 | \fill[pattern = north east lines] (-#2,0) rectangle (#2,0.2); 12 | \fill[color=black!50] (-#2,0.2) rectangle (#2,0.3); 13 | \end{scope}} 14 | 15 | \ground[yshift=-4.3cm]{4cm} 16 | \draw[decoration={aspect=0.3, segment length=3mm, amplitude=8mm,coil},decorate] (0,0) -- (0,-4); 17 | 18 | \fill[gray!50] (0,0) circle (1); 19 | 20 | %\fill (0,0) circle (0.1); 21 | %\draw[thick,-latex] (0,0) -- (0,4) node[right] {$F$}; 22 | %\draw[thick,-latex] (0,0) -- (0,-3) node[right =1cm] {$G$}; 23 | \end{tikzpicture} 24 | 25 | \end{document} -------------------------------------------------------------------------------- /gallery/thermometer/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/thermometer/example.pdf -------------------------------------------------------------------------------- /gallery/thermometer/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/thermometer/example.png -------------------------------------------------------------------------------- /gallery/thermometer/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | \documentclass{standalone} 3 | \usepackage{tikz} 4 | \usetikzlibrary{intersections,calc,positioning} 5 | \usepackage{siunitx} 6 | \usepackage{pgfplots} 7 | \pgfplotsset{compat=newest} 8 | 9 | \definecolor{cffffff}{RGB}{255,255,255} 10 | \definecolor{cff1117}{RGB}{255,17,23} 11 | \definecolor{cfe9e9e9}{RGB}{233,233,233} 12 | 13 | \begin{document} 14 | 15 | \begin{tikzpicture}[] 16 | 17 | \def\tlen{19}%温度的数值 18 | 19 | 20 | 21 | \draw [fill=cfe9e9e9] plot [smooth cycle] coordinates {(-2.5,-5) (-2.5,-7) (-1.5,-7.5) (-0.5,-7) (-0.5,-5)}; 22 | 23 | \draw[fill=cff1117] (-2.5,-5) rectangle (-0.5,\tlen); 24 | 25 | 26 | \begin{scope}[rotate=90] 27 | \def\startx{0} 28 | \def\endx{25} 29 | \pgfmathsetmacro{\stepx}{\startx+1} 30 | \pgfmathsetmacro{\stepxfive}{\startx+5} 31 | \pgfmathsetmacro{\stepxten}{\startx+10} 32 | 33 | \coordinate (startpoint) at (\startx,0) ; 34 | \coordinate (endpoint) at (\endx,0) ; 35 | \draw [](startpoint) -- (endpoint); 36 | 37 | \draw ($(startpoint) + (-10,-4)$) rectangle ($(endpoint) + (3,6)$); 38 | 39 | %细小刻度 40 | \foreach \x in {\startx,\stepx,...,\endx} 41 | \draw [](\x,0) -- (\x,-1) ; 42 | 43 | 5分之一刻度 44 | \foreach \y in {\startx,\stepxfive,...,\endx} 45 | \draw [] (\y,-1.6) -- (\y,0); 46 | 47 | 48 | %10分之一刻度 49 | \foreach \i in {\startx,\stepxten,...,\endx} 50 | \draw [] (\i,-2.2) -- (\i,0) 51 | node[right=2.5cm] {\Huge \pgfmathprint{int(\i-10)}}; 52 | 53 | 54 | \end{scope} 55 | 56 | %unit 57 | \node at ($(endpoint) +(-1,1)$) {\Huge \si{\degreeCelsius}}; 58 | 59 | \end{tikzpicture} 60 | \end{document} -------------------------------------------------------------------------------- /gallery/venn_diagram/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/venn_diagram/example.pdf -------------------------------------------------------------------------------- /gallery/venn_diagram/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/gallery/venn_diagram/example.png -------------------------------------------------------------------------------- /gallery/venn_diagram/example.tex: -------------------------------------------------------------------------------- 1 | % !Mode:: "TeX:UTF-8"%確保文檔utf-8編碼 2 | % according to http://www.texample.net/tikz/examples/venn-diagram/ 3 | 4 | \documentclass[tikz,border=2pt]{standalone} 5 | \usetikzlibrary{shapes,backgrounds} 6 | \usepackage{pgfplots} 7 | \pgfplotsset{compat=newest} 8 | 9 | 10 | \begin{document} 11 | \def\firstcircle{(0,0) circle (1.5cm)} 12 | \def\secondcircle{(45:2cm) circle (1.5cm)} 13 | \def\thirdcircle{(0:2cm) circle (1.5cm)} 14 | 15 | % Now we can draw the sets: 16 | \begin{tikzpicture} 17 | \draw \firstcircle node[below] {$A$}; 18 | \draw \secondcircle node [above] {$B$}; 19 | \draw \thirdcircle node [below] {$C$}; 20 | 21 | % Now we want to highlight the intersection of the first and the 22 | % second circle: 23 | 24 | \begin{scope} 25 | \clip \firstcircle; 26 | \fill[red] \secondcircle; 27 | \end{scope} 28 | 29 | % Next, we want the highlight the intersection of all three circles: 30 | 31 | \begin{scope} 32 | \clip \firstcircle; 33 | \clip \secondcircle; 34 | \fill[green] \thirdcircle; 35 | \end{scope} 36 | 37 | % The intersection trick works pretty well for intersections. If you need 38 | % the set-theoretic difference between two sets, things are a little more 39 | % complicated: 40 | 41 | % Suppose we want to highlight the part of the first circle that is not 42 | % also part of the second circle. For this, we need to clip against the 43 | % "complement" of the second circle. The trick is to add a large rectangle 44 | % that encompasses everything and then use the even-odd filling rule 45 | % (see the manual again): 46 | 47 | \begin{scope}[shift={(6cm,0cm)}] 48 | \begin{scope}[even odd rule]% first circle without the second 49 | \clip \secondcircle (-3,-3) rectangle (3,3); 50 | \fill[yellow] \firstcircle; 51 | \end{scope} 52 | \draw \firstcircle node {$A$}; 53 | \draw \secondcircle node {$B$}; 54 | \end{scope} 55 | 56 | % When using the above, you will notice that the border lines of the 57 | % original circles are erased by the intersection parts. To solve this 58 | % problem, either use a background layer (see the manual) or simply draw 59 | % the border lines after everything else has been drawn. 60 | 61 | % The last trick is to cheat and use transparency 62 | \begin{scope}[shift={(3cm,-5cm)}, fill opacity=0.5] 63 | \fill[red] \firstcircle; 64 | \fill[green] \secondcircle; 65 | \fill[blue] \thirdcircle; 66 | \draw \firstcircle node[below] {$A$}; 67 | \draw \secondcircle node [above] {$B$}; 68 | \draw \thirdcircle node [below] {$C$}; 69 | \end{scope} 70 | 71 | 72 | \end{tikzpicture} 73 | 74 | 75 | 76 | \end{document} -------------------------------------------------------------------------------- /generate_gallery.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*-coding:utf-8-*- 3 | 4 | 5 | """ 6 | 1. scan gallery folder 7 | 2. convert the pdf -> png 8 | 3. get png link and get code link 9 | 4. generate markdown 10 | 11 | """ 12 | import os 13 | import re 14 | import logging 15 | 16 | from jinja2 import Template 17 | 18 | from pywander.image.convert_image import convert_image 19 | from pywander.pathlib import gen_allfile 20 | 21 | 22 | FOLDER_NAME = 'gallery' 23 | MARKDOWN_NAME = 'GALLERY.md' 24 | 25 | logging.basicConfig(level=logging.DEBUG) 26 | 27 | def scan_folder(): 28 | g = gen_allfile(FOLDER_NAME, '\.tex$') 29 | all_files = [os.path.join(FOLDER_NAME, filename) for filename in g] 30 | 31 | return all_files 32 | 33 | 34 | def convert_pdf_to_png(all_files): 35 | for filename in all_files: 36 | 37 | target_pdf = filename[:-4] + '.pdf' 38 | dirname = os.path.dirname(target_pdf) 39 | 40 | logging.info(f'start convert pdf to png on :{target_pdf}') 41 | 42 | outimg = convert_image(target_pdf, outputdir=dirname,pdftocairo_fix_encoding='gb18030') 43 | 44 | logging.info(f'convert pdf result: {outimg}') 45 | 46 | 47 | def create_link_data(all_files): 48 | link_data = [] 49 | 50 | for filename in all_files: 51 | item = {} 52 | item['name'] = os.path.splitext(filename)[0][len(FOLDER_NAME)+1:] 53 | 54 | filename_url = filename.replace('\\', '/') 55 | item['tex'] = filename_url 56 | item['png'] = filename_url[:-4] + '.png' 57 | 58 | link_data.append(item) 59 | 60 | return link_data 61 | 62 | 63 | def generate_markdown(link_data): 64 | template_content = open('GALLERY.jinja2', 'rt').read() 65 | 66 | with open(MARKDOWN_NAME, 'wt') as f: 67 | template = Template(template_content) 68 | content = template.render(link_data=link_data) 69 | 70 | f.write(content) 71 | 72 | 73 | def main(): 74 | all_files = scan_folder() 75 | 76 | convert_pdf_to_png(all_files) 77 | 78 | link_data = create_link_data(all_files) 79 | 80 | generate_markdown(link_data) 81 | 82 | 83 | if __name__ == '__main__': 84 | main() -------------------------------------------------------------------------------- /images/点的相对偏移.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/images/点的相对偏移.png -------------------------------------------------------------------------------- /images/画圆.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/images/画圆.png -------------------------------------------------------------------------------- /images/画弧线.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/images/画弧线.png -------------------------------------------------------------------------------- /images/画椭圆.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/images/画椭圆.png -------------------------------------------------------------------------------- /images/画直线.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/images/画直线.png -------------------------------------------------------------------------------- /images/画长方形.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/images/画长方形.png -------------------------------------------------------------------------------- /images/直线带箭头.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/a358003542/tikz_gallery/c62d9049754b7174cbeec0f8f930e6ca0ecde59a/images/直线带箭头.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | click 2 | jinja2 3 | pillow 4 | pywander 5 | 6 | --------------------------------------------------------------------------------