commit 3e11b1ad93f563f4646d1ac70a1899ab7f0493ba Author: Dmitry Voronin Date: Mon Jul 31 04:30:43 2023 +0300 implement tex base from template with basic styling and i11n. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a007fea --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d31b51d --- /dev/null +++ b/Makefile @@ -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) diff --git a/const.tex b/const.tex new file mode 100644 index 0000000..e69de29 diff --git a/i11n.tex b/i11n.tex new file mode 100644 index 0000000..5e3ad30 --- /dev/null +++ b/i11n.tex @@ -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{декабрь} +} diff --git a/image/photo.jpg b/image/photo.jpg new file mode 100644 index 0000000..3043d98 Binary files /dev/null and b/image/photo.jpg differ diff --git a/main.tex b/main.tex new file mode 100644 index 0000000..88450f5 --- /dev/null +++ b/main.tex @@ -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} diff --git a/page/title.tex b/page/title.tex new file mode 100644 index 0000000..23303d1 --- /dev/null +++ b/page/title.tex @@ -0,0 +1,6 @@ +\slink{https://example.com/}{\sbold{\stext{\jan}}}\spar +\stext{ + \en{Hello world!} + \ru{Привет, мир!} +} +\includegraphics[width=5cm]{photo} diff --git a/shell.tex b/shell.tex new file mode 100644 index 0000000..7eea382 --- /dev/null +++ b/shell.tex @@ -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} diff --git a/style.tex b/style.tex new file mode 100644 index 0000000..01beb53 --- /dev/null +++ b/style.tex @@ -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.