xelatex-template/setup/preamble.tex
2020-05-15 10:20:53 +03:00

255 lines
6.1 KiB
TeX
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

\PassOptionsToPackage{unicode=true}{hyperref}
%
% Проверка версии компилятора
%
\usepackage{ifxetex}
%
% Функции для работы с размерностями и счётчиками
%
\usepackage{calc}
%
% Параметры страницы
%
\usepackage{geometry}
%
% Межстрочный интервал
%
\usepackage{setspace}
% \onehalfspacing работает только для шрифтов 10pt, 11pt, 12pt
% Указываем явное значение
\setstretch{1.25}
%
% Отступ первой строки в параграфе
%
\setlength{\parindent}{12.5mm}
\usepackage{indentfirst}
%
% Правила для висячих строк
%
\usepackage[defaultlines=3,all]{nowidow}
%
% Защита от строк на полях (добавление 3 виртуальных пустых символов)
%
\setlength{\emergencystretch}{3em}
%
% Работа с цветом
%
\usepackage[dvipsnames,svgnames*,x11names*]{xcolor}
%
% Оформление блоков исходных текстов (обязательно перед локализацией)
%
\usepackage{fancyvrb}
\ifxetex
% Break long lines of code
\usepackage{fvextra}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}}
\fi
\VerbatimFootnotes % allows verbatim text in footnotes
\usepackage{listings}
\newcommand{\passthrough}[1]{#1}
\lstset{defaultdialect=[5.3]Lua}
\lstset{defaultdialect=[x86masm]Assembler}
%
%
%
%
% Словари и сокращения
%
\usepackage{nomencl}
\usepackage[
xindy={language={russian},glsnumbers=false},
toc,
acronym,
nopostdot,
nogroupskip,
nonumberlist]{glossaries}
\usepackage[automake=true]{glossaries-extra}
%\pdfstringdefDisableCommands{%
% \let\gls\@firstofone
%}
\usepackage{array}
%
%
%
\usepackage{siunitx}
\sisetup{range-phrase = \text{...}}
\usepackage{physics}
\usepackage{eqexpl}
\eqexplSetIntro{где}
\providecommand{\strong}[1]{\textbf{#1}}
\newcounter{fontsnotfound}
\newcommand{\iffontsexist}[3]{
\setcounter{fontsnotfound}{0}
\expandafter\forcsvlist\expandafter\checkfont\expandafter{#1}
\ifnum\value{fontsnotfound}=0
#2
\else
#3
\fi
}
\ifxetex
\usepackage{amssymb,amsmath}
\usepackage{mathspec} % Вместо fontspec
\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text}
\defaultfontfeatures[\rmfamily]{Scale=1}
\setsansfont[Mapping=tex-text]{Arial}
\setromanfont[Mapping=tex-text]{XITS}
\setmainfont[Ligatures=TeX]{Times New Roman}
\newfontfamily\cyrillicfont{Times New Roman}[Script=Cyrillic]
\setmonofont[Scale=0.8,Mapping=tex-text]{Pragmata Pro Mono}
\newfontfamily\listingsfont{Pragmata Pro Mono Bold}
\newfontfamily\listingsfontinline{Pragmata Pro Mono Bold}
\DeclareSymbolFont{letters}{\encodingdefault}{\rmdefault}{m}{it}
\else
\usepackage{unicode-math}
\fi
%
% Настройка локализации
%
\usepackage{csquotes}
\ifxetex
\usepackage{textcase}
\usepackage{xltxtra}
\usepackage{xunicode}
\usepackage{polyglossia}
\usepackage{xecyr}
\setmainlanguage{russian}
\let\cyr\relax
\setotherlanguage{english}
\setkeys{russian}{babelshorthands=true,indentfirst=true}
\setmathfont{XITS Math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\else
\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\fi
% При переносе оставлять минимум 3 символа на первой строке и 3 на второй
\renewcommand\russianhyphenmins{33}
% Использовать для кавычек-ёлочек данные символы
\renewcommand{\flqq}{«}
\renewcommand{\frqq}{»}
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{ % use microtype if available
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
%
% Оформление URL, разрешение переносов
%
\usepackage[hyphens]{xurl}
% Использование того же шрифта, что и в окружающем тексте
\urlstyle{same}
%
%
%
\usepackage{hyperref}
\hypersetup{
unicode=true,
bookmarksnumbered=false,
bookmarksopen=false,
colorlinks=true,
pdfborder={0 0 0},
pdfborderstyle={},
breaklinks=false,
linkcolor=Maroon,
filecolor=Maroon,
citecolor=Blue,
urlcolor=Blue,
}
%bookmarks=true,
% pdftitle={\@title},
% pdfauthor={\@author},
% pdfsubject={},
% pdfkeywords={},
%[
%
% backref=false]{hyperref}
%
% Настройка таблиц
%
\usepackage{xltabular}
\usepackage{multirow}
\newcommand{\HY}{\hyphenpenalty=25\exhyphenpenalty=25}
\newcolumntype{Z}{>{\HY\raggedright\arraybackslash\hspace{0pt}}X}
\newcolumntype{M}{>{\HY\RaggedRight\arraybackslash\hspace{0pt}}c}
\newcolumntype{L}{>{\HY\RaggedRight\arraybackslash\hspace{0pt}}l}
% Обязательно после hyperref
\usepackage{fr-longtable}
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
%
% Подключение изображений (желательно после локализации)
%
\usepackage{graphicx}
\usepackage[encoding,filenameencoding=utf8,extendedchars]{grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Расположение по умолчанию
\makeatletter
\def\fps@figure{htbp}
\makeatother
%
%
%