Skip to content

Commit d893df3

Browse files
committed
getting started: install python
1 parent a537014 commit d893df3

24 files changed

+232
-6
lines changed

notation/notation.sty

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
%
2+
\RequirePackage{notation/software}%
23
\RequirePackage{notation/sources}%
4+
\RequirePackage{notation/terms}%
35
%

notation/software.sty

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
%%
2+
%% Access to Source Codes
3+
%%
4+
%
5+
\protected\gdef\softwareStyle#1{\textrm{#1}}%
6+
%
7+
\newglossaryentry{python}{%
8+
name={\softwareStyle{Python}},
9+
sort={Python},
10+
description={The \href{https://python.org/}{\softwareStyle{Python}} programming language, i.e., what you will learn about in this book.}
11+
}%
12+
\protected\gdef\python{\gls{python}}%
13+
%
14+
\xdef\pythonVersion{3.10}%
15+
\protected\gdef\pythonWithVersion{\softwareStyle{\python~\pythonVersion}}%
16+
%
17+
\newglossaryentry{ubuntu}{%
18+
name={\softwareStyle{Ubuntu}},
19+
sort={Ubuntu},
20+
description={%
21+
\href{https://ubuntu.com/}{\softwareStyle{Ubuntu}} is a variant of the open source operating system \linux. %
22+
We recommend that you use this operating system to follow this class, for software development, and for research. %
23+
If you are in China, you can download it from \expandafter{\ubuntuDownloadUrl}.%
24+
}%
25+
}%
26+
\protected\gdef\ubuntu{\gls{ubuntu}}%
27+
\xdef\ubuntuDownloadUrl{https://mirrors.ustc.edu.cn/ubuntu-releases/}%
28+
%
29+
\newglossaryentry{linux}{%
30+
name={\softwareStyle{Linux}},
31+
sort={Linux},
32+
description={%
33+
\href{https://www.linux.org/}{\softwareStyle{Linux}} is an open source operating system, i.e., a free alternative for \windows. %
34+
Its variant \ubuntu\ is particularly easy to use and install. %
35+
We recommend using it for this course, for software development, and for research.%
36+
}%
37+
}%
38+
\protected\gdef\linux{\gls{linux}}%
39+
%
40+
\newglossaryentry{windows}{%
41+
name={\softwareStyle{Windows}},
42+
sort={Windows},
43+
description={%
44+
\href{https://www.microsoft.com/windows/}{\softwareStyle{Microsoft Windows}} is a commerical proprietary operating system. %
45+
It is widely spread, but we recommend using a \linux\ variant such as \ubuntu\ for software development and for our course.%
46+
}%
47+
}%
48+
\protected\gdef\windows{\gls{windows}}%
49+
%

notation/terms.sty

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
%%
2+
%% Access to Source Codes
3+
%%
4+
%
5+
%
6+
\newglossaryentry{terminal}{%
7+
name={terminal},
8+
plural={terminals},
9+
description={%
10+
A terminal is a text-based window where you can enter commands and execute them by pressing \keys{\return}. %
11+
Knowing what a terminal is and how to use it is very essential in any programming- or system administration-related task. %
12+
If you want to open a terminal under \windows, you can press \keys{\OSwin + R}, type in \bashil{cmd}, and hit \keys{\return}, as shown, e.g., in \cpageref{fig:installingPythonWindows01openTerminal}. %
13+
Under \ubuntu\ \linux, \keys{\ctrl+\Alt+T} opens a terminal.%
14+
}
15+
}%
16+
%

styles/floats.sty

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
%%
2+
%% Figure and Table tools.
3+
%%
4+
%
5+
\RequirePackage{subfig}%
6+
%
7+
\protected\gdef\tightbox#1{\bgroup%
8+
\fboxsep=0pt%
9+
\fboxrule=0.5pt%
10+
\mbox{\fcolorbox{black}{listing-background}{\mbox{#1}}}%
11+
\egroup}%
12+
%

styles/href.sty

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ bookmarksdepth=3%
2020
\renewcommand{\subsubsectionautorefname}{Section}%
2121
\renewcommand{\chapterautorefname}{Chapter}%
2222
%
23+
%

styles/keys.sty

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
%%
2+
%% Keyboard keys.
3+
%%
4+
%
5+
\RequirePackage[os=win]{menukeys}%
6+
\renewmenumacro{\keys}[+]{shadowedroundedkeys}%
7+
%
8+
%% see https://tex.stackexchange.com/questions/387952
9+
\RequirePackage{fontawesome}%
10+
\tw@make@key@box{OS@mac}{\faApple}%
11+
\tw@make@key@box{OS@win}{\faWindows}%
12+
\tw@make@key@macro*{\OS}%
13+
%

styles/listing.sty

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,25 @@ literate=%
8585
\mbox{\fcolorbox{listing-rule}{listing-background}{\mbox{#1}}}%
8686
\egroup}%
8787
%
88-
%% print some code inline
88+
%% print some Python code inline
8989
%% #1 the optional args
9090
%% #2 the code to be printed inline
91-
\gdef\codeil#1{%
91+
\gdef\pythonil#1{%
9292
\@inlinelistingbox{\lstinline[style=python_style]$#1$}}%
9393
%
94+
%% print some Bash code inline
95+
%% #1 the optional args
96+
%% #2 the code to be printed inline
97+
\gdef\bashil#1{%
98+
\@inlinelistingbox{\lstinline[language=bash]$#1$}}%
99+
%
94100
\newlength\@lstbasicstylesheight%
95101
\settoheight{\@lstbasicstylesheight}{\mbox{\bgroup\@lstbasicstyle{s}\egroup}}%
96102
%
97-
%% print some code inline with an 's' added for plural
103+
%% print some Python code inline with an 's' added for plural
98104
%% #1 the optional args
99105
%% #2 the code to be printed inline
100-
\gdef\codeils#1{%
106+
\gdef\pythons#1{%
101107
\@inlinelistingbox{\lstinline[style=python_style]$#1$\resizebox{!}{\@lstbasicstylesheight}{\color{darkgray}s}}}%
102108
%
103109
%%

styles/styles.sty

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
\RequirePackage{styles/colors}%
1313
\RequirePackage{styles/bibliography}%
1414
\RequirePackage{styles/tables}%
15+
\RequirePackage{styles/floats}%
16+
\RequirePackage{styles/keys}%
17+
%
1518
\RequirePackage{styles/href}%
19+
%
1620
\RequirePackage{styles/latexgit}%
1721
\RequirePackage{styles/listing}%
1822
\RequirePackage{styles/glossary}%

text/back/backmatter.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
%\printRulesOfThumb%
1212
%\printsymbols%
1313
%\printacronyms%
14+
\printglossaries%
1415
\printbibliography%
1516
%

text/main/basics/basics.tex

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
\hsection{Basics}%
2+
%
3+
In this part of the book, we will gain the following abilities:%
4+
%
5+
\begin{itemize}%
6+
\item read, write, and execute simple \python\ programs%
7+
\item use some tools to help us looking for errors%
8+
\end{itemize}%
9+
%
10+
\hinput{gettingStarted}{gettingStarted.tex}%
11+
\endhsection%
12+
%

0 commit comments

Comments
 (0)