From 5c59396e5dc9b2713f8aa6369d489cc90e35c9b2 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 18 Apr 2024 18:13:43 +0200 Subject: [PATCH] latex: book --- README.md | 17 ++++++++++ latex/book/.gitignore | 8 +++++ latex/book/Makefile | 18 +++++++++++ latex/book/book.tex | 53 ++++++++++++++++++++++++++++++++ latex/book/sections/section1.tex | 7 +++++ latex/book/sections/section2.tex | 7 +++++ latex/book/sections/section3.tex | 7 +++++ latex/book/sources.bib | 4 +++ 8 files changed, 121 insertions(+) create mode 100644 latex/book/.gitignore create mode 100644 latex/book/Makefile create mode 100644 latex/book/book.tex create mode 100644 latex/book/sections/section1.tex create mode 100644 latex/book/sections/section2.tex create mode 100644 latex/book/sections/section3.tex create mode 100644 latex/book/sources.bib diff --git a/README.md b/README.md index 6faba8f..2a4b2ca 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ - [LaTeX](#latex) - [Document](#document) - [Presentation](#presentation) + - [Book](#book) - [Python](#python) - [OCaml](#ocaml) - [Rust](#rust) @@ -34,6 +35,8 @@ Copy and paste [`cpp/`](./cpp/) directory, and you should be good to go! ### Document +This is for simple document. + Copy and paste [`latex/document`](./latex/document/) directory, and you should be good to go! @@ -44,6 +47,8 @@ and you should be good to go! ### Presentation +This is for presentations. + Copy and paste [`latex/presentation`](./latex/presentation/) directory, and you should be good to go! @@ -54,6 +59,18 @@ and you should be good to go! > It is by default configured to build `slides.tex` and output `slides.pdf`. > There is a more advanced file with more examples named `slides_advanced.tex`. +### Book + +This is for complex document. + +Copy and paste [`latex/book`](./latex/book/) directory, +and you should be good to go! + +- **Run `make` to compile the document.** +- **Run `make clean` to clean artifacts.** + +> It is by default configured to output `book.pdf`. + ## Python Copy and paste [`python/`](./python/) directory, and you should be good to go! diff --git a/latex/book/.gitignore b/latex/book/.gitignore new file mode 100644 index 0000000..548ee42 --- /dev/null +++ b/latex/book/.gitignore @@ -0,0 +1,8 @@ +* + +!.gitignore +!Makefile +!*.tex +!*.bib + +!sections/ diff --git a/latex/book/Makefile b/latex/book/Makefile new file mode 100644 index 0000000..a0ad4da --- /dev/null +++ b/latex/book/Makefile @@ -0,0 +1,18 @@ +NAME = book + +TEX = $(NAME).tex +SRC = $(TEX) +PDF = $(TEX:.tex=.pdf) + +TEXMK = latexmk -lualatex -shell-escape -interaction=nonstopmode + +.PHONY: $(PDF) + +all: $(PDF) + +$(PDF): %.pdf: %.tex + $(TEXMK) $< + +EXTS = aux fdb_latexmk fls log nav out snm synctex.gz toc bbl blg sta +clean: + rm -rf $(PDF) _minted-$(NAME)/ $(foreach ext,$(EXTS),$(NAME).$(ext)) diff --git a/latex/book/book.tex b/latex/book/book.tex new file mode 100644 index 0000000..73a3802 --- /dev/null +++ b/latex/book/book.tex @@ -0,0 +1,53 @@ +\documentclass{article} + +% Files +\usepackage[subpreambles=true]{standalone} +\usepackage{import} + +\usepackage[T1]{fontenc} % encoding +\renewcommand{\familydefault}{\sfdefault} % sans-serif font + +\usepackage[french]{babel} % langages +\frenchsetup{SmallCapsFigTabCaptions=false} + +% Bibliography +\bibliographystyle{unsrt} +\nocite{*} + +% Metadata +\def\docTitle{Title} +\def\docAuthor{Author} + +% Dependencies +\usepackage[ + pdfauthor={\docAuthor}, + pdftitle={\docTitle}, + hidelinks, +]{hyperref} + + +\title{\docTitle} +\author{\docAuthor} +\date{} + +\begin{document} + +\maketitle +\flushbottom +\tableofcontents +\clearpage + +\section{First section} +\import{sections/}{section1} + +\section{Second section} +\import{sections/}{section2} + +\section{Third section} +\import{sections/}{section3} + +\clearpage +\appendix +\bibliography{sources} + +\end{document} diff --git a/latex/book/sections/section1.tex b/latex/book/sections/section1.tex new file mode 100644 index 0000000..c8f1bba --- /dev/null +++ b/latex/book/sections/section1.tex @@ -0,0 +1,7 @@ +\documentclass[class=article]{standalone} + +\begin{document} + +Here is the first section. + +\end{document} diff --git a/latex/book/sections/section2.tex b/latex/book/sections/section2.tex new file mode 100644 index 0000000..98c05e2 --- /dev/null +++ b/latex/book/sections/section2.tex @@ -0,0 +1,7 @@ +\documentclass[class=article]{standalone} + +\begin{document} + +Here is the second section. + +\end{document} diff --git a/latex/book/sections/section3.tex b/latex/book/sections/section3.tex new file mode 100644 index 0000000..fa956db --- /dev/null +++ b/latex/book/sections/section3.tex @@ -0,0 +1,7 @@ +\documentclass[class=article]{standalone} + +\begin{document} + +Here is the third section. + +\end{document} diff --git a/latex/book/sources.bib b/latex/book/sources.bib new file mode 100644 index 0000000..e6b349b --- /dev/null +++ b/latex/book/sources.bib @@ -0,0 +1,4 @@ +@misc{example, + author = {John Doe}, + howpublished = {\url{https://example.com}} +}