From 515bdd658d91020c73f82b70ff001015b359adc0 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 6 Jun 2024 08:17:18 -0300 Subject: Initial import --- .gitmodules | 3 + ChangeLog.md | 1 + DISCLAIMER | 0 LICENSE | 3 + Makefile | 33 +++++ Makefile.bookup | 215 +++++++++++++++++++++++++++++++++ README.md | 15 +++ TODO.md | 43 +++++++ _biblio.yml | 0 _bookdown.yml | 20 ++++ _bookup.yml | 18 +++ _output.yml | 100 ++++++++++++++++ bin/archive | 43 +++++++ bin/provision | 71 +++++++++++ bin/provision-dict | 13 ++ bin/provision-docker | 28 +++++ bin/provision-host | 84 +++++++++++++ bin/provision.R | 48 ++++++++ content/published/00-intro/intro.md | 7 ++ kvmxfile | 216 +++++++++++++++++++++++++++++++++ structure/00-header.tex | 81 +++++++++++++ structure/00-header.yml | 45 +++++++ structure/00-preamble.md | 53 ++++++++ structure/00-preamble.tex | 62 ++++++++++ structure/99-biblio.md | 9 ++ structure/99-end.tex | 28 +++++ templates/references.md | 8 ++ templates/tufte-handout.tex | 232 ++++++++++++++++++++++++++++++++++++ vendor/Fuse.js | 1 + 29 files changed, 1480 insertions(+) create mode 100644 .gitmodules create mode 100644 ChangeLog.md create mode 100644 DISCLAIMER create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 Makefile.bookup create mode 100644 README.md create mode 100644 TODO.md create mode 100644 _biblio.yml create mode 100644 _bookdown.yml create mode 100644 _bookup.yml create mode 100644 _output.yml create mode 100755 bin/archive create mode 100755 bin/provision create mode 100755 bin/provision-dict create mode 100755 bin/provision-docker create mode 100755 bin/provision-host create mode 100755 bin/provision.R create mode 100644 content/published/00-intro/intro.md create mode 100644 kvmxfile create mode 100644 structure/00-header.tex create mode 100644 structure/00-header.yml create mode 100644 structure/00-preamble.md create mode 100644 structure/00-preamble.tex create mode 100644 structure/99-biblio.md create mode 100644 structure/99-end.tex create mode 100644 templates/references.md create mode 100644 templates/tufte-handout.tex create mode 160000 vendor/Fuse.js diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..59ac37c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/Fuse.js"] + path = vendor/Fuse.js + url = https://github.com/krisk/Fuse diff --git a/ChangeLog.md b/ChangeLog.md new file mode 100644 index 0000000..93eb5e0 --- /dev/null +++ b/ChangeLog.md @@ -0,0 +1 @@ +# ChangeLog diff --git a/DISCLAIMER b/DISCLAIMER new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..669a46e --- /dev/null +++ b/LICENSE @@ -0,0 +1,3 @@ +Copy Far "AI" - v0.0.1 - Uma licença próxima do copyleft e longe das ditas "Inteligências Artificiais" - https://copyfarai.itcouldbewor.se/pt/flavors/CC-BY-NC-SA-4.0-FAI + +Esta obra, na presente versão assim como nas anteriores, não pode ser usada para procedimentos conhecidos como "treinamento ou aprendizado de máquina" e análise estilométrica sem a prévia autorização. Para todos os outros meios e fins, esta versão está disponível sob a Licença Creative Commons - Atribuição-NãoComercial-CompartilhaIgual 4.0 Internacional (CC BY-NC-SA 4.0). diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3157ab7 --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +# +# Global Makefile - https://templater.fluxo.info +# +# This Makefile contains basic, common targets and also includes +# any Makefile.* available in the current folder. +# + +# Set CONTAINER based in what we have available in the system +# This variable can be user in other, included Makefiles to handle virtualization tasks +ifeq ($(shell which kvmx > /dev/null && test -s kvmxfile && echo yes), yes) + CONTAINER = kvmx +else ifeq ($(shell which vagrant > /dev/null && test -s Vagrantfile && echo yes), yes) + CONTAINER = vagrant +else ifeq ($(shell which docker > /dev/null && test -s Dockerfile && echo yes), yes) + CONTAINER = docker +else + CONTAINER = '' +endif + +# Default action +default: all + +# Process any other Makefile whose filename matches Makefile.* +# See https://www.gnu.org/software/make/manual/html_node/Include.html +# +# Some of those files might even contain local customizations/overrides +# that can be .gitignore'd, like a Makefile.local for example. +-include Makefile.* + +# Customization examples can be as simple as setting variables: +#CONTAINER = vagrant +#CONTAINER = docker +#DESTDIR ?= vendor diff --git a/Makefile.bookup b/Makefile.bookup new file mode 100644 index 0000000..44158f0 --- /dev/null +++ b/Makefile.bookup @@ -0,0 +1,215 @@ +# +# Parameters +# +# Customize to your needs in your main Makefile. Examples: +# +# BOOKUP = vendor/bookup +# OUTPUT = my-essay +# OUTPUT = essay +# WEBSITE = some.hostname + +# Bookup base folder +BOOKUP ?= . + +# Project name +PROJECT ?= bookup + +# Output file names (prefix) +OUTPUT ?= $(PROJECT) + +# Destination website hostname (for rsync+ssh) +WEBSITE ?= $(PROJECT) + +# +# Exclusion patterns +# + +#EXCLUDES = --exclude=.htpasswd +#EXCLUDES = --exclude=Makefile.local +EXCLUDES = archive + +# +# Metadata +# + +REVISION = $(shell git describe --tags 2> /dev/null || git log -1 --format=oneline | cut -d ' ' -f 1) +DATE = $(shell date) +YEAR = $(shell date +%Y) + +# +# Phony targets +# + +.PHONY: archive + +# +# Default target +# + +all: submodules book clean + @true + +# +# Archive +# + +archive: + @$(BOOKUP)/bin/archive + +# +# Cleanup +# + +clean: + @true + @rm -f $(OUTPUT).aux $(OUTPUT).log $(OUTPUT).nav $(OUTPUT).out $(OUTPUT).snm $(OUTPUT).tex $(OUTPUT).toc $(OUTPUT).vrb + @rm -f index.md index.Rmd + @rm -f _main.log _main.tex _main.loe _main.Rmd + @rm -rf _book _bookdown_files + +# +# Submodules +# + +submodules: + @git submodule update --init --recursive + +# +# Metadata +# + +metadata: + @mkdir -p .metadata + @echo $(REVISION) > .metadata/revision.txt + @echo $(DATE) > .metadata/date.txt + @echo $(YEAR) > .metadata/year.txt + +# +# Compilation +# + +compile_book: metadata + @rm -f $(OUTPUT).md + @#cat sections/*.md >> $(OUTPUT).md + @/bin/bash -c 'cat _bookup.yml >> essays.md ; echo "" >> $(OUTPUT).md' + @/bin/bash -c 'cat _biblio.yml >> essays.md ; echo "" >> $(OUTPUT).md' + @/bin/bash -c 'for file in $(BOOKUP)/structure/00*.yml; do cat $$file >> essays.md ; echo "---" >> essays.md; done' + @/bin/bash -c 'for file in $(BOOKUP)/structure/00*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done' + @/bin/bash -c 'for file in content/published/*/*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done' + @/bin/bash -c 'for file in $(BOOKUP)/structure/99*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done' + @sed -i -e "s|%%revision%%|$(REVISION)|g" -e "s|%%date%%|$(DATE)|g" $(OUTPUT).md + @#sed -i -f snippets/terminology.sed $(OUTPUT).md + @ln -sf $(OUTPUT).md $(OUTPUT).Rmd + +compile: compile_book move_book + @true + +# +# Main bookdown targets +# + +bookdown_clean: + @rm -f _main.Rmd + +bookdown_html: + @# Needs to backup the index.html to avoid overwriting + @#mv index.html index.html.old + + # Cleanup + @#rm -rf $(OUTPUT)/html $(OUTPUT)/$(OUTPUT).html + @rm -rf compiled + + # Fix references + # Use sed to fix a weird reference issue on fig.cap inside knitr blocks that are not properly converted. + # Not using "sed -i" since it yields a permission denied error when running inside a guest VM. + # This fix no longer works with citeproc. + @#cp $(OUTPUT).md $(OUTPUT).md.base + @#sed -e 's/\\\\citet{\([^}]*\)}/@\1/g' $(OUTPUT).md > $(OUTPUT).new && mv $(OUTPUT).new $(OUTPUT).md + + # Build + Rscript -e 'bookdown::render_book("$(OUTPUT).md", "bookdown::gitbook")' + + # Restore $(OUTPUT).md after the weird reference fix + @#mv $(OUTPUT).md.base $(OUTPUT).md + + # See https://stackoverflow.com/questions/58340924/bookdown-generates-index-file-with-a-chapter-title-instead-of-index-html-when + # Fixed using section ID naming in the preamble + #@cd _book && ln -s "início.html" index.html + @#mv _book $(OUTPUT)/html + @#mv index.html.old index.html + @mv _book compiled + + # Replace fuse.js from CDN to local + # This ensures the HTML output can be browsed offline + #@find $(OUTPUT)/html -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|../../vendor/Fuse.js/dist/fuse.min.js|' {} \; + @mkdir compiled/js + @cp vendor/Fuse.js/dist/fuse.min.js compiled/js + @find compiled -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|js/fuse.min.js|' {} \; + + # Add revision information + @echo $(REVISION) > compiled/revision + + # Add symlink to the archive and to the slides + # This symlink is useful for checking things in localhost + # But it tends to be replaced during remote deployment + @cd compiled && ln -s ../archive + @cd compiled && ln -s ../slides + +bookdown_pdf: + # Cleanup old builds + @rm -rf _book/_main.pdf + + # Build + @Rscript -e 'bookdown::render_book("$(OUTPUT).md", "bookdown::tufte_book2")' + + # Move + @#mv _main.pdf $(OUTPUT).pdf + @#mv _book/_main.pdf $(OUTPUT)/$(OUTPUT).pdf + @mv _book/_main.pdf compiled/$(OUTPUT).pdf + +# Use sed to convert tufte::margin_note to marginfigure +# Also, "sed -i" yields a permission denied error when running inside a guest VM. +bookdown_epub: + @# EPUB format is broken right now + @true + + # Fix margin notes + @#sed -e 's/r tufte::margin_note/marginfigure/' $(OUTPUT).md > $(OUTPUT).new && mv $(OUTPUT).new $(OUTPUT).md + + # Build + @#Rscript -e 'bookdown::render_book("$(OUTPUT).md", "bookdown::epub_book")' + + # Move + @##mv _book/_main.epub $(OUTPUT)/$(OUTPUT).epub + @#mv _book/_main.epub compiled/$(OUTPUT)s.epub + + # Cleanup + @#rm _book/reference-keys.txt + @#rmdir _book + +bookdown: bookdown_clean bookdown_html bookdown_pdf bookdown_epub + +# +# Build the essays +# + +move_book: + @mv $(OUTPUT).* compiled/ + +book: archive compile_book bookdown move_book clean + +# +# Remote copies +# + +web_deploy: + @rsync -avz --delete $(EXCLUDES) ./compiled/ $(WEBSITE):/ + @rsync -avz --delete ./archive/ $(WEBSITE):/archive/ + @rsync -avz --delete ./slides/ $(WEBSITE):/slides/ + +# +# Offline copies +# + +usb_stick: + sudo rsync -av --exclude=backups --delete ./ /media/usb/$(PROJECT)/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..4501974 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Bookup + +Bookup is an _opinionated_ book publishing template based on [Bookdown][]. + +It is specially useful for reusing the existing design an workflow across +multiple book volumes. + +It was conceived as the underlying system used by [Projeto Vertigem][]. + +At this point Bookup is not highly customized, and probably will not suit +your needs, but still can be used as a reference if you're planning to do +something similar. + +[Bookdown]: https://bookdown.org +[Projeto Vertigem]: https://vertigem.fluxo.info diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..b518255 --- /dev/null +++ b/TODO.md @@ -0,0 +1,43 @@ +# TODO + +* [ ] Empacotar solução de publicação baseada em Bookdown num projeto de nome + `bookup` ("a bookdown-based publishing solution" ou similar, para + facilmente realizar a editoração e autoria de livros. +* [ ] Usar como base o código do repositório `ensaios`, com eventuais adendos + do repositório `cybersni`. Inicialmente, não é necessário investir tempo em + generalizar tudo ao máximo. O importante é criar uma base comum para os meus + livros, e talvez no futuro generalizar para que possa ser usado por outras + iniciativas. +* [ ] Setup procedure: + * [ ] Vendorizantion (`bookup` and bibliography repositories). + * [ ] Symlinking. + * [ ] Basic files: + * `images/cover.png`. + * `_bookup.yml`. + * `_biblio.yml`. + * `LICENSE`. + * `DISCLAIMER`. + * `snippets/`. +* [ ] Localization support? + * It makes sense to localize common strings in the book structure. + * But maybe it does not make much sense to localize strings in PO files for + the content itself, since long text translations may need an engine that is + not line based. Needs more thinking. +* [ ] Book folder structure: + * `archive`: to hold archives (older book versions). + * `content`: book content: + * `drafts`: leave here texts still being redacted. + * `published`: here goes all the material to be compiled. + * `notes`: notebook. + * `slides`: slides in Markdown format. + * `site`: optional HTML used for the base site; if this exists, the book will + be placed under `public/book` or something like that. + * `public`: compiled book (HTML, PDF and other formats): + * `notes`: compiled notebook. + * `book`: compiled book if there's a `site` folder, otherwise book contents + will be placed in the root of the public folder. + * `biblio`: bibliography. + * `images`: images folder. + * `vendor/bookup`: + * `content`: used when no content is available (Bookup documentation). + * `vendor/{Fuse.js,}`: dependencies. diff --git a/_biblio.yml b/_biblio.yml new file mode 100644 index 0000000..e69de29 diff --git a/_bookdown.yml b/_bookdown.yml new file mode 100644 index 0000000..8f6f09f --- /dev/null +++ b/_bookdown.yml @@ -0,0 +1,20 @@ +--- +# Main bookdown config file +# See https://bookdown.org/yihui/bookdown/configuration.html#configuration + +# Markdown files +#rmd_files: [ "published/index.md" ] + +# Filename +#book_filename: 'book' + +# Internationalization +# https://bookdown.org/yihui/bookdown/internationalization.html +language: + label: + def: 'Definição ' + prp: 'Etimologia ' + ui: + edit: Editar + chapter_name: '' + appendix_name: '' diff --git a/_bookup.yml b/_bookup.yml new file mode 100644 index 0000000..1a2dd00 --- /dev/null +++ b/_bookup.yml @@ -0,0 +1,18 @@ +--- +# Title and subtitle +title : "Bookup" +subtittle : "Bookdown-based publishing template" + +# Authorship information +author: "Silvio Rhatto" +date : "`r Sys.Date()`" + +# Publisher +publisher: "Fluxo" + +# Language +lang: "pt-br" + +# Bibliography +biblio-style: apalike +link-citations: true diff --git a/_output.yml b/_output.yml new file mode 100644 index 0000000..0346264 --- /dev/null +++ b/_output.yml @@ -0,0 +1,100 @@ +# Bookdown output configuration +# See https://bookdown.org/yihui/bookdown/output-formats.html + +# EPUB +# See https://rdrr.io/cran/bookdown/man/epub_book.html +epub_book: + toc: true + toc_depth: 3 + chapter_level: 2 + cover_image: images/cover.png + epub_version: epub3 + + # Make sure to disable Pandoc's example_lists extension + # It conflicts with bibliographical citations + # Check ChangeLog entry from 2024-03-24 + md_extensions: -example_lists + +# Gitbook +# See https://rdrr.io/cran/bookdown/man/gitbook.html +bookdown::gitbook: + config: + toc: + collapse: section + toolbar: + search: + engine: fuse + sharing: no + fontsettings: + theme: night + family: sans + size: 2 + #split_by: chapter+number + split_by: chapter + + # Make sure to disable Pandoc's example_lists extension + # It conflicts with bibliographical citations + # Check ChangeLog entry from 2024-03-24 + md_extensions: -example_lists + +# Tufte Book 2 +# See https://rdrr.io/cran/bookdown/man/pdf_book.html +bookdown::tufte_book2: + # Using a custom Tufte Handout template due do the following issues: + # + # * Unable to set any other language (! Argument of \str_uppercase:n has an extra }.) #278 + # https://github.com/Wandmalfarbe/pandoc-latex-template/issues/278 + # + # * for newest pandoc, only use babel, never polyglossia #20 + # https://github.com/JensErat/pandoc-scrlttr2/issues/20 + # + # * Suggestion for improvement: selectable babel for non-pdflatex #794 + # https://github.com/rstudio/bookdown/issues/794 + # + # The original tufe-handout.tex template can be found at + # https://github.com/rstudio/tufte/blob/main/inst/rmarkdown/templates/tufte_handout/resources/tufte-handout.tex + # + # Using the patch from + # https://github.com/idiv-biodiversity/pandoc-cheat-sheet/pull/2 + # + # Check also + # https://bookdown.org/yihui/rmarkdown/pdf-document.html#custom-templates-1 + # + # We may move back to the vanilla template once this issue is fixed upstream. + template: templates/tufte-handout.tex + + includes: + in_header: structure/00-header.tex + before_body: structure/00-preamble.tex + after_body: structure/99-end.tex + toc: true + toc_depth: 3 + #toc_appendix: true + #toc_bib: true + number_sections: true + keep_tex: true + latex_engine: "xelatex" + + # The natbib package does not support translating the author separator, only "and" is supported. + # So better to stick with pandoc-citeproc. + # + # Also, + # + # > Even if you choose natbib or biblatex for PDF output, all other output + # > formats will be using pandoc-citeproc. If you use matching styles (e.g., + # > biblio-style: apa for biblatex along with csl: apa.csl for + # > pandoc-citeproc), output to PDF and to non-PDF formats will be very + # > similar, though not necessarily identical. + # > + # > -- https://bookdown.org/yihui/bookdown/citations.html + #citation_package: "natbib" + + # Memory issues + # https://community.rstudio.com/t/bookdown-memory-issues-upon-compilation/16829 + #pandoc_args: [ "+RTS", "-K1024m", "-RTS" ] + #pandoc_args: [ "--variable=geometry:paperwidth=6in,paperheight=9in" ] + + # Make sure to disable Pandoc's example_lists extension + # It conflicts with bibliographical citations + # Check ChangeLog entry from 2024-03-24 + md_extensions: -example_lists diff --git a/bin/archive b/bin/archive new file mode 100755 index 0000000..5b71ec8 --- /dev/null +++ b/bin/archive @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Archiver +# + +# Parameters +BASENAME="`basename $0 | sed -e 's/\(.\)/\U\1/'`" +DIRNAME="`dirname $0`" +BASEDIR="$DIRNAME/.." +#ARCHIVE="$BASEDIR/archive" +ARCHIVE="archive" +REVISION="`git describe --tags 2> /dev/null || git log -1 --format=oneline | cut -d ' ' -f 1`" +REVFILE="$BASEDIR/compiled/revision" + +# Make sure the archive folder exist +mkdir -p $ARCHIVE + +# Check for previous build +if [ ! -e "$REVFILE" ]; then + echo "# $BASENAME: skipping: revision file not found" + exit +else + OLD_REVISION="`cat $REVFILE`" +fi + +# Check for non-null revision +if [ -z "$OLD_REVISION" ]; then + echo "# $BASENAME: skipping: old revision is null" + exit +fi + +# Check if it's a tag +if git tag | grep -q "^${OLD_REVISION}"; then + # Check if archive does not exists + if [ ! -d "$ARCHIVE/$OLD_REVISION" ]; then + echo "# $BASENAME: archiving $OLD_REVISION..." + cp -alf compiled $ARCHIVE/$OLD_REVISION + else + echo "# $BASENAME: revision $OLD_REVISION already archived" + fi +else + echo "# $BASENAME: not archiving: revision $OLD_REVISION is not a tag" +fi diff --git a/bin/provision b/bin/provision new file mode 100755 index 0000000..f438a5e --- /dev/null +++ b/bin/provision @@ -0,0 +1,71 @@ +#!/bin/bash +# +# Provisioner +# + +# Parameters +DIRNAME="`dirname $0`" +BOOKDOWN_PACKAGING="${BOOKDOWN_PACKAGING:-DEB}" + +# Dependencies +DEPENDENCIES="make" +DEPENDENCIES="$DEPENDENCIES texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-extra texlive-extra-utils texlive-xetex texlive-lang-portuguese vim-latexsuite" +DEPENDENCIES="$DEPENDENCIES pandoc pandoc-sidenote" +DEPENDENCIES="$DEPENDENCIES fonts-liberation fonts-linuxlibertine" +DEPENDENCIES="$DEPENDENCIES libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev" +DEPENDENCIES="$DEPENDENCIES r-cran-rmarkdown r-cran-magick" +DEPENDENCIES="$DEPENDENCIES libpoppler-cpp-dev" +DEPENDENCIES="$DEPENDENCIES graphviz" +DEPENDENCIES="$DEPENDENCIES biber pybtex" + +# Additional BibTeX dependencies +#DEPENDENCIES="$DEPENDENCIES texlive-bibtex-extra" + +# For pdfcrop support +DEPENDENCIES="$DEPENDENCIES texlive-extra-utils" + +# Old dependencies +#DEPENDENCIES="$DEPENDENCIES python-yaml python-cheetah python-unidecode python-pycurl python-shortuuid" +#DEPENDNECIES="$DEPENDENCIES python-sphinx python-sphinx-bootstrap-theme python-sphinx-paramlinks python-sphinx-patchqueue python-sphinx-rtd-theme python-sphinx-gallery python-sphinxcontrib.bibtex-doc" +#DEPENDENCIES="$DEPENDENCIES pelican hugo jekyll" + +# Check for sudo +if [ "`whoami`" != "root" ]; then + SUDO="sudo" +fi + +# Configure Debian backports +if which trashman &> /dev/null; then + trashman install debian-backports +fi + +# Ensure an up-to-date system +$SUDO apt-get update && $SUDO apt-get dist-upgrade -y && \ + $SUDO apt-get autoremove -y && $SUDO apt-get clean + +# Install dependencies +$SUDO apt install -y $DEPENDENCIES + +# Additional software +#$SUDO apt install -y python3-pandocfilters + +# Try to install pandoc-citeproc, may be unavailable on Debian bookworm onwards +#$SUDO apt install -y pandoc-citeproc + +# Tufte CSS +#$SUDO apt install cabal-install +#$SUDO cabal update +#$SUDO cabal install pandoc-sidenote +#$SUDO apt install -y libghc-pandoc-sidenote-dev \ +# libghc-pandoc-sidenote-doc libghc-pandoc-sidenote-prof + +# Bookdown dependencies +$SUDO apt install -y libcurl4-openssl-dev libssl-dev + +if [ "$BOOKDOWN_PACKAGING" == "CRAN" ]; then + $SUDO $DIRNAME/provision.R +else + $SUDO apt install -y r-cran-bookdown + $SUDO apt install -y r-cran-pdftools + $SUDO Rscript -e 'install.packages("eulerr")' +fi diff --git a/bin/provision-dict b/bin/provision-dict new file mode 100755 index 0000000..a75ae71 --- /dev/null +++ b/bin/provision-dict @@ -0,0 +1,13 @@ +#!/bin/bash +# +# Provisioner for dictionaries +# + +# Check for sudo +if [ "`whoami`" != "root" ]; then + SUDO="sudo" +fi + +# Dictionaries +$SUDO apt install -y dict dict-gcide dict-freedict-eng-por \ + dict-freedict-eng-ell dict-freedict-eng-lat diff --git a/bin/provision-docker b/bin/provision-docker new file mode 100755 index 0000000..d24ea56 --- /dev/null +++ b/bin/provision-docker @@ -0,0 +1,28 @@ +#!/bin/bash +# +# Provisioner for Docker +# + +# Check for sudo +if [ "`whoami`" != "root" ]; then + SUDO="sudo" +fi + +# Parameters +# See https://wiki.debian.org/Backports#Finding_backports +COMPOSE_BACKPORT="`apt show docker-compose -a 2> /dev/null | grep backports | awk '{ print $3 }' | cut -d '/' -f 1`" + +# Ensure an up-to-date system +$SUDO apt-get update +$SUDO apt-get upgrade -y + +# Check for backport availability for Debian bookworm +if [ "$COMPOSE_BACKPORT" == "bookworm-backports" ]; then + COMPOSE_BACKPORTS="-t $COMPOSE_BACKPORT" +fi + +# Docker and docker-compose from distribution +$SUDO apt-get install $COMPOSE_BACKPORTS -y docker.io docker-compose + +# Put the regular user into docker group +$SUDO usermod -a -G docker $(whoami) diff --git a/bin/provision-host b/bin/provision-host new file mode 100755 index 0000000..16712fb --- /dev/null +++ b/bin/provision-host @@ -0,0 +1,84 @@ +#!/bin/bash +# +# Provisioner for a simple hosting environment +# + +# Parameters +PROJECT="${PROJECT:-bookup}" + +# Check for sudo +if [ "`whoami`" != "root" ]; then + SUDO="sudo" +fi + +# Apache +$SUDO apt install -y apache2 + +# Configure an Onion Service +if which trashman &> /dev/null; then + trashman install tor-onion-service +else + HIDDEN="/var/lib/tor/hidden/${PROJECT}" + + # Install Tor + $SUDO apt install -y tor + + # Tor config + cat <<-EOF | $SUDO tee -a /etc/tor/torrc > /dev/null +RunAsDaemon 1 +HiddenServiceDir $HIDDEN +HiddenServicePort 80 127.0.0.1:80 +EOF + + # Create folder structure + $SUDO mkdir -p $HIDDEN + $SUDO chmod -R 700 $HIDDEN + $SUDO chown -R debian-tor: $HIDDEN + + # Start Tor + $SUDO service tor restart +fi + +# Configure Onion Service virtual host +cat <<-EOF | $SUDO tee /etc/apache2/sites-available/onion.conf > /dev/null + + ServerName localhost + ServerAlias *.onion + DocumentRoot "/srv/shared/compiled" + + + #AuthType Basic + #AuthName "Protected" + #AuthUserFile /srv/shared/.htpasswd + #Require valid-user + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +EOF + +# Configure local virtual host +cat <<-EOF | $SUDO tee /etc/apache2/sites-available/local.conf > /dev/null + + ServerName ${PROJECT}.local + DocumentRoot "/srv/shared/compiled" + + + #AuthType Basic + #AuthName "Protected" + #AuthUserFile /srv/shared/.htpasswd + #Require valid-user + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +EOF + +# Ensure that the DocumentRoot exists +$SUDO mkdir -p /srv/shared + +# Enable virtual host +$SUDO a2ensite onion local +$SUDO service apache2 restart diff --git a/bin/provision.R b/bin/provision.R new file mode 100755 index 0000000..a7b1bef --- /dev/null +++ b/bin/provision.R @@ -0,0 +1,48 @@ +#!/usr/bin/env Rscript +# +# Install bookdown and dependencies. +# See https://bookdown.org/yihui/bookdown/r-and-r-packages.html +# +# Environment variable "USE_DEVTOOLS" controls the way some +# packages are installed. Useful in situations like these: +# +# * https://github.com/r-lib/remotes/issues/641 +# * https://github.com/r-lib/remotes/issues/659 +# * https://github.com/r-lib/devtools/issues/1566 +# + +# Bookdown +if (Sys.getenv("USE_DEVTOOLS") == "FALSE") { + install.packages("bookdown", dependencies = TRUE) +} else { + if (!requireNamespace("devtools")) install.packages("devtools") + devtools::install_github("rstudio/bookdown") +} + +# PDF tools +# This adds support to knitr in the HTML output +# Requires libpoppler-cpp-dev and r-cran-magick +if (Sys.getenv("USE_DEVTOOLS") == "FALSE") { + install.packages("pdftools") +} else { + devtools::install_github("ropensci/pdftools") +} + +# For Euler and Venn diagrams +# See https://jolars.github.io/eulerr/ +install.packages("eulerr") + +# Tufte +install.packages('tufte') + +# Graphics support +install.packages('ggplot2') + +# The xfun package +# See https://bookdown.org/yihui/rmarkdown-cookbook/embed-file.html +# https://github.com/yihui/xfun +# https://yihui.org/xfun/ +#install.packages('xfun', repos = 'https://yihui.r-universe.dev') + +# Update everything +update.packages(ask = FALSE, checkBuilt = TRUE) diff --git a/content/published/00-intro/intro.md b/content/published/00-intro/intro.md new file mode 100644 index 0000000..306ce81 --- /dev/null +++ b/content/published/00-intro/intro.md @@ -0,0 +1,7 @@ +# Bookup {#bookup} + +Criar Bookup ajudou a manter um esquema uniforme, ao invés de ter que +implementar e corrigir funcionalidades paralelamente em muitos repositórios, já +que os livros tendem a aumentar. Lidando com a produção de conteúdo como +lidamos com outros códigos, mas sem algoritmizar, ao contrário: usando um +processo arbóreo-espiral. diff --git a/kvmxfile b/kvmxfile new file mode 100644 index 0000000..a9fcc39 --- /dev/null +++ b/kvmxfile @@ -0,0 +1,216 @@ +# +# Sample kvmx file - https://kvmx.fluxo.info +# + +# Which base box you should use. Leave unconfigured to use kvmx-create instead. +#basebox="bookworm" +basebox="dev" + +# First user name +user="user" + +# First user password +password="`head -c 40 /dev/urandom | base64`" + +# Networking +#net="tap" +net="user" + +# DNS config +#net_dns="192.168.1.1" +#net_dns="host" # copy /etc/resolv.conf from host when creating the box + +# Networking: tap config only +# This setting is used during virtual machine bootstrapping by kvmx-create. +#net_ip="10.1.1.2" +#net_mask="255.255.255.0" +#net_gateway="10.1.1.1" + +# Set this is you want to be able to share a single folder between host and guest. +# Needs ssh_support set to "y" and a workable SSH connection to the guest. +shared_folder="." +#shared_folder_mountpoint="/home/$user/code/$VM" +#shared_folder="$HOME/temp/shared/$VM" +#shared_folder_mountpoint="/home/$user/temp/shared/$VM" +shared_folder_mountpoint="/srv/shared" +#shared_folder_mountpoint="/srv/kvmx" +#shared_folder_mountpoint="/vagrant" + +# Set this is you want to be able to share multiple folders between host and guest. +# Needs ssh_support set to "y" and a workable SSH connection to the guest. +# Format: ::,::[,...] +#shared_folders="shared1:.:/home/$user/code/$VM,shared2:$HOME/.local/share/app:/home/$user/.local/share/app" + +# Maximum packet size including any headers for shared folders using 9p +# See https://forums.lime-technology.com/topic/34691-9p-sharing-speed-not-what-i-expected/ +# https://github.com/clearcontainers/hyperstart/pull/25 +#shared_folders_msize="524288" + +# Shared folders caching +# See https://www.kernel.org/doc/Documentation/filesystems/9p.txt +#shared_folders_cache="none" + +# Folder to sync during provisioning in the format "/host/folder1 /guest/folder1,/host/folder2 /guest/folder2[,...]". +# Needs ssh_support set to "y" and a workable SSH connection to the guest. +#provision_rsync="$KVMX_BASE/share/provision/ /usr/local/share/kvmx/provision/" +#provision_rsync="puppet/ /etc/puppet/" + +# Options for provision_rsync +#provision_rsync_opts="--exclude=somefolder" + +# Absolute path for a provision script located inside the guest. +# Needs ssh_support set to "y" and a workable SSH connection to the guest. +#provision_command="sudo apt-get update && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y && sudo apt-get clean" +#provision_command="/usr/local/share/kvmx/provision/debian/development && /etc/puppet/bin/provision && /etc/puppet/bin/deploy" +#provision_command="/usr/local/share/kvmx/provision/debian/development && /etc/puppet/bin/deploy" +#provision_command="/usr/local/share/kvmx/provision/debian/development && /home/$user/code/$VM/bin/custom-provisioner" +#provision_command="/usr/local/share/kvmx/provision/debian/development" +#provision_command="/usr/local/share/kvmx/provision/debian/trashman" +#provision_command="/usr/local/share/kvmx/provision/debian/desktop-basic" +provision_command="/usr/local/share/kvmx/provision/debian/development" +provision_command="$provision_command && /srv/shared/bin/provision && /srv/shared/bin/provision-dict" +provision_command="$provision_command && /srv/shared/bin/provision-host && /srv/shared/bin/provision-docker" + +# Startup command +#startup_command="/path/to/custom/command" +startup_command="hydractl aperiodic-upgrade" + +# Graphics +# See https://wiki.archlinux.org/index.php/QEMU#Graphics +#graphics="-vga std -nographic -vnc :$GUEST_DISPLAY" +graphics="-vga qxl" + +# VNC Client +#vnc_client="xtightvncviewer" +#vnc_client="xvnc4viewer" +#vnc_client="xvncviewer" +#vnc_client="vncviewer" +vnc_client="virt-viewer" + +# SPICE support +spice="1" + +# Set this if you want to attach an spice client when the machine boots. +run_spice_client="0" + +# SPICE client +#spice_client="spicec" +#spice_client="virt-viewer" +spice_client="spicy" + +# Set this if you want to start an xpra session when the machine boots. +run_xpra="0" + +# Set this if you want to start an xephyr session when the machine boots. +run_xephyr="0" + +# Set this if you want kvmx to redimension the guest screen according to host's screen dimension +# Requires ssh_support and xrandr installed on both host and guest +xrandr="0" + +# Xrandr device +#xrandr_device="qxl-0" +#xrandr_device="Virtual-0" + +# Set screen resolution +#resolution="1280x785" + +# Sound +#sound="0" +#sound="ac97" + +# Set additional hostfwd mappings +#port_mapping="hostfwd=tcp:127.0.0.1:8080-:80,hostfwd=tcp:127.0.0.1:8443-:443" +port_mapping="hostfwd=tcp:127.0.0.1:9000-:80" + +# Where the guest image is stored +#image="$HOME/.local/share/kvmx/$VM/box.img" + +# Use basebox image as a backing file for overlay images +# See https://wiki.archlinux.org/index.php/QEMU#Overlay_storage_images +#backing_file="1" + +# Where datafiles are stored: just set this if you know what you're doing +#datadir="$HOME/.local/share/kvmx/$VM" + +# Drive type: use this if you want to run a Live CD/DVD/USB +#image_drive="cdrom" + +# Image type: file or device (kvmx-create only) +image_type="file" + +# Image size +size="10G" + +# Image format: raw or qcow2 +format="qcow2" + +# Image compression (qcow2 only) +qcow2_compression="1" + +# Bootstrap method: custom or vmdeboostrap +method="custom" + +# Hostname +hostname="bookup" + +# Domain +domain="example.org" + +# System arch +arch="amd64" + +# Box distribution when bootstraping a new image +version="bookworm" + +# Debian mirror +mirror="https://deb.debian.org/debian/" + +# Memory +memory="2048" + +# Enables remote administration using SSH. With this configuration enabled, +# kvmx will be able to administer a running virtual machine using SSH access +# inside the virtual machine. +ssh_support="y" + +# Use a custom, per-virtual-machine generated SSH keypair. If you disable this +# configuration but still want guest administration using SSH, the default +# insecure keypair will be used. +# +# Please note that this setting won't take effect if you're using a basebox. +# In that case the basebox keypair will be used if it exists, otherwise kvmx +# fallsback to the default insecure keypair. +# +# This setting is used during virtual machine bootstrapping by kvmx-create. +ssh_custom="y" + +# Use this config if you want kvmx-create to include a specif SSH pubkey +# It might be a path for an existing pubkey file or the public key itself. +# +# Make sure to have this key available when trying to SSH into the guest using kvmx +#ssh_custom_pubkey="/home/myhostuser/.ssh/id_rsa.pub" +#ssh_custom_pubkey="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDVFmJ2UDn2dK3nHHAkHzt8F4AfrXTFiGa+guem92S/pztMGAUDjEZBYEW3mZ8ATyo4GoPZ92tkjmra0Fgv6ETIox+SPWbzzjhzbv2CQUTWvF6PEVwJbT1PTzaIVRiDYf+yX7e3Y8HcmkAi60Cxs5Xr3HLkqdi2jYKFofCm58R+HGnRv1WSurPnf7C7KQBSW7E1S2CafW9VFHhGCzezyThjN+n3bJjgYFzPxdTlWyfW1T7Yv61/fqfuara0kpZx1l5pblpgbCTT7WKRIhwj1x0QTo/qDQ6k52tffiCVyMGJKvires9yp5qT5Y+ldssBKDa8muRF/dh7/UCyxvcm3HTDjWG24Sr4r9JWbhkqF89UePlOw5j73qw4gzT7YQ38tzz2XI5weAL1OXM6qhCbOwfPXwYbB5xM4g62WZugtcCLan6Iy8hvoiRIJ1MU2ar73wunghQQ84oNIrEVezJsuZxwxVbe45ulnM7x4Hqeu6jmOutWFkdkAHsqd1E3zTOS1RURwi0TpnD+iWwD7FOA9c8B6AWP4i9XVW6BLi1waARrS3bVnOh3djc20fVsClfEDDXFg2KiTeQaAWfjLguyUmxysSiUC2pnibd1bEDtdfPlkA2jaE2nAn6Tw7Vp5zd8P1d1trLMx3YkRq5uQSPqnfQDKoYH5FPMlNTbMINLC56ijw== user@kvmx" + +# Bootloader (used only during bootstrapping by kvmx-create). +bootloader="grub" + +# Drive interface +#drive_interface="ide" # Needed by some systems like NetBSD and FreeBSD +#drive_interface="virtio,cache=none,index=0,format=raw" # For raw devices + +# See http://www.reactos.org/wiki/QEMU#Setting_up_network +#nic_model="ne2k_pci" + +# Additional qemu opts +# Example: http://www.linux-kvm.org/page/USB_Host_Device_Assigned_to_Guest +#qemu_opts="-usb -device usb-host,hostbus=2,hostaddr=3" + +# Number of CPUs +#smp="4" + +# Enviroment passed to SSH commands +#ssh_env="TERM=xterm" + +# Whether to be managed by kvmx-supervise +#supervise_manage="1" diff --git a/structure/00-header.tex b/structure/00-header.tex new file mode 100644 index 0000000..48b7150 --- /dev/null +++ b/structure/00-header.tex @@ -0,0 +1,81 @@ +% Bookdown LaTeX header file + +% Inclusion of external PDF documents (such as a cover image) +% See https://www.ctan.org/pkg/pdfpages +\usepackage{pdfpages} + +% To properly handle URLs in bibliographies +% See https://tex.stackexchange.com/questions/484176/biblatex-overflowing-url +\usepackage{xurl} + +% PDF bookmarks +% See https://ctan.org/pkg/bookmark +% https://texdoc.org/serve/bookmark.pdf/0 +\usepackage[depth=2]{bookmark} + +% Indexing +% See https://en.wikibooks.org/wiki/LaTeX/Indexing +% https://www.ctan.org/pkg/makeidx +% https://bookdown.org/yihui/bookdown/latex-index.html +%\usepackage{imakeidx} +\usepackage{makeidx} +\makeindex + +% No matter what is said in the docs, this was required +% But maybe because tufte::tufte_book was being used instead of bookdown::tufte_book2 +% So perhaps this is not needed anymore +% See https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#theorems +% https://ctan.math.illinois.edu/macros/latex/contrib/thmtools/doc/thmtools-manual.pdf +\usepackage{amsthm,thmtools} + +% Bookdown docs recommends to not mess with this +% See https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#theorems +%\newtheorem{definition}{Definição}[chapter] +%\newtheorem{hiphotesis}{Hipótese}[chapter] +%\newtheorem{conjecture}{Conjectura}[chapter] +%\newtheorem{demonstration}{Demonstração}[chapter] +%\newtheorem{etimology}{Etimologia}[chapter] + +% Fix positions of margin notes +% See https://ctan.org/pkg/marginfix +% https://tex.stackexchange.com/questions/119726/horizontal-margins-for-margin-notes-in-the-tufte-classes +% https://tex.stackexchange.com/questions/624033/long-sidenotes-break-marginfix-or-how-to-make-breakable-sidenotes +\usepackage{marginfix} + +% Workaround to theorems work correctly +% Maybe this is not needed anymore +% See https://stackoverflow.com/questions/46942352/r-bookdown-document-with-theorem-does-not-render-when-output-file-is-specified +\let\BeginKnitrBlock\begin \let\EndKnitrBlock\end + +% Set page size +% +% This command conflicts with something and gives an error +%\usepackage[paperwidth=6in, paperheight=9in]{geometry} +% +% This command needs tuning for the margins +%\newgeometry{paperwidth=6in, paperheight=9in} +% +% This also needs tuning +% See https://tex.stackexchange.com/questions/201893/change-paper-size-in-tufte-book-class#380699 +%\newgeometry{ +% % showframe, +% paperwidth=6in, +% paperheight=9in, +% left=0.55in, +% right=0.45in, +% top=.5in, +% bottom=.5in, +% marginparsep=0.25in, +% marginparwidth=0.65in, +% includemp, +% includehead, +% % The text width and height are calculated automatically. +%} +% +% This should work, but we're setting this at 00-header.md +%\newgeometry{b5paper} + +% Coverpage and copyright notice before title in R bookdown +% See https://stackoverflow.com/questions/45963505/coverpage-and-copyright-notice-before-title-in-r-bookdown +\let\oldmaketitle\maketitle +\AtBeginDocument{\let\maketitle\relax} diff --git a/structure/00-header.yml b/structure/00-header.yml new file mode 100644 index 0000000..2ad19fe --- /dev/null +++ b/structure/00-header.yml @@ -0,0 +1,45 @@ +# Bookdown YAML header +# See https://bookdown.org/yihui/bookdown/usage.html#usage +# https://bookdown.org/yihui/bookdown/yaml-options.html + +# Site +site: "bookdown::bookdown_site" + +# Automatically generate the list of tables and figures +# These can also be explicitly generated using LaTeX commands +lot: false +lof: false + +# Cover image +#cover-image: "images/cover.png" + +# Fonts +mainfont: "Linux Libertine O" +monofont: "Liberation Mono" + +# Paper size +#papersize: a4paper +#papersize: letterpaper +papersize: b5paper + +# Geometry +#geometry: paperwidth=6in,paperheight=9in + +# Class option +# Use "symmetric" in the classoption if you want margin notes in alternating sides +#classoption: "symmetric,justified" +#classoption: "twoside,symmetric,justified" +classoption: "justified" + +# Header includes +header-includes: + # Support for deeply nested lists + # See https://stackoverflow.com/questions/57945414/too-deeply-nested-at-just-fourth-nesting-level-using-pandoc-with-markdown + - \usepackage{enumitem} + - \setlistdepth{20} + - \renewlist{itemize}{itemize}{20} + - \renewlist{enumerate}{enumerate}{20} + - \setlist[itemize]{label=$\cdot$} + - \setlist[itemize,1]{label=\textbullet} + - \setlist[itemize,2]{label=--} + - \setlist[itemize,3]{label=*} diff --git a/structure/00-preamble.md b/structure/00-preamble.md new file mode 100644 index 0000000..4ec71c0 --- /dev/null +++ b/structure/00-preamble.md @@ -0,0 +1,53 @@ + + + + + +```{r echo=FALSE, results='asis'} +if (knitr::is_html_output()) { + cat('# Início {#index .unnumbered}') + cat("\n") + cat('') + cat("\n") + cat("

Sobre

") + cat("\n") + cat('') + cat(readLines('DISCLAIMER'), sep='\n') + cat('') + cat('

') + cat('Livro Vivo - Versão ') + cat(readLines('.metadata/revision.txt'), sep='\n') + cat(' - compilada em ') + cat(readLines('.metadata/date.txt'), sep='\n') + cat('.') + cat('
') + cat('Versões anteriores disponíveis no arquivo.') + cat('

') + cat(readLines('snippets/project.txt')) + cat(' - ') + cat(readLines('snippets/volume.txt')) + cat('
') + cat('Publicado por ') + cat(rmarkdown::metadata$publisher) + cat('
') + cat('Publicado em ') + cat(readLines('snippets/url.txt'), sep='\n') + cat('

') + cat(readLines('snippets/keywords.txt'), sep='\n') + cat("\n") + cat("

Créditos

") + cat("\n") + cat(paste(rmarkdown::metadata$title, "
", "Copyleft ©", readLines('.metadata/year.txt'), rmarkdown::metadata$author, readLines('.metadata/contact.txt'), sep=' ')) + cat('

') + cat(readLines('LICENSE'), sep='\n') + cat('

') + cat(readLines('snippets/cover.txt'), sep='\n') + cat("

Versão PDF

") + cat("\n") + cat('Baixe a versão PDF aqui, ou navegue abaixo:') + cat("\n") + cat('

') + cat('') + cat('

') +} +``` diff --git a/structure/00-preamble.tex b/structure/00-preamble.tex new file mode 100644 index 0000000..018282a --- /dev/null +++ b/structure/00-preamble.tex @@ -0,0 +1,62 @@ +% Bookdown LaTeX before-body file + +% Front matter +\frontmatter + +% Cover image +% See https://stackoverflow.com/questions/45963505/coverpage-and-copyright-notice-before-title-in-r-bookdown +% https://tex.stackexchange.com/questions/39147/scale-image-to-page-width +% https://stackoverflow.com/questions/1963923/adding-full-page-figures-in-latex-how +% +% Cover image original date: 2022-11-17 +% Cover image original file: IMG_20221117_185524.jpg +\includepdf{images/cover.png} + +% Do not print the default title set in the template +\let\maketitle\oldmaketitle +% Uncomment this to duplicate the book title +% This might also clear the \@title variable +%\maketitle + +% Metadata page +\newpage +\begin{fullwidth} +~\vfill +\thispagestyle{empty} +\setlength{\parindent}{0pt} +\setlength{\parskip}{\baselineskip} +\makeatletter\@title\makeatother + +Copyleft \copyright\ \input{.metadata/year.txt} \thanklessauthor\ \input{.metadata/contact.txt} + +\input{LICENSE} + +\input{snippets/keywords.txt} + +\input{snippets/cover.txt} + +% Some \input statements need to be protected +% See https://texfaq.org/FAQ-extrabrace +% https://www.typeerror.org/docs/latex/_005cprotect +\par\smallcaps{\protect\input{snippets/project.txt} - \protect\input{snippets/volume.txt}} + +\par\smallcaps{Publicado por \thanklesspublisher} + +\par\smallcaps{\protect\input{snippets/url.txt}} + +%\par\textit{Primeira impressão, \input{.metadata/year.txt}} +\par Livro Vivo - Versão \textit{\textbf{\input{.metadata/revision.txt}}} compilada em \textit{\textbf{\input{.metadata/date.txt}}} +\end{fullwidth} + +% Disclaimer +\newpage +\begin{fullwidth} +~\vfill +\thispagestyle{empty} +\setlength{\parindent}{0pt} +\setlength{\parskip}{\baselineskip} +\textit{\input{DISCLAIMER}} +\end{fullwidth} + +% Start the main matter (normal chapters) +\mainmatter diff --git a/structure/99-biblio.md b/structure/99-biblio.md new file mode 100644 index 0000000..c5385cb --- /dev/null +++ b/structure/99-biblio.md @@ -0,0 +1,9 @@ +\backmatter + + + + + +# Bibliografia diff --git a/structure/99-end.tex b/structure/99-end.tex new file mode 100644 index 0000000..f0f592e --- /dev/null +++ b/structure/99-end.tex @@ -0,0 +1,28 @@ +% Bookdown LaTeX footer file + +% Put all indexes in a final chapter +\chapter{Índice} + +%Listas de tabelas, figuras, definições e etimologias. +Listas de tabelas e figuras. + +% Print the list of tables +\listoftables + +% Print the list of figures +\listoffigures + +% Print the list of definitions +% See https://latex.org/forum/viewtopic.php?t=17679 +% https://ctan.org/pkg/thmtools +%\renewcommand\listtheoremname{Lista de Definições} +%\listoftheorems[ignoreall,show={definition}] + +% Print the list of etimologies +% The "proposition" theorem type is allocated for etimologies in this book +% See the _bookdown.yml at the top-level project folder for more information +%\renewcommand\listtheoremname{Lista de Etimologias} +%\listoftheorems[ignoreall,show={proposition}] + +% Print the index +%\printindex diff --git a/templates/references.md b/templates/references.md new file mode 100644 index 0000000..cf028c9 --- /dev/null +++ b/templates/references.md @@ -0,0 +1,8 @@ + +```{r echo=FALSE, results='asis'} +if (knitr::is_html_output()) { + cat("## Referências") + cat("\n") + cat("\n") +} +``` diff --git a/templates/tufte-handout.tex b/templates/tufte-handout.tex new file mode 100644 index 0000000..93dbfce --- /dev/null +++ b/templates/tufte-handout.tex @@ -0,0 +1,232 @@ +\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$} + +% ams +\usepackage{amssymb,amsmath} + +\usepackage{ifxetex,ifluatex} +\usepackage{fixltx2e} % provides \textsubscript +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc} + \usepackage[utf8]{inputenc} +$if(euro)$ + \usepackage{eurosym} +$endif$ +\else % if luatex or xelatex + \makeatletter + \@ifpackageloaded{fontspec}{}{\usepackage{fontspec}} + \makeatother + \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase} + \makeatletter + \@ifpackageloaded{soul}{ + \renewcommand\allcapsspacing[1]{{\addfontfeature{LetterSpace=15}#1}} + \renewcommand\smallcapsspacing[1]{{\addfontfeature{LetterSpace=10}#1}} + }{} + \makeatother +$if(euro)$ + \newcommand{\euro}{€} +$endif$ + +$if(mainfont)$ + \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} +$endif$ +$if(sansfont)$ + \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$} +$endif$ +$if(monofont)$ + \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$} +$endif$ +$if(mathfont)$ + \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} +$endif$ +$if(CJKmainfont)$ + \usepackage{xeCJK} + \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} +$endif$ +\fi + +% graphix +\usepackage{graphicx} +\setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} + +% booktabs +\usepackage{booktabs} + +% url +\usepackage{url} + +% hyperref +\usepackage{hyperref} + +% units. +\usepackage{units} + +$if(lang)$ +\usepackage[$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel} +% get rid of language-specific shorthands (see pandoc #6817): +\let\LanguageShortHands\languageshorthands +\def\languageshorthands#1{} +$endif$ + +$if(numbersections)$ +\setcounter{secnumdepth}{2} +$else$ +\setcounter{secnumdepth}{-1} +$endif$ + +% citations +$if(natbib)$ +\usepackage{natbib} +\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} +$endif$ +$if(biblatex)$ +\usepackage{biblatex} +$for(bibliography)$ +\addbibresource{$bibliography$} +$endfor$ +$endif$ + +$if(csl-refs)$ +\newlength{\cslhangindent} +\setlength{\cslhangindent}{1.5em} +% For Pandoc 2.8 to 2.11 +\newenvironment{cslreferences}% + {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}% + \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}% + {\par} +% For pandoc 2.11+ using new --citeproc +\newlength{\csllabelwidth} +\setlength{\csllabelwidth}{3em} +\newlength{\cslentryspacingunit} % times entry-spacing +\setlength{\cslentryspacingunit}{\parskip} +\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing + {% don't indent paragraphs + \setlength{\parindent}{0pt} + % turn on hanging indent if param 1 is 1 + \ifodd #1 + \let\oldpar\par + \def\par{\hangindent=\cslhangindent\oldpar} + \fi + % set entry spacing + \setlength{\parskip}{#2\cslentryspacingunit} + }% + {} +\usepackage{calc} +\newcommand{\CSLBlock}[1]{#1\hfill\break} +\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}} +\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}} +\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1} +$endif$ + +% pandoc syntax highlighting +$if(highlighting-macros)$ +$highlighting-macros$ +$endif$ + +% table with pandoc +$if(tables)$ +\usepackage{longtable,booktabs,array} +$if(multirow)$ +\usepackage{multirow} +$endif$ +\usepackage{calc} % for calculating minipage widths +% Correct order of tables after \paragraph or \subparagraph +\usepackage{etoolbox} +\makeatletter +\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{} +\makeatother +% Allow footnotes in longtable head/foot +\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}} +\makesavenoteenv{longtable} +$endif$ + +% multiplecol +\usepackage{multicol} + +% strikeout +\usepackage[normalem]{ulem} + +% morefloats +\usepackage{morefloats} + +$if(ctex)$ +\usepackage{ctexcap} +$endif$ + +% tightlist macro required by pandoc >= 1.14 +\providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + +% title / author / date +$if(title)$ +\title$if(runningheader)$[$runningheader$]$endif${$title$} +$endif$ +$if(author)$ +\author{$for(author)$$author$$sep$ \and $endfor$} +$endif$ +$if(date)$ +\date{$date$} +$else$ +\date{} +$endif$ + +$for(header-includes)$ +$header-includes$ +$endfor$ + +\begin{document} + +$if(title)$ +\maketitle +$endif$ + +$if(abstract)$ +\begin{abstract} +\noindent $abstract$ +\end{abstract} +$endif$ + +$for(include-before)$ +$include-before$ +$endfor$ + +$if(toc)$ +{ +$if(colorlinks)$ +\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$black$endif$} +$endif$ +\setcounter{tocdepth}{$toc-depth$} +\tableofcontents +} +$endif$ +$if(lot)$ +\listoftables +$endif$ +$if(lof)$ +\listoffigures +$endif$ + +$body$ + +$if(natbib)$ +$if(bibliography)$ +$if(biblio-title)$ +$if(book-class)$ +\renewcommand\bibname{$biblio-title$} +$else$ +\renewcommand\refname{$biblio-title$} +$endif$ +$endif$ +\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$} + +$endif$ +$endif$ +$if(biblatex)$ +\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ + +$endif$ + +$for(include-after)$ +$include-after$ +$endfor$ + +\end{document} diff --git a/vendor/Fuse.js b/vendor/Fuse.js new file mode 160000 index 0000000..43eebfa --- /dev/null +++ b/vendor/Fuse.js @@ -0,0 +1 @@ +Subproject commit 43eebfaa35917217848958e0ccc811ca07026737 -- cgit v1.2.3