Page MenuHomec4science

hello.ptex
No OneTemporary

File Metadata

Created
Sat, Sep 21, 23:11

hello.ptex

\documentclass[11pt,xcolor=dvipsnames]{beamer}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyvrb}
\begin{python}{header}
from Slides.snippet_helper import Snippet, SnippetCollection
Snippet.default_output='latex'
# Snippet.default_line_numbering=True
\end{python}
\py{Snippet.getLatexStyleDefs()}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{python}{code}
snippet = Snippet(r"""
#include <mpi.h>
#include <stdio.h>
int main(int argc, char *argv[]){
int size, rank;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
printf("I’m process %d out of %d\n", rank, size);
MPI_Finalize();
}
""", compile_flag=True, format_flag=True,
include_paths=['/usr/lib/x86_64-linux-gnu/openmpi/include']
)
\end{python}
\begin{frame}[fragile]{Hello}
\py{snippet.pigment()}
\end{frame}
\begin{frame}[fragile]{Hello}
\py{snippet.pigment(line_numbering=True)}
\end{frame}
\begin{frame}[fragile]{Hello}
\py{snippet[5:11].pigment()}
\end{frame}
\begin{frame}[fragile]{Hello}
\py{snippet[5:11].pigment(keyword='MPI')}
\end{frame}
\end{document}

Event Timeline