Skip to content

Commit 7279877

Browse files
committed
included software versions
1 parent 529ecc0 commit 7279877

File tree

5 files changed

+87
-6
lines changed

5 files changed

+87
-6
lines changed

scripts/dependencyVersions.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash -
2+
3+
# This script prints the versions of the dependencies and software environment under which the book was built.
4+
5+
# strict error handling
6+
set -o pipefail # trace ERR through pipes
7+
set -o errtrace # trace ERR through 'time command' and other functions
8+
set -o nounset # set -u : exit the script if you try to use an uninitialized variable
9+
set -o errexit # set -e : exit the script if any statement returns a non-true return value
10+
11+
# get the script directory
12+
scriptDir="$(dirname "$0")"
13+
14+
# Print the python version.
15+
echo "python: $(python3 --version | sed -n 's/.*Python\s*\([.0-9]*\)/\1/p')"
16+
echo "latexgit_py: $(pip freeze | grep latexgit | sed -n 's/.*==*\([.0-9]*\)/\1/p')"
17+
echo "latexgit_tex: $(less $scriptDir/../styles/latexgit.sty | sed -n 's/.*\\ProvidesPackage{latexgit}\[[0-9\/]* *\([.0-9]*\) .*\].*/\1/p')"
18+
echo "pycommons: $(pip freeze | grep pycommons | sed -n 's/.*==*\([.0-9]*\)/\1/p')"
19+
echo "pdflatex: $(pdflatex --version | grep 'pdfTeX 3')"
20+
echo "biber: $(biber --version | sed -n 's/.*:\s*\([.0-9]*\)/\1/p')"
21+
echo "makeglossaries: $(makeglossaries --version | grep Version | sed -n 's/.*Version\s*\([.0-9]*\)/\1/p')"
22+
echo "makeindex: $(echo '' | makeindex 2>&1 | grep makeindex | sed -n 's/.*version\s*\([.0-9]*\)/\1/p')"
23+
echo "ghostscript: $(ghostscript --version)"

styles/listing.sty

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ basicstyle=\@lstbasicstyle,%
2424
identifierstyle=\color{listing-identifier},%
2525
numberstyle=\color{listing-line-numbers},%
2626
%
27-
otherkeywords={\%,\},\{,\&,\|},
28-
keywordstyle=\color{listing-keyword-1}\bfseries,
27+
otherkeywords={\%,\},\{,\&,\|},%
28+
keywordstyle=\color{listing-keyword-1}\bfseries,%
2929
%
3030
emph={and,break,class,continue,def,yield,del,elif,else,except,exec,finally,for,from,global,if,import,in,lambda,not,or,pass,print,raise,return,try,while,assert,with},%
31-
emphstyle=\color{listing-emph-1}\bfseries,
31+
emphstyle=\color{listing-emph-1}\bfseries,%
3232
%
3333
emph={[2]True,False,None},%
3434
emphstyle=[2]\color{listing-emph-2},%
@@ -78,6 +78,49 @@ literate=%
7878
}%
7979
\lstset{style=python_style}%
8080
%
81+
%
82+
\lstdefinestyle{text_style}{%
83+
%
84+
backgroundcolor=\color{listing-background},%
85+
numbers=left,%
86+
frame=single,%
87+
rulecolor=\color{listing-rule},%
88+
frameround=ffff,%
89+
%
90+
breaklines=true,%
91+
tabsize=4,%
92+
%
93+
language={},%
94+
sensitive=true,%
95+
%
96+
basicstyle=\@lstbasicstyle,%
97+
numberstyle=\@lstbasicstyle,%
98+
identifierstyle=\@lstbasicstyle,%
99+
numberstyle=\@lstbasicstyle,%
100+
keywordstyle=\@lstbasicstyle,%
101+
emphstyle=\@lstbasicstyle,%
102+
commentstyle=\@lstbasicstyle,%
103+
stringstyle=\@lstbasicstyle,%
104+
%
105+
literate=%
106+
{á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1%
107+
{Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1%
108+
{à}{{\`a}}1 {è}{{\'e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1%
109+
{À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1%
110+
{ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1%
111+
{Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1%
112+
{â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1%
113+
{Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1%
114+
{œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1%
115+
{ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1%
116+
{€}{{\EUR}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1%
117+
{»}{{\guillemotright}}1 {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1%
118+
{…}{{\ldots}}1 {≥}{{>=}}1 {≤}{{<=}}1 {„}{{\glqq}}1 {“}{{\grqq}}1%
119+
{”}{{''}}1%
120+
}%
121+
%
122+
%
123+
%
81124
%% the box around the inline listings
82125
\protected\gdef\inlinelistingbox#1{\bgroup%
83126
\fboxsep=0.5pt%
@@ -103,7 +146,7 @@ literate=%
103146
%% print some Python code inline with an 's' added for plural
104147
%% #1 the optional args
105148
%% #2 the code to be printed inline
106-
\gdef\pythons#1{%
149+
\gdef\pythonils#1{%
107150
\inlinelistingbox{\lstinline[style=python_style]$#1$\resizebox{!}{\@lstbasicstylesheight}{\color{darkgray}s}}}%
108151
%
109152
%%
@@ -138,3 +181,15 @@ literate=%
138181
\protected\gdef\relCode#1#2#3{%
139182
\lstinputlisting[float,label={lst:#2},caption={#3}]{\currentDir/#1}}%
140183
%
184+
%%
185+
%% Use latexgit to place a listing with program output.
186+
%% #1 the git repository
187+
%% #2 the local path
188+
%% #3 the command
189+
%% #4 the label (exec: will be pre-pended)
190+
%% #5 the caption
191+
\protected\gdef\gitOutput#1#2#3#4#5{%
192+
\gitExec{#1}{#2}{#3}%
193+
\lstinputlisting[float,style=text_style,label={exec:#4},caption={#5}]{\gitFile}%
194+
}%
195+
%

text/front/preface/preface.tex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ \chapter*{Preface}%
1010
You can freely share it.
1111
Please do not print it, though, to preserve the environment.
1212

13+
This book was built using the software versions given in \cref{exec:versions}.
14+
15+
\gitOutput{}{}{scripts/dependencyVersions.sh}{versions}{The versions of the software packages used to build this book.}

text/main/basics/simpleDataTypesAndOperations/float/float.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
But how does it work in \python?
2929
How can we deal with the fact that we cannot dynamically represent fractional numbers exactly even in typical everyday cases?
3030
With \pythonilIdx{float}, \python\ offers us one type for fractional numbers.
31-
This datatype represents numbers usually in the same internal structure as \pythonil{double}s in the \pgls{C}~programming language~\cite{PSF2024NTIFC}, which, in turn, internally have a 64~bit IEEE~Standard 754 floating point number layout~\cite{IEEE2019ISFFPA,H1997IS7FPN}.
31+
This datatype represents numbers usually in the same internal structure as \pythonils{double} in the \pgls{C}~programming language~\cite{PSF2024NTIFC}, which, in turn, internally have a 64~bit IEEE~Standard 754 floating point number layout~\cite{IEEE2019ISFFPA,H1997IS7FPN}.
3232
The idea behind this standard is to represent both very large numbers, like~$10^{300}$ and very small numbers, like~$10^{-300}$.
3333
In order to achieve this, the 64~bits are divided into three pieces, as illustrated in \cref{fig:floatIEEEStructure}.
3434
%

text/main/basics/simpleDataTypesAndOperations/str/str.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@
456456
They are basically lists of characters.
457457
We can index them, i.e., extract portions of text, we can search inside a string to check whether and where it contains a certain substring, and we can manipulate strings, e.g., by replacing substrings.
458458

459-
It is also important that we can transform data such as \pythonil{int}s, \pythonil{float}s, or \pythonil{bool}s to strings.
459+
It is also important that we can transform data such as \pythonils{int}, \pythonils{float}, or \pythonils{bool} to strings.
460460
Because we actually \emph{always} print them as strings to the console.
461461
The user cannot interpret the binary representation of such data, they only want text.
462462
While the function \pythonil{str} can convert many different types of objects to strings, we often want to combine several different pieces of information to an output text.

0 commit comments

Comments
 (0)