From: François Fleuret Date: Mon, 6 May 2024 15:26:50 +0000 (+0200) Subject: Added all the files for lulu.com + A5 booklet X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;ds=inline;p=littlebook.git Added all the files for lulu.com + A5 booklet --- diff --git a/lb-booklet.tex b/lb-booklet.tex new file mode 100644 index 0000000..0abb1c7 --- /dev/null +++ b/lb-booklet.tex @@ -0,0 +1,4 @@ +% -*- mode: latex; mode: reftex; mode: auto-fill; mode: flyspell; coding: utf-8; tex-command: "pdflatex.sh" -*- + +\def\withcover{} +\input{lb-pocket} diff --git a/layout.tex b/lb-phone.tex similarity index 93% rename from layout.tex rename to lb-phone.tex index 02a8add..e6a38f5 100644 --- a/layout.tex +++ b/lb-phone.tex @@ -1,17 +1,20 @@ -% -*- mode: latex; mode: reftex; mode: auto-fill; mode: flyspell; coding: utf-8; -*- +% -*- mode: latex; mode: reftex; mode: auto-fill; mode: flyspell; coding: utf-8; tex-command: "pdflatex.sh" -*- -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\documentclass[oneside,11pt]{memoir} -\usepackage{amsmath} -\usepackage{amssymb} -\usepackage{dsfont} \usepackage{ifthen} \usepackage{caption} +\usepackage{adjustbox} +\usepackage{calc} +\newlength{\captionheight} \let\ordinal\relax \usepackage[us]{datetime} \newdateformat{dotdate}{\THEYEAR.\twodigit{\THEMONTH}.\twodigit{\THEDAY}} +\def\highquality{} +\def\breakforlittle{\\} + \usepackage{imakeidx} \makeindex[columns=1] @@ -40,16 +43,36 @@ hypertexnames=false, % to avoid errors with autonum ]{hyperref} % PDF meta-information specification +%\usepackage{cleveref} +\usepackage{autonum} + \urlstyle{same} -\usepackage[object=vectorian]{pgfornament} -\def\textsep{% -\vskip1.5ex -\centerline{\pgfornament[anchor=center,ydelta=0pt,width=2cm]{82}} +\usepackage{mdframed} +\usepackage{lipsum}% just to generate text for the example -\vskip0.5ex -} +\newmdenv[ + topline=false, + bottomline=false, + innertopmargin=0pt, + innerbottommargin=0pt, + innerleftmargin=4pt, + innerrightmargin=4pt, + leftmargin=0pt, + rightmargin=0pt, + skipabove=0pt, + skipbelow=0pt, +]{siderules} + +%% \usepackage[object=vectorian]{pgfornament} +%% \def\textsep{% +%% \vskip1.5ex + +%% \centerline{\pgfornament[anchor=center,ydelta=0pt,width=2cm]{82}} + +%% \vskip0.5ex +%% } \AddToHook{cmd/section/before}{\clearpage} \usepackage[section]{placeins} @@ -76,9 +99,10 @@ \usepackage{dsfont} \usepackage{mleftright} -\setlength{\thinmuskip}{1.5mu} % by default it is equal to 3 mu -\setlength{\medmuskip}{2mu} % by default it is equal to 4 mu -\setlength{\thickmuskip}{3.5mu} % by default it is equal to 5 mu +\newcommand{\setmuskip}[2]{#1=#2\relax} +\setmuskip{\thinmuskip}{1.5mu} % by default it is equal to 3 mu +\setmuskip{\medmuskip}{2mu} % by default it is equal to 4 mu +\setmuskip{\thickmuskip}{3.5mu} % by default it is equal to 5 mu \makeatletter \DeclareFontEncoding{LS1}{}{} @@ -88,6 +112,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\eqnumber}{\MakeLinkTarget{equation}\text{(\theequation)}} + \newcommand{\inputgenerated}[1]{% \IfFileExists{#1}{\input{#1}}{% \errmessage{Cannot find "#1", compile with -shell-escape}\stop}% @@ -128,6 +154,7 @@ \def\softargmax{\operatorname{softargmax}} \def\selfattention{\operatorname{self-att}} \def\crossattention{\operatorname{cross-att}} +\def\ffw{\operatorname{f{}fw}} \def\attention{\operatorname{att}} \def\relu{\operatorname{relu}} \def\gelu{\operatorname{gelu}} @@ -262,7 +289,6 @@ fill=paramcolor, %% preaction={fill=white}, %% pattern color=black!15, -%% pattern={Lines[line width=0.5pt,angle=-45,distance=1pt]} }, meta param/.style={label={[% inner sep=0pt, @@ -414,7 +440,8 @@ %% \makepagestyle{littlebook} %% \makeoddhead{littlebook}{}{}{} %% \makeevenhead{littlebook}{}{}{} -\newcommand{\myfooter}{\footnotesize {\thepage \hskip 0.8em \raisebox{-2pt}{\vline height 8pt} \hskip 0.4em \thelastpage}} +\newcommand{\myfooter}{\footnotesize {\thepage}} +%\newcommand{\myfooter}{\footnotesize {\thepage \hskip 0.8em \raisebox{-2pt}{\vline height 8pt} \hskip 0.4em \thelastpage}} %% \makeoddfoot{littlebook}{}{\myfooter}{} %% \makeevenfoot{littlebook}{}{\myfooter}{} \makeoddfoot{plain}{}{\myfooter}{} @@ -589,3 +616,10 @@ } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%\def\forprint{} +\def\withcover{} + +\raggedbottom + +\input{lb} diff --git a/lb-pocket-cover.tex b/lb-pocket-cover.tex new file mode 100644 index 0000000..1981950 --- /dev/null +++ b/lb-pocket-cover.tex @@ -0,0 +1,93 @@ +%% -*- mode: latex; mode: reftex; mode: flyspell; coding: utf-8; tex-command: "pdflatex.sh" -*- + +\documentclass[11pt]{article} +\usepackage[paperheight=180.98mm,paperwidth=231.29mm,top=0.0cm,bottom=0.0cm,left=0.0cm,right=0.0cm]{geometry} +\usepackage[utf8]{inputenc} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[osf]{libertine} +%\usepackage{microtype} +\usepackage{tikz} + +\let\ordinal\relax +\usepackage[us]{datetime} +\newdateformat{dotdate}{\THEYEAR.\twodigit{\THEMONTH}.\twodigit{\THEDAY}} + +\def\construct{none} +%% \def\construct{red} + +\begin{document} + +\center + +\vspace*{\stretch{1}} + +\begin{tikzpicture} + +\pgfmathsetlengthmacro{\width}{224.2mm} +\pgfmathsetlengthmacro{\height}{0.95\textheight} +%\pgfmathsetlengthmacro{\spinewidth}{8.74mm} +\pgfmathsetlengthmacro{\spinewidth}{10.74mm} % add 1mm for the fold + +\pgfmathsetlengthmacro\x{(\width-\spinewidth)/2} +\pgfmathsetlengthmacro\mx{\width/2} +\pgfmathsetlengthmacro\sidewidthx{(\width-\spinewidth)/2} +\pgfmathsetlengthmacro\mxl{(\width-\spinewidth)/4} +\pgfmathsetlengthmacro\mxr{\width/2 + \spinewidth/2 + (\width-\spinewidth)/4} +\pgfmathsetlengthmacro\my{\height/2} + +\draw[draw=\construct] (0,0) rectangle ++(\width,\height); +\draw[draw=\construct] (\x,0) rectangle ++(\spinewidth,\height); + +\node[rotate=-90] (spine) +% at (\mx,\my)% proto 2023.06.10 + at (\mx-1mm,\my) + {\large The Little Book of Things \hspace*{3cm} Bob Jones}; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\node (cover front) at (\mxr,\my){ +% + \begin{minipage}{80mm} + \begin{center} + + \vspace*{18ex} + + {\huge The Little Book\\[0.75ex] of\\[1.75ex] Things} + + \vspace*{8ex} + + {\Large Bob Jones} + + \vspace*{12ex} + +%% \includegraphics[width=0.8\textwidth] {pics/neocognitron.png}\hspace*{3mm} + + \vspace*{18ex} + + \end{center} + \end{minipage} +}; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\node (cover back) +% at (\mxl,\my) % proto 2023.06.10 +at (\mxl-2mm,\my) +{ + + \begin{minipage}{80mm} +This book is a short introduction to things for readers with a +STEM background. It aims at providing the necessary background to +understand landmark things. + \end{minipage} +}; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\end{tikzpicture} + +\vspace*{\stretch{1}} + +\end{document} diff --git a/lb-pocket.tex b/lb-pocket.tex new file mode 100644 index 0000000..85842ea --- /dev/null +++ b/lb-pocket.tex @@ -0,0 +1,619 @@ +% -*- mode: latex; mode: reftex; mode: auto-fill; mode: flyspell; coding: utf-8; tex-command: "pdflatex.sh" -*- + +\documentclass[twoside,11pt]{memoir} + +\usepackage{ifthen} +\usepackage{caption} +\usepackage{adjustbox} +\usepackage{calc} +\newlength{\captionheight} + +%\pdfminorversion=3 + +\makeatletter +\@beginparpenalty=10000 +\makeatother + +\let\ordinal\relax +\usepackage[us]{datetime} +\newdateformat{dotdate}{\THEYEAR.\twodigit{\THEMONTH}.\twodigit{\THEDAY}} + +\def\highquality{} +\def\breakforlittle{} + +\usepackage{imakeidx} +\makeindex[columns=1] + +\usepackage{enumitem} +\setlist[itemize]{leftmargin=0pt,itemindent=1em,itemsep=2ex} +\setlist{nosep} % or \setlist{noitemsep} to leave space around whole list + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[osf]{libertine} +\usepackage{microtype} + +\usepackage[ + linktocpage=true, + unicode=true, + bookmarks=true, + bookmarksnumbered=false, + bookmarksopen=false, + breaklinks=true, + pdfborder={0 0 1}, + backref=page, + colorlinks=true, + linkcolor=links, + urlcolor=links, + citecolor=links, + hypertexnames=false, % to avoid errors with autonum +]{hyperref} % PDF meta-information specification + +%\usepackage{cleveref} +\usepackage{autonum} + +\urlstyle{same} + +\usepackage{mdframed} +\usepackage{lipsum}% just to generate text for the example + +\newmdenv[ + topline=false, + bottomline=false, + innertopmargin=0pt, + innerbottommargin=0pt, + innerleftmargin=4pt, + innerrightmargin=4pt, + leftmargin=0pt, + rightmargin=0pt, + skipabove=0pt, + skipbelow=0pt, +]{siderules} + +\usepackage[object=vectorian]{pgfornament} +\def\textsep{% +\vskip1.5ex + +\centerline{\pgfornament[anchor=center,ydelta=0pt,width=2cm]{82}} + +\vskip0.5ex +} + +%\AddToHook{cmd/section/before}{\clearpage} +\usepackage[section]{placeins} + +\usepackage{xspace} +\def\wordfig{Figure\xspace} +\def\wordeq{Equation\xspace} +\def\wordtable{Table\xspace} +\def\wordchap{Chapter\xspace} + +\let\oldcenter\center +\let\oldendcenter\endcenter +\renewenvironment{center}{\setlength\topsep{0pt}\oldcenter}{\oldendcenter} + +\usepackage{environ} +\NewEnviron{hardcenter}{\makebox[\textwidth][c]{\BODY}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Math +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{dsfont} +\usepackage{mleftright} + +%\allowdisplaybreaks + +%% \setlength{\thinmuskip}{1mu} % by default it is equal to 3 mu +%% \setlength{\medmuskip}{1mu} % by default it is equal to 4 mu +%% \setlength{\thickmuskip}{3mu} % by default it is equal to 5 mu + +\makeatletter +\DeclareFontEncoding{LS1}{}{} +\DeclareFontSubstitution{LS1}{stix}{m}{n} +\DeclareMathAlphabet{\mathcal}{LS1}{stixscr}{m}{n} +\makeatother + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcommand{\eqnumber}{\MakeLinkTarget{equation}\text{(\theequation)}} + +\newcommand{\inputgenerated}[1]{% + \IfFileExists{#1}{\input{#1}}{% + \errmessage{Cannot find "#1", compile with -shell-escape}\stop}% +} + +%\newcommand{\gradient}[2]{{\nabla\!}_{#1 \mid #2}} +\newcommand{\gradient}[2]{{\nabla\!#1}_{\mid #2}} + +\def\given{\,\middle\vert\,} +\newcommand{\proba}{{P}} +\newcommand{\seq}{{S}} +\newcommand{\expect}{\mathds{E}} +\newcommand{\variance}{\mathds{V}} +\newcommand{\empexpect}{\hat{\mathds{E}}} +\newcommand{\mutinf}{\mathds{I}} +\newcommand{\empmutinf}{\hat{\mathds{I}}} +\newcommand{\entropy}{\mathds{H}} +\newcommand{\empentropy}{\hat{\mathds{H}}} +\newcommand{\ganG}{\mathbf{G}} +\newcommand{\ganD}{\mathbf{D}} +\newcommand{\ganF}{\mathbf{F}} + +\newcommand{\dkl}{\mathds{D}_{\mathsf{KL}}} +\newcommand{\djs}{\mathds{D}_{\mathsf{JS}}} + +\newcommand*{\vertbar}{\rule[-1ex]{0.5pt}{2.5ex}} +\newcommand*{\horzbar}{\rule[.5ex]{2.5ex}{0.5pt}} + +\def\positionalencoding{\operatorname{pos-enc}} +\def\concat{\operatorname{concat}} +\def\crossentropy{\LL_{\operatorname{ce}}} + +\def\embedding{\operatorname{embed}} +\def\mha{\operatorname{mha}} +\def\layernorm{\operatorname{layernorm}} +\def\batchnorm{\operatorname{batchnorm}} +\def\fullyconnected{\operatorname{fully-conn}} +\def\softargmax{\operatorname{softargmax}} +\def\selfattention{\operatorname{self-att}} +\def\crossattention{\operatorname{cross-att}} +\def\ffw{\operatorname{f{}fw}} +\def\attention{\operatorname{att}} +\def\relu{\operatorname{relu}} +\def\gelu{\operatorname{gelu}} +\def\dropout{\operatorname{dropout}} +\def\resblock{\operatorname{resblock}} +\def\dresblock{\operatorname{dresblock}} +\def\reshape{\operatorname{reshape}} +\def\convtwod{\operatorname{conv-2d}} +\def\maxpool{\operatorname{maxpool}} +\def\avgpool{\operatorname{avgpool}} +%\def\samax{\Upsilon} +%\def\samax{\operatorname{samax}} +\def\sigmoid{\operatorname{sigm}} +\def\sample{\operatorname{sample}} +\def\diag{\operatorname{diag}} +\def\sign{\operatorname{sign}} +\def\argmax{\operatornamewithlimits{argmax}} +\def\argmin{\operatornamewithlimits{argmin}} + +%\usepackage{oldgerm} +\usepackage{relsize} + +\usepackage{xfp} +\newcommand{\adaptedscale}[1]{\fpeval{1.1*#1}} +%\newcommand{\adaptedscale}[1]{#1} + +%\newcommand{\li}[1]{^{\textgoth{#1}}} +\newcommand{\li}[1]{^{\scalebox{.5}{\textbf{#1}}}} +%% \newcommand{\li}[1]{^{\textbf{#1}}} +%\newcommand{\li}[1]{{|#1}} +\newcommand{\DATAVAR}{\mathbf{{\cal D}}} +\newcommand{\DATAVAL}{\mathbf{d}} +\newcommand{\BD}{\mathbf{D}} +\newcommand{\LL}{\mathcal{L}} +\newcommand{\Ll}{\mathcal{l}} +\newcommand{\RR}{\mathbb{R}} +\newcommand{\Lh}{\mathcal{h}} +\newcommand{\transpose}{^{\top}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% tikz +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\usepackage{tikz} +\usetikzlibrary{arrows,arrows.meta,calc} +\usetikzlibrary{patterns,backgrounds} +\usetikzlibrary{positioning,fit} +\usetikzlibrary{shapes.geometric,shapes.multipart} +\usetikzlibrary{patterns.meta,decorations.pathreplacing,calligraphy} +\usetikzlibrary{tikzmark} +\usetikzlibrary{decorations.pathmorphing} + +% remove the "There is no ... in font nullfont!" errors +\AtBeginEnvironment{tikzpicture}{\tracinglostchars=0\relax} + +%% \tikzset{ +%% } + +\definecolor{operatorcolor}{rgb}{0.95,0.95,1.00} +\definecolor{paramcolor}{rgb}{0.8,0.8,1.0} + +\tikzset{ + %font={\fontsize{11pt}{12}\selectfont}, + axes/.style={ + samples=1000, + %smooth, + %scale=0.8, + }, +} + +\newlength{\layergap} +\setlength{\layergap}{2pt} +\newlength{\layerthickness} +\setlength{\layerthickness}{13pt} +\newlength{\layerwidth} +\setlength{\layerwidth}{4.75em} + +\newlength{\diminfoshift} +\setlength{\diminfoshift}{70pt} + +\tikzset{ + >={Straight Barb[angle'=80,scale=\adaptedscale{1.2}]}, + deepnet/.style={ +%% background rectangle/.style={fill=paper}, +%% show background rectangle, + %every text node part/.style={align=center}, + %rounded corners=0.5pt, + curly brace/.style={sharp corners,very thick,decoration={calligraphic brace,amplitude=0.20cm},decorate}, + %font=\footnotesize, + halo/.style={ + %% on layer=background, + preaction={ + draw=white,line width=2pt,-,%shorten <=1pt,shorten >=1pt, + }, + }, + operator/.style={draw=black!50,fill=operatorcolor,inner sep=1pt,font=\small}, + next/.style={above=##1\layergap of \tikzlastnode}, + next/.default={1}, + prev/.style={below=##1\layergap of \tikzlastnode}, + prev/.default={1}, + var/.style={inner sep=2pt}, + flow/.style={thick}, + layer/.style={operator,minimum width=\layerwidth,minimum height=\layerthickness,text depth=1pt,text height=1.3ex}, + layer small/.style={layer,minimum width=\layerthickness}, + layer large/.style={layer,minimum height=1.5\layerthickness}, + layer very large/.style={layer,minimum height=1.75\layerthickness}, + info line/.style={ + draw=black,line width=0.4pt,dash pattern=on 0.4pt off 2pt, +%% draw=black!50,line width=0.2pt,-, + shorten >=2pt,shorten <=2pt, + }, + block definition/.style={draw=black,inner sep=2\layergap,dash pattern=on 2.5pt off 0.5pt}, + replicated/.style={ + draw=black, + inner sep=\layergap, dash pattern=on 2.5pt off 1pt, + label={[% + inner sep=2pt, + anchor=south west, + ]south east:{\scriptsize $\times ##1$}}, + }, + % + inputs/.style={ + text depth=1.75ex, + path picture={% + \draw[black] + ($(path picture bounding box.south west)+(1pt,7pt)$)--($(path picture bounding box.south east)+(-1pt,7pt)$) + % + node[midway,yshift=-18pt] {\scalebox{.52}{##1}}; + } + }, + % + param/.style={% +% draw=paramcolor, + fill=paramcolor, +%% preaction={fill=white}, +%% pattern color=black!15, +%% pattern={Lines[line width=0.5pt,angle=-45,distance=1pt]} + }, + meta param/.style={label={[% + inner sep=0pt, + text depth=0pt, + anchor=south west, + shift={(1.5pt,0pt)}, + ]south east:{\scriptsize\color{blue}##1}}}, + } +} + +\newcommand{\diminfo}[3]{% + \coordinate (t) at ($(#2.north)+(\diminfoshift,0.5\layergap)$); + \node[inner sep=0pt,yshift=-0.5pt] (s) at (#1.north east-|t) {\footnotesize #3}; + \draw[info line] (#1.north east|-s)--(s); +} + +\newcommand{\defop}[2]{% +%% \coordinate (BL) at ($(#1.north)+(-0.49\textwidth, 4\layergap)$); +%% \coordinate (BR) at ($(#1.north)+( 0.49\textwidth, 4\layergap)$); +%% \coordinate (TL) at ($(#2.south-|#1)+(-0.49\textwidth,-4\layergap)$); +%% \coordinate (TR) at ($(#2.south-|#1)+( 0.49\textwidth,-4\layergap)$); + \begin{pgfinterruptboundingbox} + \node[anchor=south west,inner sep=2pt] (label) at #1 {#2}; + \draw[decorate,decoration={coil,amplitude=0.5pt,segment length=2pt,aspect=0}] (label.south west) -- (label.south east); + \end{pgfinterruptboundingbox} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% style on layer + +\tikzset{% + on layer/.code={ + \pgfonlayer{#1}\begingroup + \aftergroup\endpgfonlayer + \aftergroup\endgroup + }} + +\makeatletter +%% fix for bb computation of double wires. +%% from https://tex.stackexchange.com/questions/130456/tikz-double-lines-are-shifted +\tikzset{ + only coordinates are relevant/.is choice, + only coordinates are relevant/.default=true, + only coordinates are relevant/true/.code={% + \tikz@addmode{\pgf@relevantforpicturesizefalse}}, + only coordinates are relevant/false/.code={% + \tikz@addmode{\pgf@relevantforpicturesizetrue}} +} +\makeatother + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\makeatletter +% extract interval `start:end` values +\def\get@interval@start#1:#2\@nil{#1} +\def\get@interval@end#1:#2\@nil{#2} +% get domain +\def\domainmin{\expandafter\get@interval@start\tikz@plot@domain\@nil} +\def\domainmax{\expandafter\get@interval@end\tikz@plot@domain\@nil} +% get range +\def\rangemin{\expandafter\get@interval@start\tikz@plot@range\@nil} +\def\rangemax{\expandafter\get@interval@end\tikz@plot@range\@nil} +\makeatother + +\usepackage{pgfplots} +\usepgfplotslibrary{patchplots,colormaps} +\pgfplotsset{compat = newest} + +\newcommand{\mygrid}[5]{% + \pgfmathsetmacro{\xmin}{#1+1} + \pgfmathsetmacro{\xmax}{#1+#3-1} + \pgfmathsetmacro{\ymin}{#2+1} + \pgfmathsetmacro{\ymax}{#2+#4-1} + \ifthenelse{\equal{#5}{}} + {\draw (#1,#2) rectangle ++(#3,#4);} + {\draw[fill=#5] (#1,#2) rectangle ++(#3,#4);} + \foreach \x in {\xmin,...,\xmax}{ + \draw (\x,#2)-- ++(0,#4); + } + \foreach \y in {\ymin,...,\ymax}{ + \draw (#1,\y)-- ++(#3,0); + } +} + +\newcommand{\amatrix}[7]{% + \begin{tikzpicture}[scale=\adaptedscale{0.2}] + \ifthenelse{\equal{#7}{}} + {} + {\draw[draw=none,fill=#7] (#3,#4) rectangle ++(#5,#6);} + \mygrid{0}{0}{#1}{#2}{} + \end{tikzpicture}% +} + +\newcommand{\gridcube}[3]{% 7,4,6 + + \foreach \b in { 0,...,#2 }{ + \draw (0,\b,0)--++(#1,0,0)--++(0,0,#3); + } + + \foreach \d in { 0,...,#1 }{ + \draw (\d,0,0)--++(0,#2,0)--++(0,0,#3); + } + + \foreach \hw in { 0,...,#3 }{ + \draw (0,0,\hw)++(#1,0,0)--++(0,#2,0)--++(-#1,0,0); + } +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Bibliography +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\usepackage[square]{natbib} +\bibliographystyle{plainnatmodified-pocket} +\nobibintoc +\newcommand{\biburl}[1]{\href{#1}{pdf}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Layout +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\setlength{\cftbeforepartskip}{3ex} +\setlength{\cftbeforechapterskip}{1.2ex} +\setlength{\cftbeforesectionskip}{0.2ex} + +\cftsetindents{part}{0em}{1.8em} +\cftsetindents{chapter}{0em}{1.8em} +\cftsetindents{section}{1.8em}{2.2em} + +\setlength{\parindent}{0cm} +\setlength{\parskip}{2ex} + +\setstocksize{17.5cm}{10.8cm} +\settrimmedsize{\stockheight}{\stockwidth}{*} +% Most books will require a gutter of 0.2 - 0.3 in (=5-7.5mm) +%\setlrmarginsandblock{19.5mm}{12.5mm}{*} % proto 2023.06.10 +\setlrmarginsandblock{17.5mm}{12.5mm}{*} +\setulmarginsandblock{15mm}{20mm}{*} +\setheadfoot{15mm}{10mm} +\setheaderspaces{*}{*}{*} + +\makepagestyle{littlebook} +\makeoddhead{littlebook}{}{}{} +\makeevenhead{littlebook}{}{}{} +\newcommand{\myfooter}{\thepage} +%\newcommand{\myfooter}{{\thepage \hskip 0.8em \raisebox{-2pt}{\vline height 8pt} \hskip 0.4em \thelastpage}} +\makeevenfoot{littlebook}{}{\myfooter}{} +\makeoddfoot{littlebook}{}{\myfooter}{} +\pagestyle{littlebook} + +\makeevenfoot{plain}{}{\myfooter}{} +\makeoddfoot{plain}{}{\myfooter}{} + +\copypagestyle{chapter}{plain} +\makeevenfoot{chapter}{}{\myfooter}{} +\makeoddfoot{chapter}{}{\myfooter}{} + +\copypagestyle{part}{plain} +\makeevenfoot{part}{}{}{} +\makeoddfoot{part}{}{}{} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\renewcommand{\partnamefont}{\centering\sffamily\scshape\Huge} +\renewcommand{\partnumfont}{\sffamily\Huge} +\renewcommand{\parttitlefont}{\centering\sffamily\scshape\Huge} +\renewcommand{\beforepartskip}{\vspace*{\stretch{3}}} +\renewcommand{\afterpartskip}{% +\vspace*{\stretch{4}} +\newpage% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\makechapterstyle{Tufte}{ +\renewcommand{\chapterheadstart}{\null \vskip3.0\onelineskip} +\renewcommand{\printchaptername}{\large\sffamily\itshape\chaptername} +\renewcommand{\printchapternum}{\LARGE\thechapter \\} +\renewcommand{\afterchapternum}{} +\renewcommand{\printchaptertitle}[1]{ +\raggedright +\itshape\Huge{##1}} +\renewcommand{\afterchaptertitle}{ +\vskip3.5\onelineskip +}} +\chapterstyle{Tufte} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\setsecheadstyle{\sethangfrom{\noindent ##1}\raggedright\sffamily\itshape\Large} +\setbeforesecskip{-.9\onelineskip} +\setaftersecskip{\onelineskip} + +\setsubsecheadstyle{\sethangfrom{\noindent ##1}\raggedright\sffamily\itshape\large} +\setbeforesubsecskip{\onelineskip} +\setaftersubsecskip{.65\onelineskip} + +\setsubsubsecheadstyle{\sethangfrom{\noindent ##1}\raggedright\sffamily\itshape} +\setbeforesubsubsecskip{-.5\onelineskip} +\setaftersubsubsecskip{.1\onelineskip} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\captiontitlefont{\itshape} +\captionnamefont{} +\newcommand{\likecaption}{\color{black}\itshape} +\setlength{\abovecaptionskip}{3ex} + +\midsloppy + +\checkandfixthelayout + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% The \todo command +\newcounter{nbdrafts} +\setcounter{nbdrafts}{0} +\makeatletter +\newcommand{\checknbdrafts}{ +\ifnum \thenbdrafts > 0 +\@latex@warning@no@line{*WARNING* The document contains \thenbdrafts \space draft note(s)} +\fi} +\newcommand{\todo}[1]{\addtocounter{nbdrafts}{1}{\color{red} #1}} +\makeatother +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\definecolor{paper}{rgb}{0.95,0.95,0.95} +\definecolor{math}{rgb}{0.0,0.5,0.0} +%\definecolor{links}{rgb}{0.0,0.2,0.5} +\definecolor{links}{rgb}{0.0,0.0,0.0} +%\definecolor{hlcolor}{rgb}{0.8,1.0,0.85} + +\definecolor{blue}{rgb}{0.3,0.5,0.85} +\definecolor{red}{rgb}{0.65,0.0,0.0} +\definecolor{green}{rgb}{0.0,0.50,0.0} +\definecolor{dimmed}{rgb}{0.8,0.8,0.8} +\definecolor{orange}{rgb}{1.0,0.75,0.0} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Pretty underline, taken from +% https://tex.stackexchange.com/questions/36894/underline-omitting-the-descenders + +\usepackage{soul} +\usepackage{xcolor} +\usepackage{xparse} +\makeatletter + +\ExplSyntaxOn +\cs_new:Npn \white_text:n #1 + { + \fp_set:Nn \l_tmpa_fp {#1 * .01} + \llap{\textcolor{white}{\the\SOUL@syllable}\hspace{\fp_to_decimal:N \l_tmpa_fp em}} + \llap{\textcolor{white}{\the\SOUL@syllable}\hspace{-\fp_to_decimal:N \l_tmpa_fp em}} + } +\NewDocumentCommand{\whiten}{ m } + { + \int_step_function:nnnN {1}{1}{#1} \white_text:n + } +\ExplSyntaxOff + +\NewDocumentCommand{ \prettyul }{ D<>{5} O{0.2ex} O{0.1ex} +m } {% +\begingroup +\setul{#2}{#3}% +\def\SOUL@uleverysyllable{% + \setbox0=\hbox{\the\SOUL@syllable}% + \ifdim\dp0>\z@ + \SOUL@ulunderline{\phantom{\the\SOUL@syllable}}% + \whiten{#1}% + \llap{% + \the\SOUL@syllable + \SOUL@setkern\SOUL@charkern + }% + \else + \SOUL@ulunderline{% + \the\SOUL@syllable + \SOUL@setkern\SOUL@charkern + }% + \fi}% + \ul{#4}% +\endgroup +} + +\makeatother + +% end of prettyul +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\usepackage{accsupp} +\usepackage{xcolor, soul} + +\definecolor{hlcolor}{rgb}{1.0,1.0,0.5} +\definecolor{ulcolor}{rgb}{0.50,0.50,0.50} +\sethlcolor{hlcolor} +\setulcolor{ulcolor} +\newcommand{\keyterm}[2][]{% + \BeginAccSupp{method=plain,ActualText={#2}}% + \ifthenelse{\equal{#1}{}} + {\prettyul[2pt]{#2}\index{#2}} + {\prettyul[2pt]{#2}\index{#1}}% +%% {\emph{#2}\index{#2}} +%% {\emph{#2}\index{#1}}% + \EndAccSupp{}% +} + +\newcommand{\gizmo}{% + \begin{tikzpicture}[scale=0.25] + \draw[draw=none,fill=red] (0,0) rectangle ++(1,1); + \draw[draw=none,fill=blue] (1,0) rectangle ++(1,1); + \draw[draw=none,fill=blue] (0,1) rectangle ++(1,1); + \draw[draw=none,fill=red] (1,1) rectangle ++(1,1); + \end{tikzpicture} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\forprint{} +%\def\withcover{} + +\raggedbottom + +\input{lb} diff --git a/test.tex b/lb.tex similarity index 90% rename from test.tex rename to lb.tex index 1d703ff..69b8712 100644 --- a/test.tex +++ b/lb.tex @@ -1,41 +1,66 @@ -% -*- mode: latex; mode: reftex; mode: auto-fill; mode: flyspell; coding: utf-8; tex-command: "pdflatex.sh" -*- - -\documentclass[oneside,11pt]{memoir} - -\input{layout.tex} \usepackage{lipsum} \hypersetup{ - pdfauthor={xxxxxx}, - pdftitle={xxxxxx}, - pdfsubject={xxxxxx}, - pdfkeywords={xxxxxx}, - pdfproducer={LaTeX and TikZ}, - pdfcreator={pdflatex}, + pdfauthor={XXXX}, + pdftitle={XXXX}, + pdfsubject={XXXX}, + pdfkeywords={XXXX}, + pdfproducer={XXXX}, + pdfcreator={XXXX}, } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Cover for the phone version +\ifdefined\withcover + \thispagestyle{empty} \begin{center} \vspace*{\stretch{1}} -{\huge The Little Book\\[0.75ex] of\\[1.75ex] Something} +{\huge The Little Book\\[0.75ex] of\\[1.75ex] Things} \vspace*{4ex} -xxx xxx +{\large Bob Jones} + +\vspace*{\stretch{3}} + +\end{center} + +\newpage + +\fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% First page for the pocket book version +\ifdefined\forprint + +\cleardoublepage + +\thispagestyle{empty} + +\begin{center} + +\vspace*{4ex} + +{The Little Book of Things} \vspace*{\stretch{1}} \end{center} \newpage +\fi + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%