Author Archive

Wochentag ausgeben mit scrdate

Hier noch ein Beispiel, wie man mit scrdate.sty den Namen des aktuellen Tages ausgeben kann:

\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage{babel}
\usepackage{scrdate}
 
\begin{document}
 
Available in Standard-\LaTeX:
 
\the\year
 
\the\month
 
\the\day
 
Via scrdate:
 
Heute ist \todaysname, der \today.
 
\ISOToday
\end{document}

scrdt1a

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Short eso-pic example

Whenever I have to put something on an arbitrary position on a page, I like to use the eso-pic package. Here’s a short example how it works:

\documentclass[12pt,ngerman]{scrreprt}
 
\usepackage{eso-pic,rotating,graphicx}
\usepackage{blindtext}
 
\author{John Doe}
\title{Some Thesis}
 
\begin{document}
 
\AddToShipoutPicture*{\put(200,200){\rotatebox{45}{\scalebox{3}{Examiners copy}}}}
\maketitle
 
\blindtext
 
\end{document}
 
<a href="http://uweziegenhagen.de/wp-content/uploads/2014/02/eso.png"><img src="http://uweziegenhagen.de/wp-content/uploads/2014/02/eso.png" alt="eso" width="491" height="711" class="aligncenter size-full wp-image-2915" /></a>

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Generating math exercises for kids with LuaLaTeX

Arno T. has sent me a nice piece of LuaLaTeX code that does more or less the same thing as my Python code. I guess, I should have a closer look at LuaLaTeX.

\documentclass{scrartcl}
\usepackage{booktabs}
\usepackage{luacode}
\usepackage{longtable}
 
\begin{document}
\begin{longtable}{rcrcl}
\toprule
\luaexec{
function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
random = math.random
tp = tex.print
%
min = 1
max = 10
math.randomseed(os.time())
for i = 1,20 do
a = random(min,max)
b = random(min,max)
op = random(1,4)
if (op==1) then
c = a+b
tp(a.."&+&"..b.."&=&"..c.."\\\\")
elseif (op==2) then
c = a-b
tp(a.."&-&"..b.."&=&"..c.."\\\\")
elseif (op==3) then
c = a*b
tp(a.."&*&"..b.."&=&"..c.."\\\\")
elseif (op==4) then
c = a/b
tp(a.."&/&"..b.."&=&"..round(c,3).."\\\\")
end
end
tex.print("\\bottomrule")
}
\end{longtable}
\end{document}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Visualizing Graphs mit Graphviz (and LaTeX) – Part II

This entry is part 2 of 2 in the series GraphViz

In this article I’d like to show a little bit about how to manipulate the style of the nodes and edges.

The graph uses orthogonal edges, red edges and green boxes with blue filling and white font color.

digraph G{
graph [label="Orthogonal edges", splines=ortho, nodesep=0.2]
node [shape=box,style=filled,fillcolor="#0000FF",color="#00FF00",fontcolor="#FFFFFF"];
edge[arrowhead="none",color="#FF0000"];
a [label="Aaa",URL="http://www.google.de"];
b [label="Bbb"];
c [label="Ccc"];
d [label="Ddd"];
e [label="Eee"];
f [label="Fff"];
a->b;
a->c;
a->d;
d->e;
d->f;
}

Note that the URL can only be used in the SVG version, the PDF representation does not support it.

gv2

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Generating math exercises for kids

Here’s a simple Python script which generates math exercises for kids. It uses the Century Schoolbook font which is said to be well readable and LaTeX’s longtable. I just ran some tests, generating 24’000 lines on 2000 pages was no deal at all.

#!/usr/bin/python
# coding: utf-8
import random
import os
 
min = 1 # number to start with
max = 10 # maximum number
count = 24 # 12 fit on one page
 
with open('Aufgaben.tex', 'w') as texfile:
	texfile.write("\\documentclass[15pt,ngerman]{scrartcl}\n")
	texfile.write("\\usepackage[utf8]{inputenc}\n")
	texfile.write("\\usepackage{tgschola,longtable}\n")
	texfile.write("\\usepackage[T1]{fontenc}\n")
	texfile.write("\\setlength{\\parindent}{0pt}\n")
	texfile.write("\\pagestyle{empty}\n")
	texfile.write("\\renewcommand*{\\arraystretch}{1.5}\n")
	texfile.write("\\begin{document}\n")
	texfile.write("\\huge\n")
	texfile.write("\\begin{longtable}{cccp{8cm}c}")
 
	for i in range(count):
		a = random.randint(min, max)
		b = random.randint(min, max)
 
		result = a + b;
 
		texfile.write('%s &+ &%s &= &%s \\\\ \\hline\n'%(str(a),str(b),str(result)))
 
	texfile.write("\\end{longtable}\n")
	texfile.write("\\end{document}\n")
 
os.system("pdflatex Aufgaben.tex")
os.startfile("Aufgaben.pdf") # this line may not work under Linux

With little modification one can also generate substraction exercises:

#!/usr/bin/python
# coding: utf-8
import random
 
min = 1
max = 12
count = 24
 
import os # for sys calls
 
with open('Aufgaben.tex', 'w') as texfile:
	texfile.write("\\documentclass[15pt,ngerman]{scrartcl}\n")
	texfile.write("\\usepackage[utf8]{inputenc}\n")
	texfile.write("\\usepackage{tgschola,nicefrac,longtable}\n")
	texfile.write("\\usepackage[T1]{fontenc}\n")
	texfile.write("\\setlength{\\parindent}{0pt}\n")
	texfile.write("\\pagestyle{empty}\n")
	texfile.write("\\renewcommand*{\\arraystretch}{1.5}\n")
	texfile.write("\\begin{document}\n")
	texfile.write("\\huge\n")
	texfile.write("\\begin{longtable}{cccp{8cm}c}")
 
	for i in range(count):
		b = random.randint(min, max)
		a =  b + random.randint(1, 9)
 
		result = a - b;
 
		texfile.write('%s &- &%s &= &%s \\\\ \\hline\n'%(str(a),str(b),str(result)))
 
	texfile.write("\\end{longtable}\n")
	texfile.write("\\end{document}\n")
 
os.system("pdflatex Aufgaben.tex")
os.startfile("Aufgaben.pdf")

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Die Suche nach einer brauchbaren Vereinssoftware… Teil 2

This entry is part 2 of 2 in the series Vereinssoftware

Für die Auswertung der Buchungen will ich natürlich LaTeX nutzen. Die Vorlagen für die offiziellen „Zuwendungsbescheinigungen“ gibt es leider nur im Word und PDF Format. Daher musste ich die Vorlagen neu bauen. Die Umsetzung war mit relativ wenig Aufwand verbunden, die fertigen Dateien habe ich in einem Google Code Projekt unter http://code.google.com/p/spendenquittungen-mit-latex/ abgelegt.

Verbunden werden die Vorlagen mit den Daten über MySQL & Python, das genaue Vorgehen wird in einem Artikel für die DTK beschrieben.

zuw1

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Die Suche nach einer brauchbaren Vereinssoftware… Teil 1

This entry is part 1 of 2 in the series Vereinssoftware

Ich bin seit einigen Monaten Schatzmeister der Dingfabrik, einem Kölner Fablab.

Bevor ich das Amt übernahm, wurde die Verwaltung der Finanzen über Excel und CSV-Exporte der Sparkasse erledigt, was zeitlich sehr aufwändig war.

Der erste Schritt war der Ersatz von Excel durch Quicken. Die genutzte Quicken 2010 Jubiläumsversion kann die Konten (auch Paypal) recht ordentlich verwalten. Ich habe diverse Kategorien angelegt, jedes Mitglied hat noch eine eigene Klasse zugewiesen bekommen, die mit der Mitgliedsnummer korrespondiert. So lassen sich die Excel-Exporte aus Quicken mit den Stammdaten der Mitglieder automatisiert abgleichen und für z.B. Spendenquittungen nutzen.

Mir war vor allem wichtig, dass ich an die Daten, die ich über die Software erfasse, problemlos herankomme. Mit Quicken ist diese Anforderung zwar nicht vollumfassend erfüllt (Split-Buchungen werden nur unter der Kategori „Splitbuchung“ ausgegeben, nicht unter den Kategorien, die zugewiesen wurden), Quicken ist aber in jedem Fall eine Erleichterung im Vergleich zur reinen Excel-Lösung.

Die Stammdaten der Mitglieder verwalte ich über eine MySQL Datenbank. Dies hat den Vorteil, dass ich die komplette Kontrolle über die Daten habe und diese beliebig auswerten kann. Zusammen mit dem MySQL Add-In für Excel kann man die Daten recht einfach pflegen.

Die folgenden Felder bilden die Stammdaten:

  • ID (Mitgliedsnummer)
  • Anrede (Herr, Frau, Damen und Herren)
  • Vorname
  • Name
  • BuchungsID (unter diesem Namen kommen die Buchungen auf’s Konto)
  • Adresszusatz
  • Strasse
  • PLZ
  • Ort
  • eMail
  • MLintern (1/0 für die Mitgliedschaft der internen Mailingliste)
  • Telefon
  • Mobil
  • Mitgliedsart
  • Beitrag (der monatliche Mitgliedsbeitrag)
  • Kommentar
  • MitgliedSeit (Eintrittsdatum)
  • MitgliedBis (Austrittsdatum)

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

My Beamer Slide Template

Here’s the Beamer template I had created for my GF a while ago.

It uses XeLaTeX to compile as I had selected the Frutiger Serif font for the presentation, this can however be easily changed.

Folien (ZIP)

Folien (PDF)

template1

template2

Update 2014-03-22: The TeX file in the following zip was updated to include a progressbar in the footer:

Folien (ZIP)

During the first compilation run the total number of slides for the progressbar is not known so LaTeX complains. Just have it run through, in the second run the errors should be gone. This example was also prepared for the Frutiger Serif so you may need to update it in case these fonts are not available on your computer.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

AHK Datei für meinen DTK-Artikel

Hier ist der Inhalt meiner AHK-Datei für den Artikel in der TeXnischen Komödie:

#IfWinActive ahk_class QWidget
{
^k:: 
Send {HOME}
Send {SHIFT}+{END}
Send {DEL 2}
return

^d::
Send {HOME}
Send {SHIFT}+{END}
Send ^c
ClipWait, 2
Send {END}
Send {ENTER}
Send ^v
return
}
#IfWinActive 

:*:ch#::\chapter{{}{}}{LEFT}
:*:s#::\section{{}{}}{LEFT}
:*:ss#::\subsection{{}{}}{LEFT}
:*:sss#::\subsubsection{{}{}}{LEFT}

:*:b#::\begin{{}{}}{LEFT}
:*:e#::\end{{}{}}{LEFT}

:*:bf#::\textbf{{}{}}{LEFT}
:*:tt#::\texttt{{}{}}{LEFT}
:*:it#::\textit{{}{}}{LEFT}

:*:desc#::\begin{{}description{}}`r\item[]`r\item[]`r\item[]`r\end{{}description{}}{UP 3}{LEFT}
:*:enum#::\begin{{}enumerate{}}`r\item `r\item `r\item `r\end{{}enumerate{}}{UP 3}
:*:item#::\begin{{}itemize{}}`r\item `r\item `r\item `r\end{{}itemize{}}{UP 3}

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website

Spendenquittungen mit LaTeX

Unter http://code.google.com/p/spendenquittungen-mit-latex/ liegen jetzt aktualisierte Versionen der Spendenformulare, die das Design der offiziellen Vorlagen von http://www.finanzamt.bayern.de/Informationen/Formulare/Weitere_Themen_A_bis_Z/Spenden/default.php in LaTeX nachbauen.

In der Geldspendenbestätigung kann man jetzt mit dem ifthen-Schalter `sammel` zwischen Einzel- und Sammelbestätigung umschalten.

Update: Nach https://github.com/UweZiegenhagen/spendenquittungen-mit-latex umgezogen.

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website