From 5ccef13e7c42a179f3d065a0f0cca912dd8d3c04 Mon Sep 17 00:00:00 2001 From: Gerald Bauer Date: Wed, 6 Mar 2024 13:41:23 +0100 Subject: [PATCH] up --- README.md | 2 +- book/00_meta.md | 9 ++ book/Makefile | 50 ++++++++++ book/NOTES.md | 17 ++++ book/chapter_break.tex | 10 ++ book/fonts.tex | 36 +++++++ book/inline_code.tex | 13 +++ book/numbering.lua | 11 +++ book/pygments.theme | 211 +++++++++++++++++++++++++++++++++++++++++ script/NOTES.md | 20 ---- script/build.rb | 34 ------- 11 files changed, 358 insertions(+), 55 deletions(-) create mode 100644 book/00_meta.md create mode 100644 book/Makefile create mode 100644 book/NOTES.md create mode 100644 book/chapter_break.tex create mode 100644 book/fonts.tex create mode 100644 book/inline_code.tex create mode 100644 book/numbering.lua create mode 100644 book/pygments.theme delete mode 100644 script/NOTES.md delete mode 100644 script/build.rb diff --git a/README.md b/README.md index e437bada..e7690e48 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Crypto Collectibles Series - # Programming (Crypto) Pixel Punk Profile Pictures & (Generative) Art - Step-by-Step Book / Guide -_Inside Unique 24×24 Pixel Art on the Blockchain..._ +_Inside Unique 24×24 Pixel Art on (and off) the Blockchain..._ by [Gerald Bauer](https://github.com/geraldb), et al diff --git a/book/00_meta.md b/book/00_meta.md new file mode 100644 index 00000000..c305b569 --- /dev/null +++ b/book/00_meta.md @@ -0,0 +1,9 @@ +--- +title: Programming (Crypto) Pixel Punk Profile Pictures & (Generative) Art +subtitle: A Step-by-Step Book / Guide - Inside Unique 24×24 Pixel Art on (and off) the Blockchain +author: Gerald Bauer +date: March 2024 +## or use only 2024 - why? why not? + +## add more variable here - why? why not? +--- \ No newline at end of file diff --git a/book/Makefile b/book/Makefile new file mode 100644 index 00000000..28268c68 --- /dev/null +++ b/book/Makefile @@ -0,0 +1,50 @@ +TARGET = programming-cryptopunks +SRC = book/00_meta.md \ + 01_crop.md \ + 02_attributes.md \ + 03_generate.md \ + 05_alien_invasion.md \ + 06_palette_8bit.md \ + 07_humans.md \ + 08_composite.md \ + 09_monalisa.md \ + 10_hair.md \ + A1_special_effects.md + + + +PANDOC = c:/prg/pandoc3.1.11.1/pandoc.exe + + + +all: pdf pdf_std + + +pdf_std: $(SRC) build + $(PANDOC) --verbose $(SRC) \ + -f gfm \ + --toc \ + --number-sections \ + --pdf-engine=xelatex \ + -o build/$(TARGET)_std.pdf + + +pdf: $(SRC) build + $(PANDOC) --verbose $(SRC) \ + -f gfm \ + --lua-filter book/numbering.lua \ + --toc \ + --number-sections \ + --include-in-header book/fonts.tex \ + --include-in-header book/chapter_break.tex \ + --include-in-header book/inline_code.tex \ + --highlight-style book/pygments.theme \ + -V linkcolor:blue \ + -V geometry:a4paper \ + -V geometry:margin=2cm \ + --pdf-engine=xelatex \ + -o build/$(TARGET).pdf + +build: + mkdir build + diff --git a/book/NOTES.md b/book/NOTES.md new file mode 100644 index 00000000..6f79e880 --- /dev/null +++ b/book/NOTES.md @@ -0,0 +1,17 @@ +# Build Scripts Notes + +let's try to build a pdf booklet via pandoc (and latex). +run / try: + + + $ make -f book/Makefile pdf + +and + + $ make -f book/Makefile pdf_std + +gets you a "vanilla" booklet with no pandoc/latex customizations + + + + diff --git a/book/chapter_break.tex b/book/chapter_break.tex new file mode 100644 index 00000000..5954354a --- /dev/null +++ b/book/chapter_break.tex @@ -0,0 +1,10 @@ +%% Adds pagebreak between chapters +% from comments of accepted answer +% https://superuser.com/questions/601469/getting-chapters-to-start-on-a-new-page-in-a-pandoc-generated-pdf +\usepackage{sectsty} +\sectionfont{\clearpage} + +% accepted answer gave error +%\usepackage{titlesec} +%\newcommand{\sectionbreak}{\clearpage} + diff --git a/book/fonts.tex b/book/fonts.tex new file mode 100644 index 00000000..c0804fe4 --- /dev/null +++ b/book/fonts.tex @@ -0,0 +1,36 @@ + +\usepackage{fontspec} + + +\setmainfont{DejaVuSerif}[ + Path=/sites/tex/dejavu-fonts-ttf-2.37/ttf/, + Extension = .ttf, + UprightFont=*, + BoldFont=*-Bold, + ItalicFont=*-Italic, + BoldItalicFont=*-BoldItalic + ] + +\setsansfont{DejaVuSans}[ + Path=/sites/tex/dejavu-fonts-ttf-2.37/ttf/, + Extension = .ttf, + UprightFont=*, + BoldFont=*-Bold, + ItalicFont=*-Oblique, + BoldItalicFont=*-BoldOblique + ] + +\setmonofont{DejaVuSansMono}[ + Path=/sites/tex/dejavu-fonts-ttf-2.37/ttf/, + Extension = .ttf, + UprightFont=*, + BoldFont=*-Bold, + ItalicFont=*-Oblique, + BoldItalicFont=*-BoldOblique + ] + + +% Oblique characters follow the structure of the upright styles, +% while italics have a different structure, informed by cursive writing. +% Obliques are not merely digitally slanted—optical corrections +% are made to avoid distortions and an incorrect distribution of weight. diff --git a/book/inline_code.tex b/book/inline_code.tex new file mode 100644 index 00000000..fbb5952d --- /dev/null +++ b/book/inline_code.tex @@ -0,0 +1,13 @@ +%% https://stackoverflow.com/questions/40975004/pandoc-latex-change-backtick-highlight +\usepackage{fancyvrb,newverbs,xcolor} + +%\definecolor{Light}{gray}{.90} +%% https://martin-thoma.com/colors-in-latex/ +%% https://en.wikibooks.org/wiki/LaTeX/Colors +\definecolor{Light}{HTML}{F4F4F4} + +\let\oldtexttt\texttt +\renewcommand{\texttt}[1]{ + \colorbox{Light}{\oldtexttt{#1}} +} + diff --git a/book/numbering.lua b/book/numbering.lua new file mode 100644 index 00000000..475618a3 --- /dev/null +++ b/book/numbering.lua @@ -0,0 +1,11 @@ +-- adjust as needed +-- turn off numbering for sections below max treshhold +local max_numbering_level = 1 + +function Header(h) + if h.level > max_numbering_level then + h.classes:insert 'unnumbered' + end + return h +end + diff --git a/book/pygments.theme b/book/pygments.theme new file mode 100644 index 00000000..2ab986a6 --- /dev/null +++ b/book/pygments.theme @@ -0,0 +1,211 @@ +{ + "text-color": null, + "background-color": "#f8f8f8", + "line-number-color": "#aaaaaa", + "line-number-background-color": null, + "text-styles": { + "Alert": { + "text-color": "#ff0000", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Annotation": { + "text-color": "#60a0b0", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + }, + "Attribute": { + "text-color": "#7d9029", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "BaseN": { + "text-color": "#40a070", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "BuiltIn": { + "text-color": "#008000", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Char": { + "text-color": "#4070a0", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Comment": { + "text-color": "#60a0b0", + "background-color": null, + "bold": false, + "italic": true, + "underline": false + }, + "CommentVar": { + "text-color": "#60a0b0", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + }, + "Constant": { + "text-color": "#880000", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "ControlFlow": { + "text-color": "#007020", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "DataType": { + "text-color": "#902000", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "DecVal": { + "text-color": "#40a070", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Documentation": { + "text-color": "#ba2121", + "background-color": null, + "bold": false, + "italic": true, + "underline": false + }, + "Error": { + "text-color": "#ff0000", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Extension": { + "text-color": null, + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Float": { + "text-color": "#40a070", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Function": { + "text-color": "#06287e", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Import": { + "text-color": "#008000", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Information": { + "text-color": "#60a0b0", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + }, + "Keyword": { + "text-color": "#007020", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Operator": { + "text-color": "#666666", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Other": { + "text-color": "#007020", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Preprocessor": { + "text-color": "#bc7a00", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "SpecialChar": { + "text-color": "#4070a0", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "SpecialString": { + "text-color": "#bb6688", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "String": { + "text-color": "#4070a0", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Variable": { + "text-color": "#19177c", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "VerbatimString": { + "text-color": "#4070a0", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Warning": { + "text-color": "#60a0b0", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + } + } +} diff --git a/script/NOTES.md b/script/NOTES.md deleted file mode 100644 index b3fa4388..00000000 --- a/script/NOTES.md +++ /dev/null @@ -1,20 +0,0 @@ -# Build Scripts Notes - -let's try to build a pdf booklet via pandoc (and latex) - - - - - - - -## misc(ellaneous) - -- [ ] add (auto-generated) table of contents - - -## tooling - -requires pandoc, and latex (install via miktex on windows) - - diff --git a/script/build.rb b/script/build.rb deleted file mode 100644 index 68b318cf..00000000 --- a/script/build.rb +++ /dev/null @@ -1,34 +0,0 @@ -########### -# to run use: -# $ ruby script/build.rb - - - -chapters = [ - '01_crop.md', - '02_attributes.md', - '03_generate.md' -] - - -pp chapters - -pandoc = 'c:\prg\pandoc3.1.11.1\pandoc.exe' - -cmd = "#{pandoc} #{chapters.join( ' ')} " -# cmd += "--extract-media build " - -# cmd += "--table-of-contents " -# cmd += "--toc-depth 3 " - -cmd += "--standalone " -cmd += "-o build/book.tex" -pp cmd - - -puts "==> calling #{cmd}..." - -system( cmd ) - -puts "bye" -