Skip to content

Instantly share code, notes, and snippets.

@Krugloff
Last active December 16, 2015 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Krugloff/5491168 to your computer and use it in GitHub Desktop.
Save Krugloff/5491168 to your computer and use it in GitHub Desktop.
XeLaTeX style for RusRubyBook
\ProvidesPackage{rus_ruby_book}
\clubpenalty=10000 % запрет разрыва после первой строки абзаца.
\widowpenalty=10000 % запрет разрыва перед последней строкой абзаца.
\tolerance=5000
\RequirePackage{xltxtra}
\RequirePackage{xunicode}
\RequirePackage{xecyr}
\RequirePackage{indentfirst}
\RequirePackage{longtable}
\RequirePackage{fontspec}
\RequirePackage{underscore}
\RequirePackage[matrix,arrow,curve]{xy}
\RequirePackage{color}
\RequirePackage{framed}
% Цвет для выделения списка определений.
\definecolor{shadecolor}{rgb}{0.83, 0.88, 0.82}
% Цвет текста для определений и ссылок.
\definecolor{grey}{rgb}{0.36, 0.46, 0.32}
\RequirePackage{polyglossia}
\setdefaultlanguage{russian}
\setotherlanguage{english}
\setmainfont{Liberation Serif}
\setsansfont{Liberation Sans}
\setmonofont[Scale=0.75]{Liberation Mono}
\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text}
% Без этого почему-то не получаются длинные тире.
\newfontfamily\russianfont[Scale=MatchLowercase,Mapping=tex-text]{Liberation Serif}
\RequirePackage{fancyvrb}
\VerbatimFootnotes
\RequirePackage[xetex,
frenchlinks,
colorlinks,
linkcolor=black,
urlcolor=red,
bookmarksnumbered]{hyperref}
\newcommand{\italy}[1]{\textit{#1}}
\newcommand{\mono}[1]{\texttt{#1}}
\renewcommand{\epigraph}[2] {
\medskip \hfill \begin{minipage}[h]{0.75\textwidth}
\italy{#1}
\begin{flushright} \italy{#2} \end{flushright}
\end{minipage} \medskip}
% Примечания автора.
\newenvironment{note}
{ \begin{samepage}
\medskip \itshape }
{ \medskip
\end{samepage} }
% Список определений.
\newenvironment{keylist}[1]
{ \begin{shaded}\subsubsection*{#1} }
{ \end{shaded} }
\newcommand{\key}[1]{ \textcolor{grey}{#1} }
\RecustomVerbatimEnvironment
{verbatim}{Verbatim}
{frame=leftline, framesep=5mm, samepage=true}
%? В правом углу можно отображать инкапсуляцию (общий, защищенный, частный).
\newcommand{\declare}[2]{
\medskip\hrule\nopagebreak\noindent
\colorbox{shadecolor}{ \textbf{#1} \italy{#2} }
\nopagebreak\medskip\nopagebreak
}
\newcommand{\twoless}{\textless\textless\-,\-,}
\newcommand{\twogreat}{\textgreater\textgreater\-,\-,}
\newcommand{\twominus}{\-/\-/}
% ToDo: Сделать ссылки на методы, константы и ошибки.
\newcommand{\method}[1]{\mono{#1}}
\newcommand{\constant}[1]{\mono{#1}}
\newcommand{\error}[1]{\mono{#1}}
\newcommand{\alias}[1]{Синонимы: \method{#1}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment