mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-25 14:28:05 +02:00
added some more examples
This commit is contained in:
parent
a40c94463e
commit
ccfac9c458
6 changed files with 237 additions and 0 deletions
40
tikz/3d-page-conflicts/3d-page-conflicts.tex
Normal file
40
tikz/3d-page-conflicts/3d-page-conflicts.tex
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
\documentclass{article}
|
||||||
|
\usepackage[pdftex,active,tightpage]{preview}
|
||||||
|
\setlength\PreviewBorder{2mm}
|
||||||
|
\usepackage{pgfplots}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\begin{preview}
|
||||||
|
\pgfplotsset{
|
||||||
|
colormap={whitered}{
|
||||||
|
color(0cm)=(white);
|
||||||
|
color(1cm)=(orange!75!red)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\newcommand{\Pages}{250}
|
||||||
|
\begin{axis}[
|
||||||
|
colormap name=whitered,
|
||||||
|
width=15cm,
|
||||||
|
view={20}{25},
|
||||||
|
enlargelimits=false,
|
||||||
|
grid=major,
|
||||||
|
domain=0:\Pages,
|
||||||
|
y domain=1:\Pages,
|
||||||
|
samples=16,
|
||||||
|
xlabel=$p$,
|
||||||
|
ylabel=$C$,
|
||||||
|
zlabel={$z$},
|
||||||
|
colorbar,
|
||||||
|
colorbar style={
|
||||||
|
at={(-0.1,0)},
|
||||||
|
anchor=south west,
|
||||||
|
height=0.25*\pgfkeysvalueof{/pgfplots/parent axis height},
|
||||||
|
title={$f(x,y)$}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
\addplot3[surf] {(\Pages!/(x!*(\Pages-x)!)) * (1/y)^x * (1-1/y)^(\Pages-x)};
|
||||||
|
\end{axis}
|
||||||
|
\end{tikzpicture}
|
||||||
|
\end{preview}
|
||||||
|
\end{document}
|
31
tikz/3d-page-conflicts/Makefile
Normal file
31
tikz/3d-page-conflicts/Makefile
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
SOURCE = 3d-page-conflicts
|
||||||
|
DELAY = 80
|
||||||
|
DENSITY = 300
|
||||||
|
WIDTH = 500
|
||||||
|
|
||||||
|
make:
|
||||||
|
pdflatex $(SOURCE).tex -output-format=pdf
|
||||||
|
make clean
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
|
||||||
|
|
||||||
|
gif:
|
||||||
|
pdfcrop $(SOURCE).pdf
|
||||||
|
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
|
||||||
|
make clean
|
||||||
|
|
||||||
|
png:
|
||||||
|
make
|
||||||
|
make svg
|
||||||
|
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
|
||||||
|
|
||||||
|
transparentGif:
|
||||||
|
convert $(SOURCE).pdf -transparent white result.gif
|
||||||
|
make clean
|
||||||
|
|
||||||
|
svg:
|
||||||
|
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
|
||||||
|
pdf2svg $(SOURCE).pdf $(SOURCE).svg
|
||||||
|
# Necessary, as pdf2svg does not always create valid svgs:
|
||||||
|
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
|
32
tikz/cache-4-way-associative/Makefile
Normal file
32
tikz/cache-4-way-associative/Makefile
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
SOURCE = cache-4-way-associative
|
||||||
|
DELAY = 80
|
||||||
|
DENSITY = 300
|
||||||
|
WIDTH = 500
|
||||||
|
|
||||||
|
make:
|
||||||
|
pdflatex $(SOURCE).tex -output-format=pdf
|
||||||
|
make clean
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(TARGET) *.class *.html *.log *.aux
|
||||||
|
|
||||||
|
gif:
|
||||||
|
pdfcrop $(SOURCE).pdf
|
||||||
|
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
|
||||||
|
make clean
|
||||||
|
|
||||||
|
png:
|
||||||
|
make
|
||||||
|
make svg
|
||||||
|
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
|
||||||
|
|
||||||
|
transparentGif:
|
||||||
|
convert $(SOURCE).pdf -transparent white result.gif
|
||||||
|
make clean
|
||||||
|
|
||||||
|
svg:
|
||||||
|
make
|
||||||
|
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
|
||||||
|
pdf2svg $(SOURCE).pdf $(SOURCE).svg
|
||||||
|
# Necessary, as pdf2svg does not always create valid svgs:
|
||||||
|
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
|
51
tikz/cache-4-way-associative/cache-4-way-associative.tex
Normal file
51
tikz/cache-4-way-associative/cache-4-way-associative.tex
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
\documentclass{article}
|
||||||
|
\usepackage[pdftex,active,tightpage]{preview}
|
||||||
|
\setlength\PreviewBorder{2mm}
|
||||||
|
|
||||||
|
\usepackage{amsmath,array}
|
||||||
|
\usepackage{tikz}
|
||||||
|
\usetikzlibrary{decorations.pathreplacing}
|
||||||
|
|
||||||
|
\setlength\arraycolsep{4pt} % default value: 6pt
|
||||||
|
|
||||||
|
\newcommand\tikzmark[1]{%
|
||||||
|
\tikz[overlay,remember picture,baseline] \coordinate [anchor=base] (#1);}
|
||||||
|
|
||||||
|
\newcommand\DrawBrace[3]{%
|
||||||
|
\draw [decorate,decoration={brace,amplitude=2pt,mirror,raise=2pt}]
|
||||||
|
(#1) -- (#2) node [black,midway,sloped,yshift=-10pt] {\footnotesize$#3$};
|
||||||
|
}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\begin{preview}
|
||||||
|
TODO!!!
|
||||||
|
\begin{tabular}{|l|l|}
|
||||||
|
\hline
|
||||||
|
Tag & Daten\\
|
||||||
|
\hline \hline
|
||||||
|
0 & 12345 \tikzmark{a}\\
|
||||||
|
1 & 12345\\
|
||||||
|
2 & 12345\\
|
||||||
|
3 & 12345 \tikzmark{b}\\
|
||||||
|
4 & 12345\\
|
||||||
|
5 & 12345\\
|
||||||
|
6 & 12345\\
|
||||||
|
7 & 12345\\
|
||||||
|
8 & 12345\\
|
||||||
|
9 & 12345\\
|
||||||
|
10 & 12345\\
|
||||||
|
11 & 12345\\
|
||||||
|
12 & 12345\\
|
||||||
|
13 & 12345\\
|
||||||
|
14 & 12345\\
|
||||||
|
15 & 12345\\
|
||||||
|
16 & 12345\\
|
||||||
|
\hline
|
||||||
|
\end{tabular}
|
||||||
|
|
||||||
|
\begin{tikzpicture}[remember picture,overlay]
|
||||||
|
\DrawBrace{b}{a}{blibla}
|
||||||
|
\end{tikzpicture}
|
||||||
|
|
||||||
|
\end{preview}
|
||||||
|
\end{document}
|
31
tikz/single-level-page-table/Makefile
Normal file
31
tikz/single-level-page-table/Makefile
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
SOURCE = single-level-page-table
|
||||||
|
DELAY = 80
|
||||||
|
DENSITY = 300
|
||||||
|
WIDTH = 500
|
||||||
|
|
||||||
|
make:
|
||||||
|
pdflatex $(SOURCE).tex -output-format=pdf
|
||||||
|
make clean
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(TARGET) *.class *.html *.log *.aux
|
||||||
|
|
||||||
|
gif:
|
||||||
|
pdfcrop $(SOURCE).pdf
|
||||||
|
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
|
||||||
|
make clean
|
||||||
|
|
||||||
|
png:
|
||||||
|
make
|
||||||
|
make svg
|
||||||
|
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
|
||||||
|
|
||||||
|
transparentGif:
|
||||||
|
convert $(SOURCE).pdf -transparent white result.gif
|
||||||
|
make clean
|
||||||
|
|
||||||
|
svg:
|
||||||
|
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
|
||||||
|
pdf2svg $(SOURCE).pdf $(SOURCE).svg
|
||||||
|
# Necessary, as pdf2svg does not always create valid svgs:
|
||||||
|
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
|
52
tikz/single-level-page-table/single-level-page-table.tex
Normal file
52
tikz/single-level-page-table/single-level-page-table.tex
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
\documentclass{article}
|
||||||
|
\usepackage[pdftex,active,tightpage]{preview}
|
||||||
|
\setlength\PreviewBorder{2mm}
|
||||||
|
% http://upload.wikimedia.org/wikipedia/de/5/5d/EinstufigeSeitentabelle.png
|
||||||
|
\usepackage{tikz}
|
||||||
|
\usetikzlibrary{calc, shapes.multipart}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\begin{preview}
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\newcommand{\PageNumber}{Seitennummer};
|
||||||
|
\newcommand{\Offset}{Offset};
|
||||||
|
\newcommand{\VirtualAdress}{Virtuelle Adresse};
|
||||||
|
\newcommand{\RealAdress}{Reale Adresse};
|
||||||
|
\newcommand{\PageTable}{Seitentabelle};
|
||||||
|
\newcommand{\textBoxHeight}{1};
|
||||||
|
|
||||||
|
\node[rectangle split, rectangle split horizontal,
|
||||||
|
rectangle split parts=2, draw, fill=black!20,label=left:\textbf{\VirtualAdress}]
|
||||||
|
(VirtualAdressNode) at (5,0)
|
||||||
|
{\nodepart{one}\PageNumber \nodepart{two}\Offset};
|
||||||
|
|
||||||
|
\newcommand{\titleShift}{0.45cm};
|
||||||
|
\draw[<->] ([yshift=\titleShift]VirtualAdressNode.one west) -- ([yshift=\titleShift]VirtualAdressNode.one split);
|
||||||
|
\draw[<->] ([yshift=\titleShift]VirtualAdressNode.one split) -- ([yshift=\titleShift]VirtualAdressNode.one east);
|
||||||
|
|
||||||
|
\node[fill=white,font=\tiny,yshift=\titleShift] at ($(VirtualAdressNode.one west)!0.5!(VirtualAdressNode.one split)$) {n bit};
|
||||||
|
\node[fill=white,font=\tiny,yshift=\titleShift] at ($(VirtualAdressNode.one split)!0.5!(VirtualAdressNode.one east)$) {m bit};
|
||||||
|
|
||||||
|
\node[rectangle split,
|
||||||
|
rectangle split parts=10, draw, fill=black!20]
|
||||||
|
(PageTableNode1) at (2,-3)
|
||||||
|
{};
|
||||||
|
\node[rectangle split, minimum width=3cm,anchor=west,
|
||||||
|
rectangle split parts=10, draw, fill=black!20,label=above:\textbf{\PageTable}]
|
||||||
|
(PageTableNode2) at (2.2,-3)
|
||||||
|
{};
|
||||||
|
|
||||||
|
\node (StatusBitsNode) at (2,-5.6) {Statusbits};
|
||||||
|
\node (BasisadresseNode) at (4,-5.6) {Basisadresse};
|
||||||
|
\draw[->,very thick] (StatusBitsNode) -- (2, -5);
|
||||||
|
\draw[->,very thick] (BasisadresseNode) -- (4, -5);
|
||||||
|
|
||||||
|
\node[rectangle split, rectangle split horizontal,
|
||||||
|
rectangle split parts=2, draw, fill=black!20,label=left:\textbf{\RealAdress}]
|
||||||
|
(RealAdressNode) at (5,-6.4)
|
||||||
|
{\nodepart{one}Basisadresse der realen Seite \nodepart{two}\Offset};
|
||||||
|
|
||||||
|
\draw[->, very thick] (VirtualAdressNode.two south) -- (RealAdressNode.two north);
|
||||||
|
\end{tikzpicture}
|
||||||
|
\end{preview}
|
||||||
|
\end{document}
|
Loading…
Add table
Add a link
Reference in a new issue