latex: book

This commit is contained in:
Mylloon 2024-04-18 18:13:43 +02:00
parent 8acc6e91d1
commit 5c59396e5d
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
8 changed files with 121 additions and 0 deletions

View file

@ -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!

8
latex/book/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
*
!.gitignore
!Makefile
!*.tex
!*.bib
!sections/

18
latex/book/Makefile Normal file
View file

@ -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))

53
latex/book/book.tex Normal file
View file

@ -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}

View file

@ -0,0 +1,7 @@
\documentclass[class=article]{standalone}
\begin{document}
Here is the first section.
\end{document}

View file

@ -0,0 +1,7 @@
\documentclass[class=article]{standalone}
\begin{document}
Here is the second section.
\end{document}

View file

@ -0,0 +1,7 @@
\documentclass[class=article]{standalone}
\begin{document}
Here is the third section.
\end{document}

4
latex/book/sources.bib Normal file
View file

@ -0,0 +1,4 @@
@misc{example,
author = {John Doe},
howpublished = {\url{https://example.com}}
}