2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00

Add README.md and rendered image to 6 tikz examples

The examples were found by

```bash
$ find . -type d '!' -exec test -e "{}/README.md" ';' -print
```
This commit is contained in:
Martin Thoma 2015-11-20 08:11:29 +01:00
parent 7732da4f39
commit 6364e13a6a
21 changed files with 67 additions and 47 deletions

View file

@ -2,11 +2,11 @@ SOURCE = bellman-ford-algorithm
DELAY = 80 DELAY = 80
DENSITY = 300 DENSITY = 300
WIDTH = 512 WIDTH = 512
make: make:
pdflatex $(SOURCE).tex -output-format=pdf pdflatex $(SOURCE).tex -output-format=pdf
make clean make clean
clean: clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.toc *.snm *.out *.nav rm -rf $(TARGET) *.class *.html *.log *.aux *.toc *.snm *.out *.nav
@ -20,22 +20,20 @@ animatedGif:
pdfcrop $(SOURCE).pdf pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean make clean
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
png: png:
make make
make svg make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg: svg:
make
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs: # Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg inkscape $(SOURCE).svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg rm $(SOURCE)1.svg
rm $(SOURCE)2.svg

View file

@ -1 +0,0 @@
TODO: Not ready, make ready!

View file

@ -0,0 +1,6 @@
TODO: Not ready, make ready!
Compiled example
----------------
![Example](bellman-ford-algorithm.gif)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -25,11 +25,9 @@ transparentGif:
make clean make clean
svg: svg:
make
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs: # Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg inkscape $(SOURCE).svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg rm $(SOURCE)1.svg
rm $(SOURCE)2.svg

3
tikz/center/README.md Normal file
View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](center.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

View file

@ -1,6 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from random import uniform from random import uniform
import random import random
import math
n = 5 n = 5
xMin, yMin = 0, 0 xMin, yMin = 0, 0
@ -12,29 +14,30 @@ coordinates = []
random.seed(42) random.seed(42)
for i in range(n): for i in range(n):
x = uniform(xMin, xMax) x = uniform(xMin, xMax)
y = uniform(yMin, yMax) y = uniform(yMin, yMax)
xSum += x xSum += x
ySum += y ySum += y
coordinates.append((x,y)) coordinates.append((x, y))
center = (float(xSum) / n, float(ySum) / n) center = (float(xSum) / n, float(ySum) / n)
cx, cy = center cx, cy = center
pointCoords = "" point_coords = ""
for p in coordinates: for p in coordinates:
px, py = p px, py = p
newP = "(%.2f,%.2f)," % (px, py) new_p = "(%.2f,%.2f)," % (px, py)
pointCoords = newP + pointCoords point_coords = new_p + point_coords
deltaY = cy-py delta_y = cy-py
deltaX = cx-px delta_x = cx-px
length = (deltaY**2+deltaX**2)**0.5 length = (delta_y**2+delta_x**2)**0.5
sinAlpha = deltaY/length sin_alpha = delta_y/length
cosAlpha = deltaX/length cos_alpha = delta_x/length
print("\draw[->] (%.2f,%.2f) -- (%.2f,%.2f);" % (px, py, px+cosAlpha*length*0.80, py+sinAlpha*length*0.80)) print("\draw[->] (%.2f,%.2f) -- (%.2f,%.2f);" %
(px, py, px + cos_alpha*length*0.80, py + sin_alpha*length*0.80))
print("\\node[circle,inner sep=1pt,fill] at (%.2f,%.2f) {};" % (cx, cy)) print("\\node[circle,inner sep=1pt,fill] at (%.2f,%.2f) {};" % (cx, cy))
print("\\foreach \point in {" + pointCoords + "}{") print("\\foreach \point in {" + point_coords + "}{")
print("\\node[dot] at \point {};") print("\\node[dot] at \point {};")
print("}") print("}")

View file

@ -1,4 +1,5 @@
SOURCE = cubic-function-intermediate-value-theorem SOURCE = cubic-function-intermediate-value-theorem
DELAY = 80 DELAY = 80
DENSITY = 300 DENSITY = 300
WIDTH = 500 WIDTH = 500

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](cubic-function-intermediate-value-theorem.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -1,10 +1,9 @@
SOURCE = dirichlet-function SOURCE = dirichlet-function
DELAY = 80 DELAY = 80
DENSITY = 300 DENSITY = 300
WIDTH = 500 WIDTH = 512
make: make:
pdflatex $(SOURCE).tex -output-format=pdf
pdflatex $(SOURCE).tex -output-format=pdf pdflatex $(SOURCE).tex -output-format=pdf
make clean make clean
@ -29,4 +28,6 @@ svg:
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs: # Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg inkscape $(SOURCE).svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
rm $(SOURCE)1.svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](dirichlet-function.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View file

@ -1,15 +1,14 @@
SOURCE = jordan-normal-form SOURCE = jordan-normal-form
DELAY = 80 DELAY = 80
DENSITY = 300 DENSITY = 300
WIDTH = 500 WIDTH = 512
make: make:
pdflatex $(SOURCE).tex -output-format=pdf
pdflatex $(SOURCE).tex -output-format=pdf pdflatex $(SOURCE).tex -output-format=pdf
make clean make clean
clean: clean:
rm -rf $(TARGET) *.class *.html *.log *.aux rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif: gif:
pdfcrop $(SOURCE).pdf pdfcrop $(SOURCE).pdf
@ -29,4 +28,6 @@ svg:
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs: # Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg inkscape $(SOURCE).svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
rm $(SOURCE)1.svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](jordan-normal-form.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

@ -25,11 +25,9 @@ transparentGif:
make clean make clean
svg: svg:
make
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs: # Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg inkscape $(SOURCE).svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg rm $(SOURCE)1.svg
rm $(SOURCE)2.svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](resource-allocation-graph.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before After
Before After