我需要在我的第一个列表的左侧放置文字,它应该看起来像照片上的那样。
\lstdefinestyle{myStyle}{
belowcaptionskip=1\baselineskip,
breaklines=true,
frame=none,
numbers=none,
basicstyle=\footnotesize\ttfamily,
keywordstyle=\bfseries\color{gray!120!white},
commentstyle=\itshape\color{purple!40!black},
identifierstyle=\color{black},
backgroundcolor=\color{gray!10!white},
language=Python
}
\lstset{style=myStyle}
\begin{lstlisting}
from IPython import parallel
engines = parallel.Client()
engines.block = True
print engines.ids \end{lstlisting}
答案1
这个怎么样?
\documentclass{article}
\usepackage{marginnote}
\parskip=3pt
\parindent=0pt
\reversemarginpar
\begin{document}
We have seen how to initialize the cluster. No matter which way we
initialize the cluster, the following commands allow us to connect to
it. These commands should either be introduced through the notebook or
typed into the IPython command line interpreter (the client):
{\ttfamily
from IPython import parallel\marginnote{In[1]:}\newline
engines = parallel.Client()\newline
engines.block = True\newline
print engines.ids\newline
[0, 1, 2, 3, 4, 5, 6, 7]\marginnote{Out[1]:}
}
\end{document}