-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathpython_cover.tex
More file actions
175 lines (164 loc) · 8.23 KB
/
python_cover.tex
File metadata and controls
175 lines (164 loc) · 8.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
%
% A compiler avec xelatex !
% xelatex -output-driver="xdvipdfmx -V3" python_cover.tex
%
\documentclass[tikz,border=0mm]{standalone}
\usetikzlibrary{calc}
% =====================================================
% For the Python logo (that was in SVG)
% =====================================================
\usetikzlibrary{svg.path}
% =====================================================
% For the Hilbert curve
% =====================================================
\usetikzlibrary{shadings,lindenmayersystems}
\pgfdeclarelindenmayersystem{Hilbert curve}{
\rule{L -> +RF-LFL-FR+}
\rule{R -> -LF+RFR+FL-}}
% =====================================================
% The font
% =====================================================
\usepackage{fontspec}
\newfontfamily\titlefont{AlteDin1451Mittelschrift.ttf}
\newfontfamily\roboto{Roboto}
\setmainfont{Roboto}
%\newfontfamily\authorfont{Times New Roman}
%\newfontfamily\authorfont{Roboto}
\newfontfamily\authorfont{AlteDin1451Mittelschrift.ttf}
% =====================================================
% The colors
% =====================================================
\definecolor{scratchgreen}{rgb}{.43000793,.78393555,.27934265}
\definecolor{scratchviolet}{rgb}{.50601196,.10708618,.55937195}
\definecolor{goldleaf}{HTML}{D1B280}
% 16 Day & Night
\definecolor{darknavy}{HTML}{011A27}
\definecolor{blueberry}{HTML}{073852}
\definecolor{tangerine}{HTML}{F0810F}
\definecolor{daffodil}{HTML}{E7DF44}
% Colors by function
\colorlet{background}{tangerine}
\tikzset{
hilbert/.style = {bottom color=black, top color=white, draw=black, opacity=.14},
spine/.style = {fill, opacity=.1}
}
\colorlet{author}{black}
\colorlet{pythonlogoup}{darknavy}
\colorlet{pythonlogodown}{blueberry}
\colorlet{titlepython}{white}
\colorlet{titleau}{daffodil}
\colorlet{titlelycee}{white}
\colorlet{subtitlealgo}{blueberry}
\colorlet{spinepython}{white}
\colorlet{spineau}{daffodil}
\colorlet{spinelycee}{white}
\colorlet{spinealgo}{blueberry}
%=======================================================
% The cover size
%=======================================================
% Calculate the splin
\def\numPages{262}
\newlength{\thickCream}\setlength{\thickCream}{0.0025 in}
\newlength{\thickWhite}\setlength{\thickWhite}{0.002252 in}
\newlength{\SpineW}\setlength{\SpineW}{\numPages\thickWhite} % 236*0.0025 = 0.59 (cream), 262*0.002252 = 0.590024 (white)
% The standard bleed
\newlength{\Bleed}\setlength{\Bleed}{.125 in}
% Set the page size
\newlength{\PageW}\setlength{\PageW}{8.5 in}
\newlength{\PageH}\setlength{\PageH}{11 in}
% Calculate the total dimensions
\newlength{\TrimW}\setlength{\TrimW}{\dimexpr 2\PageW + \SpineW \relax}
\newlength{\TrimH}\setlength{\TrimH}{\PageH}
\newlength{\CropW}\setlength{\CropW}{\dimexpr \TrimW + 2\Bleed \relax}
\newlength{\CropH}\setlength{\CropH}{\dimexpr \TrimH + 2\Bleed \relax}
\newlength{\LineW}\setlength{\LineW}{2\Bleed}
%=======================================================
% Some PDF specials
%=======================================================
\special{pdf: docinfo <<
/Author (Exo7)
/Title (Python au Lycée - Algorithmes et programmation)
/Keywords (Python, Lycée)
/Subject (manuel de programmation en Python)
>>}
\edef\pwpt{\the\numexpr \dimexpr0.996264009963\CropW\relax/65536 \relax} %paper width in PS points
\edef\phpt{\the\numexpr \dimexpr0.996264009963\CropH\relax/65536 \relax} %paper height in PS points
\expandafter\special\expandafter{pdf: put @thispage <<
/MediaBox [0 0 \pwpt\space\phpt]
/BleedBox [0 0 \pwpt\space\phpt]
/CropBox [0 0 \pwpt\space\phpt]
/TrimBox [0 0 \pwpt\space\phpt]>>}
%=======================================================
% for test
%=======================================================
\usepackage{blindtext}
\newif\ifshowborders\showbordersfalse % to display the security zone (Bleed)
% \showborderstrue
\tikzset{
frame/.style 2 args={inner sep=0, outer sep=0, minimum width=#1, minimum height=#2, node contents=}
}
\begin{document}%
\begin{tikzpicture}
% Clip
\clip (-.5*\CropW,-\Bleed) rectangle +(\CropW,\CropH);
% Set nodes for anchors : Cover, Back, Front and Spine
\path
(0,-\Bleed) node[name=Cover,above,fill=background,frame={\CropW}{\CropH}]
(-\SpineW/2,0) node[name=Back,above left,frame={\PageW}{\PageH}]
(\SpineW/2,0) node[name=Front,above right,frame={\PageW}{\PageH}]
(0,0) node[name=Spine,above,spine,frame={\SpineW}{\PageH}];
% ---------------------------------------------------
% Background
% ---------------------------------------------------
\def\steps{5}
\shadedraw[shift={(Cover.south west)}, hilbert]
[l-system={Hilbert curve, axiom=L, order=5, step={\CropW/31+.01pt}, angle=90}]
lindenmayer system;
% ---------------------------------------------------
% Auteur
% ---------------------------------------------------
\path (Front.north) +(0,-21mm) node[author,scale=3,font=\authorfont]{Arnaud Bodin};
% ---------------------------------------------------
% Python logo and title
% ---------------------------------------------------
\begin{scope}[transform canvas ={yshift=21mm}]
\fill[shift={(Front.center)},pythonlogoup]svg{M 133.72 -122.51 v 52.97 c 0 41.07 -34.81 75.63 -74.52 75.63 h -119.15 c -32.64 0 -59.64 27.93 -59.64 60.61 v 113.59 c 0 32.32 28.11 51.34 59.64 60.61 c 37.76 11.1 73.96 13.12 119.15 0 c 30.03 -8.69 59.64 -26.19 59.64 -60.61 v -45.46 h -119.14 v -15.15 h 119.14 h 59.64 c 34.67 0 47.59 -24.18 59.64 -60.48 c 12.45 -37.37 11.93 -73.3 0 -121.23 c -8.57 -34.51 -24.93 -60.47 -59.64 -60.48 h -44.76 z m -67.01 287.64 c 12.37 0 22.38 10.13 22.38 22.66 c 0 12.57 -10.02 22.8 -22.38 22.8 c -12.32 0 -22.38 -10.23 -22.38 -22.8 c 0 -12.53 10.06 -22.66 22.38 -22.66 z};
\fill[shift={(Front.center)},pythonlogodown]svg{M -2.94 -250 c -20.39 .1 -39.87 1.83 -57 4.87 c -50.48 8.92 -59.64 27.58 -59.65 62.01 v 45.46 h 119.29 v 15.15 h -119.29 h -44.76 c -34.67 0 -65.02 20.84 -74.52 60.48 c -10.95 45.44 -11.44 73.79 0 121.23 c 8.48 35.31 28.73 60.47 63.4 60.48 h 41.01 v -54.51 c 0 -39.37 34.06 -74.1 74.51 -74.1 h 119.15 c 33.17 0 59.64 -27.31 59.64 -60.61 v -113.58 c 0 -32.32 -27.27 -56.61 -59.64 -62.01 c -20.49 -3.41 -41.75 -4.96 -62.14 -4.87 z m -64.51 36.57 c 12.32 0 22.38 10.23 22.38 22.8 c 0 12.53 -10.06 22.66 -22.38 22.66 c -12.37 0 -22.38 -10.13 -22.39 -22.66 c 0 -12.57 10.02 -22.8 22.39 -22.8 z};
% ---------------------------------------------------
\path[every node/.style={scale=7, font=\titlefont, outer sep=0, inner sep=0}]
(Front.center) +(21mm,21mm) node[titlepython]{PYTHON}
(Front.center) +(-21mm,-21mm) node
{\textcolor{titleau}{AU}\textcolor{titlelycee}{LYCÉE}};
\path (Cover.east) +(0,-105mm) node[left,scale=2,text width=.35\PageW,align=left,fill=white,text=subtitlealgo,inner sep=.7em]{Algorithmes et programmation};
\end{scope}
% ---------------------------------------------------
% Spine
% ---------------------------------------------------
\begin{scope}[transform canvas ={yshift=21mm}]
\node[rotate=-90,scale=2.1] (tranche) at (Spine.center)
{\textcolor{spinepython}{PYTHON}\textcolor{spineau}{~AU~}\textcolor{spinelycee}{LYCÉE}\textcolor{spinealgo}{~\textemdash~Algorithmes et programmation}};
\end{scope}
% ---------------------------------------------------
% Logos Exo7
% ---------------------------------------------------
\path (Spine.south) +(0,14mm) node{\includegraphics[width=11mm]{exo7_logo_white}};
\path (Front.south) +(0,14mm) node{\includegraphics[width=21mm]{exo7_logo_white}};
% ---------------------------------------------------
% Back
% ---------------------------------------------------
\path (Back.center) node[scale=2,text width=7cm,fill=white,fill opacity=.5,text opacity=.77]{\blindtext};
% ---------------------------------------------------
\ifshowborders
% --- security zone
\begin{scope}[line width=\LineW,red,opacity=.35]
\draw (-.5*\TrimW,0) rectangle +(\TrimW,\TrimH);
\draw (-.5*\SpineW-\Bleed/3,0) rectangle +(\SpineW+2\Bleed/3,\TrimH);
\end{scope}
% --- guides
\begin{scope}[dashed]
\draw (-.5*\TrimW,0) rectangle +(\TrimW,\TrimH);
\draw (-.5*\SpineW,0) rectangle +(\SpineW,\TrimH);
\end{scope}
\fi
\end{tikzpicture}%
\end{document}