Browse Source

preislister: Adjust LaTeX/PDF output

- Improve page margin appraoch
- .. and set margin to 1cm everywhere
- Set font style to sans-serif
- Move date on top
- Alternate row color
- Increase font size
- Bold table header
Sebastian Pipping 9 years ago
parent
commit
bb13e1fcc3
1 changed files with 13 additions and 18 deletions
  1. 13
    18
      preislister/main.py

+ 13
- 18
preislister/main.py View File

@@ -53,19 +53,14 @@ if __name__ == '__main__':
53 53
 	f = open(preisliste_tex, 'w')
54 54
 
55 55
 	f.write(r"""
56
-\documentclass[a4paper,10pt]{scrartcl}
56
+\documentclass[a4paper,12pt]{scrartcl}
57 57
 
58 58
 \usepackage[ngerman]{babel}
59 59
 \usepackage[utf8]{inputenc}
60 60
 \usepackage{fullpage}
61
-\usepackage{booktabs}
62 61
 \usepackage{eurosym}
63
-
64
-% Reduce vertical offset
65
-\addtolength{\textheight}{\voffset}
66
-\setlength{\voffset}{0cm}
67
-\setlength{\voffset}{-1cm}
68
-\addtolength{\textheight}{1cm}
62
+\usepackage[table]{xcolor}
63
+\usepackage[hmargin=1cm,vmargin=1cm]{geometry}
69 64
 
70 65
 % No footskip
71 66
 \addtolength{\textheight}{\footskip}
@@ -78,14 +73,15 @@ if __name__ == '__main__':
78 73
 % No page number
79 74
 \pagestyle{empty}
80 75
 
81
-\begin{document}
82
-\begin{flushright}Stand \today\end{flushright}
83
-\vspace*{-4.6ex}
84
-%
76
+\definecolor{mygray}{RGB}{224,224,224}
77
+\renewcommand{\arraystretch}{1.2}
78
+
79
+\begin{document}\sffamily
80
+\noindent
81
+Stand \today\\[\baselineskip]
82
+\rowcolors{2}{white}{mygray}
85 83
 \begin{tabular}{l@{\quad}rr}
86
-\toprule
87
-Artikel & \multicolumn{1}{c}{Preis} & \multicolumn{1}{c}{Pfand} \\
88
-\midrule
84
+\textbf{Artikel} & \multicolumn{1}{c}{\textbf{Preis}} & \multicolumn{1}{c}{\textbf{Pfand}} \\
89 85
 """)
90 86
 
91 87
 	first = True
@@ -98,12 +94,11 @@ Artikel & \multicolumn{1}{c}{Preis} & \multicolumn{1}{c}{Pfand} \\
98 94
 		latex_price = german('\\textbf{%.2f} \\euro', i.price)
99 95
 		latex_deposit = '~' if i.deposit == 0 else german('+ %.2f \\euro', i.deposit)
100 96
 
101
-		write_utf8(f, '%s%s & %s & %s \\\\\n' % (
102
-				'' if first else '\\midrule\n',
97
+		write_utf8(f, '%s & %s & %s \\\\\n' % (
103 98
 				latex_name, latex_price, latex_deposit))
104 99
 		first = False
105 100
 
106
-	f.write(r"""\bottomrule
101
+	f.write(r"""
107 102
 \end{tabular}
108 103
 \end{document}
109 104
 """)

Loading…
Cancel
Save