Skip to content

Instantly share code, notes, and snippets.

@murych
Created April 3, 2018 19:47
Show Gist options
  • Save murych/d62a97699e9c88d548a6c0bb5813d82f to your computer and use it in GitHub Desktop.
Save murych/d62a97699e9c88d548a6c0bb5813d82f to your computer and use it in GitHub Desktop.
% Преамбула документа
\usepackage{listings}
\usepackage{color}
\usepackage{textcomp}
\usepackage[defaultmono]{droidmono}
\definecolor{listinggray}{gray}{0.5}
\definecolor{lbcolor}{rgb}{1,1,1}
\renewcommand*\lstlistingname{Листинг}
\lstset{
backgroundcolor=\color{lbcolor},
tabsize=4,
rulecolor=,
language=matlab, % меняй язык тут
%basicstyle=\BeraMonottfamily,
%basicstyle=\scriptsize,
%basicstyle=\footnotesize\ttfamily,
%basicstyle=\normalsize\fontencoding{T1}\ttfamily,
basicstyle=\footnotesize\fontencoding{T1}\ttfamily,
upquote=true,
aboveskip={1\baselineskip},
columns=fixed,
%columns=flexible,
showstringspaces=false,
extendedchars=true,
breaklines=true,
mathescape=true,
prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
frame=single,
showtabs=false,
showspaces=false,
showstringspaces=false,
%identifierstyle=\ttfamily,
keywordstyle=\color[rgb]{0, 0, 1},
commentstyle=\color[rgb]{0.133, 0.545, 0.133},
stringstyle=\color[rgb]{0.627, 0.126, 0.941},
}
% В самом документе
\lstinputlisting[caption={Метод Эйлера}, label=code:euler]{euler_diff.m} % Вставить целый файл
\lstinputlisting[caption={Вычисление интеграла функции \ref{eq:function} методом средних прямоугольников},
label=code:average_rectangles_compute,
firstline=24,
lastline=44]{main.m} % Вставить несколько конкретных строк
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment