diff --git a/.gitignore b/.gitignore index 5ba28ae..7d3a145 100644 --- a/.gitignore +++ b/.gitignore @@ -301,4 +301,5 @@ TSWLatexianTemp* #*Notes.bib *.pdf +!images/**/*.pdf main-diff.tex diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7724994 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +CLEAN = *.aux *.blg *.fdb_latexmk *.fls *.log *.out *.pdf *.synctex.gz *.toc *.dvi main-diff.tex +IMAGE = $(shell find . -name '*.drawio.png') + +MDTOPDF = md-to-pdf +DRAWIO = /Applications/draw.io.app/Contents/MacOS/draw.io + +.PHONY: all +all: main.pdf + +main.pdf: main.tex main.bib $(IMAGE:%.drawio.png=%.pdf) + latexmk -g main.tex + +.PHONY: diff +diff: main-diff.pdf + +main-diff.pdf main-diff.tex: main.tex main.bib + ./script/latexdiff.sh $(VERSION) + @echo VERSION = $(VERSION) + +.PHONY: images +images: $(IMAGE:%.drawio.png=%.pdf) + +%.pdf: %.drawio.png + $(DRAWIO) --export --format pdf --crop -o $@ $^ + +.PHONY: clean/images +clean/images: + - $(RM) $(IMAGE:%.drawio.png=%.pdf) + +.PHONY: clean +clean: + - $(RM) -r $(CLEAN) diff --git a/README.md b/README.md index da44c32..1002d29 100644 --- a/README.md +++ b/README.md @@ -5,17 +5,23 @@ This repository is a template for writing and building documents with LaTeX. Please write documents in `main.tex`. If you want to use bibtex, you can write references in `main.bib`. +### images +You can use draw.io to create images. +First, please install draw.io desktop app from [here](https://github.com/jgraph/drawio-desktop/releases). +Next, please update `DRAWIO` in `Makefile` to the path of draw.io desktop app. +You can create `images/.drawio.png` and run `make images` to generate `images/.pdf`. + ### latexdiff You can check diff with latexdiff. When you run below command, `main-diff.pdf` will be built. ``` -./script/latexdiff.sh +make main-diff.pdf ``` ## Outputs ### local -You can see `main.pdf` by running command `latexmk`. +You can see `main.pdf` by running command `make`. ### remote This repository builds PDF with GitHub Action and [container-texlive](https://github.com/hiroyaonoe/container-texlive). diff --git a/images/example.drawio.png b/images/example.drawio.png new file mode 100644 index 0000000..cdc96c4 Binary files /dev/null and b/images/example.drawio.png differ diff --git a/images/example.pdf b/images/example.pdf new file mode 100644 index 0000000..c0b4168 Binary files /dev/null and b/images/example.pdf differ diff --git a/main.tex b/main.tex index 9d57e06..b2ebab6 100644 --- a/main.tex +++ b/main.tex @@ -1,5 +1,7 @@ \documentclass[a4paper,11pt,uplatex,dvipdfmx]{article} +\usepackage{graphicx} + \begin{document} \title{LaTeX Template} @@ -9,6 +11,13 @@ This repository is a template for writing and building documents with LaTeX. Please see README.md\cite{latex-template} for the usage. +\begin{figure}[htb] + \centering + \includegraphics[keepaspectratio, width=\hsize]{images/example.pdf} + \caption{example image} + \label{fig: example} +\end{figure} + \bibliography{main} \bibliographystyle{unsrt} \end{document}