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

Automatisch Liste von Definitionen erzeugen.

This commit is contained in:
Martin Thoma 2014-01-22 18:00:06 +01:00
parent ae3f4e8133
commit 9b9e6e6e00
6 changed files with 198 additions and 2 deletions

View file

@ -52,8 +52,6 @@
\fancyhead[LO]{\helv \rightmark}
\fancyhead[RE]{\helv \leftmark}
\makeindex
\hypersetup{
pdfauthor = {Siehe tinyurl.com/GeoTopo},
pdfkeywords = {Geometrie, Topologie},

View file

@ -0,0 +1,8 @@
SOURCE = definitionen
make:
./generateDefinitions.py
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.out *.thm definitionen.tex

Binary file not shown.

View file

@ -0,0 +1,28 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import glob
def get_definitions(filename):
with open(filename) as f:
content = f.read()
pattern = re.compile(r"\\begin{definition}.*?\\end{definition}", re.DOTALL)
m = re.findall(pattern, content)
return "\n\n".join(m)
def write_definitions_to_template(definitions, template="mathe-vorlage.tex", target="definitionen.tex"):
with open(template) as f:
content = f.read()
content = content.replace('%CONTENT%', definitions)
with open(target, 'w') as f:
f.write(content)
if __name__ == "__main__":
definitions = []
for texsource in sorted(glob.glob("../Kapitel*.tex")):
definitions.append(get_definitions(texsource))
write_definitions_to_template("\n\n\n".join(definitions))

View file

@ -0,0 +1,54 @@
\documentclass[a4paper,9pt]{scrartcl}
\usepackage{etoolbox}
\usepackage{amsmath,amssymb}% math symbols / fonts
\usepackage{mathtools} % \xRightarrow
\usepackage{nicefrac} % \nicefrac
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage[framed,amsmath,thmmarks,hyperref]{ntheorem}
\usepackage{framed}
\usepackage{marvosym}
\usepackage{makeidx} % for automatically generation of an index
\usepackage{xcolor}
\usepackage[bookmarks,bookmarksnumbered,hypertexnames=false,pdfpagelayout=OneColumn,colorlinks,hyperindex=false]{hyperref} % has to be after makeidx
\usepackage{enumitem} % Better than \usepackage{enumerate}, because it allows to set references
\usepackage{tabto}
\usepackage{braket} % needed for \Set
\usepackage{csquotes} % \enquote{}
\usepackage{subfig} % multiple figures in one
\usepackage{parskip} % nicer paragraphs
\usepackage{xifthen} % \isempty
\usepackage{changepage} % for the adjustwidth environment
\usepackage{pst-solides3d}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\usepackage[arrow, matrix, curve]{xy}
\usepackage{caption} % get newlines within captions
\usepackage{tikz} % draw
\usepackage{tikz-3dplot} % draw
\usepackage{tkz-fct} % draw
\usepackage{tkz-euclide} % draw
\usetkzobj{all} % tkz-euclide
\usetikzlibrary{3d,calc,intersections,er,arrows,positioning,shapes.misc,patterns,fadings,decorations.pathreplacing}
\usepackage{tqft}
\usepackage{xspace} % for new commands; decides weather I want to insert a space after the command
\usepackage[german,nameinlink]{cleveref} % has to be after hyperref, ntheorem, amsthm
\usepackage{shortcuts}
\clubpenalty = 10000 % Schusterjungen verhindern
\widowpenalty = 10000 % Hurenkinder verhindern
\hypersetup{
pdfauthor = {Martin Thoma},
pdfkeywords = {Geometrie und Topologie},
pdftitle = {Geometrie und Topologie - Definitionen}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Begin document %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%CONTENT%
\end{document}

View file

@ -0,0 +1,108 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% make the index link to the correct part of the page %
% http://tex.stackexchange.com/q/74493/5645 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{indexanchor}
\newcommand*{\xindex}[1]{%
\stepcounter{indexanchor}% make anchor unique
\def\theindexterm{#1}%
\edef\doindexentry{\noexpand\index
{\expandonce\theindexterm|indexanchor{index-\theindexanchor}}}%
\raisebox{\baselineskip}{\hypertarget{index-\theindexanchor}%
{\doindexentry}}%
}
\newcommand*{\indexanchor}[2]{\hyperlink{#1}{#2}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Aufgaben-Environment %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{aufgabe}
\newenvironment{aufgabe}[1][]{\refstepcounter{aufgabe}%
\ifthenelse{\isempty{#1}}%
{\subsection*{Aufgabe~\theaufgabe}}% if #1 is empty
{\subsection*{Aufgabe~\theaufgabe~(#1)}}% if #1 is not empty
\begin{adjustwidth}{1cm}{}}%
{\end{adjustwidth}}
\newenvironment{solution}[1][]{%
\subsection*{Lösung zu Aufgabe~#1}%
\begin{adjustwidth}{1cm}{}}%
{\end{adjustwidth}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define theorems %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\thmfoot}{}
\theoremstyle{break}
\setlength\theoremindent{0.7cm}
\theoremheaderfont{\kern-0.7cm\normalfont\bfseries}
\theorembodyfont{\normalfont} % nicht mehr kursiv
\theoremseparator{\thmfoot}
\newframedtheorem{satz}{Satz}[section]
\newframedtheorem{lemma}[satz]{Lemma}
\newframedtheorem{proposition}[satz]{Proposition}
\newtheorem{korollar}[satz]{Korollar}
\newtheorem{folgerung}[satz]{Folgerung}
\newtheorem{plaindefinition}{Definition}
\newenvironment{definition}{\begin{plaindefinition}}{\end{plaindefinition}}
\newenvironment{definition*}{\begin{plaindefinition*}}{\end{plaindefinition*}}
\newtheorem{beispiel}{Beispiel}
\newtheorem{bemerkung}{Bemerkung}
\theoremstyle{nonumberplain}
\newtheorem{beweis}{Beweis:}
\newtheorem{behauptung}{Beh.:}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\fB{\mathfrak{B}}%Für Basis
\def\fT{\mathfrak{T}}%Für Topologie
\renewcommand{\qed}{\hfill\blacksquare}
\newcommand{\qedwhite}{\hfill \ensuremath{\Box}}
\newcommand{\powerset}[1]{\mathcal{P}(#1)}
\def\praum{\ensuremath{\mathcal{P}}}
\def\mdp{\ensuremath{\mathbb{P}}}
\def\mdc{\ensuremath{\mathbb{C}}}
\def\mdr{\ensuremath{\mathbb{R}}}
\def\mdq{\ensuremath{\mathbb{Q}}}
\def\mdz{\ensuremath{\mathbb{Z}}}
\def\mdn{\ensuremath{\mathbb{N}}}
\def\gdw{\ensuremath{\Leftrightarrow}}
\def\atlas{\ensuremath{\mathcal{A}}}
\DeclareMathOperator{\rang}{rg}
\def\GL{\ensuremath{\mathrm{GL}}}
\def\SL{\ensuremath{\mathrm{SL}}}
\newcommand\mapsfrom{\mathrel{\reflectbox{\ensuremath{\mapsto}}}}
\newcommand\dcup{\mathbin{\dot{\cup}}}
\newcommand{\id}{\textnormal{id}}
\DeclareMathOperator{\Deck}{Deck}
\DeclareMathOperator{\Fix}{Fix}
\DeclareMathOperator{\Iso}{Iso}
\DeclareMathOperator{\grad}{grad}
\DeclareMathOperator{\Perm}{Perm}
\DeclareMathOperator{\Sym}{Sym}
\DeclareMathOperator{\Homoo}{\textnormal{Homöo}}
\DeclareMathOperator{\Diffeo}{Diffeo}
\DeclareMathOperator{\conv}{conv}
\DeclareMathOperator{\IWS}{IWS}
%%%Text %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\obda{o.~B.~d.~A.\xspace}
\newcommand\Obda{O.~B.~d.~A.\xspace}
\newcommand{\ts}[1]{\textnormal{#1}} % textual subscript
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% http://tex.stackexchange.com/a/101138/5645
\newcommand\rtilde[1]{\widetilde{\mathit{#1}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\crefname{satz}{Satz}{Sätze}
\crefname{proposition}{Proposition}{Propositionen}
\crefname{lemma}{Lemma}{Lemmata}
\crefname{korollar}{Korollar}{Korollare}
\crefname{folgerung}{Folgerung}{Folgerungen}
\crefname{definition}{Definition}{Definitionen}
\crefname{plaindefinition}{Definition}{Definitionen}
\crefname{behauptung}{Behauptung}{Behauptungen}
\crefname{beispiel}{Beispiel}{Beispiele}
\crefname{aufgabe}{Aufgabe}{Aufgaben}
\crefname{bemerkung}{Bemerkung}{Bemerkungen}
%\let\OldAngle\angle
%\let\angle\sphericalangle