-
Notifications
You must be signed in to change notification settings - Fork 0
/
preamble.tex
92 lines (85 loc) · 3.89 KB
/
preamble.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
%
% Copyright 2016 Erint Labs OÜ
%
% Licensed under the EUPL, Version 1.1 or – as soon they
% will be approved by the European Commission - subsequent
% versions of the EUPL (the "Licence");
% You may not use this work except in compliance with the
% Licence.
% You may obtain a copy of the Licence at:
%
% https://joinup.ec.europa.eu/software/page/eupl
%
% Unless required by applicable law or agreed to in
% writing, software distributed under the Licence is
% distributed on an "AS IS" basis,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
% express or implied.
% See the Licence for the specific language governing
% permissions and limitations under the Licence.
%
\documentclass[a4paper]{article}
\usepackage[landscape,top=1cm, bottom=1.5cm, left=1cm, right=1cm]{geometry}
% TODO: non XeLaTeX compliation support
\usepackage[colorlinks]{hyperref}
\usepackage{paracol}
\usepackage{fancyref}
\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{ifthen}
\usepackage{multirow}
\usepackage{xunicode}
\usepackage{indentfirst}
\usepackage[firstpage=true]{background}
\usepackage{fancyhdr}
\XeTeXinputencoding utf8
\usepackage{polyglossia}
\setdefaultlanguage{ukrainian}
\setotherlanguages{english,estonian}
\setromanfont[Mapping=tex-text]{Libertinus Serif}
% TODO: remove color borders maybe?
% TODO: better document class?
% TODO: make hyperref only use English names for TOC entries
% TODO: prevent letters in numeric fields
% TODO: cyrillic small caps depend on: khaledhosny/libertinus#44 providing a faux option
% Courtesy of: https://tex.stackexchange.com/questions/55664/fake-small-caps-with-xetex-fontspec
\newcommand{\fauxsc}[1]{{\footnotesize \uppercase{#1}}}
% WARNING: current Estonian version may contain machine translation.
% DO NOT use it right now if you don't know what you're doing
% Footer to contain the template
\pagestyle{fancy}
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
\lfoot{\large\thepage}
\cfoot{}
\newcommand\docurl{https://github.com/Ecognize/contracts/blob/master/\jobname.tex}
\rfoot{\scriptsize Шаблон доступний за адресою / Template available at / Näidis on kättesaadav aadressil : \href{\docurl}{\docurl} }
% Entry boxes with \raisebox
\newcommand\field[3]{\raisebox{-#2pt}{\TextField[borderwidth=0,#3,name=#1]{}}}
\newcommand\fieldrws[4]{\field{#1}{#2}{width=#3pt,charsize=#4pt}}
\newcommand\fieldhs[3]{\field{#1}{2}{height=#2pt,charsize=#3pt}}
\newcommand\fieldwhs[4]{\field{#1}{2}{width=#2pt,height=#3pt,charsize=#4pt}}
\newcommand\fieldw[2]{\field{#1}{2}{width=#2pt}}
\newcommand\fieldtw[2]{\field{#1}{2.2}{height=10pt,charsize=8pt,width=#2pt}}
% Most typical variations
\newcommand\fieldline[1]{\fieldw{#1}{250}}
\newcommand\fieldterm[1]{\fieldhs{#1}{12}{10}}
\newcommand\fieldt[1]{\fieldtw{#1}{40}}
\newcommand\fieldb[1]{\fieldwhs{#1}{150}{14}{10}}
\newcommand\fieldbs[1]{\fieldwhs{#1}{150}{12}{8}}
% Three column text in UK, EN, and ET
\newcommand\freetextcommon[3]{\begin{ukrainian}#1\end{ukrainian}\switchcolumn\begin{english}#2\end{english}\switchcolumn\begin{estonian}#3\end{estonian}}
\newcommand\freetextnoalign[3]{\freetextcommon{#1}{#2}{#3}\swtichcolumn}
\newcommand\freetext[3]{\freetextcommon{#1}{#2}{#3}\switchcolumn*}
\newcommand\freetextnoindent[3]{\freetext{\noindent#1}{\noindent#2}{\noindent#3}}
\newcommand\multibreak{\freetext{\pagebreak}{\pagebreak}{\pagebreak}}
% Same with section header
\newcommand\clause[6]{\freetext{\section{#1}#4}{\section{#2}#5}{\section{#3}#6}}
\newcommand\clausenewpage[6]{\freetext{\pagebreak\section{#1}#4}{\pagebreak\section{#2}#5}{\pagebreak\section{#3}#6}}
% Cute symbols
\renewcommand\thesection{§\arabic{section}}
\renewcommand\thesubsection{§\arabic{section}.\arabic{subsection}}
% Hyperlinks to Appendixes and sections
\newcommand\smartref[2]{\hyperref[#1]{#2\ref{#1}}}
% This is lame, but I have no will to make it better
\newcommand{\myloop}[3]{\stepcounter{#1}#3\ifthenelse{\value{#1} < \value{#2}}{\\\myloop{#1}{#2}{#3}}{\\}}