diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9a7fb34 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,39 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false +insert_final_newline = false + +[*.nix] +indent_style = space +indent_size = 2 + +# Match diffs, avoid to trim trailing whitespace +[*.{diff,patch}] +trim_trailing_whitespace = false + +[*.{vim,sh,bats}] +indent_style = space +indent_size = 4 +max_line_length = 80 + +[*.{yml,json}] +indent_style = space +indent_size = 2 + +[Makefile] +indent_style = tab + +[*.{mk}] +indent_style = tab + +[*.tex] +indent_style = space +indent_size = 2 + diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..a6ee435 --- /dev/null +++ b/.envrc @@ -0,0 +1,5 @@ +# shellcheck shell=bash +if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=" +fi +use flake diff --git a/.gitignore b/.gitignore index 38e66a8..8e3aae1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +/.direnv +/outputs +/result + ### TeX ### ## Core latex/pdflatex auxiliary files: *.aux diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..a0f69f8 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,13 @@ +{ + "recommendations": [ + "editorconfig.editorconfig", + "mhutchie.git-graph", + "donjayamanne.githistory", + "codezombiech.gitignore", + "waderyan.gitblame", + "gruntfuggly.todo-tree", + "bbenoist.nix", + "ms-vscode.makefile-tools", + "tomoki1207.pdf" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e26d2d4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editorconfig.generateAuto": false +} diff --git a/LICENCE b/LICENSE similarity index 100% rename from LICENCE rename to LICENSE diff --git a/Makefile b/Makefile index ae1a12a..71f232b 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,174 @@ +.DEFAULT_GOAL := all +.SHELLFLAGS := -e -c +SHELL := $(shell command -v sh) + +## Enviroment overridable variables +out ?= $(CURDIR)/outputs +src ?= $(CURDIR) + +CURDIR ?= {PWD} +VERBOSE ?= 1 +FORCE ?= 0 +LANG ?= C.UTF-8 +XETEX ?= xelatex + +### Installation paths +DOCDIR ?= share/doc/awesome-cv +EXAMPLEDIR ?= $(addsuffix /examples,$(DOCDIR)) +DESTDIR ?= /usr/local + +## Commandline overridable +SRC = $(src) +OUT = $(out) + +### Internal variables +examples_dir = $(src)/examples + +coverletter_dir = $(examples_dir) +coverletter_srcs = +coverletter_srcs += $(coverletter_dir)/coverletter.tex +coverletter_srcs += $(src)/awesome-cv.cls +coverletter_deps = $(patsubst $(src)/%,$(out)/%,$(coverletter_srcs)) + +resume_dir = $(examples_dir)/resume +resume_srcs = +resume_srcs += $(shell find "$(resume_dir)" -name "*.tex") +resume_srcs += $(src)/awesome-cv.cls +resume_deps = $(patsubst $(src)/%,$(out)/%,$(resume_srcs)) + +cv_dir = $(examples_dir)/cv +cv_srcs = +cv_srcs += $(shell find "$(cv_dir)" -name "*.tex") +cv_srcs += $(src)/awesome-cv.cls +cv_deps = $(patsubst $(src)/%,$(out)/%,$(cv_srcs)) + +out_dirs = $(sort $(dir \ +$(coverletter_deps) \ +$(resume_deps) \ +$(cv_deps) \ +)) + +install_dest_dir = $(addsuffix /,$(DESTDIR)) +install_doc_dir = $(addprefix $(install_dest_dir),$(DOCDIR)) +install_example_dir = $(addprefix $(install_dest_dir),$(EXAMPLEDIR)) + +force = +ifneq ($(strip $(filter-out 0,$(FORCE))),) +force = .force_non_existing +endif + +silent = +ifeq ($(strip $(filter-out 0,$(VERBOSE))),) +silent = @ +endif + +## Resolve lazy variables +force := $(force) +silent := $(silent) +src := $(SRC) +out := $(OUT) +out_dirs := $(out_dirs) +install_dest_dir := $(install_dest_dir) +install_doc_dir := $(install_doc_dir) +install_example_dir := $(install_example_dir) + +## Sentinel checks +ifeq ($(strip $(out)),) +$(error Output directory should be set to a value (OUT=)) +endif +ifeq ($(strip $(src)),) +$(error Source directory should be set to a value (SRC=)) +endif +ifeq ($(realpath $(out)),$(realpath $(src))) +$(error Output directory should not point to source tree (OUT <=> SRC='$(src)')) +endif + +## (Re-)Exported variables +export LANG + +.DELETE_ON_ERROR: + +.ONE_SHELL: + +.SUFFIXES: + .PHONY: examples +examples: \ +$(out)/examples/coverletter.pdf \ +$(out)/examples/cv.pdf \ +$(out)/examples/resume.pdf -CC = xelatex -EXAMPLES_DIR = examples -RESUME_DIR = examples/resume -CV_DIR = examples/cv -RESUME_SRCS = $(shell find $(RESUME_DIR) -name '*.tex') -CV_SRCS = $(shell find $(CV_DIR) -name '*.tex') +$(out)/%/resume.pdf: $(out)/%/resume.tex $(resume_deps) $(force) $(MAKEFILE_LIST) | $(out_dirs) + $(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" 0<&- -examples: $(foreach x, coverletter cv resume, $x.pdf) +$(out)/%/cv.pdf: $(out)/%/cv.tex $(cv_deps) $(force) $(MAKEFILE_LIST) | $(out_dirs) + $(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" 0<&- -resume.pdf: $(EXAMPLES_DIR)/resume.tex $(RESUME_SRCS) - $(CC) -output-directory=$(EXAMPLES_DIR) $< +$(out)/%/coverletter.pdf: $(out)/%/coverletter.tex $(coverletter_deps) $(force) $(MAKEFILE_LIST) | $(out_dirs) + $(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" 0<&- -cv.pdf: $(EXAMPLES_DIR)/cv.tex $(CV_SRCS) - $(CC) -output-directory=$(EXAMPLES_DIR) $< +$(out)/%.cls : $(src)/%.cls | $(out_dirs) + $(silent)ln -sf "$<" "$@" -coverletter.pdf: $(EXAMPLES_DIR)/coverletter.tex - $(CC) -output-directory=$(EXAMPLES_DIR) $< +$(out)/%.tex : $(src)/%.tex | $(out_dirs) + $(silent)ln -sf "$<" "$@" +$(out_dirs): + $(silent)mkdir -p "$@" + +$(force): ; + +.PHONY: pdf +pdf: examples + +.PHONY: all +all: pdf + +.PHONY: clean clean: - rm -rf $(EXAMPLES_DIR)/*.pdf + $(silent)rm -rf "$(out)" + +.PHONY: println-% +println-%: + @printf -- '%s\n' "$*" 1>&2 + @printf -- '%s\n' $(foreach v,$($*),"$(v)") + +.PHONY: install +install: all + $(silent)install -d "$(install_doc_dir)" + $(silent)install -d "$(install_example_dir)" + $(silent)install -m 644 $(out)/examples/*.pdf "$(install_example_dir)/" + $(silent)install -m 644 $(src)/README.md "$(install_doc_dir)/" + $(silent)install -m 644 $(src)/LICENSE "$(install_doc_dir)/" + $(silent)install -m 644 $(out)/awesome-cv.cls "$(install_doc_dir)/" + +.PHONY: uninstall +uninstall: + $(silent)rm -rf "$(install_doc_dir)" "$(install_example_dir)" + +.PHONY: help +help: + @{ \ + echo "Usage: make [target] [VARIABLE=value]"; \ + echo "Available targets:"; \ + echo " all - Build all examples (default)"; \ + echo " pdf - Build PDF files"; \ + echo " examples - Build all example PDFs"; \ + echo " clean - Clean output directory"; \ + echo " install - Install the documentation and examples"; \ + echo " uninstall - Uninstall the documentation and examples"; \ + echo " help - Show this help message"; \ + echo ""; \ + echo "Overridable variables:"; \ + echo " OUT - Output directory (default: outputs)"; \ + echo " SRC - Source directory (default: current directory)"; \ + echo " VERBOSE - Verbosity level (0 for silent, default: 1)"; \ + echo " FORCE - Force rebuild (0 for no, default: 0)"; \ + echo " LANG - Language setting for LaTeX (default: C.UTF-8)"; \ + echo " XETEX - LaTeX engine to use (default: xelatex)"; \ + echo ""; \ + echo "Example usage:"; \ + echo " make pdf OUT=outputs SRC=src VERBOSE=1 FORCE=1"; \ + echo " make install DESTDIR=/usr/local"; \ + echo " make uninstall DESTDIR=/usr/local"; \ + } diff --git a/awesome-cv.cls b/awesome-cv.cls index 5feebdf..3301a69 100644 --- a/awesome-cv.cls +++ b/awesome-cv.cls @@ -105,7 +105,19 @@ %------------------------------------------------------------------------------- %% Page Layout % Configure page margins with geometry -\geometry{left=2.0cm, top=1.5cm, right=2.0cm, bottom=2.0cm, footskip=.5cm} +\geometry{ + paper=a4paper, + top=1.5cm, + bottom=2cm, + left=2cm, + right=2cm, + headheight=12pt, + footskip=.5cm, + includehead, + includefoot, + heightrounded, + nomarginpar +} %% Header & Footer % Set offset to each header and footer @@ -426,8 +438,8 @@ \newcommand{\acvHeaderAfterQuoteSkip}{5mm} % Others -\newcommand{\acvSectionTopSkip}{3mm} -\newcommand{\acvSectionContentTopSkip}{2.5mm} +\newcommand{\acvSectionTopSkip}{2.5mm} +\newcommand{\acvSectionContentTopSkip}{2.0mm} %------------------------------------------------------------------------------- @@ -650,7 +662,8 @@ \vspace{\acvSectionTopSkip} \sectionstyle{#1} \phantomsection - \color{sectiondivider}\vhrulefill{0.9pt} + \color{gray}\vhrulefill{0.9pt} + \vspace{\acvSectionContentTopSkip} } % Define a subsection for CV @@ -679,10 +692,11 @@ }{% \end{center} } + % Define an entry of cv information % Usage: \cventry{}{}{<location>}{<date>}{<description>} \newcommand*{\cventry}[5]{% - \vspace{-2.0mm} + \vspace{-1.5mm} \setlength\tabcolsep{0pt} \setlength{\extrarowheight}{0pt} \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} L{\textwidth - 4.5cm} R{4.5cm}} @@ -694,6 +708,7 @@ {} {\multicolumn{2}{L{\textwidth}}{\descriptionstyle{#5}} \\} \end{tabular*}% + \vspace{2mm} % Add space after each entry } % Define an environment for cvsubentry @@ -745,10 +760,11 @@ \begin{center} \setlength\tabcolsep{1ex} \setlength{\extrarowheight}{0pt} - \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} r L{\textwidth * \real{0.9}}} + \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} r L{\textwidth * \real{0.85}}} }{% \end{tabular*} \end{center} + \vspace{1mm} } % Define a line of cv information(skill) % Usage: \cvskill{<type>}{<skillset>} @@ -758,7 +774,7 @@ % Define an environment for cvitems(for cventry) \newenvironment{cvitems}{% - \vspace{-4.0mm} + \vspace{-2mm} \begin{justify} \begin{itemize}[leftmargin=2ex, nosep, noitemsep] \setlength{\parskip}{0pt} @@ -766,7 +782,7 @@ }{% \end{itemize} \end{justify} - \vspace{-4.0mm} + \vspace{1mm} } @@ -782,12 +798,11 @@ % Define a section for the cover letter % Usage: \lettersection{<section-title>} \newcommand{\lettersection}[1]{% - \par\addvspace{2.5ex} + \par\addvspace{2.0ex} \phantomsection{} \lettersectionstyle{#1} - \color{sectiondivider}\vhrulefill{0.9pt} - \par\nobreak\addvspace{0.4ex} - \lettertextstyle + \color{gray}\vhrulefill{0.9pt} + \par\nobreak\addvspace{0.5ex} } % Define a title of the cover letter diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..496816b --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1746061036, + "narHash": "sha256-OxYwCGJf9VJ2KnUO+w/hVJVTjOgscdDg/lPv8Eus07Y=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3afd19146cac33ed242fc0fc87481c67c758a59e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7714d53 --- /dev/null +++ b/flake.nix @@ -0,0 +1,121 @@ +{ + description = "A basic flake with a shell, make and latex support"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + systems.url = "github:nix-systems/default"; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.systems.follows = "systems"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + pname = "awesome-cv"; + + tex = pkgs.texlive.combine { + inherit (pkgs.texlive.pkgs) + xetex + xetexref + scheme-minimal + mathtools + enumitem + ragged2e + geometry + fancyhdr + xcolor + ifmtarg + xkeyval + tikzfill + xifthen + xstring + etoolbox + setspace + fontspec + unicode-math + fontawesome5 + roboto + sourcesanspro + tcolorbox + parskip + hyperref + bookmark + ; + }; + + src = ./.; + nativeBuildInputs = with pkgs; [ + coreutils + bashInteractive + gnumake + tex + line-awesome + fontconfig + poppler-utils # for pdffonts + ]; + buildInputs = with pkgs; [ ]; + + systemfontdirs = with pkgs; map toString [ + line-awesome + ]; + + # used by xetex and mtx-fonts (context) + generatedFontsConf = pkgs.makeFontsConf { + fontDirectories = systemfontdirs ++ [ tex.fonts ]; + }; + + customFontConf = pkgs.writeText "custom-fonts.conf" '' + <?xml version="1.0"?> + <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> + <fontconfig/> + ''; + + fontsConf = pkgs.writeText "fonts.conf" '' + <?xml version="1.0"?> + <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> + <fontconfig> + <include>${customFontConf}</include> + <include>${generatedFontsConf}</include> + <include ignore_missing="yes">/etc/fonts/fonts.conf</include> + </fontconfig> + ''; + + FONTCONFIG_FILE = fontsConf; + in + { + devShells.default = pkgs.mkShellNoCC { + inherit buildInputs nativeBuildInputs FONTCONFIG_FILE; + }; + + packages.default = pkgs.stdenvNoCC.mkDerivation { + inherit pname; + version = "1.0.0"; + inherit src nativeBuildInputs buildInputs FONTCONFIG_FILE; + + buildPhase = '' + make all OUT=. VERBOSE=1 + ''; + + installPhase = '' + make install \ + DESTDIR=$out \ + DOCDIR="share/doc/${pname}" \ + EXAMPLEDIR="share/doc/${pname}/examples" \ + OUT=. \ + VERBOSE=1 + ''; + + meta = with pkgs.lib; { + description = "Awesome LaTeX CV and resume class"; + homepage = "https://github.com/posquit0/Awesome-CV"; + license = licenses.lppl13c; + platforms = platforms.all; + maintainers = []; + }; + }; + } + ); +}