Notes-on-Python/Notes on Python.tex

174 lines
6.2 KiB
TeX
Raw Normal View History

2023-07-28 23:35:57 +00:00
\documentclass[letterpaper, 10pt, twoside]{article}
% Packages without options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{lipsum}
\usepackage{verbatim} % Better code blocks
\usepackage{fancyvrb} % Even better code blocks
\usepackage{fvextra} % Even more better code blocks
\usepackage{enumitem} % Control spacing inside list environments
2023-07-29 03:53:41 +00:00
\usepackage{microtype} % Better typography
2023-07-28 23:35:57 +00:00
\usepackage{wrapfig} % Allows us to use \wrapfigure command
\usepackage{adjustbox} % Adjust padding inside \minipage environment
2023-07-29 03:53:41 +00:00
\usepackage{tikz} % Draw pictures
2023-07-28 23:35:57 +00:00
% Packages with options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2023-07-29 03:53:41 +00:00
\usepackage{multicol} % Most of our text will have two columns
2023-07-28 23:35:57 +00:00
\setlength\columnsep{25pt}
2023-07-29 03:53:41 +00:00
\usepackage{fancyhdr} % Granular control over headers and footers
\pagestyle{fancy} % Define pagesyle «fancy»
\fancyhf{} % Clear existing header/footer entries
\fancyhead[LE, RO]{\thepage} % Page number is always on the outside
2023-07-29 02:01:27 +00:00
\fancyhead[CE, CO]{Notes on Python} % Title is always in the middle
2023-07-29 03:53:41 +00:00
\fancyhfoffset[LE,RO]{0in} % Adjust header and footer width to match text width
2023-07-28 23:35:57 +00:00
\renewcommand{\headrulewidth}{0.5pt}
2023-07-29 03:53:41 +00:00
\usepackage{geometry} % Adjust margins
\geometry{ % Package options
bmargin=0.75in, % bottom margin
tmargin=1in, % top margin
hmargin=0.75in, % horizontal margin (both sides)
bindingoffset=0.25in % Just in case this is printed and bound
2023-07-28 23:35:57 +00:00
}
2023-07-29 01:54:16 +00:00
\usepackage[nottoc,numbib]{tocbibind} % Add references to TOC
2023-07-29 02:09:56 +00:00
\usepackage[hidelinks]{hyperref} % Include URLs
2023-07-29 03:53:41 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2023-07-28 23:35:57 +00:00
% My macros %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2023-07-29 03:53:41 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2023-07-28 23:35:57 +00:00
% Make a nice border and box for the tops of our examples
\newcommand\klab[3]{\vspace{#1}\noindent{}\hrulefill~~\fbox{\texttt{~#2~}}~~\hrulefill\vspace{#3}}
% Add an \hrule with space above and below
\newcommand\krule[2]{\vspace{#1}\hrule\vspace{#2}}
% Make hrefs easier (must load package hyperref}
\newcommand\kref[2]{\href{#1}{{\texttt{#2}}}}
% Make some call outs
2023-07-28 23:35:57 +00:00
\newcommand\kpull[2]{
2023-07-29 03:53:41 +00:00
\setlength{\intextsep}{3.0pt plus 2.0pt minus 2.0pt}
2023-07-28 23:35:57 +00:00
\setlength{\columnsep}{10pt}
\begin{wrapfigure}[]{r}[8pt]{0pt}
\fbox{
\adjustbox{padding*=0pt 2pt 0pt 1pt}{
\begin{minipage}{#2} % This is the width of the call out
2023-07-28 23:35:57 +00:00
\begin{small}
\begin{flushleft}
{#1} % This is the contents of the call out
2023-07-28 23:35:57 +00:00
\end{flushleft}
\end{small}
\end{minipage}
} % End adjustbox
} % End fbox
\end{wrapfigure}
2023-07-29 03:53:41 +00:00
} % The width variable comes after the contents variable because the contents should give you some idea of how wide to make this.
2023-07-28 23:35:57 +00:00
% And make them work nicely with out multicol environment
% Not quite sure if commented lines are needed. More testing is required.
%\def\ksep{25pt}
\newcommand\kcolb{
% \setlength{\columnsep}{\ksep}
\begin{multicols}{2}
}
\newcommand\kcole{
\end{multicols}
}
2023-07-29 01:54:16 +00:00
% Add an indent to bibliography items
% This is a bit of a kludge, but it works. Look for a best practice to replace this.
\newcommand\kbib{
\begin{tikzpicture} \draw [white, line width=6] (0,0) -- (0.1,0); \end{tikzpicture}
}
% Make a Python Symbol like a LaTeX symbol
2023-07-29 03:53:41 +00:00
\newcommand\kpy{P{\scriptsize \raisebox{-0.4em}{\hspace{-0.16em}Y}}T{\scriptsize \raisebox{-0.3em}{h}}\hspace{-0.15em}\raisebox{0.4em}{o}\hspace{0.05em}\raisebox{-0.2em}N}
2023-07-28 23:35:57 +00:00
% Additional options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\raggedbottom
% Title info %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{\textbf{Notes on Python}}
\author{Kenneth John Odle\\ {\small \texttt{ken at kjodle dot net}}}
2023-07-28 23:35:57 +00:00
\date{2023\\ \medskip v. 0.0.1}
2023-07-29 02:01:27 +00:00
% Notes to self %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make sure that \section{} is OUTside the multicols environment
% Make sure that \subsection{} is INside the multilcols environment
% If needed, add \newpage before a \section if the placement of the heading is weird
2023-07-28 23:35:57 +00:00
\begin{document}
\maketitle
\begin{abstract}
This document consists of notes on Python, gleaned from various sources. A list of references (often with commentary) follows.
The latest version of this document can be found at \kref{https://git.kjodle.net/kjodle/Notes-on-Python}{https://git.kjodle.net/kjodle/Notes-\\on-Python}.
2023-07-28 23:35:57 +00:00
\end{abstract}
2023-07-29 01:54:16 +00:00
\tableofcontents
\newpage
2023-07-28 23:35:57 +00:00
\section{Preliminaries}
\kcolb
2023-07-29 02:01:27 +00:00
\subsection{What is Python?}
2023-07-28 23:35:57 +00:00
\subsection{Why use Python?}
2023-07-28 23:35:57 +00:00
2023-07-29 03:53:41 +00:00
I won't bore you with details. If you have made enough effort to find this document, you are probably aware of the importance of the Python programming language. If not, however, I'll give a brief summary.
2023-07-28 23:35:57 +00:00
2023-07-29 03:53:41 +00:00
Many fields depend on \kpy\footnote{This is my attempt to produce a text symbol for Python, similar to \LaTeX{}. My thought is that it looks like a snake wriggling back and forth. Your mileage, of course, may (and probably will) vary. If you would like to use this in your own documents (why?) I have defined it as a macro, which you can obtain from the source code for this document. See the abstract for its location.} to process data.
Mueller\cite{mueller-jp:23} has many reasons why a knowledge of Python may be useful in a job search. \kpull{This is \textit{not} my favorite book.}{22mm} They were fairly accurate as of their publication (2023),but things change quickly, so a keyword search of your preferred job boards is always in order.
2023-07-28 23:35:57 +00:00
\subsection{IDEs and Python}
2023-07-28 23:35:57 +00:00
2023-07-29 03:53:41 +00:00
\subsection{Version 2 versus Version 3}
\kcole
2023-07-28 23:35:57 +00:00
\newpage
\section{Python Basics}
2023-07-28 23:35:57 +00:00
\kcolb
2023-07-28 23:35:57 +00:00
\subsection{Python Data Types}
2023-07-28 23:35:57 +00:00
\kcole
% References page begins below %%%%%%%%%%%%%%%%%%%%%%%%%%%%
2023-07-29 01:54:16 +00:00
\newpage
\begin{thebibliography}{XX}
\kcolb
2023-07-29 03:53:41 +00:00
\bibitem{mueller-jp:23}
2023-07-29 01:54:16 +00:00
Mueller, John Paul.
\textit{Beginning Programming with Python for Dummies}.
2023-07-29 03:53:41 +00:00
John Wiley \& Sons Inc. (United States: New Jersey: Hoboken).
2023-07-29 01:54:16 +00:00
3rd Edition,
2023.\\
\kbib{}This book \textit{heavily} emphasizes the use of Google Colab. It's basically an advertisement for the $\Gamma$oogle and \textit{highly} disappointing. Python is meant to be fairly universal and this book's approach seems to work counter to that intention.
2023-07-29 01:54:16 +00:00
2023-07-29 02:09:56 +00:00
\bibitem{pythonorg:main}
python.org.
``Python for Beginners'',\\
2023-07-29 03:53:41 +00:00
\kbib\kref{https://www.python.org/about/gettingstarted/}{https://www.python.org/about/\\gettingstarted/}\\
\kbib The official site of the Python Software Foundation.
2023-07-29 02:09:56 +00:00
2023-07-29 01:54:16 +00:00
\kcole
\end{thebibliography}
2023-07-28 23:35:57 +00:00
\end{document}