Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 44000ed

Browse files
committed
Better solution for code environment.
1 parent 0ed6918 commit 44000ed

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

Doc/myformat.sty

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
\newcommand{\Python}{Python}
1919
\newcommand{\UNIX}{U{\sc nix}}
2020

21-
% Code environment (use together with verbatim!)
21+
% Calculate the text width for the minipage in the code environment:
22+
\newlength{\codewidth}
23+
\setlength{\codewidth}{\textwidth}
24+
\addtolength{\codewidth}{-\parindent}
25+
26+
% Code environment. Use together with begin/end verbatim!
2227
\newenvironment{code}%
23-
{\nopagebreak\begin{list}{\nopagebreak}{\nopagebreak}\nopagebreak}%
24-
{\nopagebreak\end{list}\nopagebreak}
28+
{\vspace{10pt}\par\begin{minipage}{\codewidth}}% begin stuff
29+
{\end{minipage}\par\vspace{10pt}\noindent}% end stuff

0 commit comments

Comments
 (0)