Compare commits

..

9 Commits

2 changed files with 152 additions and 12 deletions

View File

@ -41,8 +41,8 @@ def plantuml(key, value, format_, meta):
else: else:
latex_img_format = "eps" latex_img_format = "eps"
os.makedirs("images", exist_ok=True) os.makedirs("output/images", exist_ok=True)
filename = "images/" + hashlib.sha1(code.encode(sys.getfilesystemencoding())).hexdigest() filename = "output/images/" + hashlib.sha1(code.encode(sys.getfilesystemencoding())).hexdigest()
filetype = get_extension(format_, "png", html="svg", latex=latex_img_format, beamer=latex_img_format) filetype = get_extension(format_, "png", html="svg", latex=latex_img_format, beamer=latex_img_format)
src = filename + '.uml' src = filename + '.uml'
@ -55,7 +55,6 @@ def plantuml(key, value, format_, meta):
with open(src, "wb") as f: with open(src, "wb") as f:
f.write(txt) f.write(txt)
subprocess.check_call(PLANTUML_BIN.split() + ["-t" + filetype, src]) subprocess.check_call(PLANTUML_BIN.split() + ["-t" + filetype, src])
sys.stderr.write('Created image ' + dest + '\n')
if (filetype == "latex") and (latex_img_format == 'latex'): if (filetype == "latex") and (latex_img_format == 'latex'):
latex = open(dest).read() latex = open(dest).read()
return RawBlock('latex', latex.split("\\begin{document}")[-1].split("\\end{document}")[0]) return RawBlock('latex', latex.split("\\begin{document}")[-1].split("\\end{document}")[0])

View File

@ -10,6 +10,9 @@ $if(latex-dir-rtl)$
\PassOptionsToPackage{RTLdocument}{bidi} \PassOptionsToPackage{RTLdocument}{bidi}
$endif$ $endif$
$endif$ $endif$
$if(CJKmainfont)$
\PassOptionsToPackage{space}{xeCJK}
$endif$
% %
\documentclass[ \documentclass[
$if(fontsize)$ $if(fontsize)$
@ -55,9 +58,9 @@ $for(beameroption)$
\setbeameroption{$beameroption$} \setbeameroption{$beameroption$}
$endfor$ $endfor$
% Prevent slide breaks in the middle of a paragraph % Prevent slide breaks in the middle of a paragraph
\widowpenalties 1 10000 \widowpenalty10000
\clubpenalty10000
\raggedbottom \raggedbottom
\usepackage[defaultlines=3,all]{nowidow}
$if(section-titles)$ $if(section-titles)$
\setbeamertemplate{part page}{ \setbeamertemplate{part page}{
\centering \centering
@ -127,15 +130,17 @@ $endif$
$if(mainfont)$ $if(mainfont)$
\setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
$else$ $else$
\setmainfont[Scale=1.0]{Georgia} \setmainfont[Scale=1.0]{PT Serif}
$endif$ $endif$
$if(sansfont)$ $if(sansfont)$
\setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$} \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
$else$
\setmainfont[Scale=1.0]{PT Sans}
$endif$ $endif$
$if(monofont)$ $if(monofont)$
\setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$} \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$}
$else$ $else$
\setmonofont[Scale=0.75]{Pragmata Pro} \setmonofont[Scale=0.75]{Iosevka Prog}
$endif$ $endif$
$for(fontfamilies)$ $for(fontfamilies)$
\newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$} \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
@ -169,6 +174,12 @@ $if(CJKmainfont)$
\fi \fi
$endif$ $endif$
\fi \fi
\setlength{\parindent}{12.5mm}
\usepackage[defaultlines=3,all]{nowidow}
\usepackage[nobottomtitles]{titlesec}
\renewcommand{\bottomtitlespace}{.15\textheight}
$if(beamer)$ $if(beamer)$
$if(theme)$ $if(theme)$
\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$} \usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
@ -195,14 +206,15 @@ $endif$
\usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype} \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{} }{}
\usepackage{indentfirst}
$if(indent)$ $if(indent)$
$else$ $else$
\makeatletter \makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class \@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{% \IfFileExists{parskip.sty}{%
\usepackage{parskip} \usepackage{parskip}
}{% else }{% else%
\setlength{\parindent}{0pt} \setlength{\parindent}{12.5mm}
\setlength{\parskip}{6pt plus 2pt minus 1pt}} \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class }{% if KOMA class
\KOMAoptions{parskip=half}} \KOMAoptions{parskip=half}}
@ -221,6 +233,9 @@ $endif$
$if(author-meta)$ $if(author-meta)$
pdfauthor={$author-meta$}, pdfauthor={$author-meta$},
$endif$ $endif$
$if(lang)$
pdflang={$lang$},
$endif$
$if(subject)$ $if(subject)$
pdfsubject={$subject$}, pdfsubject={$subject$},
$endif$ $endif$
@ -239,7 +254,7 @@ $endif$
} }
\urlstyle{same} % disable monospaced font for URLs \urlstyle{same} % disable monospaced font for URLs
$if(verbatim-in-note)$ $if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes \VerbatimFootnotes % allow verbatim text in footnotes
$endif$ $endif$
$if(geometry)$ $if(geometry)$
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
@ -262,7 +277,11 @@ $if(highlighting-macros)$
$highlighting-macros$ $highlighting-macros$
$endif$ $endif$
$if(tables)$ $if(tables)$
\usepackage{longtable,booktabs} \usepackage{longtable,booktabs,array}
$if(multirow)$
\usepackage{multirow}
$endif$
\usepackage{calc} % for calculating minipage widths
$if(beamer)$ $if(beamer)$
\usepackage{caption} \usepackage{caption}
% Make caption package work with longtable % Make caption package work with longtable
@ -270,6 +289,11 @@ $if(beamer)$
\def\fnum@table{\tablename~\thetable} \def\fnum@table{\tablename~\thetable}
\makeatother \makeatother
$else$ $else$
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot % Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}} \IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable} \makesavenoteenv{longtable}
@ -357,6 +381,9 @@ $else$
\usepackage[shorthands=off,russian]{babel} \usepackage[shorthands=off,russian]{babel}
\fi \fi
$endif$ $endif$
\ifluatex
\usepackage{selnolig} % disable illegal ligatures
\fi
$if(dir)$ $if(dir)$
\ifxetex \ifxetex
% Load bidi as late as possible as it modifies e.g. graphicx % Load bidi as late as possible as it modifies e.g. graphicx
@ -380,6 +407,78 @@ $for(bibliography)$
\addbibresource{$bibliography$} \addbibresource{$bibliography$}
$endfor$ $endfor$
$endif$ $endif$
$if(csl-refs)$
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
{% don't indent paragraphs
\setlength{\parindent}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1 \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces\fi
% set entry spacing
\ifnum #2 > 0
\setlength{\parskip}{#2\baselineskip}
\fi
}%
{}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$
$if(csquotes)$
\usepackage{csquotes}
$endif$
\RequirePackage{enumitem} % убрать вертикальный отступ перед списками
\setlist[itemize]{%
topsep=0pt,
parsep=0pt,
leftmargin=0cm,
listparindent=\parindent{},
itemindent=\labelwidth{}
}
\setlist[enumerate]{%
topsep=0pt,
parsep=0pt,
leftmargin=0cm,
listparindent=\parindent{},
itemindent=\labelwidth{}
}
\AddEnumerateCounter{\asbuk}{\@asbuk}{\cyra}
\renewcommand{\theenumi}{\arabic{enumi}}
\renewcommand{\labelenumi}{\theenumi)}
\renewcommand{\theenumii}{\asbuk{enumi}}
\renewcommand{\labelenumii}{\theenumii)}
\renewcommand{\labelitemi}{\bfseries\textemdash}
\renewcommand{\labelitemii}{\bfseries\textemdash}
\renewcommand{\labelitemiii}{\bfseries\textemdash}
\renewcommand{\labelitemiv}{\bfseries\textemdash}
%\renewcommand{\@listi}{%
% \setlength{\itemsep}{0pt}}
%\renewcommand{\@listii}{%
% \setlength{\itemsep}{0pt}}
%\renewcommand{\@listiii}{%
% \setlength{\itemsep}{0pt}}
%\renewcommand{\@listiv}{%
% \setlength{\itemsep}{0pt}}
%\let\@listI\@listi
%\@listi
\setlength{\labelwidth}{\parindent}
\addtolength{\labelwidth}{\labelsep}
\addtolength{\labelwidth}{0.7em}
\setlength{\itemindent}{0pt}
\setlength{\leftmargin}{\labelwidth}
$if(title)$ $if(title)$
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$} \title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
@ -412,6 +511,46 @@ $if(logo)$
$endif$ $endif$
$endif$ $endif$
\usepackage{float}
\let\origfigure=\figure
\let\endorigfigure=\endfigure
\renewenvironment{figure}[1][]{%
\origfigure[H]
\centering
}{%
\endorigfigure
}
\usepackage{acro}
\NewAcroTemplate[list]{acrolist}{%
\AcroNeedPackage{array}%
\acronymsmapF{%
\AcroAddRow{
\acrowrite{short}%
\acroifT{alt}{/\acrowrite{alt}}
&~---~
\acrowrite{list}%
\acroifanyT{foreign,extra}{ (}%
\acroifT{foreign}{\acrowrite{foreign}\acroifT{extra}{, }}%
\acroifT{extra}{\acrowrite{extra}}%
\acroifanyT{foreign,extra}{)}%
\acropagefill
\acropages
{\acrotranslate{page}\nobreakspace}
{\acrotranslate{pages}\nobreakspace}%
\tabularnewline
}%
}
{\AcroRerun}%
\acroheading
\acropreamble
\par\noindent
\begin{tabular}{>{}lp{.7\linewidth}}
\AcronymTable
\end{tabular}
}
\acsetup{make-links = true, pdfcomments/use = true, list/template = acrolist, first-style = short}
\begin{document} \begin{document}
$if(has-frontmatter)$ $if(has-frontmatter)$
\frontmatter \frontmatter
@ -434,11 +573,12 @@ $include-before$
$endfor$ $endfor$
$if(toc)$ $if(toc)$
\cleardoublepage
$if(toc-title)$ $if(toc-title)$
\renewcommand*\contentsname{$toc-title$} \renewcommand*\contentsname{$toc-title$}
$endif$ $endif$
$if(beamer)$ $if(beamer)$
\begin{frame} \begin{frame}[allowframebreaks]
$if(toc-title)$ $if(toc-title)$
\frametitle{$toc-title$} \frametitle{$toc-title$}
$endif$ $endif$
@ -453,6 +593,7 @@ $endif$
\tableofcontents \tableofcontents
} }
$endif$ $endif$
\cleardoublepage
$endif$ $endif$
$if(lot)$ $if(lot)$
\listoftables \listoftables