Skip to content

Commit

Permalink
replace everything to use markdown as input to generate pdf
Browse files Browse the repository at this point in the history
Signed-off-by: Luiz Oliveira <[email protected]>
  • Loading branch information
Ziul committed Aug 2, 2024
1 parent 700a9f3 commit 059588e
Show file tree
Hide file tree
Showing 27 changed files with 2,663 additions and 1,345 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/latex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: LaTeX Build

on:
push:
paths:
- "*.tex"
- "*.ttf"
- ".github/workflows/*"
- "*.md"
- "**/*.md"

jobs:
build:
runs-on: ubuntu-latest
container: thomasweise/docker-texlive-full

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install TexLive and other dependencies
run: |
apt-get update -qq
# apt-get install -y texlive-full
apt-get install -y latexmk pandoc
- name: Copy fonts and update font cache
run: |
cp -v *.ttf /usr/local/share/fonts
fc-cache -fv
- name: Build LaTeX files
run: |
make convert
make
- id: commit
uses: prompt/actions-commit-hash@v3
- name: Upload PDF artifacts
uses: actions/upload-artifact@v2
with:
name: pdf-files
path: |
*.pdf
- name: Release
uses: softprops/action-gh-release@v2 # in the future, try ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.commit.outputs.short }}
name: Release ${{ steps.commit.outputs.short }}
draft: false
prerelease: false
files: |
*.pdf
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ sympy-plots-for-*.tex/

# xindy
*.xdy
conteudo/commit_log.tex
conteudo/commit_log.tex

# temporary tex files
*.tex
Binary file added Fontin-Regular.ttf
Binary file not shown.
68 changes: 68 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

BIBTEX = bibtex
# LATEX = pdflatex
LATEX = xelatex
DVIPS = dvips
PS2PDF = ps2pdf
TEMPLATE = ieee

VERSION = 0.1.0

SOURCES = $(wildcard ./*.*)

NPROCS := 1
OS := $(shell uname)
export NPROCS

ifeq ($J,)

ifeq ($(OS),Linux)
NPROCS := $(shell grep -c ^processor /proc/cpuinfo)
else ifeq ($(OS),Darwin)
# NPROCS := $(shell system_profiler | awk '/Number of CPUs/ {print $$4}{next;}')
NPROCS := 1
endif # $(OS)

else
NPROCS := $J
endif # $J

.PHONY: all clean dist-clean

TEX_FILES := $(shell find . -type f -name "*.tex")
MD_FILES := $(shell find . -type f -name "*.md" | grep -v "README.md")

all: convert
@echo "Using" $(NPROCS) "jobs"
@for file in $(TEX_FILES); do \
echo "Processing $$file"; \
latexmk -xelatex $$file; \
done
@for file in $(shell find . -type f -name "*.pdf"); do \
echo "----- $$file"; \
pdfinfo $$file; \
done

convert:
@echo files: $(MD_FILES)
@for file in $(MD_FILES); do \
echo "Converting $$file" using $(TEMPLATE); \
output=$${file%.md}.tex; \
pandoc --read=markdown --write=latex --output=testdoc.tex --template=$(TEMPLATE).latex $$file -o $$output --listings --biblatex --csl abnt.csl ; \
done

$(TARGET): $(MAIN_FILE) $(SOURCES)
$(MAKE) clean
$(LATEX) $(MAIN_FILE)
$(LATEX) -interaction=batchmode $(MAIN_FILE)
@mv $(PDF_FILE) $(TARGET)

clean:
rm -rf *~ *.dvi *.ps *.backup *.aux *.log *.out *.xdv *.fls *.fdb_latexmk
rm -f *.lof *.lot *.bbl *.blg *.brf *.toc *.idx *.lol *.bcf *.xml

install:
apt update -qq
apt install -y pandoc pandoc-citeproc latexmk
cp -v *.ttf /usr/local/share/fonts
fc-cache -fv
Binary file added Optima.ttf
Binary file not shown.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ Dependências:
- texlive-publishers
- texlive-fonts-recommended
- texlive-generic-recommended
- texlive-lang-german
Loading

0 comments on commit 059588e

Please sign in to comment.