Archive for the ‘Pakete’ Category.

Calendars with Excel and pgfgantt, Part II

Since the last example of my pgfgantt-calendar generated a PDF with 1,60m width I decided to switch to a quarterly calendar. It took me quite a while to figure out the necessary Excel formulas (one may even find easier ways) but it works.

The green part contains some basic variables, e.g. when a quarter starts and ends. In the red part you just enter your dates. The violet part generates the entries for pgfgantt, the red box holds the copy&paste-ready entries for the TeX code. The code is able to handle events exceeding a single quarter.

23.01

Excel Code

final PDF

\documentclass{article}
\usepackage[landscape,a3paper,left=1cm,right=1cm,top=1cm,bottom=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pgfgantt}
\usetikzlibrary{calendar}
 
\protected\def\aaa#1{%
\pgfcalendarifdate{2012-12-31+#1}{weekend}% Test if it's a weekend
{\textcolor{red}{\pgfcalendarifdateday}}% Typeset with red color
{\pgfcalendarifdateday}% Or just the number
}
 
\protected\def\bbb#1{%
\pgfcalendarifdate{2013-03-31+#1}{weekend}% Test if it's a weekend
{\textcolor{red}{\pgfcalendarifdateday}}% Typeset with red color
{\pgfcalendarifdateday}% Or just the number
}
 
\protected\def\ccc#1{%
\pgfcalendarifdate{2013-06-30+#1}{weekend}% Test if it's a weekend
{\textcolor{red}{\pgfcalendarifdateday}}% Typeset with red color
{\pgfcalendarifdateday}% Or just the number
}
 
\protected\def\ddd#1{%
\pgfcalendarifdate{2013-09-30+#1}{weekend}% Test if it's a weekend
{\textcolor{red}{\pgfcalendarifdateday}}% Typeset with red color
{\pgfcalendarifdateday}% Or just the number
}
 
 
\begin{document}
\begin{flushright}
%\begin{tikzpicture}[scale=0.5, every node/.style={scale=0.25}]
\begin{ganttchart}[hgrid, vgrid, x unit=0.4cm]{90}
\gantttitle{1. Quartal}{90} \\
\gantttitlelist[
title list options={var=\y, evaluate=\y as \x using {"\aaa{\y}"}}
]{1,...,90}{1} \\
\ganttbar[bar/.style={fill=red}]{Neujahr}{1}{1}\\
\ganttbar[bar/.style={fill=yellow}]{Feiertag}{42}{42}\\
\ganttbar[bar/.style={fill=red}]{Feiertag}{88}{88}\\
\ganttbar[bar/.style={fill=green}]{Frühling}{79}{90}\\
\end{ganttchart}\vspace*{1cm}
 
\begin{ganttchart}[hgrid, vgrid, x unit=0.4cm]{91}
\gantttitle{2. Quartal}{91} \\
\gantttitlelist[
title list options={var=\y, evaluate=\y as \x using {"\bbb{\y}"}}
]{1,...,91}{1} \\
\ganttbar[bar/.style={fill=yellow}]{Feiertag}{1}{1}\\
\ganttbar[bar/.style={fill=red}]{Tag der Arbeit}{31}{31}\\
\ganttbar[bar/.style={fill=yellow}]{Herrentag}{39}{39}\\
\ganttbar[bar/.style={fill=green}]{Frühling}{1}{81}\\
\ganttbar[bar/.style={fill=yellow}]{Sommer}{82}{91}\\
\end{ganttchart}\vspace*{1cm}
 
\clearpage
 
\begin{ganttchart}[hgrid, vgrid, x unit=0.4cm]{92}
\gantttitle{3. Quartal}{92} \\
\gantttitlelist[
title list options={var=\y, evaluate=\y as \x using {"\aaa{\y}"}}
]{1,...,92}{1} \\
\ganttbar[bar/.style={fill=yellow}]{Sommer}{1}{83}\\
\ganttbar[bar/.style={fill=brown}]{Herbst}{84}{92}\\
\end{ganttchart}\vspace*{1cm}
 
\begin{ganttchart}[hgrid, vgrid, x unit=0.4cm]{92}
\gantttitle{4. Quartal}{92} \\
\gantttitlelist[
title list options={var=\y, evaluate=\y as \x using {"\aaa{\y}"}}
]{1,...,92}{1} \\
\ganttbar[bar/.style={fill=brown}]{Herbst}{1}{81}\\
\end{ganttchart}
 
\end{flushright}
\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

Kommentare in LaTeX ein- und ausblenden

Was ich in LaTeX vermisse, ist der Überarbeiten Modus von MS Office. Alle Hacks, die etwas ähnliches in LaTeX umsetzen, sind nicht so integriert wie in Word. Hier aber mal ein Beispiel, was mit LaTeX geht. Den Hinweis auf comment.sty habe ich auf der EuroTeX in Breskens von L. Arnold aufgeschnappt, zusätzlich bot http://www.astro.gla.ac.uk/~matthew/blog/?p=376 einen guten Überblick über das Paket.

Im folgenden Beispiel nutze ich das ifdraft Paket, um zu prüfen, ob „draft“ gesetzt wurde. Wenn dies der Fall ist, werden die drei Kommentar-Umgebungen eingeblendet, ansonsten nicht.

\documentclass[ngerman,draft]{article}
%\documentclass[ngerman]{article}
\usepackage{ifdraft}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{xcolor}
\usepackage{comment}
 
\ifdraft{%
\includecomment{versiona}%
\includecomment{versionb}%
\specialcomment{notea}{\begingroup\sffamily\color{red}}{\endgroup}
}{%
\excludecomment{versiona}%
\excludecomment{versionb}%
\excludecomment{notea}%
}
 
\begin{document}
 
Hallo Text. Durch Setzen der Klassenoption \texttt{draft} werden alle Kommentare eingeblendet.
 
 
\begin{versiona}
Hallo, ich bin der Text zu Version A.
\end{versiona}
 
 
\begin{versionb}
Hallo, ich bin der Text zu Version B.
\end{versionb}
 
\begin{notea}
Ich bin eine Note A.
\end{notea}
 
\end{document}

Ich denke, hieraus lassen sich noch einige schöne Anwendungen bauen.

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

PDF Kommentare mit LaTeX setzen

Hier ein kurzes Beispiel, wie man mit LaTeX Kommentare im PDF setzt.

PDF

\documentclass{scrartcl}
\usepackage{pdfcomment}
\begin{document}
 
Ich bin ein Beispiel für einen Kommentar im PDF\pdfsquarecomment{Und ich bin der Kommentar!}
 
\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

Geometrie-Änderungen im Dokument mit geometry

Hier ein kurzes Beispiel, wie man mit dem geometry Paket das Layout im Dokument ändern kann.

PDF

\documentclass[12pt,ngerman]{scrartcl}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{blindtext}
 
\usepackage[a4paper]{geometry}
 
\begin{document}
 
\savegeometry{mysize}
 
\blindtext[10]
 
\newgeometry{left=1cm,top=1cm,right=1cm,bottom=1cm} 
 
\blindtext[10]
 
\restoregeometry{mysize}
 
\blindtext[10]
 
\end{document}

Für mehr Anpassungen siehe http://stackoverflow.com/questions/2812892/change-paper-size-in-the-middle-of-a-latex-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

Mein erstes ConTeXt Dokument

Hier mein erstes ConTeXt Dokument.

context-1.pdf

\setuppapersize[A4][A3]
\showframe
 
\mainlanguage[de]
 
\setupbodyfont[Garamond Premier Pro,16pt]
 
\starttext
 
Hallo Uwe üöä! Ich bin ein Beispiel für einen Text, der in ConTeXt geschrieben wurde.
 
\startchapter[title=Mein erstes Kapitel,reference=test]
 
Hallo Welt üöä! Ich bin ein Beispiel für einen Text, der in ConTeXt geschrieben wurde.
 
\stopchapter
 
\startsection[title=Mein erste Section]
 
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse eu augue nulla. Etiam vestibulum, diam quis bibendum fringilla, diam libero sollicitudin mauris, sit amet ultricies est arcu tincidunt diam. Morbi porttitor quam a dolor sodales nec condimentum leo volutpat. Praesent lobortis aliquam nulla, eget porta neque congue sit amet. Nam vel venenatis est. Cras luctus, nisi ultrices condimentum laoreet, ligula erat vehicula nunc, vitae pharetra libero neque vehicula justo. Duis pulvinar euismod felis quis porttitor. Aenean urna eros, auctor eget pharetra id, eleifend eu magna. Ut vitae sapien lacus. Aliquam erat volutpat.
 
Aliquam erat volutpat. Maecenas et libero at quam vehicula euismod. Fusce eu sem purus, vel ullamcorper turpis. Aliquam condimentum lacus urna. Vestibulum tempus, dui in accumsan mollis, diam augue accumsan sapien, vitae porta nibh nisl id lacus. Duis lacinia magna sit amet purus hendrerit venenatis. Sed at nisi purus. Nulla in velit non est vulputate fermentum. Etiam eu massa et mauris luctus molestie.
 
Aliquam erat volutpat. Donec fringilla orci eget massa feugiat ut feugiat justo commodo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque venenatis mollis massa, vitae consequat metus dictum eget. Vivamus at sem metus, eget laoreet leo. Aliquam erat volutpat. Nunc ac velit lorem. Mauris vel placerat massa. Aenean id lorem orci. Sed fermentum augue in neque pulvinar mattis. Maecenas quis mi et tellus rhoncus convallis. Etiam sapien dui, vulputate id pellentesque sit amet, tincidunt in elit. Cras convallis felis id tellus cursus id condimentum lectus faucibus. Integer ac accumsan lectus. Integer ullamcorper lobortis ultrices. Pellentesque faucibus vestibulum lacus.
 
Donec congue nunc vitae nulla accumsan ullamcorper. Suspendisse bibendum convallis lorem, vitae suscipit purus ultricies ut. Pellentesque libero erat, convallis vel rhoncus at, fringilla at ligula. Morbi pulvinar rhoncus consequat. Maecenas libero est, accumsan id semper eu, tincidunt luctus velit. Aenean urna ligula, porttitor nec tincidunt eu, sollicitudin vel nisi. Sed nulla lectus, lobortis sed vehicula sed, sagittis in turpis. Ut cursus, ante id sagittis feugiat, mi leo varius lectus, sed mattis dolor massa et quam. Curabitur justo mi, laoreet id dictum in, auctor sed eros. Suspendisse eu lectus purus, pharetra iaculis ligula. Proin velit mauris, varius non rutrum vel, dapibus a lacus.
 
Mauris tincidunt elit non augue fermentum et sodales dolor dapibus. Vivamus eget tellus tellus, nec tincidunt metus. Nunc sit amet pharetra neque. Fusce et adipiscing leo. Nunc at nisi id justo eleifend hendrerit. Phasellus semper porta bibendum. Phasellus mi lectus, auctor eu euismod eu, bibendum nec lorem. Phasellus pellentesque lacus id odio imperdiet ornare. Nulla dignissim euismod sagittis. Praesent bibendum dictum accumsan. Aenean vel sem sit amet urna varius tristique ut in tortor. 
 
\startitemize[a,packed]
\startitem Hallo \stopitem
\startitem Hallo \stopitem
\startitem Hallo \stopitem
\stopitemize
 
\startplacefigure[title=Hallo Welt]
\externalfigure[cow.pdf]
\stopplacefigure
 
$a+b=c$ ^ _
 
\startformula
a+b=c
\stopformula
 
\type{a+2}
 
\startitemize[]
\startitem Hallo \stopitem
\startitem Hallo \stopitem
\startitem Hallo \stopitem
\stopitemize
 
\starttabulate[lp]
aaa \NC bbb dsidhg ifdg fdgifdog  fodg dfgo foigudf ifdogudof g \NR
\stoptabulate
 
\stopsection
\stopchapter
 
\in{chapter}[test]
 
\starttyping
Hallo Welt
\stoptyping
 
\stoptext

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

Herzen mit LaTeX

Hier ein Beispiel, wie man mit Hilfe von shapepar.sty Text in Herzen reinsetzen kann.

\documentclass[12pt,ngerman]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[]{shapepar}
\usepackage[]{blindtext}
\begin{document}
 
\heartpar{\blindtext[2]}
 
\end{document}

Shape.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

Gantt Diagramme mit LaTeX

Auch für Gantt-Diagramme hat LaTeX ein passendes Paket, in diesem Fall pgfgantt. Hier ein Beispiel, abgewandelt aus dem exzellenten Handbuch:

\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage[landscape,a4paper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{paralist}
\usepackage{xcolor}
\usepackage[]{pgfgantt}
\usepackage[]{palatino}
 
\begin{document}
 
\begin{ganttchart}{1}{31} % added {1} on 2014-12-07
\gantttitle{Projektplan}{31} \\
\gantttitlelist{1,...,31}{1} \\
\ganttgroup{Group 1}{2}{30} \\
\ganttbar{Task 1}{2}{5} \\
\ganttbar{Task 2}{3}{5} \\
\ganttlinkedbar{Task 3}{6}{10}  \ganttnewline 
\ganttbar{Task 4}{11}{25} \\
\ganttmilestone{Milestone}{26} \ganttnewline
\ganttbar{Final Task}{27}{30}
\ganttlink{elem2}{elem3}
\ganttlink{elem3}{elem4}
\end{ganttchart}
 
\end{document}

(Hinweis: Man braucht nicht alle geladenen Pakete, diese lade ich jedoch standardmäßig immer)

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

Minitocs für einzelne Sections mit dem minitoc Paket

Mit dem minitoc Paket lassen sich einfach Inhaltsverzeichnisse für einzelne Sections erzeugen. Hier ein Minimalbeispiel aus der Paket-Dokumentation:

minit (PDF)

\documentclass[]{scrartcl}
 
\title{Test Requirements Document  for Some Project}
\author{My name}
 
\usepackage[]{minitoc}
\setcounter{secttocdepth}{2}
\setlength{\stcindent}{24pt}
\renewcommand{\stcfont}{\small\rm}
\renewcommand{\stcSSfont}{\small\bf} 
\dosecttoc
\dosectlof
\dosectlot
 
\begin{document}
\maketitle
 
\tableofcontents
 
\section{Overview}
\section{Tests}
\secttoc 
 
\subsection{Some first test}
 
\subsubsection{Prerequisites}
 
\subsection{A second test}
 
\section{Some other section of the document}
 
\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

Mehrzeilige Kommentare in LaTeX

Mehrzeilige Kommentare lassen sich mit dem verbatim Paket einfach nutzen.

\documentclass{scrartcl}
\usepackage{verbatim}
\begin{document}
 
\begin{comment}
Hallo, ich
bin ein mehrzeiliger 
Kommentar.
\end{comment}
 
Hallo Welt.
 
\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

Seiten im PDF drehen

Setzt man Tabellen im Querformat, muss man den Kopf für die Bildschirmanzeige drehen, was auf Dauer lästig ist. Das pdflscape Paket behebt diesen Umstand, indem es die entsprechenden PDF Seiten ebenfalls dreht.

\documentclass{scrartcl}
\usepackage{pdflscape}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage[]{blindtext}
 
\begin{document}
\blindtext
 
\clearpage
 
\begin{landscape}
 
\blindtext
 
\end{landscape}
\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