implement tex base from template with basic styling and i11n.

This commit is contained in:
Dmitry Voronin 2023-07-31 04:30:43 +03:00
commit 3e11b1ad93
9 changed files with 168 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build/*

30
Makefile Normal file
View file

@ -0,0 +1,30 @@
build = $(CURDIR)/build
src = $(CURDIR)/main.tex
target = $(build)/main.pdf
targetru = $(build)/voronind_ru.pdf
targeten = $(build)/voronind_en.pdf
.PHONY: all
all: clean ru en view
.PHONY: clean
clean:
@rm -rf $(build)
.PHONY: en
en:
@mkdir -p $(build);\
export RESUME_LANG=en;\
lualatex --output-dir=$(build) $(src);\
mv $(target) $(targeten)
.PHONY: ru
ru:
@mkdir -p $(build);\
export RESUME_LANG=ru;\
lualatex --output-dir=$(build) $(src);\
mv $(target) $(targetru)
.PHONY: view
view:
@gio open $(targeten) $(targetru)

0
const.tex Normal file
View file

65
i11n.tex Normal file
View file

@ -0,0 +1,65 @@
% language switches.
\newif\ifen
\newif\ifru
\newcommand{\en}[1]{\ifen#1\fi}
\newcommand{\ru}[1]{\ifru#1\fi}
% language detection.
\def\liten{en} % english literal.
\def\litru{ru} % russian literal.
\def\litnil{} % empty literal.
\getenv[\lang]{RESUME_LANG} % read shell variable.
\ifdefequal{\lang}{\liten}{\entrue}{} % use english.
\ifdefequal{\lang}{\litru}{\rutrue}{} % use russian.
\ifdefequal{\lang}{\litnil}{\entrue}{} % use english by default.
% months.
\newcommand{\jan}{
\en{January}
\ru{январь}
}
\newcommand{\feb}{
\en{February}
\ru{февраль}
}
\newcommand{\mar}{
\en{March}
\ru{март}
}
\newcommand{\apr}{
\en{April}
\ru{апрель}
}
\newcommand{\may}{
\en{May}
\ru{май}
}
\newcommand{\jun}{
\en{June}
\ru{июнь}
}
\newcommand{\jul}{
\en{July}
\ru{июль}
}
\newcommand{\aug}{
\en{August}
\ru{август}
}
\newcommand{\sep}{
\en{September}
\ru{сентябрь}
}
\newcommand{\oct}{
\en{October}
\ru{октябрь}
}
\newcommand{\nov}{
\en{November}
\ru{ноябрь}
}
\newcommand{\dec}{
\en{December}
\ru{декабрь}
}

BIN
image/photo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

46
main.tex Normal file
View file

@ -0,0 +1,46 @@
\documentclass{article} % basic document class (template).
\usepackage[T2A,T1]{fontenc} % specify font encodings.
\usepackage[utf8]{inputenc} % specify input file encodings.
\usepackage[bidi=default]{babel} % use babel for i11n.
\usepackage{graphicx} % image support.
\usepackage{xcolor} % colored text support.
\usepackage{montserrat} % custom font.
\usepackage{hyperref} % hyperlinks.
\usepackage{indentfirst} % auto indent for paragraphs.
\usepackage{luacode} % lua scripts support.
% configure geometry.
\usepackage[
a4paper,
left = 0.50in,
right = 0.50in,
top = 0.5in,
bottom = 0.5in
]{geometry}
\input{shell} % import shell support.
\input{style} % import common styles.
\input{const} % import constant values.
% configure hyperlinks.
\hypersetup{
linktocpage = true,
colorlinks = true,
hidelinks = true,
linktoc = all
}
\graphicspath{ {./image} } % specify where images are stored.
\babelprovide[import]{russian} % add russian support.
\babelfont{rm}{montserrat} % use custom serif font for english.
\babelfont{sf}{montserrat} % use custom sans font for english.
\babelfont{tt}{montserrat} % use custom mono font for english.
\babelfont[russian]{rm}{montserrat} % use custom serif font for russian.
\babelfont[russian]{sf}{montserrat} % use custom sans font for russian.
\babelfont[russian]{tt}{montserrat} % use custom mono font for russian.
\begin{document}
\input{i11n} % import internationalization support.
\input{page/title} % import title.
\end{document}

6
page/title.tex Normal file
View file

@ -0,0 +1,6 @@
\slink{https://example.com/}{\sbold{\stext{\jan}}}\spar
\stext{
\en{Hello world!}
\ru{Привет, мир!}
}
\includegraphics[width=5cm]{photo}

5
shell.tex Normal file
View file

@ -0,0 +1,5 @@
% \getenv[\HOME]{HOME} % example: store $HOME shell var into \HOME cmd.
\usepackage{catchfile}
\newcommand{\getenv}[2][]{%
\CatchFileEdef{\temp}{"|kpsewhich --var-value #2"}{\endlinechar=-1}%
\if\relax\detokenize{#1}\relax\temp\else\let#1\temp\fi}

15
style.tex Normal file
View file

@ -0,0 +1,15 @@
% settings.
\linespread{1.5} % height between non-breaking lines.
\sloppy % correct word placement on newline.
% colors.
\definecolor{white}{RGB}{255,255,255} % default white color.
\definecolor{link}{RGB}{46,116,181} % web link color.
% styles.
\newcommand{\spar}[0]{\par\vspace{2mm}} % default paragraph break.
\newcommand{\stext}[1]{\fontsize{14}{7}{\selectfont{#1}}} % default text.
\newcommand{\sitallic}[1]{\textit{#1}} % itallic text.
\newcommand{\sbold}[1]{\textbf{#1}} % bold text.
\newcommand{\sunderline}[1]{\underline{#1}} % underline text.
\newcommand{\slink}[2]{\href{#1}{\textcolor{link}{\sunderline{#2}}}} % link webpage.