-\usepackage{listings}
+\usepackage{listingsutf8} % listings с поддержкой unicode
% for listings
\definecolor{acmebg}{HTML}{FFFFEF}
\kern\linewidth \kern\lst@numbersep
\lst@numberstyle{\thelstnumber}}\lst@linebgrd}%
}{\PackageError{Listings}{Numbers #1 unknown}\@ehc}}
-\makeatother
\ No newline at end of file
+\makeatother
Пример кода:
% gobble отрежет 8 символов левого отступа и избавится от финальной пустой строки т.к. она короче 8ми символов
- \begin{lstlisting}[linewidth=0.9\textwidth, gobble=8]
+ \begin{lstlisting}[language=bash, linewidth=0.9\textwidth, gobble=8, inputencoding=utf8, extendedchars=true]
+ echo "Hellow, World! По русски"
pip install -r requirements.txt
# Дети, никогда так не делайте. Питон опасен для когнитивных функций вашего мозга!
\end{lstlisting}
% Settings
\AtBeginDocument{\setromanfont{Times New Roman}}
\AtBeginDocument{\setsansfont{Roboto}}
-\AtBeginDocument{\setmonofont{Consolas}}
+\AtBeginDocument{\setmonofont{RobotoMono-Regular}}
\setbeamercolor*{title page header}{fg=white}
\setbeamerfont*{title}{size*={40pt}{40pt},family={\fontspec{Roboto-Medium}}}
\setbeamercolor*{subtitle}{fg=subTitleColor}
\renewcommand{\ULthickness}{\dimexpr \f@size pt * 488 / 10000 \relax}%
\renewcommand{\ULdepth}{\dimexpr \f@size pt * 10 / 100 \relax}% отступ от базовой линии
-
% Переопределяем href чтобы он использовал \uline для подчеркивания ссылок
\let\oldhref\href
\renewcommand{\href}[2]{{\color{urlcolor}\uline{\oldhref{#1}{#2}}}}
+
+\definecolor{codeTextColor}{HTML}{142D99}
+\definecolor{codeBgColor}{HTML}{EFEFF2}
+\setbeamerfont*{codelisting}{size*={14pt}{16pt},family=\ttfamily}
+
+\AtBeginDocument{%
+ \@ifpackageloaded{listings}{%
+ \lstset{
+ basicstyle=\usebeamerfont{codelisting}\color{codeTextColor},
+ backgroundcolor=\color{codeBgColor},
+ rulecolor=\color{codeBgColor},
+ }%
+ }{}%
+}
+
+
+
+
+
% Макросы воспроизводят поведение LibreOffice Impress при размещении текста
% в текстовом блоке: LibreOffice использует usWinAscent как First Baseline
% Offset — расстояние от верхней границы блока до базовой линии первой строки.